2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CPLANE
|
|
|
|
#define _CPLANE
|
2022-09-18 05:55:13 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
2022-10-03 02:55:05 +00:00
|
|
|
#include "Kyoto/Math/CUnitVector3f.hpp"
|
2022-09-29 23:55:38 +00:00
|
|
|
#include "Kyoto/Math/CVector3f.hpp"
|
|
|
|
|
2022-09-18 05:55:13 +00:00
|
|
|
class CPlane {
|
|
|
|
public:
|
2022-10-21 00:26:38 +00:00
|
|
|
CPlane(const CVector3f& vec, const CUnitVector3f& normal)
|
|
|
|
: x0_normal(normal), xc_constant(CVector3f::Dot(vec, normal)) {}
|
2022-10-09 23:05:06 +00:00
|
|
|
CPlane(float constant, const CUnitVector3f& normal) : x0_normal(normal), xc_constant(constant) {}
|
2022-09-29 23:55:38 +00:00
|
|
|
CPlane(const CVector3f&, const CVector3f&, const CVector3f&);
|
2022-09-18 05:55:13 +00:00
|
|
|
// TODO
|
|
|
|
|
2022-09-29 23:55:38 +00:00
|
|
|
const CUnitVector3f& GetNormal() const { return x0_normal; }
|
2022-10-09 05:37:23 +00:00
|
|
|
float GetConstant() const { return xc_constant; }
|
2022-10-21 00:26:38 +00:00
|
|
|
float GetHeight(const CVector3f& pos) const {
|
|
|
|
return CVector3f::Dot(GetNormal(), pos) - GetConstant();
|
|
|
|
}
|
2022-09-29 23:55:38 +00:00
|
|
|
// IsFacing__6CPlaneCFRC9CVector3f
|
2022-10-03 02:55:05 +00:00
|
|
|
float ClipLineSegment(const CVector3f& start, const CVector3f& end) const;
|
2022-09-29 23:55:38 +00:00
|
|
|
|
2022-09-18 05:55:13 +00:00
|
|
|
private:
|
2022-09-29 23:55:38 +00:00
|
|
|
CUnitVector3f x0_normal;
|
2022-10-09 05:37:23 +00:00
|
|
|
float xc_constant;
|
2022-09-18 05:55:13 +00:00
|
|
|
};
|
|
|
|
CHECK_SIZEOF(CPlane, 0x10)
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CPLANE
|