| Crates.io | mugltf |
| lib.rs | mugltf |
| version | 0.1.2 |
| created_at | 2022-04-18 01:47:34.221247+00 |
| updated_at | 2022-04-25 21:22:01.0696+00 |
| description | Minimal glTF 2.0 asset loader for Rust |
| homepage | https://github.com/andykswong/muge/tree/main/crates/mugltf |
| repository | https://github.com/andykswong/muge |
| max_upload_size | |
| id | 569639 |
| size | 4,717,455 |
mugltf is a minimal implementation of glTF 2.0 asset model loader in Rust. It uses serde for parsing the glTF JSON.
[dependencies]
mugltf = "0.1"
Features:
std - (default) enables std support.serde - (default) enables serde parsing of glTF assetsgltf-name - enables the name field for all glTF nodesgltf-extras - enables the extras field for all glTF nodesgltf-extensions - enables the extensions field for all glTF nodesfile-loader - enables GltfResourceFileLoader for loading glTF resources from file systemfetch-loader - enables GltfResourceFetchLoader for loading glTF resources using fetch API for web WASMSee Docs.rs: https://docs.rs/mugltf
// 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 gltf_model = asset.gltf;
let binary_chunk = asset.bin;
let buffers = asset.buffers;
let images = asset.images;
See tests for more example usages.