Esc

Gltf_Animation

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

Declaration

Gltf_Animation :: struct @json(rename_all=camelCase) {
    channels: [] Gltf_Channel;    samplers: [] Gltf_Animation_Sampler;    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)}

Keyframed motion: channels that connect samplers to node properties.

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);
animation := asset.document.animations[0];
assert(animation.channels.count == 1 && animation.samplers.count == 1);

See also