Import glTF/GLB meshes & scene hierarchy (materials → #31)
Current State
engine/assets/GltfLoader.zig + engine/vendor/cgltf_wrap.c extract only basic mesh geometry from a single primitive. Node hierarchy, multi-primitive meshes, naming, and tangents are dropped. There is also a separate ObjLoader.zig.
Scope split: This issue covers mesh + scene-graph import. glTF material import is tracked separately in #16 (closed), and the material system itself in. Re-scoped from XL → L accordingly.
Goal
Robust import of glTF/GLB geometry and node structure, with other formats (OBJ) converted through the same internal mesh representation at import time.
Tasks
- Extend the cgltf wrapper to walk all meshes/primitives (not just primitive 0)
- Import node hierarchy → GameObject tree with local transforms and names
- Import normals; generate UVs/tangents when missing (tangents needed for normal mapping)
- Handle indexed and non-indexed primitives, and multiple UV sets
- Preserve mesh/node names for stable identity
- Route OBJ import through the same internal mesh path (dedupe
ObjLoader) - Generate
.meta+ stable GUIDs for imported meshes; reimport is idempotent - Defer materials/textures to #16 (closed) (assign placeholder material for now)
Acceptance Criteria
- Importing a multi-mesh.gltf/.glb produces the correct GameObject hierarchy with named nodes and transforms.
- Meshes render in the viewport and the built game.
- Reimport yields stable GUIDs (no duplicate assets).
Related
- #16 (closed) (glTF→materials), (material system), #5 (closed) (texture importer).
Edited by Bruno Massa