Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h @ 4922

Last change on this file since 4922 was 4922, checked in by patrick, 19 years ago

orxonox/trunk: started cleaning up the code a little and making the comments

File size: 1.5 KB
Line 
1/*!
2    \file quadtree.h
3  *  Definition of a spatial data separation using quadtree
4
5*/
6
7#ifndef _QUADTREE_H
8#define _QUADTREE_H
9
10
11#include "base_object.h"
12#include "abstract_model.h"
13
14
15class QuadtreeNode;
16class Material;
17class Vector;
18
19//! A class for quadtree separation of the world
20class Quadtree : public BaseObject {
21
22 public:
23  Quadtree(modelInfo* pModelInfo, const int treeDepth);
24  virtual ~Quadtree();
25
26  QuadtreeNode* getQuadtreeFromPosition(const Vector& position);
27
28  void drawTree() const;
29  inline Material* getMaterial(int indexNode) const { return this->materials[indexNode % 4]; }
30
31  private:
32    void revertHashTable(QuadtreeNode** nodes);
33    void sortHashTable(QuadtreeNode** nodes);
34
35 private:
36   QuadtreeNode*                   rootNode;              //!< reference to the root node of the quadtree
37   modelInfo*                      pModelInfo;            //!< reference to the modelInfo of the object
38   int                             treeDepth;             //!< depth of the tree
39
40   float                           quadLength;            //!< length of the leaf quadtree nodes
41   Vector*                         offset;                //!< vector to the left lower corner of the root quadtree node
42   int                             maxIndex;              //!< maximal index for the nodes array
43
44   Material**                      materials;             //!< materials for debug drawing purposes
45
46   QuadtreeNode**                  nodes;                 //!< reference to all quadtree nodes (only leafs of the quad tree)
47};
48
49#endif /* _QUADTREE_H */
Note: See TracBrowser for help on using the repository browser.