Skip to main content

Module gltf_loader

Module gltf_loader 

Source
Expand description

One-shot glTF 2.0 loading — load_gltf parses geometry, a skeleton, and animation clips out of a .gltf/.glb file. Deliberately not part of the Asset/LazyResource pipeline: those retry forever on None, which is right for “the backend isn’t ready yet” but wrong for “this file doesn’t exist” or “this glTF feature isn’t supported” — conditions that can never resolve on their own. Call load_gltf directly (in main(), a .once() system, wherever you need it) and handle the Result like any other fallible I/O.

Scoped to geometry + skeleton + animation only — materials and textures are never read, even though the file may reference them; load your own textures via TextureBuilder and write your own Material/shader separately. See ModelLoadError::UnsupportedFeature for the full list of glTF features this doesn’t handle (multiple skins, CUBICSPLINE interpolation, sparse accessors, morph targets, non-indexed primitives).

Structs§

LoadedModel
Everything load_gltf extracted from one file. skinned_meshes are primitives bound to the file’s one skin; static_meshes are everything else (rigid props, environment pieces in the same file) as the ordinary Mesh — not padded with identity joint weights just to force them through the skinned path.

Enums§

ModelLoadError

Functions§

load_gltf
Loads geometry, a skeleton, and animation clips from a glTF 2.0 file (.gltf or .glb — both handled transparently). One-shot and synchronous: call it directly, not through the asset pipeline (see the module docs above for why).