Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 21, 2005, 3:59:28 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: started cleaning up the code a little and making the comments

File:
1 edited

Legend:

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

    r4921 r4922  
    135135
    136136
     137/**
     138
     139 */
    137140void QuadtreeNode::buildHashTable(QuadtreeNode** nodeList, int* index)
    138141{
     
    362365  Vector center = *this->pDimension->getCenter();
    363366  float ax = this->pDimension->getAxis();
     367
    364368  if( v.x > center.x - ax && v.x < center.x + ax &&
    365369      v.z > center.z - ax && v.z < center.z + ax )
    366     printf("THIS POINT IS INSIDE :) \n");
    367   else
    368     printf("POINT IS NOT INSIEDE\n");
    369   this->bDraw = true;
    370 }
     370  {
     371    this->bDraw = true;
     372    return true;
     373  }
     374  return false;
     375}
     376
    371377
    372378/**
    373379 *  draws the debug quadtree boxes around the model
    374380 */
    375 void QuadtreeNode::drawTree(int depth, int drawMode) const
     381void QuadtreeNode::drawTree() const
    376382{
    377383  if( this->treeDepth == this->maxDepth)
     
    381387    float h = 50.0f;
    382388
    383     //printf("draw @ %f, %f to %f, %f", t1.x + ax, t1.z + ax, t1.x - ax, t1.z - ax);
    384 
    385389    this->quadtree->getMaterial(this->indexNode)->select();
    386390    glBegin(GL_QUADS);
    387     glVertex3f(t1.x + ax, h - depth * 10.0f, t1.z + ax);
    388     glVertex3f(t1.x - ax, h - depth * 10.0f, t1.z + ax);
    389     glVertex3f(t1.x - ax, h - depth * 10.0f, t1.z - ax);
    390     glVertex3f(t1.x + ax, h - depth * 10.0f, t1.z - ax);
     391    glVertex3f(t1.x + ax, h - this->treeDepth * 10.0f, t1.z + ax);
     392    glVertex3f(t1.x - ax, h - this->treeDepth * 10.0f, t1.z + ax);
     393    glVertex3f(t1.x - ax, h - this->treeDepth * 10.0f, t1.z - ax);
     394    glVertex3f(t1.x + ax, h - this->treeDepth * 10.0f, t1.z - ax);
    391395    glEnd();
    392396  }
     
    394398
    395399  if( this->nodeA != NULL)
    396     this->nodeA->drawTree(depth - 1, drawMode);
     400    this->nodeA->drawTree();
    397401  if( this->nodeB != NULL)
    398     this->nodeB->drawTree(depth - 1, drawMode);
     402    this->nodeB->drawTree();
    399403  if( this->nodeC != NULL)
    400     this->nodeC->drawTree(depth - 1, drawMode);
     404    this->nodeC->drawTree();
    401405  if( this->nodeD != NULL)
    402     this->nodeD->drawTree(depth - 1, drawMode);
    403 }
     406    this->nodeD->drawTree();
     407}
     408
    404409
    405410void QuadtreeNode::draw() const
     
    411416  float h = 70.0f;
    412417
    413     //printf("draw @ %f, %f to %f, %f", t1.x + ax, t1.z + ax, t1.x - ax, t1.z - ax);
    414 
    415418  glBegin(GL_QUADS);
    416419  this->quadtree->getMaterial(this->indexNode)->select();
    417 //   for( int i = 0; i < 50; ++i)
    418 //   {
    419   int i = 0;
    420     glVertex3f(t1.x + ax, h + 10.0f * i, t1.z + ax);
    421     glVertex3f(t1.x - ax, h + 10.0f * i, t1.z + ax);
    422     glVertex3f(t1.x - ax, h + 10.0f * i, t1.z - ax);
    423     glVertex3f(t1.x + ax, h + 10.0f * i, t1.z - ax);
    424 //   }
     420
     421  glVertex3f(t1.x + ax, h, t1.z + ax);
     422  glVertex3f(t1.x - ax, h, t1.z + ax);
     423  glVertex3f(t1.x - ax, h, t1.z - ax);
     424  glVertex3f(t1.x + ax, h, t1.z - ax);
     425
    425426  glEnd();
    426427
Note: See TracChangeset for help on using the changeset viewer.