/*! \file quadtree.h * Definition of a spatial data separation using quadtree */ #ifndef _QUADTREE_H #define _QUADTREE_H #include "base_object.h" #include "abstract_model.h" class QuadtreeNode; class Material; class Vector; //! A class for quadtree separation of the world class Quadtree : public BaseObject { public: Quadtree(modelInfo* pModelInfo, const int treeDepth); virtual ~Quadtree(); QuadtreeNode* getQuadtreeFromPosition(const Vector& position); void drawTree(int depth, int drawMode) const; inline Material* getMaterial(int indexNode) const { return this->materials[indexNode % 4]; } private: QuadtreeNode* rootNode; //!< reference to the root node of the quadtree modelInfo* pModelInfo; //!< reference to the modelInfo of the object int treeDepth; //!< depth of the tree Material** materials; //!< materials for debug drawing purposes QuadtreeNode** nodes; //!< reference to all quadtree nodes (only leafs of the quad tree) }; #endif /* _QUADTREE_H */