Esc

Gltf_Animation_Sampler

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

Declaration

Gltf_Animation_Sampler :: struct @json(rename_all=camelCase) {
    input: u32;    output: u32;    interpolation: Gltf_Interpolation = .LINEAR; @json(default)    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)}

Keyframes: the accessor of times (input), the accessor of values (output) and the interpolation between them.

Example↗
asset, error := gltf_load("{\"asset\":{\"version\":\"2.0\"},\"nodes\":[{}],\"buffers\":[{\"byteLength\":32,\"uri\":\"data:application/octet-stream;base64,AAAAAAAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAQAAAQEA=\"}],\"bufferViews\":[{\"buffer\":0,\"byteLength\":32}],\"accessors\":[{\"bufferView\":0,\"componentType\":5126,\"count\":2,\"type\":\"SCALAR\",\"min\":[0],\"max\":[1]},{\"bufferView\":0,\"byteOffset\":8,\"componentType\":5126,\"count\":2,\"type\":\"VEC3\"}],\"animations\":[{\"samplers\":[{\"input\":0,\"output\":1}],\"channels\":[{\"sampler\":0,\"target\":{\"node\":0,\"path\":\"translation\"}}]}]}");
assert(error.kind == .NONE);
defer gltf_free(*asset);
sampler := asset.document.animations[0].samplers[0];
assert(sampler.input == 0 && sampler.output == 1);

See also