Function frustum

Build an frustum perspective projection matrix with NDC and DepthClip selected at runtime

Mat4!T frustum(T) (
  NDC ndc,
  in T l,
  in T r,
  in T b,
  in T t,
  in T n,
  in T f
);

Parameters

NameDescription
ndc the target NDC
l X position of the left edge at the near plane
r X position of the right edge at the near plane
b Y position of the bottom edge at the near plane
t Y position of the top edge at the near plane
n distance from origin to near plane (in Z-)
f distance from origin to far plane (in Z-)

Returns

a matrix that maps from eye space to clip space. To obtain NDC, the vector must be divided by w.