[go: up one dir, main page]

Module mesh

Module mesh 

Source
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§

iter
Iterators.
utilutils
Utility functions.

Structs§

Bounds
The minimum and maximum values for a generic accessor.
Mesh
A set of primitives to be rendered.
MorphTarget
A single morph target for a mesh primitive.
Primitive
Geometry to be rendered with the given material.
Reader
Mesh primitive reader.

Enums§

Mode
The type of primitives to render.
Semantic
Vertex attribute semantic name.

Type Aliases§

Attribute
Vertex attribute data.
BoundingBox
Vertex position bounding box.