Function munum::transform::perspective
source · [−]Expand description
Creates the 4x4 perspective projection using glTF’s formula. Use infinite projection if zfar = Infinity. See: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#projection-matrices
Examples
assert_float_eq!(
transform::perspective(2., PI/2., 1., INFINITY).as_ref(),
&[0.5, 0., 0., 0., 0., 1., 0., 0., 0., 0., -1., -1., 0., 0., -2., 0.]
);
assert_float_eq!(
transform::perspective(2., PI/2., 1., 9.).as_ref(),
&[0.5, 0., 0., 0., 0., 1., 0., 0., 0., 0., -1.25, -1., 0., 0., -2.25, 0.]
);