Esc

Gltf_Sparse_Indices

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

Declaration

Gltf_Sparse_Indices :: struct @json(rename_all=camelCase) {
    buffer_view: u32;    byte_offset: u32 = 0; @json(default,skip_serializing_if=zero)    component_type: Gltf_Component; @json(as_number)    name: string; @json(default,skip_serializing_if=empty)    extensions: Json_Value; @json(default,skip_serializing_if=null)    extras: Json_Value; @json(default,skip_serializing_if=null)}

The positions replaced by a Gltf_Sparse accessor, read from a buffer view.

Example↗
asset, error := gltf_load("{\"asset\":{\"version\":\"2.0\"},\"buffers\":[{\"byteLength\":8,\"uri\":\"data:application/octet-stream;base64,AQAAAACAAEA=\"}],\"bufferViews\":[{\"buffer\":0,\"byteLength\":1},{\"buffer\":0,\"byteOffset\":4,\"byteLength\":4}],\"accessors\":[{\"componentType\":5126,\"count\":3,\"type\":\"SCALAR\",\"sparse\":{\"count\":1,\"indices\":{\"bufferView\":0,\"componentType\":5121},\"values\":{\"bufferView\":1}}}]}");
assert(error.kind == .NONE);
defer gltf_free(*asset);
indices := asset.document.accessors[0].sparse.indices;
assert(indices.buffer_view == 0 && indices.component_type == .UNSIGNED_BYTE);

See also