3 releases
0.0.3 | Nov 17, 2023 |
---|---|
0.0.2 | Nov 14, 2023 |
0.0.1 | Nov 9, 2023 |
#38 in Data formats
125 downloads per month
Used in 2 crates
43KB
1K
SLoC
gltf_kun
An extensible library for building glTF toolchains. Builds upon the gltf and petgraph crates to create a traversable graph of the glTF document.
lib.rs
:
An extensible library for building glTF toolchains. Builds upon the gltf and petgraph crates to create a traversable graph of the glTF document.
Basic Usage
use gltf_kun::Gltf;
// Create a glTF document
let mut gltf = Gltf::default();
// Create a node
let mut node = gltf.create_node();
node.set_name(Some("My Node".to_string()));
node.set_translation([1.0, 2.0, 3.0]);
// Create a scene and add the node to it
let mut scene = gltf.create_scene();
scene.add_node(&mut node);
// Iterate over all nodes in the scene
scene.nodes().iter().for_each(|n| {
println!("Node: {}", n.name().unwrap());
});
// Export to binary glb
let bytes = gltf.to_glb().to_vec().unwrap();
// std::fs::write("model.glb", bytes).unwrap();
Dependencies
~2.5–3.5MB
~72K SLoC