Expand description
Meshes and their primitives.
§Basic usage
Listing the attributes of each mesh primitive in a glTF asset.
for mesh in gltf.meshes() {
println!("Mesh #{}", mesh.index());
for primitive in mesh.primitives() {
println!("- Primitive #{}", primitive.index());
for (semantic, _) in primitive.attributes() {
println!("-- {:?}", semantic);
}
}
}§Reader utility
Printing the vertex positions of each primitive of each mesh in a glTF asset.
let (gltf, buffers, _) = gltf::import("examples/Box.gltf")?;
for mesh in gltf.meshes() {
println!("Mesh #{}", mesh.index());
for primitive in mesh.primitives() {
println!("- Primitive #{}", primitive.index());
let reader = primitive.reader(|buffer| Some(&buffers[buffer.index()]));
if let Some(iter) = reader.read_positions() {
for vertex_position in iter {
println!("{:?}", vertex_position);
}
}
}
}Modules§
Structs§
- Bounds
- The minimum and maximum values for a generic accessor.
- Mesh
- A set of primitives to be rendered.
- Morph
Target - A single morph target for a mesh primitive.
- Primitive
- Geometry to be rendered with the given material.
- Reader
- Mesh primitive reader.
Enums§
Type Aliases§
- Attribute
- Vertex attribute data.
- Bounding
Box - Vertex position bounding box.