Match and link CCollisionSurface

This commit is contained in:
Phillip Stephens 2022-10-09 16:05:06 -07:00
parent cf99f3047b
commit 736cec9baa
3 changed files with 26 additions and 5 deletions

View File

@ -9,7 +9,7 @@
class CPlane { class CPlane {
public: public:
CPlane(const CVector3f&, const CUnitVector3f&); // TODO weak CPlane(const CVector3f&, const CUnitVector3f&); // TODO weak
CPlane(float, const CUnitVector3f&); // TODO weak CPlane(float constant, const CUnitVector3f& normal) : x0_normal(normal), xc_constant(constant) {}
CPlane(const CVector3f&, const CVector3f&, const CVector3f&); CPlane(const CVector3f&, const CVector3f&, const CVector3f&);
// TODO // TODO

View File

@ -4,17 +4,22 @@
#include "types.h" #include "types.h"
#include "Kyoto/Math/CVector3f.hpp" #include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/Math/CPlane.hpp"
class CCollisionSurface { class CCollisionSurface {
public: public:
typedef CVector3f TVerts[3];
// TODO CCollisionSurface(const CVector3f&, const CVector3f&, const CVector3f&, uint flags);
CUnitVector3f GetNormal() const;
CPlane GetPlane() const;
private: private:
TVerts x0_data; CVector3f x0_a;
CVector3f xc_b;
CVector3f x18_c;
uint x24_flags; uint x24_flags;
}; };
CHECK_SIZEOF(CCollisionSurface, 0x28) //CHECK_SIZEOF(CCollisionSurface, 0x28)
#endif // _CCOLLISIONSURFACE #endif // _CCOLLISIONSURFACE

View File

@ -0,0 +1,16 @@
#include "WorldFormat/CCollisionSurface.hpp"
CCollisionSurface::CCollisionSurface(const CVector3f& a, const CVector3f& b, const CVector3f& c,
uint flags)
: x0_a(a), xc_b(b), x18_c(c), x24_flags(flags) {}
CUnitVector3f CCollisionSurface::GetNormal() const {
CVector3f baDiff = xc_b - x0_a;
CVector3f caDiff = x18_c - x0_a;
CVector3f tmp = CVector3f::Cross(baDiff, caDiff);
return tmp;
}
CPlane CCollisionSurface::GetPlane() const {
const CUnitVector3f norm = GetNormal();
return CPlane(CVector3f::Dot(norm, x0_a), norm);
}