Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5383 in orxonox.OLD for trunk/src/lib/coord


Ignore:
Timestamp:
Oct 15, 2005, 8:42:17 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: the drawing of the PNode-debug is much better now

Location:
trunk/src/lib/coord
Files:
2 edited

Legend:

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

    r5382 r5383  
    654654 *  displays some information about this pNode
    655655 * @param depth The deph into which to debug the children of this PNode to.
    656  * (0: all children will be debugged, 1: only this PNode, 2: this and direct children...)
    657  * @param level The n-th level of the Node we draw (this is internal and only for nice output)
     656 * (0: all children will be debugged, 1: only this PNode, 2: this and direct children, ...)
     657 * @param level !! INTERNAL !! The n-th level of the Node we draw (this is internal and only for nice output).
    658658*/
    659659void PNode::debug(unsigned int depth, unsigned int level) const
     
    697697
    698698/**
    699    displays the PNode at its position with its rotation as a cube.
    700 */
    701 void PNode::debugDraw(unsigned int depth, float size, const Vector& color) const
    702 {
    703   glMatrixMode(GL_MODELVIEW);
     699 * displays the PNode at its position with its rotation as a cube.
     700 * @param  depth The deph into which to debug the children of this PNode to.
     701 * (0: all children will be displayed, 1: only this PNode, 2: this and direct children, ...)
     702 * @param size the Size of the Box to draw.
     703 * @param color the color of the Box to display.
     704 * @param level !! INTERNAL !! The n-th level of the Node we draw (this is internal and only for nice output).
     705 */
     706void PNode::debugDraw(unsigned int depth, float size, const Vector& color, unsigned int level) const
     707{
     708  if (level == 0)
     709  {
     710    glPushAttrib(GL_ENABLE_BIT);
     711    glMatrixMode(GL_MODELVIEW);
     712
     713    glDisable(GL_LIGHTING);
     714    glDisable(GL_BLEND);
     715    glDisable(GL_TEXTURE_2D);
     716  }
     717
    704718  glPushMatrix();
    705   glDisable(GL_LIGHTING);
    706 
    707719  /* translate */
    708720  glTranslatef (this->getAbsCoor ().x,
     
    715727  Vector tmpRot = this->getAbsDir().getSpacialAxis();
    716728  glColor3f(color.x, color.y, color.z);
     729
    717730  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    718731  {
     
    745758
    746759  glPopMatrix();
    747   glEnable(GL_LIGHTING);
    748760  if (depth >= 2 || depth == 0)
    749761  {
    750762    Vector childColor =  Color::HSVtoRGB(Color::RGBtoHSV(color)+Vector(20,0,.0));
    751 
    752763    tIterator<PNode>* iterator = this->children->getIterator();
    753764    PNode* pn = iterator->firstElement();
     
    755766    {
    756767      if (depth == 0)
    757         pn->debugDraw(0, size, childColor);
     768        pn->debugDraw(0, size, childColor, level+1);
    758769      else
    759         pn->debugDraw(depth - 1, size, childColor);
     770        pn->debugDraw(depth - 1, size, childColor, level +1);
    760771      pn = iterator->nextElement();
    761772    }
    762773    delete iterator;
    763774  }
     775  if (level == 0)
     776    glPopAttrib();
    764777}
    765778
  • trunk/src/lib/coord/p_node.h

    r5382 r5383  
    118118
    119119  void debug (unsigned int depth = 1, unsigned int level = 0) const;
    120   void debugDraw(unsigned int depth = 1, float size = 1.0, const Vector& color = Vector(1,1,1)) const;
     120  void debugDraw(unsigned int depth = 1, float size = 1.0, const Vector& color = Vector(1, 0, 0), unsigned int level = 0) const;
    121121
    122122
Note: See TracChangeset for help on using the changeset viewer.