Files
craft-libs/crates
9e458e14cc craft-mesh: glTF sparse accessors, specular-glossiness, WebP textures; PLY per-corner UVs and TextureFile (#915)
* craft-mesh: FBX 7.x reader from EffectCraft (`fbx`)

EffectCraft's FBX reader (crates/model/src/fbx.rs: binary with 32- and 64-bit
record offsets and zlib arrays, ASCII, geometry layer elements, the Model
transform chain, Lambert/Phong materials, textures) onto the crate's Scene.
The reader was written by vangel76 (EffectCraft #736); its memory budget and
shared instanced meshes by DWAA1660 (EffectCraft #1234).

It includes the fixes of the open EffectCraft PR #2955: a binary child record
must end within its parent, a failed array inflate reports only its status,
textures that end at one image share it and its bytes are charged to the
budget, and material slots and connections are found through maps.

What differs from the app's copy, because the model here is neutral:
polygons stay whole and layer elements stay indexed pools (no vertex
unification, no computed normals or tangents); images are bytes, not decoded
pixels; the axis system is not applied (Document::axes_to_y_up gives it);
the memory budget is Limits::max_data_bytes; a file without meshes is a
scene, not an error. base64_decode moves from the gltf module to the crate
root so both formats share it (gltf re-exports it).

* craft-mesh: read FBX 6.x

FBX 6.1 files differ from 7.x in how the scene is laid out, not in the
record syntax: a Model holds its own Vertices and layer elements, properties
are Properties60/Property (no label field), Connect lines name objects by
Class::Name instead of by id, and GlobalSettings sits among the objects.
The reader now takes all four, and NormalIndex beside NormalsIndex, so 6.x
geometry, transforms, the hierarchy and materials are read. 6.x textures
(connected to Models) are not.

Ported from storytold/deckcraft#1380 (crates/mesh/src/fbx), whose reader
took 6.1 to 7.7; its mesh building, axis turn and rasteriser stay in
DeckCraft.

* craft-mesh: glTF sparse accessors, specular-glossiness and WebP textures; PLY per-corner texture coordinates and TextureFile

glTF:
- Sparse accessors are read instead of refused: the values replace the
  elements the indices name, over the buffer view's values or over zeros.
  An index past the accessor, more entries than elements, or a read past a
  view is Malformed.
- KHR_materials_pbrSpecularGlossiness becomes the nearest
  metallic-roughness material: diffuse factor and texture, no metal,
  roughness 1 - glossiness.
- A texture whose image is only in EXT_texture_webp uses it; one with a
  fallback source keeps the fallback.
Both extensions may now be required without a warning.

PLY:
- A face's `texcoord` list (u v per corner, as MeshLab writes wedge
  coordinates) becomes the UV set, indexed per corner, instead of the
  vertices' own s/t.
- `comment TextureFile <name>` gives the mesh a material whose base colour
  texture is that file, named and listed in Scene::external, never opened.

Ported from storytold/deckcraft#743 (crates/mesh/src/gltf.rs, ply.rs).

---------

Co-authored-by: Ethan Dale <ethandale@Ethans-MacBook-Pro.local>
Co-authored-by: uvxszi <uvxszi@gmail.com>
2026-11-11 18:08:57 -05:00
..
2026-11-05 10:29:52 +01:00