Esc

Gltf_Perspective

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

Declaration

Gltf_Perspective :: struct @json(rename_all=camelCase) {
    aspect_ratio: Json_Maybe(float32);    yfov: float32;    zfar: Json_Maybe(float32);    znear: float32;    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 perspective projection; a missing zfar means an infinite far plane.

Example↗
asset, error := gltf_load("{\"asset\":{\"version\":\"2.0\"},\"cameras\":[{\"type\":\"perspective\",\"perspective\":{\"yfov\":0.8,\"znear\":0.1}}]}");
assert(error.kind == .NONE);
defer gltf_free(*asset);
perspective := asset.document.cameras[0].perspective;
assert(perspective.yfov == 0.8 && perspective.zfar.state == .MISSING); // an infinite far plane

See also