#bevy #gltf #mesh-processing #optimization #graph

gltf_kun

Extensible library for building glTF toolchains

3 releases

0.0.3 Nov 17, 2023
0.0.2 Nov 14, 2023
0.0.1 Nov 9, 2023

#38 in Data formats

Download history 19/week @ 2023-11-04 66/week @ 2023-11-11 21/week @ 2023-11-18 19/week @ 2023-11-25

125 downloads per month
Used in 2 crates

MIT/Apache

43KB
1K SLoC

gltf_kun

Crates.io CI Crates.io Documentation

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