From 8e684dc0c76708e3174f005aebcaabc144b85500 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 5 Dec 2019 09:21:26 +0800 Subject: =?UTF-8?q?*=E8=83=8C=E9=9D=A2=E5=89=94=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/math/matrix.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/math/matrix.c') 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); -- cgit v1.1-26-g67d0