mugltf

Crates.iomugltf
lib.rsmugltf
version0.1.2
sourcesrc
created_at2022-04-18 01:47:34.221247
updated_at2022-04-25 21:22:01.0696
descriptionMinimal glTF 2.0 asset loader for Rust
homepagehttps://github.com/andykswong/muge/tree/main/crates/mugltf
repositoryhttps://github.com/andykswong/muge
max_upload_size
id569639
size4,717,455
Andy K. S. Wong (andykswong)

documentation

https://docs.rs/mugltf

README

μglTF

Minimal glTF 2.0 asset loader for Rust


License: MIT Crates.io Docs.rs

Overview

mugltf is a minimal implementation of glTF 2.0 asset model loader in Rust. It uses serde for parsing the glTF JSON.

Install

[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

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 = 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.

Commit count: 26

cargo fmt