Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4921 in orxonox.OLD for orxonox/trunk/src/lib/graphics


Ignore:
Timestamp:
Jul 21, 2005, 3:32:54 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: the way, where the fighter flights though is now drawn in quadtree partitions. now you can see where the space craft has been :)

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

Legend:

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

    r4920 r4921  
    162162    printf("-----------\nthe array coordinates are: %i, %i\n", i, j);
    163163    printf("position: %f,%f, center %f, %f\n", position.x, position.z, this->nodes[i + j * max]->getDimension()->getCenter()->x, this->nodes[i + j * max]->getDimension()->getCenter()->z);
    164     this->nodes[i + j * max]->drawTree(0,0);
     164
     165    //this->nodes[i + j * max]->draw();
    165166    this->nodes[i + j * max]->includesPoint(position);
    166167  }
    167168  else
    168169    printf("object has left terrain\n");
    169 
    170170}
    171171
     
    179179  for(int i = 0; i < (int)pow(4, this->treeDepth); ++i)
    180180  {
    181     //this->nodes[i]->drawTree(0, 0);
     181    this->nodes[i]->draw();
    182182  }
    183183
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc

    r4920 r4921  
    102102  this->offset = 0.0f;
    103103  this->nodeIter = -1;
     104  this->bDraw = false;
    104105
    105106  this->parent = NULL;
     
    366367  else
    367368    printf("POINT IS NOT INSIEDE\n");
     369  this->bDraw = true;
    368370}
    369371
     
    379381    float h = 50.0f;
    380382
     383    //printf("draw @ %f, %f to %f, %f", t1.x + ax, t1.z + ax, t1.x - ax, t1.z - ax);
     384
     385    this->quadtree->getMaterial(this->indexNode)->select();
    381386    glBegin(GL_QUADS);
    382     this->quadtree->getMaterial(this->indexNode)->select();
    383387    glVertex3f(t1.x + ax, h - depth * 10.0f, t1.z + ax);
    384388    glVertex3f(t1.x - ax, h - depth * 10.0f, t1.z + ax);
     
    398402    this->nodeD->drawTree(depth - 1, drawMode);
    399403}
     404
     405void QuadtreeNode::draw() const
     406{
     407  if( likely(!bDraw))
     408    return;
     409  Vector t1 = *this->pDimension->getCenter();
     410  float ax = this->pDimension->getAxis();
     411  float h = 70.0f;
     412
     413    //printf("draw @ %f, %f to %f, %f", t1.x + ax, t1.z + ax, t1.x - ax, t1.z - ax);
     414
     415  glBegin(GL_QUADS);
     416  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//   }
     425  glEnd();
     426
     427}
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h

    r4920 r4921  
    3535
    3636    void drawTree(int depth, int drawMode) const;
     37    void draw() const;
    3738
    3839
     
    7172    modelInfo*                      pModelInfo;         //!< reference to the modelInfo of the object
    7273    Rectangle*                      pDimension;         //!< pointer to the local rectangle properties
     74
     75    bool                            bDraw;              //!< shall it be drawn? DEBUG only
    7376};
    7477
  • orxonox/trunk/src/lib/graphics/spatial_separation/spatial_separation.cc

    r4914 r4921  
    9999Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model)
    100100{
    101   this->quadtree = new Quadtree(model->getModelInfo(), 4);
     101  this->quadtree = new Quadtree(model->getModelInfo(), 5);
    102102
    103103  return this->quadtree;
Note: See TracChangeset for help on using the changeset viewer.