Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/collision_detection/obb_tree_node.h @ 4622

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

orxonox/trunk: drawing in diffrent hirarchies works now, with diffrent colors

File size: 1.8 KB
Line 
1/*!
2    \file bv_tree.h
3    \brief Definition of a bounding volume tree
4
5 */
6
7#ifndef _OBB_TREE_NODE_H
8#define _OBB_TREE_NODE_H
9
10#include "bv_tree_node.h"
11
12
13
14// FORWARD DEFINITION
15class BoundingVolume;
16class OBB;
17class OBBTree;
18//struct sVec3D;
19
20//! A class that represents a bounding volume tree
21class OBBTreeNode : public BVTreeNode {
22
23
24  public:
25    OBBTreeNode();
26    virtual ~OBBTreeNode();
27
28    virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length);
29
30    BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; }
31    inline const int getIndex() { return this->treeIndex; }
32    inline void setTreeRef(OBBTree* tree) { this->obbTree = tree;}
33
34    virtual void collideWith(const BVTree &tree);
35
36    virtual void drawBV(int depth) const;
37    virtual void drawBVPolygon(int depth) const;
38    virtual void drawBVBlended(int depth) const;
39
40    void debug();
41
42  private:
43    OBB* createBox();
44    void calculateBoxAttributes(OBB* box, sVec3D* verticesList, int length);
45    void forkBox(OBB* box);
46
47
48  protected:
49    OBB* bvElement;                                 //!< the obb element
50    OBBTreeNode* nodeLeft;                          //!< ref to the left tree node
51    OBBTreeNode* nodeRight;                         //!< ref to the right tree node
52
53
54  private:
55    unsigned int        treeIndex;                  //!< Index number of the BV in the tree
56    sVec3D*             vertices;                   //!< pointer to the vertices data
57    int                 numOfVertices;              //!< number of vertices in vertices data
58    int                 depth;                      //!< the depth of the node in the tree
59    static OBBTree*     obbTree;                    //!< reference to the obb tree
60};
61
62#endif /* _OBB_TREE_NODE_H */
Note: See TracBrowser for help on using the repository browser.