Overview
mugltf is a minimal implementation of glTF 2.0 asset model loader in Rust. It uses serde for parsing the glTF JSON.
Install
[]
= "0.1"
Features:
std- (default) enablesstdsupport.serde- (default) enablesserdeparsing of glTF assetsgltf-name- enables thenamefield for all glTF nodesgltf-extras- enables theextrasfield for all glTF nodesgltf-extensions- enables theextensionsfield for all glTF nodesfile-loader- enablesGltfResourceFileLoaderfor loading glTF resources from file systemfetch-loader- enablesGltfResourceFetchLoaderfor loading glTF resources using fetch API for web WASM
Documentation
See Docs.rs: https://docs.rs/mugltf
Usage
// Init a loader and set the base path (Use mugltf::GltfResourceFetchLoader for WASM web environment)
let mut loader = 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 = GltfAsset.load.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.