summaryrefslogtreecommitdiff
path: root/src/math/matrix.c
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-12-05 09:21:26 +0800
committerchai <chaifix@163.com>2019-12-05 09:21:26 +0800
commit8e684dc0c76708e3174f005aebcaabc144b85500 (patch)
treed7803e49ee1fdb5575128114d19499787f870c00 /src/math/matrix.c
parent2e82e2ddd0852b8063a3d6645366f53ee844e273 (diff)
*背面剔除
Diffstat (limited to 'src/math/matrix.c')
-rw-r--r--src/math/matrix.c12
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);