OctTree can check if a box collides with a box in the OctTree.

This commit is contained in:
William Moberg
2015-12-08 17:12:58 +01:00
parent 32d2aa6a93
commit a7fb77d998
2 changed files with 65 additions and 43 deletions
+7 -3
View File
@@ -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