Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: the memory requirements are lowered, some strucural changes in the bv generation

File size: 2.0 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    void calculateBoxAttributes(OBB* box, sVec3D* verticesList, int length);
44    void forkBox(OBB* box);
45
46
47  protected:
48    OBB* bvElement;                                 //!< the obb element
49    OBBTreeNode* nodeLeft;                          //!< ref to the left tree node
50    OBBTreeNode* nodeRight;                         //!< ref to the right tree node
51
52
53  private:
54    unsigned int        treeIndex;                  //!< Index number of the BV in the tree
55    sVec3D*             vertices;                   //!< pointer to the vertices data
56    int                 numOfVertices;              //!< number of vertices in vertices data
57    int                 depth;                      //!< the depth of the node in the tree
58    static OBBTree*     obbTree;                    //!< reference to the obb tree
59
60    /* tmp saving place for obb variables */
61    sVec3D*             tmpVert1;
62    sVec3D*             tmpVert2;
63    int                 tmpLen1;
64    int                 tmpLen2;
65
66    static float**       coMat;
67    static float**       eigvMat;
68    static float*        eigvlMat;
69    static int*          rotCount;
70};
71
72#endif /* _OBB_TREE_NODE_H */
Note: See TracBrowser for help on using the repository browser.