diff options
Diffstat (limited to 'src/math/matrix.c')
-rw-r--r-- | src/math/matrix.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/math/matrix.c b/src/math/matrix.c index 458f432..15a194d 100644 --- a/src/math/matrix.c +++ b/src/math/matrix.c @@ -61,6 +61,18 @@ void mat4_setidentity(Mat4* out) { out->e33 = 1; } +void mat4_setortho(float l, float r, float b, float t, float n, float f, Mat4* out) { + ssr_assert(out); + mat4_zero(out); + out->e00 = 2 / (r - l); + out->e03 = -(r + l) / (r - l); + out->e11 = 2 / (t - b); + out->e13 = -(t + b) / (t - b); + out->e22 = -2 / (f - n); + out->e23 = -(f + n) / (f - n); + out->e33 = 1; +} + void mat4_setfrustum(float l, float r, float b, float t, float n, float f, Mat4* out) { ssr_assert(out); mat4_zero(out); |