[][src]Module gltf::accessor

Accessors for reading vertex attributes from buffer views.

Basic usage

Visiting the accessors of a glTF asset.

for accessor in gltf.accessors() {
    println!("Accessor #{}", accessor.index());
    println!("offset: {}", accessor.offset());
    println!("count: {}", accessor.count());
    println!("data_type: {:?}", accessor.data_type());
    println!("dimensions: {:?}", accessor.dimensions());
}

Utility functions

Reading the values from the vec3 accessors of a glTF asset.

Note

The Iter utility is a low-level iterator intended for use in special cases. The average user is expected to use reader abstractions such as mesh::Reader.

let (gltf, buffers, _) = gltf::import("examples/Box.gltf")?;
let get_buffer_data = |buffer: gltf::Buffer| buffers.get(buffer.index()).map(|x| &*x.0);
for accessor in gltf.accessors() {
    match (accessor.data_type(), accessor.dimensions()) {
        (DataType::F32, Dimensions::Vec3) => {
            let iter = Iter::<[f32; 3]>::new(accessor, get_buffer_data);
            for item in iter {
                println!("{:?}", item);
            }
        }
        _ => {},
    }
}

Modules

sparse

Contains data structures for sparse storage.

util

Utility functions.

Structs

Accessor

A typed view into a buffer view.

Enums

DataType

The component data type.

Dimensions

Specifies whether an attribute, vector, or matrix.

Iter

General iterator for an accessor.

Traits

Item

Represents items that can be read by an Accessor.