Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5703 in orxonox.OLD for branches


Ignore:
Timestamp:
Nov 22, 2005, 1:42:42 PM (19 years ago)
Author:
patrick
Message:

collision_detection: cleanup and recode of some small parts.

Location:
branches/collision_detection/src/lib/collision_detection
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/collision_detection/src/lib/collision_detection/bv_tree_node.h

    r5702 r5703  
    2929  virtual void spawnBVTree(const int depth, const modelInfo& modInfo, const int* triangleIndexes, unsigned int length) = 0;
    3030
    31   virtual BoundingVolume* getBV(int index) const = 0;
     31  virtual const BoundingVolume* getBV() const = 0;
    3232  inline const int getIndex() { return this->treeIndex; }
    3333
  • branches/collision_detection/src/lib/collision_detection/obb_tree.cc

    r5702 r5703  
    7676      this->flushTree();
    7777    }
    78   OBBTreeNode* node = new OBBTreeNode();
     78  OBBTreeNode* node = new OBBTreeNode(this);
    7979  this->rootNode = node;
    80   this->rootNode->setTreeRef(this);
    8180  this->rootNode->spawnBVTree(--depth, verticesList, length);
    8281}
     
    9089    this->flushTree();
    9190  }
    92   OBBTreeNode* node = new OBBTreeNode();
     91  OBBTreeNode* node = new OBBTreeNode(this);
    9392  this->rootNode = node;
    94   this->rootNode->setTreeRef(this);
    9593 
    9694  /* triangles indexes created */
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc

    r5702 r5703  
    3333using namespace std;
    3434
    35 OBBTree*  OBBTreeNode::obbTree = NULL;
    36 
    3735float**  OBBTreeNode::coMat = NULL;
    3836float**  OBBTreeNode::eigvMat = NULL;
     
    4442 *  standard constructor
    4543 */
    46 OBBTreeNode::OBBTreeNode ()
     44OBBTreeNode::OBBTreeNode (const OBBTree* tree)
     45  : BVTreeNode()
    4746{
    4847  this->setClassID(CL_OBB_TREE_NODE, "OBBTreeNode");
     48  this->obbTree = tree;
    4949  this->nodeLeft = NULL;
    5050  this->nodeRight = NULL;
     
    117117
    118118  PRINT(3)("\n");
    119   this->treeIndex = this->obbTree->getID();
    120119  PRINTF(3)("OBB Depth: %i, tree index: %i, numVertices: %i\n", depth, treeIndex, length);
    121120  this->depth = depth;
     
    181180{
    182181  PRINT(3)("\n");
    183   this->treeIndex = this->obbTree->getID();
    184182  PRINTF(3)("OBB Depth: %i, tree index: %i, numVertices: %i\n", depth, treeIndex, length);
    185183  this->depth = depth;
     
    208206    if(this->tmpLen1 > 2)
    209207    {
    210       OBBTreeNode* node1 = new OBBTreeNode();
     208      OBBTreeNode* node1 = new OBBTreeNode(this->obbTree);
    211209      this->nodeLeft = node1;
    212210      this->nodeLeft->spawnBVTree(depth - 1, this->tmpVert1, this->tmpLen1);
     
    219217    if( this->tmpLen2 > 2)
    220218    {
    221       OBBTreeNode* node2 = new OBBTreeNode();
     219      OBBTreeNode* node2 = new OBBTreeNode(this->obbTree);
    222220      this->nodeRight = node2;
    223221      this->nodeRight->spawnBVTree(depth - 1, this->tmpVert2, this->tmpLen2);
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.h

    r5702 r5703  
    2525
    2626  public:
    27     OBBTreeNode();
     27    OBBTreeNode(const OBBTree* tree);
    2828    virtual ~OBBTreeNode();
    2929
     30    /*  this function returns the bounding volume of this tree node @return: returns the BV */
     31    virtual inline const BoundingVolume* getBV() const { return (BoundingVolume*)this->bvElement; }
     32   
    3033    virtual void spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length);
    3134    virtual void spawnBVTree(const int depth, const modelInfo& modelInf,
    3235                             const int* triangleIndexes, unsigned int length);
    33 
    34     BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; }
    35     inline const int getIndex() { return this->treeIndex; }
    36     inline void setTreeRef(OBBTree* tree) { this->obbTree = tree;}
    3736
    3837    virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB);
     
    6665    int                 numOfVertices;              //!< number of vertices in vertices data
    6766    int                 depth;                      //!< the depth of the node in the tree
    68     static OBBTree*     obbTree;                    //!< reference to the obb tree
     67    const OBBTree*      obbTree;                    //!< reference to the obb tree
    6968    Plane               separationPlane;            //!< the separation plane of the obb
    7069    const sVec3D*       sepPlaneCenter;             //!< only needed to draw plane
Note: See TracChangeset for help on using the changeset viewer.