Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5432 in orxonox.OLD for trunk/src/lib/coord/p_node.cc


Ignore:
Timestamp:
Oct 25, 2005, 1:13:50 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some documentation in the PNode-debugDraw function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/coord/p_node.cc

    r5420 r5432  
    763763void PNode::debugDraw(unsigned int depth, float size, const Vector& color, unsigned int level) const
    764764{
     765  // if this is the first Element we draw
    765766  if (level == 0)
    766767  {
    767     glPushAttrib(GL_ENABLE_BIT);
    768     glMatrixMode(GL_MODELVIEW);
    769 
    770     glDisable(GL_LIGHTING);
    771     glDisable(GL_BLEND);
    772     glDisable(GL_TEXTURE_2D);
    773   }
    774 
    775   glPushMatrix();
     768    glPushAttrib(GL_ENABLE_BIT); // save the Enable-attributes
     769    glMatrixMode(GL_MODELVIEW);  // goto the ModelView Matrix
     770
     771    glDisable(GL_LIGHTING);      // disable lighting (we do not need them for just lighting)
     772    glDisable(GL_BLEND);         // ''
     773    glDisable(GL_TEXTURE_2D);    // ''
     774  }
     775
     776  glPushMatrix();                // repush the Matrix-stack
    776777  /* translate */
    777778  glTranslatef (this->getAbsCoor ().x,
    778779                this->getAbsCoor ().y,
    779780                this->getAbsCoor ().z);
     781//  this->getAbsDir ().matrix (matrix);
     782
    780783  /* rotate */
    781 //  this->getAbsDir ().matrix (matrix);
    782 //  glMultMatrixf((float*)matrix);
    783 
    784784  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     785  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     786  /* set the new Color */
    785787  glColor3f(color.x, color.y, color.z);
    786 
    787   glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    788   {
     788  { /* draw a cube of size size */
    789789    glBegin(GL_LINE_STRIP);
    790790    glVertex3f(-.5*size, -.5*size,  -.5*size);
     
    817817  if (depth >= 2 || depth == 0)
    818818  {
     819    /* rotate the current color in HSV space around 20 degree */
    819820    Vector childColor =  Color::HSVtoRGB(Color::RGBtoHSV(color)+Vector(20,0,.0));
    820821    tIterator<PNode>* iterator = this->children->getIterator();
     
    836837        glEnd();
    837838      }
    838       if (depth == 0)
     839      /* if we want to draw the children too */
     840      if (depth == 0) /* -> all of them */
    839841        pn->debugDraw(0, size, childColor, level+1);
    840       else
     842      else            /* -> only the Next one */
    841843        pn->debugDraw(depth - 1, size, childColor, level +1);
    842844      pn = iterator->nextElement();
     
    845847  }
    846848  if (level == 0)
    847     glPopAttrib();
     849    glPopAttrib(); /* pop the saved attributes back out */
    848850}
    849851
Note: See TracChangeset for help on using the changeset viewer.