mirror of
https://github.com/zeldaret/tp
synced 2026-07-09 06:53:23 -04:00
start c_m3d
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user