Files
dusklight/libs/dolphin/mtx/mtx44.c
T
Pheenoh f9380b3e05 d_a_obj_carry work, SETUP_ACTOR macro, header cleanup (#1885)
* d_a_obj_carry work, SETUP_ACTOR macro

* rm headers, add script

* progress

* macro rename, consistent spacing
2023-08-16 12:07:52 -07:00

83 lines
1.8 KiB
C

//
// Generated By: dol2asm
// Translation Unit: mtx44
//
#include "dolphin/mtx/mtx44.h"
#include "MSL_C/math.h"
//
// Declarations:
//
/* ############################################################################################## */
static void __C_MTXOrtho1(Mtx44 m, f32 l, f32 r, f32 t, f32 b) {
f32 temp_f10 = 1.0F / (r - l);
f32 temp_f8;
m[0][0] = 2.0F * temp_f10;
m[0][1] = 0.0F;
m[0][2] = 0.0F;
m[0][3] = temp_f10 * -(r + l);
temp_f8 = 1.0F / (t - b);
m[1][0] = 0.0F;
m[1][1] = 2.0F * temp_f8;
m[1][2] = 0.0F;
m[1][3] = temp_f8 * -(t + b);
}
static void __C_MTXOrtho2(Mtx44 m, f32 f, f32 n) {
f32 temp_f4 = 1.0F / (f - n);
m[2][0] = 0.0F;
m[2][1] = 0.0F;
m[2][2] = -1.0F * temp_f4;
m[2][3] = -f * temp_f4;
m[3][0] = 0.0F;
m[3][1] = 0.0F;
m[3][2] = 0.0F;
m[3][3] = 1.0F;
}
/* 80346F28-80346FF8 341868 00D0+00 0/0 6/6 0/0 .text C_MTXPerspective */
// Functions match but has issues with float constants
void C_MTXPerspective(Mtx44 m, f32 fovY, f32 aspect, f32 n, f32 f)
{
f32 temp_f3;
f32 temp_f4;
fovY = 0.5F * fovY;
temp_f4 = 1.0F / tanf(0.017453292F * (fovY));
temp_f3 = 1.0F / (f - n);
m[0][0] = temp_f4 / aspect;
m[0][1] = 0.0F;
m[0][2] = 0.0F;
m[0][3] = 0.0F;
m[1][0] = 0.0F;
m[1][1] = temp_f4;
m[1][2] = 0.0F;
m[1][3] = 0.0F;
m[2][0] = 0.0F;
m[2][1] = 0.0F;
m[2][2] = -n * temp_f3;
m[2][3] = temp_f3 * -(f * n);
m[3][0] = 0.0F;
m[3][1] = 0.0F;
m[3][2] = -1.0F;
m[3][3] = 0.0F;
}
/* 80346FF8-80347090 341938 0098+00 0/0 11/11 2/2 .text C_MTXOrtho */
void C_MTXOrtho(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f)
{
__C_MTXOrtho1(m, l, r, t, b);
__C_MTXOrtho2(m, f, n);
}