summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Dolphin/mtx/mtx.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/Dolphin/mtx/mtx.c b/src/Dolphin/mtx/mtx.c
index 4a229bd..69d72b7 100644
--- a/src/Dolphin/mtx/mtx.c
+++ b/src/Dolphin/mtx/mtx.c
@@ -596,7 +596,24 @@ void C_MTXLookAt(Mtx m, const Vec* camPos, const Vec* camUp, const Vec* target)
void C_MTXLightFrustum(Mtx m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 scaleS, f32 scaleT, f32 transS, f32 transT)
{
-
+ f32 inv_dist = 1.0 / (r - l);
+ f32 two_n = 2*n;
+
+ m[0][0] = two_n * inv_dist * scaleS;
+ m[0][1] = 0.0;
+ m[0][2] = ((r+l) * inv_dist * scaleS) - transS;
+ m[0][3] = 0.0;
+
+ inv_dist = 1.0 / (t - b);
+ m[1][0] = 0.0;
+ m[1][1] = two_n * inv_dist * scaleT;
+ m[1][2] = ((t+b) * inv_dist * scaleT) - transT;
+ m[1][3] = 0.0;
+
+ m[2][0] = 0.0;
+ m[2][1] = 0.0;
+ m[2][2] = -1.0;
+ m[2][3] = 0.0;
}
void C_MTXLightPerspective(Mtx m, f32 fovY, f32 aspect, float scaleS, float scaleT, float transS, float transT)