Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 13, 2005, 12:57:53 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: now the obb tree is build as it should

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4613 r4614  
    6464/**
    6565   \brief creates a new BVTree or BVTree partition
    66    \param depth: the depth of the tree
     66   \param depth: how much more depth-steps to go: if == 1 don't go any deeper!
    6767   \param verticesList: the list of vertices of the object - each vertices triple is interpreted as a triangle
    6868*/
    6969void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length)
    7070{
    71   this->bvElement = this->createBox();
    72   this->calculateBoxAttributes(this->bvElement, verticesList, length);
    73   this->forkBox(this->bvElement);
     71  this->depth = depth;
     72
     73  if( likely( this->depth > 0))
     74  {
     75    this->bvElement = this->createBox();
     76    this->calculateBoxAttributes(this->bvElement, verticesList, length);
     77    this->forkBox(this->bvElement);
     78  }
    7479}
    7580
     
    366371  }
    367372
     373  /* now spawn the obb tree: create the nodes and descent */
     374  OBBTreeNode*       node1 = new OBBTreeNode();
     375  OBBTreeNode*       node2 = new OBBTreeNode();
     376
     377  this->nodeLeft = node1;
     378  this->nodeRight = node2;
     379
     380  this->nodeLeft->spawnBVTree(this->depth - 1, vertList1, partition1.getSize());
     381  this->nodeRight->spawnBVTree(this->depth - 1, vertList2, partition2.getSize());
    368382}
    369383
Note: See TracChangeset for help on using the changeset viewer.