Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5008 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Aug 14, 2005, 2:46:29 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: better coloring

Location:
orxonox/trunk/src/lib
Files:
3 edited

Legend:

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

    r5007 r5008  
    657657   displays the PNode at its position with its rotation as a cube.
    658658*/
    659 void PNode::debugDraw(unsigned int depth, float size) const
     659void PNode::debugDraw(unsigned int depth, float size, Vector color) const
    660660{
    661661  glMatrixMode(GL_MODELVIEW);
    662662  glPushMatrix();
     663  glDisable(GL_LIGHTING);
    663664
    664665  /* translate */
     
    671672
    672673  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     674  glColor3f(color.x, color.y, color.z);
    673675  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    674676  {
     
    705707    tIterator<PNode>* iterator = this->children->getIterator();
    706708      //PNode* pn = this->children->enumerate ();
     709    Vector childColor =  color - Vector(.0,.3,.3);
    707710    PNode* pn = iterator->nextElement();
    708711    while( pn != NULL)
    709712    {
    710713      if (depth == 0)
    711         pn->debugDraw(0, size);
     714        pn->debugDraw(0, size, childColor);
    712715      else
    713         pn->debugDraw(depth - 1, size);
     716        pn->debugDraw(depth - 1, size, childColor);
    714717      pn = iterator->nextElement();
    715718    }
    716719    delete iterator;
    717720  }
     721  glEnable(GL_LIGHTING);
    718722}
    719723
  • orxonox/trunk/src/lib/coord/p_node.h

    r5007 r5008  
    116116
    117117  void debug (unsigned int depth = 1, unsigned int level = 0) const;
    118   void debugDraw(unsigned int depth = 1, float size = 1.0) const;
     118  void debugDraw(unsigned int depth = 1, float size = 1.0, Vector color = Vector(1,1,1)) const;
    119119
    120120
  • orxonox/trunk/src/lib/math/vector.h

    r5006 r5008  
    11/*!
    2     \file vector.h
    3   * A basic 3D math framework
    4 
    5    Contains classes to handle vectors, lines, rotations and planes
     2 * @file vector.h
     3 * A basic 3D math framework
     4 *
     5 * Contains classes to handle vectors, lines, rotations and planes
    66*/
    77
     
    107107inline float angleRad (const Vector& v1, const Vector& v2) { return acos( v1 * v2 / (v1.len() * v2.len())) * 180/M_PI; };
    108108
     109/** an easy way to create a Random Vector @param sideLength the length of the Vector (x not sqrt(x^2...)) */
     110#define VECTOR_RAND(sideLength)  (Vector((float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5) * sideLength)
     111
    109112
    110113//! Quaternion
Note: See TracChangeset for help on using the changeset viewer.