Index: orxonox/trunk/src/lib/coord/p_node.cc
===================================================================
--- orxonox/trunk/src/lib/coord/p_node.cc	(revision 4569)
+++ orxonox/trunk/src/lib/coord/p_node.cc	(revision 4570)
@@ -1,5 +1,5 @@
 
 
-/* 
+/*
    orxonox - the future of 3D-vertical-scrollers
 
@@ -13,5 +13,5 @@
    ### File Specific:
    main-programmer: Patrick Boenzli
-   co-programmer: 
+   co-programmer:
 
    \todo Smooth-Parent: delay, speed
@@ -40,5 +40,5 @@
    \brief standard constructor
 */
-PNode::PNode () 
+PNode::PNode ()
 {
   init(NULL);
@@ -54,5 +54,5 @@
   this->init(NULL);
   this->loadParams(root);
-  
+
   NullParent::getInstance()->addChild(this);
 }
@@ -80,10 +80,10 @@
    \brief standard deconstructor
 */
-PNode::~PNode () 
+PNode::~PNode ()
 {
   tIterator<PNode>* iterator = this->children->getIterator();
   PNode* pn = iterator->nextElement();
-  while( pn != NULL) 
-    { 
+  while( pn != NULL)
+    {
       delete pn;
       pn = iterator->nextElement();
@@ -106,5 +106,5 @@
   this->bRelDirChanged = true;
   this->bAbsDirChanged = false;
-  this->parent = parent; 
+  this->parent = parent;
 }
 
@@ -161,5 +161,5 @@
    Vector newCoor = currentCoor + objectMovement;
    someNode->setRelCoor(newCoor);
-   
+
    yea right... shorter...
 
@@ -172,5 +172,5 @@
       this->absCoordinate += shift;
     }
-  else 
+  else
     {
       this->relCoordinate += shift;
@@ -223,5 +223,5 @@
    Quaternion newCoor = currentCoor + objectMovement;
    someNode->setRelCoor(newCoor);
-   
+
    yea right... shorter...
 
@@ -278,7 +278,7 @@
   tIterator<PNode>* iterator = this->children->getIterator();
   PNode* pn = iterator->nextElement();
- 
-  while( pn != NULL) 
-    { 
+
+  while( pn != NULL)
+    {
       nullParent->addChild(pn, pn->getParentMode());
       pn = iterator->nextElement();
@@ -311,5 +311,5 @@
 /**
    \brief has to be called, if the parent coordinate has changed
-   
+
    normaly this will be done by the parent itself automaticaly. If you call this, you
    will force an update of the coordinated of the node.
@@ -327,5 +327,5 @@
 
    this is used to go through the parent-tree to update all the absolute coordinates
-   and directions. this update should be done by the engine, so you don't have to 
+   and directions. this update should be done by the engine, so you don't have to
    worry, normaly...
 */
@@ -340,72 +340,72 @@
 
       if( likely(this->parentMode & PNODE_MOVEMENT))
-	{
-	  if( unlikely(this->bAbsCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
-	    {
-	      /* if you have set the absolute coordinates this overrides all other changes */
-	      this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
-	    }
-	  if( likely(this->bRelCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
-
-	    {
-	      /*this is bad style... must be deleted later - just for testing*/
-
-	      /*
-		if( unlikely(this->parent == NULL))
-		{
-		*this->absCoordinate = *this->relCoordinate;
-		}
-		else */
-	      this->absCoordinate = parent->getAbsCoor() + this->relCoordinate;	      /* update the current absCoordinate */
-	    }
-	}
-  
+        {
+          if( unlikely(this->bAbsCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
+            {
+              /* if you have set the absolute coordinates this overrides all other changes */
+              this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
+            }
+          if( likely(this->bRelCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
+
+            {
+              /*this is bad style... must be deleted later - just for testing*/
+
+              /*
+                if( unlikely(this->parent == NULL))
+                {
+                *this->absCoordinate = *this->relCoordinate;
+                }
+                else */
+              this->absCoordinate = parent->getAbsCoor() + this->relCoordinate;       /* update the current absCoordinate */
+            }
+        }
+
       if( this->parentMode & PNODE_LOCAL_ROTATE)
-	{
-	  if( unlikely(this->bAbsDirChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
-	    {
-	      /* if you have set the absolute coordinates this overrides all other changes */
-	      this->relDirection = this->absDirection - parent->getAbsDir();
-	    }
-	  else if( likely(this->bRelDirChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
-	    {
-	      /* update the current absDirection - remember * means rotation around sth.*/
-	      this->absDirection = parent->getAbsDir() * this->relDirection;
-	    }
-	}
-  
+        {
+          if( unlikely(this->bAbsDirChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
+            {
+              /* if you have set the absolute coordinates this overrides all other changes */
+              this->relDirection = this->absDirection - parent->getAbsDir();
+            }
+          else if( likely(this->bRelDirChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
+            {
+              /* update the current absDirection - remember * means rotation around sth.*/
+              this->absDirection = parent->getAbsDir() * this->relDirection;
+            }
+        }
+
       if( this->parentMode & PNODE_ROTATE_MOVEMENT)
-	{
-	  if( unlikely(this->bAbsCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
-	    {
-	      /* if you have set the absolute coordinates this overrides all other changes */
-	      this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
-	    }
-	  else if( likely(this->bRelCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
-	    {
-	      /*this is bad style... must be deleted later - just for testing*/
-	      /*if( this->parent == NULL)
-	       *this->absCoordinate = *this->relCoordinate;
-	       else*/
-	      this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(this->relCoordinate);	      /* update the current absCoordinate */
-	    }
-	}
-  
-  
+        {
+          if( unlikely(this->bAbsCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
+            {
+              /* if you have set the absolute coordinates this overrides all other changes */
+              this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
+            }
+          else if( likely(this->bRelCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
+            {
+              /*this is bad style... must be deleted later - just for testing*/
+              /*if( this->parent == NULL)
+               *this->absCoordinate = *this->relCoordinate;
+               else*/
+              this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(this->relCoordinate);            /* update the current absCoordinate */
+            }
+        }
+
+
       tIterator<PNode>* iterator = this->children->getIterator();
       //PNode* pn = this->children->enumerate();
       PNode* pn = iterator->nextElement();
-      while( pn != NULL) 
-	{ 
-	  /* if this node has changed, make sure, that all children are updated also */
-	  if( likely(this->bRelCoorChanged || this->bAbsCoorChanged))
-	    pn->parentCoorChanged ();
-	  if( likely(this->bRelDirChanged || this->bAbsDirChanged))
-	    pn->parentDirChanged ();
-
-	  pn->update(dt);
-	  //pn = this->children->nextElement();
-	  pn = iterator->nextElement();
-	}
+      while( pn != NULL)
+        {
+          /* if this node has changed, make sure, that all children are updated also */
+          if( likely(this->bRelCoorChanged || this->bAbsCoorChanged))
+            pn->parentCoorChanged ();
+          if( likely(this->bRelDirChanged || this->bAbsDirChanged))
+            pn->parentDirChanged ();
+
+          pn->update(dt);
+          //pn = this->children->nextElement();
+          pn = iterator->nextElement();
+        }
       delete iterator;
 
@@ -425,15 +425,15 @@
       //PNode* pn = this->children->enumerate ();
       PNode* pn = iterator->nextElement();
-      while( pn != NULL) 
-	{ 
-	  /* if this node has changed, make sure, that all children are updated also */
-	  if( this->bRelCoorChanged || this->bAbsCoorChanged)
-	    pn->parentCoorChanged ();
-	  if( this->bRelDirChanged || this->bAbsDirChanged)
-	    pn->parentDirChanged ();
-	  pn->update (dt);
-	  //pn = this->children->nextElement ();
-	  pn = iterator->nextElement();
-	}
+      while( pn != NULL)
+        {
+          /* if this node has changed, make sure, that all children are updated also */
+          if( this->bRelCoorChanged || this->bAbsCoorChanged)
+            pn->parentCoorChanged ();
+          if( this->bRelDirChanged || this->bAbsDirChanged)
+            pn->parentDirChanged ();
+          pn->update (dt);
+          //pn = this->children->nextElement ();
+          pn = iterator->nextElement();
+        }
 
       this->bRelCoorChanged = false;
@@ -449,8 +449,51 @@
 void PNode::debug()
 {
-  PRINTF(2)("PNode::debug() - absCoord: (%f, %f, %f)\n", 
-	 this->absCoordinate.x, 
-	 this->absCoordinate.y,
-	 this->absCoordinate.z);
-}
-
+  PRINTF(2)("PNode::debug() - absCoord: (%f, %f, %f)\n",
+         this->absCoordinate.x,
+         this->absCoordinate.y,
+         this->absCoordinate.z);
+}
+
+/**
+  @brief displays the PNode at its position with its rotation as a cube.
+*/
+void PNode::debugDraw(float size) const
+{
+  glMatrixMode(GL_MODELVIEW);
+  glPushMatrix();
+  float matrix[4][4];
+
+  /* translate */
+  glTranslatef (this->getAbsCoor ().x,
+                this->getAbsCoor ().y,
+                this->getAbsCoor ().z);
+  /* rotate */
+  this->getAbsDir ().matrix (matrix);
+  glMultMatrixf((float*)matrix);
+  {
+    glBegin(GL_LINE_STRIP);
+    glVertex3f( .5,  .5, -.5);
+    glVertex3f( .5,  .5,  .5);
+    glVertex3f(-.5,  .5,  .5);
+    glVertex3f(-.5, -.5,  .5);
+    glVertex3f( .5,  .5, -.5);
+    glVertex3f( .5, -.5, -.5);
+    glVertex3f(-.5, -.5, -.5);
+    glVertex3f(-.5,  .5, -.5);
+    glEnd();
+    glBegin(GL_LINE_STRIP);
+    glVertex3f(-.5, -.5, -.5);
+    glVertex3f(-.5, -.5,  .5);
+    glVertex3f( .5, -.5,  .5);
+    glVertex3f( .5, -.5, -.5);
+    glEnd();
+    glBegin(GL_LINES);
+    glVertex3f( .5, -.5,  .5);
+    glVertex3f( .5,  .5,  .5);
+    glVertex3f(-.5, -.5,  .5);
+    glVertex3f(-.5,  .5,  .5);
+    glEnd();
+  }
+
+  glPopMatrix();
+}
Index: orxonox/trunk/src/lib/coord/p_node.h
===================================================================
--- orxonox/trunk/src/lib/coord/p_node.h	(revision 4569)
+++ orxonox/trunk/src/lib/coord/p_node.h	(revision 4570)
@@ -1,3 +1,3 @@
-/*! 
+/*!
     \file p_node.h
     \brief Definition of a parenting node
@@ -9,5 +9,5 @@
 
     absCoordinate, absDirection have to be recalculated as soon as there was a change in
-    place or ortientation. this is only the case if 
+    place or ortientation. this is only the case if
     o bDirChanged is true (so changed) AND timeStamp != now
     o bCoorChanged is true (so moved) AND timeStamp != now
@@ -78,5 +78,5 @@
 
   /** \returns the Speed of the Node */
-  inline float getSpeed() const {return this->velocity.len();} 
+  inline float getSpeed() const {return this->velocity.len();}
   /** \returns the Velocity of the Node */
   inline const Vector& getVelocity() const {return this->velocity;}
@@ -95,5 +95,5 @@
 
   void debug ();
-
+  void debugDraw(float size = 1.0) const;
 
  private:
@@ -128,3 +128,3 @@
 
 #endif /* _P_NODE_H */
- 
+
