mirror of
https://github.com/zeldaret/ss
synced 2026-07-08 13:56:15 -04:00
Added egg/math and egg/prim headers
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user