Skip to content

Commit

Permalink
match a bunch of gu funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Prakxo committed Feb 24, 2023
1 parent 018de2a commit 2589c29
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 1 deletion.
12 changes: 12 additions & 0 deletions include/libultra/gu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifndef GU_H
#define GU_H
#include <PR/gbi.h">
#include "types.h"
#include "libultra/u64types.h"

Expand All @@ -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
18 changes: 18 additions & 0 deletions src/libultra/gu/lookathil.c
Original file line number Diff line number Diff line change
@@ -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);
}
7 changes: 7 additions & 0 deletions src/libultra/gu/mtxutil.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "libultra/gu.h"

void guMtxIdent(Mtx *m) {
float mf[4][4];
guMtxIdentF(mf);
guMtxF2L(mf, m);
}
10 changes: 10 additions & 0 deletions src/libultra/gu/normalize.c
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 8 additions & 0 deletions src/libultra/gu/ortho.c
Original file line number Diff line number Diff line change
@@ -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);
}
2 changes: 1 addition & 1 deletion tools/ppcdis

0 comments on commit 2589c29

Please sign in to comment.