Added egg/math and egg/prim headers

This commit is contained in:
Elijah Thomas
2023-08-18 13:23:11 -04:00
parent 4b6a5d2e01
commit 495dfbbde7
7 changed files with 163 additions and 4 deletions
+26
View File
@@ -145,6 +145,32 @@ lib/egg/core/eggController.cpp:
.sdata2 start:0x8057F338 end:0x8057F360 rename:.sdata
.bss start:0x80673B40 end:0x80674C00
lib/egg/math/eggMath.cpp:
.text start:0x8049AB60 end:0x8049AC64
.sdata2 start:0x8057F360 end:0x8057F368
lib/egg/math/eggMatrix.cpp:
.text start:0x8049AC70 end:0x8049B388
.ctors start:0x804DB990 end:0x804DB994
.sdata2 start:0x8057F368 end:0x8057F380
.bss start:0x80674C00 end:0x80674C30
lib/egg/math/eggQuat.cpp:
.text start:0x8049B390 end:0x8049BCB4
.sdata2 start:0x8057F380 end:0x8057F3A8
lib/egg/math/eggVector.cpp:
.text start:0x8049BCC0 end:0x8049BF90
.ctors start:0x804DB994 end:0x804DB998
.sbss start:0x805767C0 end:0x805767F8
.sdata2 start:0x8057F3A8 end:0x8057F3B8
.bss start:0x80674C30 end:0x80674C60
lib/egg/prim/eggAssert.cpp:
.text start:0x8049BF90 end:0x8049C5BC
.data start:0x8056EC88 end:0x8056ED00
.sbss start:0x805767F8 end:0x80576808
Runtime/__init_cpp_exceptions.cpp:
.text start:0x804C71A8 end:0x804C7218
.ctors start:0x804DB640 end:0x804DB644 rename:.ctors$10
+6 -1
View File
@@ -62,7 +62,12 @@ LIBS = [
["lib/egg/core/eggXfb.cpp", False],
["lib/egg/core/eggXfbManager.cpp", False],
["lib/egg/core/eggGraphicsFifo.cpp", False],
["lib/egg/core/eggController.cpp", False],
["lib/egg/core/eggController.cpp", False],
["lib/egg/math/eggMath.cpp", False],
["lib/egg/math/eggMatrix.cpp", False],
["lib/egg/math/eggQuat.cpp", False],
["lib/egg/math/eggVector.cpp", False],
["lib/egg/prim/eggAssert.cpp", False],
],
}
]
+25
View File
@@ -0,0 +1,25 @@
#pragma once
#include <types.h>
namespace EGG
{
template <typename T>
class Math {
public:
static T frsqrt(T);
static T sin(T);
static T cos(T);
static T acos(T);
static T atan2(T);
};
// f32 impls
// /* 8049ab60 */ Math<f32>::frsqrt(f32);
// /* 8049abb0 */ Math<f32>::sin(f32);
// /* 8049abe0 */ Math<f32>::cos(f32);
// /* 8049ac10 */ Math<f32>::acos(f32);
// /* 8049ac40 */ Math<f32>::atan2(f32, f32);
} // namespace EGG
+25 -1
View File
@@ -1,12 +1,36 @@
#pragma once
#include <types.h>
#include <egg/math/eggVector.h>
#include <egg/math/eggQuat.h>
namespace EGG
{
struct Matrix34f{
// Maybe inherits
class Matrix34f {
public:
f32 mData[3][4];
public:
Matrix34f() {};
f32& operator()(int i, int j) {return mData[i][j]; }
/* 8049ac70 */ bool InverseTo(Matrix34f* dest) const;
/* 8049ac80 */ bool InverseTransposeTo(Matrix34f* dest) const;
/* 8049ac90 */ void makeIdentity();
/* 8049acd0 */ Matrix34f( \
f32 fxx, f32 fxy, f32 fxz, f32 fxw, \
f32 fyx, f32 fyy, f32 fyz, f32 fyw, \
f32 fzx, f32 fzy, f32 fzz, f32 fzw);
/* 8049ad20 */ void makeQT(const Quatf&, const Vector3f&);
/* 8049ade0 */ void makeQ(const Quatf&); // these could be swapped
/* 8049ae90 */ void fromQuat(const Quatf& from); // these could be swapped
/* 8049af40 */ void toQuat(Quatf& dest);
/* 8049b250 */ void slerpTo(const Matrix34f&, Matrix34f&, f32) const;
/* 8049b2d0 */ void setAxisRotation(const Vector3f&, f32);
/* 8049b310 */ void loadPosMtx(u32);
/* 8049b320 */ void multiplyTo(const Matrix34f&, Matrix34f& out);
public:
/* 80674c00 */ static Matrix34f ident;
};
} // namespace EGG
+26
View File
@@ -0,0 +1,26 @@
#pragma once
#include <types.h>
#include <egg/math/eggVector.h>
namespace EGG
{
class Quatf {
public:
f32 x,y,z,w;
public:
Quatf() {}
// could also be void set(f32, f32, f32, f32);
/* 8049b390 */ Quatf(f32 fx, f32 fy, f32 fz, f32 fw);
/* 8049b3b0 */ void setAxisRotation(const Vector3f&, f32);
/* 8049b450 */ f32 norm();
/* 8049b480 */ void normalise();
/* 8049b500 */ void conjugate();
/* 8049b550 */ Vector3f rotateVector(const Vector3f&);
/* 8049b800 */ void slerpTo(const Quatf&, f32, Quatf& out) const;
/* 8049b800 */ void slerpTo(const Quatf&, f32, f32, Quatf& out) const;
/* 8049bbb0 */ void makeVectorRotation(Vector3f&, Vector3f&);
};
} // namespace EGG
+32 -2
View File
@@ -1,16 +1,46 @@
#pragma once
#include <types.h>
#include <egg/math/eggMath.h>
namespace EGG
{
struct Vector3f {
class Vector3f {
public:
f32 x,y,z;
public:
// may need change
Vector3f(const Vector3f& other) {x = other.x, y = other.y, z = other.z;}
// may need change
f32 squaredLength() { return x*x + y*y + z*z; }
f32 length() { return Math<f32>::frsqrt(squaredLength()); }
/* 8049bcc0 */ void normalise();
/* 8049bd50 */ void setLength(Vector3f& src, f32 length);
/* 8049be10 */ void setLength(f32 length);
public:
/* 80674c30 */ static Vector3f zero;
/* 80674c3c */ static Vector3f ex;
/* 80674c48 */ static Vector3f ey;
/* 80674c54 */ static Vector3f ez;
};
struct Vector2f {
f32 x,y;
public:
/* 805767c0 */ static Vector2f zero;
/* 805767c8 */ static Vector2f ex;
/* 805767d0 */ static Vector2f ey;
};
struct Vector3s {
s16 x,y,z;
public:
/* 805767d8 */ static Vector3s zero;
/* 805767e0 */ static Vector3s ex;
/* 805767e8 */ static Vector3s ey;
/* 805767f0 */ static Vector3s ez;
};
} // namespace EGG
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include <types.h>
namespace EGG
{
// All this is guess
// TODO: Fixup funtions
namespace Assert
{
/* 8049bf90 */ void wait(u32 time);
/* 8049c010 */ void assert_printf();
/* 8049c010 */ void report();
/* 8049c0a0 */ s32 getPeriodPos(char*);
/* 8049c100 */ char* getMapSymbol();
/* 8049c150 */ bool isOutsideMEM1(u32 addr);
/* 8049c190 */ void system_halt();
/* 8049c530 */ void assert();
} // namespace Assert
} // namespace EGG