Esc

gltf_node_local

procedureextensionsince 0.36.1Source
  • macOS: gltf_node_local works on macOS
  • Linux: gltf_node_local works on Linux
  • Windows: gltf_node_local works on Windows
  • Wasm: gltf_node_local works on Wasm

A node's transform relative to its parent, as a Matrix4 (column vectors, m * v). A node with a matrix uses it, converted from glTF's column-major order; otherwise the result is translation times rotation times scale, with absent parts as identity. Rotation is the [x, y, z, w] quaternion. The node must come from a loaded or validated asset, which checks the lengths.

Signature

gltf_node_local :: (node: Gltf_Node) -> Matrix4
Example↗
#import "Math";

asset, error := gltf_load("{\"asset\":{\"version\":\"2.0\"},\"nodes\":[{\"translation\":[1,2,3],\"scale\":[2,2,2]}]}");
assert(error.kind == .NONE);
defer gltf_free(*asset);
local := gltf_node_local(asset.document.nodes[0]);
assert(transform_point(local, xyz(1, 1, 1)) == xyz(3, 4, 5));

See also