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.0"
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 system
Documentation
See Docs.rs: https://docs.rs/mugltf
Usage
// 1. Start from parsing a gltf / glb file
let asset = parse_gltf;
let glb_asset = parse_glb;
// You can now read the glTF model and binry chunk (for glb file).
let gltf_model = glb_asset.gltf;
let binary_chunk = glb_asset.bin;
// 2. Init a loader to load resources (external/embedded buffers and images) async
let mut loader = default;
loader.set_path;
glb_asset.load_resources.await?;
// Buffer and image resources are now populated
let buffers = glb_asset.buffers;
let images = glb_asset.images;
See tests for more example usages.