ortho_LH_01

Build an orthographic projection matrix with left-hand NDC and [0 .. 1] depth clipping

pure @safe @nogc nothrow
ortho_LH_01
(
T
)
(
in T l
,
in T r
,
in T b
,
in T t
,
in T n
,
in T f
)

Parameters

l T

X position of the left plane

r T

X position of the right plane

b T

Y position of the bottom plane

t T

Y position of the top plane

n T

distance from origin to near plane (in Z-)

f T

distance from origin to far plane (in Z-)

Return Value

Type: Mat4!T

an affine matrix that maps from eye coordinates to NDC.

Examples

import gfx.math.approx : approxUlp;
const m = ortho_LH_01(3f, 5f, -2f, 7f, 1f, 10f);
const v1 = vec(3f, -2f, -1f, 1f);
const v2 = vec(5f, 7f, -10f, 1f);
const v0 = vec(4f, 2.5f, -5.5f, 1f);

assert(approxUlp( m * v1, vec(-1f, -1f, 0f, 1f) ));
assert(approxUlp( m * v2, vec(1f, 1f, 1f, 1f) ));
assert(approxUlp( m * v0, vec(0f, 0f, 0.5f, 1f) ));

Meta