mugltf
is a minimal implementation of glTF 2.0 asset model loader in Rust. It uses serde
for parsing the glTF JSON.
toml
[dependencies]
mugltf = "0.1"
Features:
- std
- (default) enables std
support.
- serde
- (default) enables serde
parsing of glTF assets
- gltf-name
- enables the name
field for all glTF nodes
- gltf-extras
- enables the extras
field for all glTF nodes
- gltf-extensions
- enables the extensions
field for all glTF nodes
- file-loader
- enables GltfResourceFileLoader
for loading glTF resources from file system
- fetch-loader
- enables GltfResourceFetchLoader
for loading glTF resources using fetch API for web WASM
See Docs.rs: https://docs.rs/mugltf
```rust // Init a loader and set the base path (Use mugltf::GltfResourceFetchLoader for WASM web environment) let mut loader = mugltf::GltfResourceFileLoader::default(); loader.set_path("./");
// Load a glTF JSON / GLB asset async // You can set the last parameter to false to skip loading buffers and images let asset = mugltf::GltfAsset.load(&loader, "./test.glb", true).await?;
// You can now read the glTF model and resources. let gltfmodel = asset.gltf; let binarychunk = asset.bin; let buffers = asset.buffers; let images = asset.images; ```
See tests for more example usages.