Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jun 10, 2005, 1:50:37 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: PNode debug info much better now (recursive)

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

Legend:

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

    r4571 r4574  
    426426      PNode* pn = iterator->nextElement();
    427427      while( pn != NULL)
    428         {
    429           /* if this node has changed, make sure, that all children are updated also */
     428      {
     429        /* if this node has changed, make sure, that all children are updated also */
    430430          if( this->bRelCoorChanged || this->bAbsCoorChanged)
    431431            pn->parentCoorChanged ();
     
    436436          pn = iterator->nextElement();
    437437        }
    438 
     438      delete iterator;
    439439      this->bRelCoorChanged = false;
    440440      this->bAbsCoorChanged = false;
     
    446446/**
    447447   \brief displays some information about this pNode
    448 */
    449 void PNode::debug(unsigned int depth) const
    450 {
    451   PRINTF(2)("PNode::debug() - absCoord: (%f, %f, %f)\n",
    452          this->absCoordinate.x,
    453          this->absCoordinate.y,
    454          this->absCoordinate.z);
     448   \param depth The deph into which to debug the children of this PNode to.
     449  (0: all children will be debugged, 1: only this PNode, 2: this and direct children...)
     450   \param level The n-th level of the Node we draw (this is internal and only for nice output)
     451*/
     452void PNode::debug(unsigned int depth, unsigned int level) const
     453{
     454  for (unsigned int i = 0; i < level; i++)
     455    PRINT(0)("|");
     456  if (this->children->getSize() > 0)
     457    PRINT(0)("+");
     458  PRINT(0)("PNode(%s::%s) - absCoord: (%0.2f, %0.2f, %0.2f), relCoord(%0.2f, %0.2f, %0.2f)\n",
     459           this->getClassName(),
     460           this->getName(),
     461           this->absCoordinate.x,
     462           this->absCoordinate.y,
     463           this->absCoordinate.z,
     464           this->relCoordinate.x,
     465           this->relCoordinate.y,
     466           this->relCoordinate.z );
     467  if (depth >= 2 || depth == 0)
     468  {
     469    tIterator<PNode>* iterator = this->children->getIterator();
     470      //PNode* pn = this->children->enumerate ();
     471    PNode* pn = iterator->nextElement();
     472    while( pn != NULL)
     473    {
     474      if (depth == 0)
     475        pn->debug(0, level + 1);
     476      else
     477        pn->debug(depth - 1, level +1);
     478      pn = iterator->nextElement();
     479    }
     480    delete iterator;
     481  }
    455482}
    456483
  • orxonox/trunk/src/lib/coord/p_node.h

    r4571 r4574  
    3232template<class T> class tList;
    3333
    34 //! enumeration for the different translation-binding-types
    35 //typedef enum parentingMode {PNODE_LOCAL_ROTATE, PNODE_ROTATE_MOVEMENT, PNODE_ALL, PNODE_MOVEMENT, PNODE_ROTATE_AND_MOVE};
    3634// linkage modes
    3735#define PNODE_LOCAL_ROTATE       1    //!< Rotates all the children around their centers.
     
    9492  void update (float dt);
    9593
    96   void debug (unsigned int depth = 1) const;
     94  void debug (unsigned int depth = 1, unsigned int level = 0) const;
    9795  void debugDraw(float size = 1.0) const;
    9896
Note: See TracChangeset for help on using the changeset viewer.