From 389a7b6cb997cda4a2b700be4804dcbc9cac455a Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Thu, 2 Feb 2023 11:32:03 -0400 Subject: mtx: Decompile `C_MTXLightFrustum()` --- src/Dolphin/mtx/mtx.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/Dolphin/mtx') 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) -- cgit v1.2.3-13-gbd6f