Esc

Gltf_Cursor

structextensionsince 0.36.1Source
  • macOS: Gltf_Cursor works on macOS
  • Linux: Gltf_Cursor works on Linux
  • Windows: Gltf_Cursor works on Windows
  • Wasm: Gltf_Cursor works on Wasm

Declaration

Gltf_Cursor :: struct {
    asset: *Gltf_Asset;    accessor: s64;    element: s64;    sparse_element: s64;    components: s64;}

A position in an accessor's elements, for gltf_next_floats and gltf_next_index. Start one with gltf_accessor; the asset must outlive it and stay unchanged. components is the number of values per element.

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, 0);
assert(cursor.components == 3); // a VEC3 element has three values

See also