Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 20, 2005, 9:33:10 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: hash table preparation for quadtree nodes lookup

Location:
orxonox/trunk/src/lib/graphics/spatial_separation
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.cc

    r4902 r4907  
    3333   this->treeDepth = treeDepth;
    3434
     35   /* initialize the materials for debug draw */
    3536   this->materials = new Material*[4];
    3637   for(int i = 0; i < 4; ++i)
     
    4445   materials[3]->setAmbient(5.0, 3.0, 1.0);
    4546
     47   /* build the tree */
     48   this->rootNode = new QuadtreeNode(this->pModelInfo, this, this->treeDepth);
    4649
    47    this->rootNode = new QuadtreeNode(this->pModelInfo, this, this->treeDepth);
     50   /* make an array with access to the leafs of the Quad-Tree */
     51   this->nodes = new QuadtreeNode*[(int)pow(4, treeDepth)];
    4852}
    4953
     
    5660{
    5761  // delete what has to be deleted here
     62  delete [] this->nodes;
     63  delete this->rootNode;
    5864}
    5965
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h

    r4904 r4907  
    3535
    3636   Material**                      materials;             //!< materials for debug drawing purposes
     37
     38   QuadtreeNode**                  nodes;                 //!< reference to all quadtree nodes (only leafs of the quad tree)
    3739};
    3840
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc

    r4902 r4907  
    107107  this->nodeC = NULL;
    108108  this->nodeD = NULL;
     109  this->nodes = new QuadtreeNode*[4];
    109110
    110111  if( this->treeDepth < this->maxDepth)
     
    279280
    280281  this->nodeD = new QuadtreeNode(pTriD, lenD, this->pVertices, this->numVertices, this->quadtree, this, rD, this->treeDepth + 1, this->maxDepth, (this->treeDepth + 1) * 10 + 3);
     282  /* map the array references, this is for faster and automatical interfacing  \todo: use only array */
     283  this->nodes[0] = this->nodeA;
     284  this->nodes[1] = this->nodeB;
     285  this->nodes[2] = this->nodeC;
     286  this->nodes[3] = this->nodeD;
    281287}
    282288
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h

    r4904 r4907  
    4646    QuadtreeNode*                   nodeC;              //!< reference to the node C
    4747    QuadtreeNode*                   nodeD;              //!< reference to the node D
     48    QuadtreeNode**                  nodes;              //!< reference to the quadtree nodes
     49
    4850
    4951  private:
Note: See TracChangeset for help on using the changeset viewer.