diff --git a/Makefile b/Makefile index 9dc3d28a..cecb544b 100644 --- a/Makefile +++ b/Makefile @@ -194,11 +194,13 @@ build/src/libultra/2D300.o: OPTFLAGS := -O1 -g0 build/src/libultra/io/controller.o: OPTFLAGS := -O1 -g0 build/src/libultra/libc/string.o: OPTFLAGS := -O2 -g0 build/src/libultra/libc/ldiv.o: OPTFLAGS := -O2 -g0 +build/src/libultra/gu/ortho.o: OPTFLAGS := -O3 -g0 build/src/libultra/gu/lookat.o: OPTFLAGS := -O3 -g0 # cc & asm-processor CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(IDO) -- $(AS) $(ASFLAGS) -- build/src/libultra/gu/lookat.o: CC := $(IDO) +build/src/libultra/gu/ortho.o: CC := $(IDO) #build/src/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(IDO) -- $(AS) $(ASFLAGS) -- all: uncompressed diff --git a/src/libultra/gu/lookat.c b/src/libultra/gu/lookat.c index a1829777..89ca18f3 100644 --- a/src/libultra/gu/lookat.c +++ b/src/libultra/gu/lookat.c @@ -1,9 +1,6 @@ #include "global.h" #include "PR/gbi.h" - -void guMtxIdentF(float (*mf)[4]); - -float sqrtf(float value); +#include "PR/gu.h" void guLookAtF(float mf[4][4], float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp, float yUp, float zUp) { diff --git a/src/libultra/gu/ortho.c b/src/libultra/gu/ortho.c index a86fb619..14945f8c 100644 --- a/src/libultra/gu/ortho.c +++ b/src/libultra/gu/ortho.c @@ -1,5 +1,31 @@ -#include "common.h" +#include "global.h" +#include "PR/gu.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/gu/ortho/guOrthoF.s") +void guOrthoF(float mf[4][4], float l, float r, float b, float t, float n, float f, float scale) { + int i; + int j; -#pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/gu/ortho/guOrtho.s") + guMtxIdentF(mf); + + mf[0][0] = 2 / (r - l); + mf[1][1] = 2 / (t - b); + mf[2][2] = -2 / (f - n); + mf[3][0] = -(r + l) / (r - l); + mf[3][1] = -(t + b) / (t - b); + mf[3][2] = -(f + n) / (f - n); + mf[3][3] = 1; + + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + mf[i][j] *= scale; + } + } +} + +void guOrtho(Mtx* m, float l, float r, float b, float t, float n, float f, float scale) { + Matrix mf; + + guOrthoF(mf, l, r, b, t, n, f, scale); + + guMtxF2L(mf, m); +}