diff --git a/Makefile b/Makefile index d7e070d8..32e5cb0a 100755 --- a/Makefile +++ b/Makefile @@ -257,7 +257,6 @@ ALL_ASSETS_BUILT += $(patsubst $(UCODE_IN_DIR)/%.bin,$(UCODE_OUT_DIR)/%.bin,$(UC $(BUILD_DIR)/lib/%.o: OPT_FLAGS := -O2 $(BUILD_DIR)/lib/src/al/%.o: OPT_FLAGS := -O3 -$(BUILD_DIR)/lib/src/gu/guPerspectiveF.o: OPT_FLAGS := -O2 $(BUILD_DIR)/lib/src/os/%.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/os/osViMgr.o: OPT_FLAGS := -O2 $(BUILD_DIR)/lib/src/os/osCreatePiManager.o: OPT_FLAGS := -O2 diff --git a/lib/src/gu/guPerspectiveF.c b/lib/src/gu/guPerspectiveF.c index 2b871642..6ad42a70 100644 --- a/lib/src/gu/guPerspectiveF.c +++ b/lib/src/gu/guPerspectiveF.c @@ -6,38 +6,42 @@ #include "libc/math.h" #include "PR/gu.h" -#if 0 -void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect, float near, float far, float scale) -{ - float cot; - int i, j; +void guPerspectiveF(Matrix mf, u16 *perspNorm, float fovy, float aspect, float near, float far, float scale) { + float cot; + int i, j; - guMtxIdentF(mf); + guMtxIdentF(mf); - fovy *= 3.1415926 / 180.0; - cot = cosf (fovy/2) / sinf (fovy/2); + fovy *= 3.1415926 / 180.0; + cot = cosf (fovy/2) / sinf (fovy/2); - mf[0][0] = cot / aspect; - mf[1][1] = cot; - mf[2][2] = (near + far) / (near - far); - mf[2][3] = -1; - mf[3][2] = (2 * near * far) / (near - far); - mf[3][3] = 0; + mf[0][0] = cot / aspect; + mf[1][1] = cot; + mf[2][2] = (near + far) / (near - far); + mf[2][3] = -1; + mf[3][2] = (2 * near * far) / (near - far); + mf[3][3] = 0; - for (i=0; i<4; i++) - for (j=0; j<4; j++) - mf[i][j] *= scale; + for (i=0; i<4; i++) { + for (j=0; j<4; j++) + mf[i][j] *= scale; + } - if (perspNorm != (u16 *) NULL) { - if (near+far<=2.0) { - *perspNorm = (u16) 0xFFFF; - } else { - *perspNorm = (u16) ((2.0*65536.0)/(near+far)); - if (*perspNorm<=0) - *perspNorm = (u16) 0x0001; - } - } + if (perspNorm != (u16 *) NULL) { + if (near+far<=2.0) { + *perspNorm = (u16) 0xFFFF; + } else { + *perspNorm = (u16) ((2.0*65536.0)/(near+far)); + if (*perspNorm<=0) + *perspNorm = (u16) 0x0001; + } + } +} + +void guPerspective(Mtx *m, u16 *perspNorm, float fovy, float aspect, float near, float far, float scale) { + Matrix mf; + + guPerspectiveF(mf, perspNorm, fovy, aspect, near, far, scale); + + guMtxF2L(mf, m); } -#else -GLOBAL_ASM("lib/asm/non_matchings/unknown_0CCF90/guPerspectiveF.s") -#endif