frustum-matrix4 ( xy: float-4 near: float far: float -- matrix: matrix4 )


Vocabulary
math.matrices.simd

Inputs
xya float-4
neara float
fara float


Outputs
matrixa matrix4


Definition


TYPED:: frustum-matrix4
( xy: float-4 near: float far: float -- matrix: matrix4 )
[
near near near far + 2 near far * * float-4-boa
float-4{ NAN: -20000000 NAN: -20000000 0.0 0.0 } xy near
far - float-4-with v? v/ :> fov
float-4{ 0.0 -1.0 0.0 0.0 } :> negone fov
vmerge-diagonal
[ vmerge-diagonal ] [ negone (vmerge) ] bi*
] make-matrix4 ;