OctTree can check if a box collides with a box in the OctTree.
This commit is contained in:
@@ -20,17 +20,21 @@ public:
|
||||
void ClearBoxes();
|
||||
//Returns true if the ray collides with something in the tree. Result is written to [data].
|
||||
bool RayCollides(const Ray& ray, Output& data) const;
|
||||
//Returns true if the box collides with something in the tree.
|
||||
//On collision with a box, that box is written to [outBoxIntersected].
|
||||
bool BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected) const;
|
||||
|
||||
private:
|
||||
OctTree* m_Children[8];
|
||||
std::vector<AABB> m_ContainingBoxes;
|
||||
//TODO: Do derived class from AABB with a bool Tested, falsify at
|
||||
//start of Collision test, set on check, don't check if set already. Solves duplicate boxes in tree.
|
||||
//TODO: Boxes collide with themselves? Fix somehow, maybe float epsilon stuff.
|
||||
std::vector<AABB> m_ContainingBoxes;
|
||||
AABB m_Box;
|
||||
|
||||
bool rayCollides(const Ray& ray, Output& data) const;
|
||||
|
||||
inline bool hasChildren() const;
|
||||
int childIndexContainingPoint(const glm::vec3& point) const;
|
||||
std::vector<int> childIndicesContainingBox(const AABB& box) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user