/*! \file bv_tree.h \brief Definition of a bounding volume tree */ #ifndef _OBB_TREE_NODE_H #define _OBB_TREE_NODE_H #include "bv_tree_node.h" // FORWARD DEFINITION class BoundingVolume; class OBB; class OBBTree; //struct sVec3D; //! A class that represents a bounding volume tree class OBBTreeNode : public BVTreeNode { public: OBBTreeNode(); virtual ~OBBTreeNode(); virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length); BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; } inline const int getIndex() { return this->treeIndex; } inline void setTreeRef(OBBTree* tree) { this->obbTree = tree;} virtual void collideWith(const BVTree &tree); virtual void drawBV(int depth) const; virtual void drawBVPolygon(int depth) const; virtual void drawBVBlended(int depth) const; void debug(); private: OBB* createBox(); void calculateBoxAttributes(OBB* box, sVec3D* verticesList, int length); void forkBox(OBB* box); protected: OBB* bvElement; //!< the obb element OBBTreeNode* nodeLeft; //!< ref to the left tree node OBBTreeNode* nodeRight; //!< ref to the right tree node private: unsigned int treeIndex; //!< Index number of the BV in the tree sVec3D* vertices; //!< pointer to the vertices data int numOfVertices; //!< number of vertices in vertices data int depth; //!< the depth of the node in the tree static OBBTree* obbTree; //!< reference to the obb tree }; #endif /* _OBB_TREE_NODE_H */