diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-02 11:32:03 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-02 11:32:03 -0400 |
commit | 389a7b6cb997cda4a2b700be4804dcbc9cac455a (patch) | |
tree | 889f81894f0853074ba3888a53e264b8d0e4e1ac /src/Dolphin/mtx | |
parent | 55487832c614edb61ebf22d0c153944ba864feaa (diff) |
mtx: Decompile `C_MTXLightFrustum()`
Diffstat (limited to 'src/Dolphin/mtx')
-rw-r--r-- | src/Dolphin/mtx/mtx.c | 19 |
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) |