Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h @ 4921

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

orxonox/trunk: the way, where the fighter flights though is now drawn in quadtree partitions. now you can see where the space craft has been :)

File size: 3.2 KB
Line 
1/*!
2    \file proto_class.h
3 *  Definition of ...
4
5 */
6
7#ifndef _QUADTREE_NODE_H
8#define _QUADTREE_NODE_H
9
10#include "base_object.h"
11#include "vector.h"
12#include "abstract_model.h"
13
14// FORWARD DEFINITION
15class Quadtree;
16
17
18//! A class for a Quadtree Node representation
19class QuadtreeNode : public BaseObject {
20
21  public:
22    QuadtreeNode(sTriangleExt** triangles, int numTriangles,
23                 const float* pVertices, int numVertices,
24                 Quadtree* quadtree, QuadtreeNode* parent,
25                 Rectangle* rect, int treeDepth, const int maxDepth, int index);
26    QuadtreeNode(modelInfo* pModelInfo, Quadtree* quadtree, const int maxDepth);
27    virtual ~QuadtreeNode();
28
29    void buildHashTable(QuadtreeNode** nodeList, int* index);
30
31    float getHeight(const Vector& position);
32    Rectangle* getDimension() { return this->pDimension; }
33
34    bool includesPoint(const Vector& v);
35
36    void drawTree(int depth, int drawMode) const;
37    void draw() const;
38
39
40  private:
41    void init();
42
43    void separateNode(float minLength);
44    void separateNode();
45
46    Rectangle* getDimFromModel();
47
48  protected:
49    QuadtreeNode*                   parent;             //!< reference to the paren QuadtreeNode (NULL if rootnode)
50    QuadtreeNode*                   nodeA;              //!< reference to the node A
51    QuadtreeNode*                   nodeB;              //!< reference to the node B
52    QuadtreeNode*                   nodeC;              //!< reference to the node C
53    QuadtreeNode*                   nodeD;              //!< reference to the node D
54    QuadtreeNode**                  nodes;              //!< reference to the quadtree nodes
55    int                             nodeIter;           //!< temp helping variable for the hashing algorithm
56
57  private:
58    Quadtree*                       quadtree;           //!< reference to the quadtree
59    Vector                          center;             //!< center coordinate of the quadtree node - relative coordinates in model space(!)
60    float                           axisLength;         //!< axis length of the quadtree
61    float                           maxHeigth;          //!< max height of the model in the quadtree
62    float                           offset;             //!< offset of the actual quadtree rectangle
63
64    int                             treeDepth;          //!< the depth of the tree
65    int                             maxDepth;           //!< the maximal depth of the tree
66    int                             indexNode;          //!< the index number of the node
67
68    sTriangleExt**                  pTriangles;         //!< reference to the triangles of the node
69    const float*                    pVertices;          //!< reference to vertices data
70    unsigned int                    numTriangles;       //!< number of triangles of the Node
71    unsigned int                    numVertices;        //!< number of vertices of the node
72    modelInfo*                      pModelInfo;         //!< reference to the modelInfo of the object
73    Rectangle*                      pDimension;         //!< pointer to the local rectangle properties
74
75    bool                            bDraw;              //!< shall it be drawn? DEBUG only
76};
77
78#endif /* _QUADTREE_NODE_H */
Note: See TracBrowser for help on using the repository browser.