14 releases

0.1.0 Jan 3, 2025
0.0.13 Jul 18, 2024
0.0.12 Mar 19, 2024
0.0.6 Jan 22, 2024
0.0.3 Nov 17, 2023

#20 in Data formats

Download history 66/week @ 2024-09-24 36/week @ 2024-10-01 14/week @ 2024-10-08 11/week @ 2024-10-15 5/week @ 2024-10-22 9/week @ 2024-10-29 11/week @ 2024-11-05 1/week @ 2024-11-12 12/week @ 2024-11-19 23/week @ 2024-11-26 14/week @ 2024-12-03 82/week @ 2024-12-10 16/week @ 2024-12-17 169/week @ 2024-12-31 12/week @ 2025-01-07

202 downloads per month
Used in 5 crates (4 directly)

MIT/Apache

245KB
6.5K SLoC

gltf_kun

Graph-based glTF processing library. Uses petgraph to create a traversable graph of the glTF document.

Usage

use gltf_kun::graph::{Graph, GraphNodeWeight, gltf::document::GltfDocument};

let mut graph = Graph::default();

// Create a new glTF document within the graph.
let doc = GltfDocument::new(&mut graph);

// Create a new scene.
// This `scene` variable is just a wrapper around a u32 index into the graph,
// making it cheap to copy and pass around.
let mut scene = doc.create_scene(&mut graph);

// To read or write data, we need to get the weight.
let weight = scene.get_mut(&mut graph);
weight.name = Some("My Scene".to_string());

// Create a glTF node and add it to the scene.
let mut node = doc.create_node(&mut graph);
scene.add_node(&mut graph, node);

// Iterate over all scenes in the document, printing their names.
doc.scenes(&graph).iter().for_each(|scene| {
    let weight = scene.get(&graph);
    println!("Scene name: {:?}", weight.name);
});

use gltf_kun::{extensions::DefaultExtensions, io::format::glb::GlbExport};

// Export the document to a GLB byte array.
let glb = GlbExport::<DefaultExtensions>::export(&mut graph, &doc).ok();

Dependencies

~14MB
~308K SLoC