diff --git a/Runtime/Collision/CCollisionSurface.hpp b/Runtime/Collision/CCollisionSurface.hpp index 0f9358565..ea7a6ce50 100644 --- a/Runtime/Collision/CCollisionSurface.hpp +++ b/Runtime/Collision/CCollisionSurface.hpp @@ -9,7 +9,11 @@ namespace urde { class CCollisionSurface { - std::array x0_data; +public: + using Vertices = std::array; + +private: + Vertices x0_data; u32 x24_flags; public: @@ -17,7 +21,7 @@ public: zeus::CVector3f GetNormal() const; const zeus::CVector3f& GetVert(s32 idx) const { return x0_data[idx]; } - const zeus::CVector3f* GetVerts() const { return x0_data.data(); } + const Vertices& GetVerts() const { return x0_data; } zeus::CPlane GetPlane() const; u32 GetSurfaceFlags() const { return x24_flags; } }; diff --git a/Runtime/Collision/CMetroidAreaCollider.cpp b/Runtime/Collision/CMetroidAreaCollider.cpp index 51002711a..3a914762e 100644 --- a/Runtime/Collision/CMetroidAreaCollider.cpp +++ b/Runtime/Collision/CMetroidAreaCollider.cpp @@ -199,8 +199,8 @@ static zeus::CVector3f ClipRayToPlane(const zeus::CVector3f& a, const zeus::CVec return (1.f - -plane.pointToPlaneDist(a) / (b - a).dot(plane.normal())) * (a - b) + b; } -bool CMetroidAreaCollider::ConvexPolyCollision(const std::array& planes, const zeus::CVector3f* verts, - zeus::CAABox& aabb) { +bool CMetroidAreaCollider::ConvexPolyCollision(const std::array& planes, + const std::array& verts, zeus::CAABox& aabb) { std::array, 2> vecs; g_CalledClip += 1; diff --git a/Runtime/Collision/CMetroidAreaCollider.hpp b/Runtime/Collision/CMetroidAreaCollider.hpp index 15502347e..7f34f557c 100644 --- a/Runtime/Collision/CMetroidAreaCollider.hpp +++ b/Runtime/Collision/CMetroidAreaCollider.hpp @@ -133,8 +133,8 @@ public: }; static void BuildOctreeLeafCache(const CAreaOctTree::Node& root, const zeus::CAABox& aabb, CMetroidAreaCollider::COctreeLeafCache& cache); - static bool ConvexPolyCollision(const std::array& planes, const zeus::CVector3f* verts, - zeus::CAABox& aabb); + static bool ConvexPolyCollision(const std::array& planes, + const std::array& verts, zeus::CAABox& aabb); static bool AABoxCollisionCheckBoolean_Cached(const COctreeLeafCache& leafCache, const zeus::CAABox& aabb, const CMaterialFilter& filter); diff --git a/Runtime/Collision/CollisionUtil.cpp b/Runtime/Collision/CollisionUtil.cpp index 5abb4fd5a..9ff424cb7 100644 --- a/Runtime/Collision/CollisionUtil.cpp +++ b/Runtime/Collision/CollisionUtil.cpp @@ -263,7 +263,7 @@ bool RaySphereIntersection(const zeus::CSphere& sphere, const zeus::CVector3f& p } bool RayTriangleIntersection_Double(const zeus::CVector3f& point, const zeus::CVector3f& dir, - const zeus::CVector3f* verts, double& d) { + const std::array& verts, double& d) { const zeus::CVector3d v0tov1 = verts[1] - verts[0]; const zeus::CVector3d v0tov2 = verts[2] - verts[0]; const zeus::CVector3d cross0 = zeus::CVector3d(dir).cross(v0tov2); @@ -293,8 +293,8 @@ bool RayTriangleIntersection_Double(const zeus::CVector3f& point, const zeus::CV return true; } -bool RayTriangleIntersection(const zeus::CVector3f& point, const zeus::CVector3f& dir, const zeus::CVector3f* verts, - float& d) { +bool RayTriangleIntersection(const zeus::CVector3f& point, const zeus::CVector3f& dir, + const std::array& verts, float& d) { const zeus::CVector3f v0tov1 = verts[1] - verts[0]; const zeus::CVector3f v0tov2 = verts[2] - verts[0]; const zeus::CVector3f cross0 = dir.cross(v0tov2); diff --git a/Runtime/Collision/CollisionUtil.hpp b/Runtime/Collision/CollisionUtil.hpp index 8e6da6c8b..a0c4f179a 100644 --- a/Runtime/Collision/CollisionUtil.hpp +++ b/Runtime/Collision/CollisionUtil.hpp @@ -20,9 +20,9 @@ bool RaySphereIntersection_Double(const zeus::CSphere&, const zeus::CVector3f&, bool RaySphereIntersection(const zeus::CSphere& sphere, const zeus::CVector3f& pos, const zeus::CVector3f& dir, float mag, float& T, zeus::CVector3f& point); bool RayTriangleIntersection_Double(const zeus::CVector3f& point, const zeus::CVector3f& dir, - const zeus::CVector3f* verts, double& d); -bool RayTriangleIntersection(const zeus::CVector3f& point, const zeus::CVector3f& dir, const zeus::CVector3f* verts, - float& d); + const std::array& verts, double& d); +bool RayTriangleIntersection(const zeus::CVector3f& point, const zeus::CVector3f& dir, + const std::array& verts, float& d); void FilterOutBackfaces(const zeus::CVector3f& vec, const CCollisionInfoList& in, CCollisionInfoList& out); void FilterByClosestNormal(const zeus::CVector3f& norm, const CCollisionInfoList& in, CCollisionInfoList& out); bool AABoxAABoxIntersection(const zeus::CAABox& aabb0, const CMaterialList& list0, const zeus::CAABox& aabb1,