2022-07-26 04:36:32 +00:00
|
|
|
#ifndef __CAABOX_HPP__
|
|
|
|
#define __CAABOX_HPP__
|
|
|
|
|
|
|
|
#include "Kyoto/Math/CVector3f.hpp"
|
|
|
|
|
2022-09-29 23:55:38 +00:00
|
|
|
class CInputStream;
|
|
|
|
class CLineSeg;
|
|
|
|
class CPlane;
|
|
|
|
class CTransform4f;
|
|
|
|
class CTri;
|
|
|
|
|
2022-07-26 04:36:32 +00:00
|
|
|
class CAABox {
|
2022-08-13 01:26:00 +00:00
|
|
|
public:
|
2022-09-29 23:55:38 +00:00
|
|
|
enum EBoxEdgeId {
|
|
|
|
kE_Z0,
|
|
|
|
kE_X0,
|
|
|
|
kE_Z1,
|
|
|
|
kE_X1,
|
|
|
|
kE_Z2,
|
|
|
|
kE_X2,
|
|
|
|
kE_Z3,
|
|
|
|
kE_X3,
|
|
|
|
kE_Y0,
|
|
|
|
kE_Y1,
|
|
|
|
kE_Y2,
|
|
|
|
kE_Y3,
|
|
|
|
};
|
|
|
|
enum EBoxFaceId {
|
|
|
|
kF_YMin,
|
|
|
|
kF_YMax,
|
|
|
|
kF_XMin,
|
|
|
|
kF_XMax,
|
|
|
|
kF_ZMax,
|
|
|
|
kF_ZMin,
|
|
|
|
};
|
|
|
|
|
|
|
|
CAABox(const CVector3f& min, const CVector3f& max);
|
|
|
|
CAABox(f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ)
|
|
|
|
: min(minX, minY, minZ), max(maxX, maxY, maxZ) {}
|
|
|
|
CAABox(CInputStream& in);
|
2022-09-21 05:18:07 +00:00
|
|
|
// CAABox(const CAABox& other)
|
2022-09-29 23:55:38 +00:00
|
|
|
// : min(other.min)
|
|
|
|
// , max(other.max) {}
|
2022-09-21 05:18:07 +00:00
|
|
|
|
2022-09-29 23:55:38 +00:00
|
|
|
// CAABox& operator=(const CAABox& other) {
|
|
|
|
// min = other.min;
|
|
|
|
// max = other.max;
|
|
|
|
// return *this;
|
|
|
|
// }
|
2022-08-16 02:14:28 +00:00
|
|
|
|
2022-09-29 23:55:38 +00:00
|
|
|
CLineSeg GetEdge(EBoxEdgeId edge) const;
|
|
|
|
CTri GetTri(EBoxFaceId face, int windOffset) const;
|
2022-08-16 02:14:28 +00:00
|
|
|
CVector3f ClosestPointAlongVector(const CVector3f& vec) const;
|
2022-09-29 23:55:38 +00:00
|
|
|
CVector3f FurthestPointAlongVector(const CVector3f& vec) const;
|
2022-09-29 05:30:20 +00:00
|
|
|
const CVector3f& GetMinPoint() const { return min; }
|
|
|
|
const CVector3f& GetMaxPoint() const { return max; }
|
|
|
|
// GetCenterPoint__6CAABoxCFv global
|
|
|
|
// GetPoint__6CAABoxCFi global
|
|
|
|
// Include__6CAABoxFRC9CVector3f weak
|
|
|
|
// Include__6CAABoxFRC6CAABox weak
|
2022-09-29 23:55:38 +00:00
|
|
|
void AccumulateBounds(const CVector3f&);
|
2022-09-29 05:30:20 +00:00
|
|
|
// bool Invalid__6CAABoxCFv global
|
|
|
|
// PointInside__6CAABoxCFRC9CVector3f global
|
2022-09-29 23:55:38 +00:00
|
|
|
bool DoBoundsOverlap(const CAABox&) const;
|
2022-09-29 05:30:20 +00:00
|
|
|
// GetVolume__6CAABoxCFv global
|
|
|
|
// GetBooleanIntersection__6CAABoxCFRC6CAABox global
|
2022-09-29 23:55:38 +00:00
|
|
|
bool Inside(const CAABox& other) const;
|
|
|
|
bool InsidePlane(const CPlane& plane) const;
|
|
|
|
CVector3f ClampToBox(const CVector3f& vec) const;
|
2022-09-29 05:30:20 +00:00
|
|
|
// GetTri__6CAABoxCFQ26CAABox10EBoxFaceIdi global
|
|
|
|
// DistanceBetween__6CAABoxFRC6CAABoxRC6CAABox global
|
2022-09-29 23:55:38 +00:00
|
|
|
CAABox GetTransformedAABox(const CTransform4f& xf) const;
|
2022-09-29 05:30:20 +00:00
|
|
|
|
|
|
|
// GetPointA__6CAABoxCFv weak
|
|
|
|
// GetPointB__6CAABoxCFv weak
|
|
|
|
// GetPointC__6CAABoxCFv weak
|
|
|
|
// GetPointD__6CAABoxCFv weak
|
|
|
|
// GetPointE__6CAABoxCFv weak
|
|
|
|
// GetPointF__6CAABoxCFv weak
|
|
|
|
// GetPointG__6CAABoxCFv weak
|
|
|
|
// GetPointH__6CAABoxCFv weak
|
|
|
|
|
|
|
|
// GetWidth__6CAABoxCFv weak
|
|
|
|
// GetDepth__6CAABoxCFv weak
|
|
|
|
// GetHeight__6CAABoxCFv weak
|
|
|
|
// GetTri__6CAABoxCFii weak
|
|
|
|
// GetEdge__6CAABoxCFi weak
|
|
|
|
|
2022-09-21 05:18:07 +00:00
|
|
|
static const CAABox& Identity() { return mskNullBox; }
|
|
|
|
static const CAABox& MakeMaxInvertedBox() { return mskInvertedBox; }
|
2022-09-29 05:30:20 +00:00
|
|
|
// MakeNullBox__6CAABoxFv ??
|
2022-08-13 01:26:00 +00:00
|
|
|
|
|
|
|
private:
|
2022-09-29 05:30:20 +00:00
|
|
|
CVector3f min;
|
|
|
|
CVector3f max;
|
2022-09-21 05:18:07 +00:00
|
|
|
|
|
|
|
static CAABox mskInvertedBox;
|
|
|
|
static CAABox mskNullBox;
|
2022-07-26 04:36:32 +00:00
|
|
|
};
|
2022-08-13 01:26:00 +00:00
|
|
|
CHECK_SIZEOF(CAABox, 0x18)
|
2022-07-26 04:36:32 +00:00
|
|
|
|
|
|
|
#endif // __CAABOX_HPP__
|