Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unavi-xyz/gltf_kun
Graph-based glTF processing library.
https://github.com/unavi-xyz/gltf_kun
bevy gltf glxf graph mesh-processing optimization
Last synced: 10 days ago
JSON representation
Graph-based glTF processing library.
- Host: GitHub
- URL: https://github.com/unavi-xyz/gltf_kun
- Owner: unavi-xyz
- License: apache-2.0
- Created: 2023-11-08T20:55:49.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-09-02T13:12:09.000Z (2 months ago)
- Last Synced: 2024-09-03T11:11:12.887Z (2 months ago)
- Topics: bevy, gltf, glxf, graph, mesh-processing, optimization
- Language: Rust
- Homepage: https://unavi-xyz.github.io/gltf_kun/
- Size: 15.6 MB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# gltf_kun
Graph-based [glTF](https://github.com/KhronosGroup/glTF) processing library.
Uses [petgraph](https://crates.io/crates/petgraph) to create a traversable graph of the glTF document.### Usage
```rust
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::::export(&mut graph, &doc).ok();
```