Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4912 in orxonox.OLD


Ignore:
Timestamp:
Jul 21, 2005, 1:00:08 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: some problems with the hash alg

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

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

    r4911 r4912  
    7373void Quadtree::drawTree(int depth, int drawMode) const
    7474{
    75   this->rootNode->drawTree(depth, drawMode);
     75  //this->rootNode->drawTree(depth, drawMode);
     76  for(int i = 0; i < 256; ++i)
     77  {
     78    this->nodes[i]->drawTree(0, 0);
     79  }
    7680}
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc

    r4911 r4912  
    136136void QuadtreeNode::buildHashTable(QuadtreeNode** nodeList, int* index)
    137137{
    138   int loopLimit = (this->nodeIter < ((int)pow(4, maxDepth - treeDepth) / 2))?2:4;
    139 
    140   printf("buildHashTable depth: %i, nodeIter : %i, limit: %i, @nodeIndex: %i\n", this->treeDepth, nodeIter, loopLimit, indexNode);
     138  int elCount = (int)pow(4, maxDepth - treeDepth) / 2;
     139  int loopLimit = (this->nodeIter < elCount)?2:4;
     140
    141141  /* is it a leaf? */
    142142  if( this->treeDepth < this->maxDepth)
    143143  {
    144     for(int i = (this->nodeIter < ((int)pow(4, maxDepth - treeDepth) / 2))?0:2; i < loopLimit; ++i)
    145     {
     144    for(int i = (this->nodeIter < elCount)?0:2; i < loopLimit; ++i)
     145    {
     146      for( int j = 0; j < this->treeDepth; ++j)
     147        printf(" ");
     148      printf("-> %i @ depth: %i, %i/%i \n", i, this->treeDepth, nodeIter, elCount);
     149
    146150      this->nodes[i]->buildHashTable(nodeList, index);
    147151      ++this->nodeIter;
     
    150154  else
    151155  {
    152     printf("leaf, index: %i\n", *index);
     156    for( int j = 0; j < this->treeDepth; ++j)
     157      printf(" ");
     158    printf("        leaf, index: %i\n", *index);
    153159    nodeList[(*index)++] = this;
    154160  }
     
    366372void QuadtreeNode::drawTree(int depth, int drawMode) const
    367373{
    368 
    369   Vector t1 = *this->pDimension->getCenter();
    370   float ax = this->pDimension->getAxis();
    371   float h = 50.0f;
    372 
    373   glBegin(GL_QUADS);
    374   this->quadtree->getMaterial(this->indexNode)->select();
    375   glVertex3f(t1.x + ax, h - depth * 10.0f, t1.z + ax);
    376   glVertex3f(t1.x - ax, h - depth * 10.0f, t1.z + ax);
    377   glVertex3f(t1.x - ax, h - depth * 10.0f, t1.z - ax);
    378   glVertex3f(t1.x + ax, h - depth * 10.0f, t1.z - ax);
    379   glEnd();
    380 
     374  if( depth == 0)
     375  {
     376    Vector t1 = *this->pDimension->getCenter();
     377    float ax = this->pDimension->getAxis();
     378    float h = 50.0f;
     379
     380    glBegin(GL_QUADS);
     381    this->quadtree->getMaterial(this->indexNode)->select();
     382    glVertex3f(t1.x + ax, h - depth * 10.0f, t1.z + ax);
     383    glVertex3f(t1.x - ax, h - depth * 10.0f, t1.z + ax);
     384    glVertex3f(t1.x - ax, h - depth * 10.0f, t1.z - ax);
     385    glVertex3f(t1.x + ax, h - depth * 10.0f, t1.z - ax);
     386    glEnd();
     387  }
    381388  if( this->nodeA != NULL)
    382389    this->nodeA->drawTree(depth - 1, drawMode);
  • orxonox/trunk/src/world_entities/terrain.cc

    r4905 r4912  
    122122  glPopMatrix();
    123123
    124   //this->ssp->drawQuadtree();
     124  this->ssp->drawQuadtree();
    125125}
    126126
Note: See TracChangeset for help on using the changeset viewer.