An orthographic projection of the box left..right, bottom..top, near..far (distances in front of the camera, which looks along -z) into clip space. The depth range maps to -1..1, or 0..1 with depth_range_01 = true. Right-handed; no divide by zero check, so equal bounds give infinities.
m := orthographic_projection_matrix(-2, 2, -1, 1, 1, 11);
p := m * xyzw(2, 1, -1, 1); // right, top, near
assert(abs(p.x - 1) < 0.0001 && abs(p.y - 1) < 0.0001 && abs(p.z + 1) < 0.0001);orthographic_projection_matrix :: (
left: float,
right: float,
bottom: float,
top: float,
near: float,
far: float,
depth_range_01 := false
) -> Matrix4
An orthographic projection for the box between the six planes.
Parameters
- left: float
- the left plane.
- right: float
- the right plane.
- bottom: float
- the bottom plane.
- top: float
- the top plane.
- near: float
- distance to the near plane.
- far: float
- distance to the far plane.
- depth_range_01 := false
- true maps depth to
0..1, false to-1..1.