Esc

gltf_next_index

procedureextensionsince 0.36.1Source
  • macOS: gltf_next_index works on macOS
  • Linux: gltf_next_index works on Linux
  • Windows: gltf_next_index works on Windows
  • Wasm: gltf_next_index works on Wasm

Read an unsigned SCALAR without float rounding.

Signature

gltf_next_index :: (cursor: *Gltf_Cursor) -> (u32, bool, Gltf_Error)
Example↗
asset, error := gltf_load("{\"asset\":{\"version\":\"2.0\"},\"scene\":0,\"scenes\":[{\"nodes\":[0]}],\"nodes\":[{\"mesh\":0}],\"meshes\":[{\"primitives\":[{\"attributes\":{\"POSITION\":0},\"indices\":1}]}],\"buffers\":[{\"byteLength\":42,\"uri\":\"data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAgD8AAAAAAAABAAIA\"}],\"bufferViews\":[{\"buffer\":0,\"byteLength\":36,\"target\":34962},{\"buffer\":0,\"byteOffset\":36,\"byteLength\":6,\"target\":34963}],\"accessors\":[{\"bufferView\":0,\"componentType\":5126,\"count\":3,\"type\":\"VEC3\",\"min\":[0,0,0],\"max\":[1,1,0]},{\"bufferView\":1,\"componentType\":5123,\"count\":3,\"type\":\"SCALAR\"}]}");
assert(error.kind == .NONE);
defer gltf_free(*asset);
cursor, _ := gltf_accessor(*asset, 1);
total: u32;
while true {
    index, more, step := gltf_next_index(*cursor);
    if !more break;
    assert(step.kind == .NONE);
    total += index;
}
assert(total == 3); // 0 + 1 + 2

See also