Esc

Gltf_Node

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

Declaration

Gltf_Node :: struct @json(rename_all=camelCase) {
    children: [] u32; @json(default,skip_serializing_if=empty)    mesh: Json_Maybe(u32);    skin: Json_Maybe(u32);    camera: Json_Maybe(u32);    matrix: [] float32; @json(default,skip_serializing_if=empty)    rotation: [] float32; @json(default,skip_serializing_if=empty)    scale: [] float32; @json(default,skip_serializing_if=empty)    translation: [] float32; @json(default,skip_serializing_if=empty)    weights: [] float32; @json(default,skip_serializing_if=empty)    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)}

A node in the scene hierarchy: it may place a mesh, skin or camera and has either a matrix or translation, rotation and scale. children and the references are indices.

Example↗
asset, error := gltf_load("{\"asset\":{\"version\":\"2.0\"},\"nodes\":[{\"name\":\"parent\",\"translation\":[1,2,3],\"children\":[1]},{}]}");
assert(error.kind == .NONE);
defer gltf_free(*asset);
parent := asset.document.nodes[0];
assert(parent.translation[1] == 2 && parent.children[0] == 1);
assert(parent.mesh.state == .MISSING);

See also