From 2589c294e289baadeaa6727f9debfb162f49346b Mon Sep 17 00:00:00 2001 From: Prakxo Date: Fri, 24 Feb 2023 21:29:19 +0100 Subject: [PATCH] match a bunch of gu funcs --- include/libultra/gu.h | 12 ++++++++++++ src/libultra/gu/lookathil.c | 18 ++++++++++++++++++ src/libultra/gu/mtxutil.c | 7 +++++++ src/libultra/gu/normalize.c | 10 ++++++++++ src/libultra/gu/ortho.c | 8 ++++++++ tools/ppcdis | 2 +- 6 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/libultra/gu/lookathil.c create mode 100644 src/libultra/gu/mtxutil.c create mode 100644 src/libultra/gu/normalize.c create mode 100644 src/libultra/gu/ortho.c diff --git a/include/libultra/gu.h b/include/libultra/gu.h index bc6ae164..8a4fb1a9 100644 --- a/include/libultra/gu.h +++ b/include/libultra/gu.h @@ -1,5 +1,6 @@ #ifndef GU_H #define GU_H +#include #include "types.h" #include "libultra/u64types.h" @@ -24,5 +25,16 @@ void guMtxIdentF(float mf[4][4]); void guTranslate(Mtx *m, float x, float y, float z); void guScale(Mtx *m, float x, float y, float z); +void guMtxIdent(Mtx *m); +void guNormalize(float* x, float* y, float* z); +void guOrtho(Mtx *m, float l, float r, float b, float t, float n, float f, float scale); + +void guLookAtHilite (Mtx *m, LookAt *l, Hilite *h, + float xEye, float yEye, float zEye, + float xAt, float yAt, float zAt, + float xUp, float yUp, float zUp, + float xl1, float yl1, float zl1, /* light 1 direction */ + float xl2, float yl2, float zl2, /* light 2 direction */ + int twidth, int theight); /* highlight txtr size*/ #endif \ No newline at end of file diff --git a/src/libultra/gu/lookathil.c b/src/libultra/gu/lookathil.c new file mode 100644 index 00000000..c6ab4497 --- /dev/null +++ b/src/libultra/gu/lookathil.c @@ -0,0 +1,18 @@ +#include "libultra/gu.h" + +void guLookAtHilite (Mtx *m, LookAt *l, Hilite *h, + float xEye, float yEye, float zEye, + float xAt, float yAt, float zAt, + float xUp, float yUp, float zUp, + float xl1, float yl1, float zl1, /* light 1 direction */ + float xl2, float yl2, float zl2, /* light 2 direction */ + int twidth, int theight) /* highlight txtr size*/ +{ + float mf[4][4]; + + guLookAtHiliteF(mf, l, h, xEye, yEye, zEye, xAt, yAt, zAt, + xUp, yUp, zUp, xl1, yl1, zl1, xl2, yl2, zl2, + twidth, theight); + + guMtxF2L(mf, m); +} \ No newline at end of file diff --git a/src/libultra/gu/mtxutil.c b/src/libultra/gu/mtxutil.c new file mode 100644 index 00000000..bdef9649 --- /dev/null +++ b/src/libultra/gu/mtxutil.c @@ -0,0 +1,7 @@ +#include "libultra/gu.h" + +void guMtxIdent(Mtx *m) { + float mf[4][4]; + guMtxIdentF(mf); + guMtxF2L(mf, m); +} diff --git a/src/libultra/gu/normalize.c b/src/libultra/gu/normalize.c new file mode 100644 index 00000000..1772cd9e --- /dev/null +++ b/src/libultra/gu/normalize.c @@ -0,0 +1,10 @@ +#include "libultra/gu.h" + +void guNormalize(float* x, float* y, float* z) { + float norm = sqrtf(*x * *x + *y * *y + *z * *z); + norm = 1.0f / norm; + *x *= norm; + *y *= norm; + *z *= norm; + // might return norm +} diff --git a/src/libultra/gu/ortho.c b/src/libultra/gu/ortho.c new file mode 100644 index 00000000..39c5ee2f --- /dev/null +++ b/src/libultra/gu/ortho.c @@ -0,0 +1,8 @@ +#include "libultra/gu.h" + +void guOrtho(Mtx *m, float l, float r, float b, float t, float n, float f, float scale) +{ + float mf[4][4]; + guOrthoF(mf, l, r, b, t, n, f, scale); + guMtxF2L(mf, m); +} \ No newline at end of file diff --git a/tools/ppcdis b/tools/ppcdis index eca3f301..83260829 160000 --- a/tools/ppcdis +++ b/tools/ppcdis @@ -1 +1 @@ -Subproject commit eca3f3015a86bf0c78d1e415aeff2dda1851194f +Subproject commit 83260829c50f37dd9fe54889cf8971c8fe14c54e