diff options
| author | lepelog <lepelog@users.noreply.github.com> | 2021-03-31 00:50:18 +0200 |
|---|---|---|
| committer | lepelog <lepelog@users.noreply.github.com> | 2021-03-31 00:50:18 +0200 |
| commit | 0b09be34fb4f1e06e9627ec8670def708386fcf1 (patch) | |
| tree | c351350d9b3a1c65e2b6fc173d4a21d2040d7ca4 /include/SSystem | |
| parent | 38c71b196828984329b168b94a5e41030e0fd6e7 (diff) | |
start c_m3d
Diffstat (limited to 'include/SSystem')
| -rw-r--r-- | include/SSystem/SComponent/c_m3d_g_aab.h | 30 | ||||
| -rw-r--r-- | include/SSystem/SComponent/c_m3d_g_cir.h | 18 | ||||
| -rw-r--r-- | include/SSystem/SComponent/c_m3d_g_cps.h | 20 | ||||
| -rw-r--r-- | include/SSystem/SComponent/c_m3d_g_lin.h | 23 | ||||
| -rw-r--r-- | include/SSystem/SComponent/c_xyz.h | 53 |
5 files changed, 144 insertions, 0 deletions
diff --git a/include/SSystem/SComponent/c_m3d_g_aab.h b/include/SSystem/SComponent/c_m3d_g_aab.h index fc2e27fa7a..559f2937bf 100644 --- a/include/SSystem/SComponent/c_m3d_g_aab.h +++ b/include/SSystem/SComponent/c_m3d_g_aab.h @@ -2,5 +2,35 @@ #define C_M3D_G_AAB_H #include "dolphin/types.h" +#include "SSystem/SComponent/c_xyz.h" + +// Axis aligned bounding box +class cM3dGAab { +private: +public: + cXyz mMin; + cXyz mMax; + + virtual ~cM3dGAab(); + void Set(const cXyz*, const cXyz*); + bool CrossY(const cXyz*) const; + bool UnderPlaneYUnder(f32) const; + bool TopPlaneYUnder(f32) const; + void ClearForMinMax(void); + void SetMinMax(const cXyz&); + void SetMinMax(const cM3dGAab&); + void SetMin(const cXyz&); + void SetMax(const cXyz&); + void CalcCenter(cXyz*) const; + void PlusR(f32); + const cXyz& getMaxP(void) const { return mMax; } + const cXyz& getMinP(void) const { return mMin; } + const f32 GetMaxX(void) const { return mMax.GetX(); } + const f32 GetMaxY(void) const { return mMax.GetY(); } + const f32 GetMaxZ(void) const { return mMax.GetZ(); } + const f32 GetMinX(void) const { return mMin.GetX(); } + const f32 GetMinY(void) const { return mMin.GetY(); } + const f32 GetMinZ(void) const { return mMin.GetZ(); } +}; #endif /* C_M3D_G_AAB_H */ diff --git a/include/SSystem/SComponent/c_m3d_g_cir.h b/include/SSystem/SComponent/c_m3d_g_cir.h index d8ce850da6..d58bd406a4 100644 --- a/include/SSystem/SComponent/c_m3d_g_cir.h +++ b/include/SSystem/SComponent/c_m3d_g_cir.h @@ -3,4 +3,22 @@ #include "dolphin/types.h" +class cM2dGCir { +public: + f32 mPosX; + f32 mPosY; + f32 mRadius; + cM2dGCir() {} + virtual ~cM2dGCir() {} +}; + +class cM3dGCir : public cM2dGCir { + f32 mPosZ; + +public: + cM3dGCir(void); + virtual ~cM3dGCir(void); + void Set(f32, f32, f32, f32); +}; + #endif /* C_M3D_G_CIR_H */ diff --git a/include/SSystem/SComponent/c_m3d_g_cps.h b/include/SSystem/SComponent/c_m3d_g_cps.h index 9af5ec6e91..149f194e0a 100644 --- a/include/SSystem/SComponent/c_m3d_g_cps.h +++ b/include/SSystem/SComponent/c_m3d_g_cps.h @@ -2,5 +2,25 @@ #define C_M3D_G_CPS_H #include "dolphin/types.h" +#include "SSystem/SComponent/c_m3d_g_lin.h" +#include "SSystem/SComponent/c_xyz.h" + +struct cM3dGCpsS { + Vec mStart; + Vec mEnd; + f32 unk_0x1c; +}; + +class cM3dGCps : public cM3dGLin { +private: + f32 unk_0x1c; + +public: + cM3dGCps(void); + virtual ~cM3dGCps(void); + void Set(const cXyz&, const cXyz&, f32); + void Set(const cM3dGCpsS&); + void SetCps(const cM3dGCps&); +}; #endif /* C_M3D_G_CPS_H */ diff --git a/include/SSystem/SComponent/c_m3d_g_lin.h b/include/SSystem/SComponent/c_m3d_g_lin.h index 4a1e950115..4493ffe4d0 100644 --- a/include/SSystem/SComponent/c_m3d_g_lin.h +++ b/include/SSystem/SComponent/c_m3d_g_lin.h @@ -2,5 +2,28 @@ #define C_M3D_G_LIN_H #include "dolphin/types.h" +#include "SSystem/SComponent/c_xyz.h" +#include "mtx_vec.h" + +// Line +class cM3dGLin { + // private: +public: + cXyz mStart; + cXyz mEnd; + + cM3dGLin() {} + cM3dGLin(const cXyz&, const cXyz&); + virtual ~cM3dGLin() {} + void SetStartEnd(const cXyz&, const cXyz&); + void SetStartEnd(const Vec&, const Vec&); + void CalcPos(Vec*, f32) const; + void CalcVec(Vec* pOut) const { PSVECSubtract(&this->mEnd, &this->mStart, pOut); } + void SetEnd(const cXyz&); + const cXyz& GetStartP(void) const { return mStart; } + cXyz& GetStartP(void) { return mStart; } + const cXyz& GetEndP(void) const { return mEnd; } + cXyz& GetEndP(void) { return mEnd; } +}; #endif /* C_M3D_G_LIN_H */ diff --git a/include/SSystem/SComponent/c_xyz.h b/include/SSystem/SComponent/c_xyz.h index 21460d2bfb..d75dd51d23 100644 --- a/include/SSystem/SComponent/c_xyz.h +++ b/include/SSystem/SComponent/c_xyz.h @@ -32,6 +32,21 @@ struct cXyz : Vec { /* 80266B84 */ cXyz operator*(f32) const; /* 80266BD0 */ cXyz operator*(Vec const&) const; /* 80266C18 */ cXyz operator/(f32) const; + void operator+=(f32 f) { + x += f; + y += f; + z += f; + } + void operator-=(f32 f) { + x -= f; + y -= f; + z -= f; + } + void operator+=(const Vec& vec) { + x += vec.x; + y += vec.y; + z += vec.z; + } /* 80266C6C */ cXyz getCrossProduct(Vec const&) const; /* 80266CBC */ cXyz outprod(Vec const&) const; /* 80266CE4 */ cXyz norm() const; @@ -45,6 +60,44 @@ struct cXyz : Vec { /* 802670AC */ bool isZero() const; /* 80267128 */ s16 atan2sX_Z() const; /* 80267150 */ s16 atan2sY_XZ() const; + + void setAll(f32 f) { + z = f; + y = f; + x = f; + } + + void set(f32 pX, f32 pY, f32 pZ) { + x = pX; + y = pY; + z = pZ; + } + + void setMin(const cXyz& other) { + if (x > other.x) { + x = other.x; + } + if (y > other.y) { + y = other.y; + } + if (z > other.z) { + z = other.z; + } + } + + void setMax(const cXyz& other) { + if (x < other.x) { + x = other.x; + } + if (y < other.y) { + y = other.y; + } + if (z < other.z) { + z = other.z; + } + } + + float getSquareMag() const { return PSVECSquareMag(this); } }; #endif /* C_XYZ_H */ |
