mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 11:07:44 +00:00
Work on collision related implementations
This commit is contained in:
@@ -1,13 +1,78 @@
|
||||
#ifndef __URDE_CMETROIDAREACOLLIDER_HPP__
|
||||
#define __URDE_CMETROIDAREACOLLIDER_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "zeus/CAABox.hpp"
|
||||
#include "CAreaOctTree.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CCollisionInfoList;
|
||||
class CMaterialList;
|
||||
|
||||
class CMetroidAreaCollider
|
||||
{
|
||||
public:
|
||||
CMetroidAreaCollider();
|
||||
class COctreeLeafCache
|
||||
{
|
||||
const CAreaOctTree& x0_octTree;
|
||||
rstl::reserved_vector<CAreaOctTree::Node, 64> x4_nodeCache;
|
||||
bool x908_24_overflow : 1;
|
||||
public:
|
||||
COctreeLeafCache(const CAreaOctTree& octTree);
|
||||
void AddLeaf(const CAreaOctTree::Node& node);
|
||||
u32 GetNumLeaves() const { return x4_nodeCache.size(); }
|
||||
bool HasCacheOverflowed() const { return x908_24_overflow; }
|
||||
};
|
||||
static void BuildOctreeLeafCache(const CAreaOctTree::Node& root, const zeus::CAABox& aabb,
|
||||
CMetroidAreaCollider::COctreeLeafCache& cache);
|
||||
static bool AABoxCollisionCheckBoolean_Cached(const COctreeLeafCache& leafCache, const zeus::CAABox& aabb,
|
||||
const CMaterialFilter& filter);
|
||||
static bool AABoxCollisionCheckBoolean(const CAreaOctTree& octTree, const zeus::CAABox& aabb,
|
||||
const CMaterialFilter& filter);
|
||||
static bool SphereCollisionCheckBoolean_Cached(const COctreeLeafCache& leafCache, const zeus::CAABox& aabb,
|
||||
const zeus::CSphere& sphere, const CMaterialFilter& filter);
|
||||
static bool SphereCollisionCheckBoolean(const CAreaOctTree& octTree, const zeus::CAABox& aabb,
|
||||
const zeus::CSphere& sphere, const CMaterialFilter& filter);
|
||||
|
||||
static bool AABoxCollisionCheck_Cached(const COctreeLeafCache& leafCache, const zeus::CAABox& aabb,
|
||||
const CMaterialFilter& filter, const CMaterialList& matList,
|
||||
CCollisionInfoList& list);
|
||||
static bool AABoxCollisionCheck(const CAreaOctTree& octTree, const zeus::CAABox& aabb,
|
||||
const CMaterialFilter& filter, const CMaterialList& matList,
|
||||
CCollisionInfoList& list);
|
||||
static bool SphereCollisionCheck_Cached(const COctreeLeafCache& leafCache, const zeus::CAABox& aabb,
|
||||
const zeus::CSphere& sphere, const CMaterialList& matList,
|
||||
const CMaterialFilter& filter, CCollisionInfoList& list);
|
||||
static bool SphereCollisionCheck(const CAreaOctTree& octTree, const zeus::CAABox& aabb,
|
||||
const zeus::CSphere& sphere, const CMaterialList& matList,
|
||||
const CMaterialFilter& filter, CCollisionInfoList& list);
|
||||
};
|
||||
|
||||
class CAreaCollisionCache
|
||||
{
|
||||
zeus::CAABox x0_aabb;
|
||||
rstl::reserved_vector<CMetroidAreaCollider::COctreeLeafCache, 3> x18_leafCaches;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x1b40_24_leafOverflow : 1;
|
||||
bool x1b40_25_cacheOverflow : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
public:
|
||||
CAreaCollisionCache(const zeus::CAABox& aabb) : x0_aabb(aabb) {}
|
||||
void ClearCache();
|
||||
const zeus::CAABox& GetCacheBounds() const { return x0_aabb; }
|
||||
void SetCacheBounds(const zeus::CAABox& aabb) { x0_aabb = aabb; }
|
||||
void AddOctreeLeafCache(const CMetroidAreaCollider::COctreeLeafCache& leafCache);
|
||||
u32 GetNumCaches() const { return x18_leafCaches.size(); }
|
||||
const CMetroidAreaCollider::COctreeLeafCache& GetOctreeLeafCache(int idx) { return x18_leafCaches[idx]; }
|
||||
bool HasCacheOverflowed() const { return x1b40_24_leafOverflow; }
|
||||
rstl::reserved_vector<CMetroidAreaCollider::COctreeLeafCache, 3>::iterator begin() { return x18_leafCaches.begin(); }
|
||||
rstl::reserved_vector<CMetroidAreaCollider::COctreeLeafCache, 3>::iterator end() { return x18_leafCaches.end(); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user