1010#include " Collision/CMaterialList.hpp"
1111
1212#include " Kyoto/Math/CAABox.hpp"
13+ #include " Kyoto/Math/CLineSeg.hpp"
1314#include " Kyoto/Math/CPlane.hpp"
1415#include " Kyoto/Math/CSphere.hpp"
16+ #include " Kyoto/Math/CVector3d.hpp"
1517#include " Kyoto/Math/CVector3f.hpp"
1618
1719#include " rstl/reserved_vector.hpp"
@@ -21,14 +23,7 @@ class CAABoxAreaCache {
2123 friend class CMetroidAreaCollider ;
2224
2325 CAABoxAreaCache (const CAABox& aabb, const CPlane* pl, const CMaterialFilter& filter,
24- const CMaterialList& material, CCollisionInfoList& collisionList)
25- : x0_aabb(aabb)
26- , x4_planes(pl)
27- , x8_filter(filter)
28- , xc_material(material)
29- , x10_collisionList(collisionList)
30- , x14_center(aabb.GetCenterPoint())
31- , x20_halfExtent(aabb.GetHalfExtent()) {}
26+ const CMaterialList& material, CCollisionInfoList& collisionList);
3227
3328private:
3429 const CAABox& x0_aabb;
@@ -40,8 +35,76 @@ class CAABoxAreaCache {
4035 CVector3f x20_halfExtent;
4136};
4237
38+ class CBooleanAABoxAreaCache {
39+ public:
40+ friend class CMetroidAreaCollider ;
41+
42+ CBooleanAABoxAreaCache (const CAABox& aabb, const CMaterialFilter& filter);
43+
44+ private:
45+ const CAABox& x0_aabb;
46+ const CMaterialFilter& x4_filter;
47+ CVector3f x8_center;
48+ CVector3f x14_halfExtent;
49+ };
50+
51+ class CSphereAreaCache {
52+ public:
53+ friend class CMetroidAreaCollider ;
54+
55+ CSphereAreaCache (const CAABox& aabb, const CSphere& sphere, const CMaterialFilter& filter,
56+ const CMaterialList& material, CCollisionInfoList& collisionList)
57+ : x0_aabb(aabb)
58+ , x4_sphere(sphere)
59+ , x8_filter(filter)
60+ , xc_material(material)
61+ , x10_collisionList(collisionList) {}
62+
63+ private:
64+ const CAABox& x0_aabb;
65+ const CSphere& x4_sphere;
66+ const CMaterialFilter& x8_filter;
67+ const CMaterialList& xc_material;
68+ CCollisionInfoList& x10_collisionList;
69+ };
70+
71+ class CBooleanSphereAreaCache {
72+ public:
73+ friend class CMetroidAreaCollider ;
74+
75+ CBooleanSphereAreaCache (const CAABox& aabb, const CSphere& sphere, const CMaterialFilter& filter)
76+ : x0_aabb(aabb), x4_sphere(sphere), x8_filter(filter) {}
77+
78+ private:
79+ const CAABox& x0_aabb;
80+ const CSphere& x4_sphere;
81+ const CMaterialFilter& x8_filter;
82+ };
83+
4384class CMetroidAreaCollider {
4485public:
86+ struct SBoxEdge {
87+ CLineSeg x0_seg;
88+ CVector3d x28_start;
89+ CVector3d x40_end;
90+ CVector3d x58_delta;
91+ CVector3d x70_coDir;
92+ double x88_dirCoDirDot;
93+ SBoxEdge (const CAABox& aabb, int idx, const CVector3f& dir);
94+ };
95+
96+ class CMovingAABoxComponents {
97+ public:
98+ CMovingAABoxComponents (const CAABox& aabb, const CVector3f& dir);
99+
100+ private:
101+ friend class CMetroidAreaCollider ;
102+ friend class CCollidableOBBTree ;
103+ rstl::reserved_vector< SBoxEdge, 12 > x0_edges;
104+ rstl::reserved_vector< uint, 8 > x6c4_vertIdxs;
105+ CAABox x6e8_aabb;
106+ };
107+
45108 class COctreeLeafCache {
46109 public:
47110 COctreeLeafCache (const CAreaOctTree& octTree);
@@ -58,6 +121,7 @@ class CMetroidAreaCollider {
58121 }
59122
60123 private:
124+ friend class CMetroidAreaCollider ;
61125 const CAreaOctTree& x0_octTree;
62126 rstl::reserved_vector< CAreaOctTree::Node, 64 > x4_nodeCache;
63127 bool x908_24_overflow : 1 ;
@@ -106,13 +170,29 @@ class CMetroidAreaCollider {
106170 float d, CCollisionInfo& infoOut,
107171 double & dOut);
108172
173+ static ushort GetPrimitiveCheckCount () { return sDupPrimitiveCheckCount ; }
174+ static ushort* GetTriangleList () { return sDupTriangleList ; }
175+
109176private:
110177 static ushort sDupPrimitiveCheckCount ;
111178 static ushort sDupVertexList [0x2800 ];
112179 static ushort sDupEdgeList [0x6000 ];
113180 static ushort sDupTriangleList [0x4000 ];
114181 static void ResetInternalCounters ();
115182 static bool AABoxCollisionCheck_Internal (const CAreaOctTree::Node&, CAABoxAreaCache&);
183+ static bool AABoxCollisionCheckBoolean_Internal (const CAreaOctTree::Node&,
184+ const CBooleanAABoxAreaCache&);
185+ static bool SphereCollisionCheck_Internal (const CAreaOctTree::Node&, CSphereAreaCache&);
186+ static bool SphereCollisionCheckBoolean_Internal (const CAreaOctTree::Node&,
187+ const CBooleanSphereAreaCache&);
188+ static bool MovingAABoxCollisionCheck_BoxVertexTri (const CCollisionSurface&, const CAABox&,
189+ const rstl::reserved_vector< uint, 8 >&,
190+ CVector3f, double &, CVector3f&, CVector3f&);
191+ static bool MovingAABoxCollisionCheck_TriVertexBox (const CVector3f&, const CAABox&,
192+ CVector3f, double &, CVector3f&, CVector3f&);
193+ static bool MovingAABoxCollisionCheck_Edge (const CVector3f&, const CVector3f&,
194+ const rstl::reserved_vector< SBoxEdge, 12 >&,
195+ CVector3f, double &, CVector3f&, CVector3f&);
116196};
117197
118198class CAreaCollisionCache {
0 commit comments