More COBBTree

This commit is contained in:
Phillip Stephens
2026-06-23 15:09:55 -07:00
parent 4f285bb8e0
commit e5fb4a0ab7
5 changed files with 93 additions and 15 deletions
+26 -4
View File
@@ -3,17 +3,39 @@
#include <Collision/CCollisionPrimitive.hpp>
class COBBTree;
class CCollidableOBBTree : public CCollisionPrimitive {
#include "WorldFormat/COBBTree.hpp"
class COBBTree;
class COBBox;
class CCollidableOBBTree : public CCollisionPrimitive {
public:
CCollidableOBBTree(const COBBTree& tree, const CMaterialList& list);
CCollidableOBBTree(COBBTree* tree, const CMaterialList& list);
uint GetTableIndex() const override;
CAABox CalculateAABox(const CTransform4f& xf) const override;
const CAABox CalculateLocalAABox() const override;
CAABox CalculateLocalAABox() const override;
FourCC GetPrimType() const override;
CRayCastResult CastRayInternal(const CInternalRayCastStructure& intRayCast) const override;
bool AABoxCollision(const COBBTree::CNode& node, const CTransform4f& xf, const CAABox& abb,
const COBBox& obb, const CMaterialList& matList,
const CMaterialFilter& matFilter, const CPlane plane[6],
CCollisionInfoList& outList) const;
bool AABoxCollideWithLeaf(const COBBTree::CLeafData&, const CTransform4f&, const CAABox&,
const CMaterialList&, const CMaterialFilter&, const CPlane*,
CCollisionInfoList&) const;
void ResetTestStats() const {}
void ResetTestStatsRecurse(const COBBTree::CNode& node) const {}
private:
COBBTree* x10_tree;
mutable uint x14_tries;
mutable uint x18_misses;
mutable uint x1c_hits;
static uint sTableIndex;
};
#endif // _CCOLLIDABLEOBBTREE
+8 -7
View File
@@ -38,7 +38,7 @@ public:
private:
rstl::vector< ushort > x0_surface;
};
class CNode {
public:
CNode(const CTransform4f& xf, const CVector3f& point, const CNode* left, const CNode* right,
@@ -53,7 +53,8 @@ public:
const CNode* GetLeftNode() const { return x40_left; }
const CNode* GetRightNode() const { return x44_right; }
bool WasHit() const { return x4c_hit; }
void SetHit(bool hit) { x4c_hit = hit; }
void SetHit(const bool hit) const { x4c_hit = hit; }
const CLeafData* GetLeafData() const { return x48_leaf; }
static void* operator new(size_t size, const char* file, int line);
static void operator delete(void* ptr, size_t size);
@@ -64,11 +65,11 @@ public:
const CNode* x40_left;
const CNode* x44_right;
const CLeafData* x48_leaf;
bool x4c_hit;
mutable bool x4c_hit;
static CSimpleAllocator* spAllocator;
};
struct SIndexData {
rstl::vector< uint > x0_materials;
rstl::vector< uchar > x10_vertMaterials;
@@ -85,9 +86,9 @@ public:
COBBTree(const SIndexData& indexData, const CNode* root);
~COBBTree();
static rstl::auto_ptr< COBBTree > BuildOrientedBoundingBoxTree(const CVector3f& extent, const CVector3f& center);
static rstl::auto_ptr< COBBTree > BuildOrientedBoundingBoxTree(const CVector3f& extent,
const CVector3f& center);
CAABox CalculateLocalAABox() const;
void GetTriangleVertexIndices(const ushort index, ushort out[2]) const;