frustum-matrix4 ( xy-dim near far -- matrix )


Vocabulary
math.matrices

Inputs and outputs
xy-diman object
nearan object
faran object
matrixan object


Definition


:: frustum-matrix4 ( xy-dim near far -- matrix )
xy-dim first2 :> ( x y ) near x /f :> xf near y /f
:> yf near far + near far - /f :> zf 2 near far * *
near far - /f :> wf {
{ xf 0.0 0.0 0.0 }
{ 0.0 yf 0.0 0.0 }
{ 0.0 0.0 zf wf }
{ 0.0 0.0 -1.0 0.0 }
} ;