Index: orxonox/branches/levelloader/src/lib/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/lib/Makefile.in	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/Makefile.in	(revision 3605)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.2 from Makefile.am.
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
 # @configure_input@
 
@@ -78,4 +78,6 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@
+DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@
 DOXYGEN = @DOXYGEN@
 DOXYGEN_FALSE = @DOXYGEN_FALSE@
@@ -181,7 +183,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -276,12 +278,14 @@
 	tags=; \
 	here=`pwd`; \
-	if (etags --etags-include --version) >/dev/null 2>&1; then \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
+	  empty_fix=.; \
 	else \
 	  include_option=--include; \
+	  empty_fix=; \
 	fi; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -f $$subdir/TAGS && \
+	    test ! -f $$subdir/TAGS || \
 	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
@@ -293,7 +297,9 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
Index: orxonox/branches/levelloader/src/lib/coord/helper_parent.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/coord/helper_parent.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/coord/helper_parent.cc	(revision 3605)
@@ -39,4 +39,6 @@
    \todo this deconstructor is not jet implemented - do it
 */
-HelperParent::~HelperParent () {}
+HelperParent::~HelperParent () 
+{
 
+}
Index: orxonox/branches/levelloader/src/lib/coord/helper_parent.h
===================================================================
--- orxonox/branches/levelloader/src/lib/coord/helper_parent.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/coord/helper_parent.h	(revision 3605)
@@ -17,6 +17,5 @@
  public:
   HelperParent ();
-  ~HelperParent ();
-
+  virtual ~HelperParent ();
 
 };
Index: orxonox/branches/levelloader/src/lib/coord/null_parent.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/coord/null_parent.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/coord/null_parent.cc	(revision 3605)
@@ -16,4 +16,5 @@
 */
 
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_NULL_PARENT
 
 #include "null_parent.h"
@@ -26,5 +27,5 @@
 NullParent* NullParent::getInstance ()
 {
-  if( singletonRef == NULL)
+  if(!singletonRef)
     singletonRef = new NullParent ();
   return singletonRef;
@@ -36,16 +37,20 @@
    \todo this constructor is not jet implemented - do it
 */
-NullParent::NullParent () 
+NullParent::NullParent () : PNode (new Vector(0,0,0), NULL)
 {
+  PRINTF(4)("NullParent::NullParent() - making new NullParent, there can only be one..\n");
   this->parent = this;
-  this->mode = ALL;
+  this->mode = PNODE_ALL;
+  this->setName("NullParent");
 }
 
 
-NullParent::NullParent (Vector* absCoordinate)
+NullParent::NullParent (Vector* absCoordinate) : PNode (new Vector(0,0,0), NULL)
 {
+  singletonRef = this;
   this->parent = this;
-  this->mode = ALL;
+  this->mode = PNODE_ALL;
   this->absCoordinate = *absCoordinate;
+  this->setName("NullParent");
 }
 
@@ -58,10 +63,7 @@
 NullParent::~NullParent () 
 {
-  delete singletonRef;
+  //delete singletonRef;
   singletonRef = NULL;
 }
-
-
-
 
 /**
@@ -72,6 +74,8 @@
    worry, normaly...
 */
-void NullParent::update (float timeStamp)
+void NullParent::update ()
 {
+
+  PRINTF(4)("NullParent::update - (%f, %f, %f)\n", this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
   this->absCoordinate = this->relCoordinate;
   this->absDirection = parent->getAbsDir () * this->relDirection;
@@ -85,5 +89,5 @@
       if( this->bRelDirChanged || this->bAbsDirChanged)
 	pn->parentDirChanged ();
-      pn->update (timeStamp);
+      pn->update ();
       pn = this->children->nextElement ();
     }
Index: orxonox/branches/levelloader/src/lib/coord/null_parent.h
===================================================================
--- orxonox/branches/levelloader/src/lib/coord/null_parent.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/coord/null_parent.h	(revision 3605)
@@ -16,13 +16,13 @@
  public:
   static NullParent* getInstance ();
-  ~NullParent ();
-  
-  static NullParent* singletonRef;
+  virtual ~NullParent ();
 
-  virtual void update (float timeStamp);
+
+  virtual void update ();
 
  private:
   NullParent ();
   NullParent (Vector* absCoordinate);
+  static NullParent* singletonRef;
 
 };
Index: orxonox/branches/levelloader/src/lib/coord/p_node.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/coord/p_node.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/coord/p_node.cc	(revision 3605)
@@ -13,14 +13,15 @@
    ### File Specific:
    main-programmer: Patrick Boenzli
-   co-programmer: ...
-
-   \todo Null-Parent => center of the coord system - singleton
+   co-programmer: 
+
    \todo Smooth-Parent: delay, speed
-   \todo destroy the stuff again, delete...
-*/
-
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_PNODE
 
 #include "p_node.h"
 
+#include "null_parent.h"
+#include "vector.h"
 
 using namespace std;
@@ -34,10 +35,8 @@
 PNode::PNode () 
 {
-  this->children = new tList<PNode>();
-  this->bRelCoorChanged = true;
-  this->bAbsCoorChanged = false;
-  this->bRelDirChanged = true;
-  this->bAbsDirChanged = false;
-  this->parent = NULL;
+  init(NULL);
+
+  NullParent* np = NullParent::getInstance();
+  np->addChild(this);
   this->objectName = NULL;
 }
@@ -51,18 +50,15 @@
 PNode::PNode (Vector* absCoordinate, PNode* parent )
 {
+  this->init(parent);
+
   this->absCoordinate = *absCoordinate;
-  this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
-  
-  this->children = new tList<PNode>();
-  this->bRelCoorChanged = true;
-  this->bAbsCoorChanged = false;
-  this->bRelDirChanged = true;
-  this->bAbsDirChanged = false;
-  this->parent = parent;
-  this->objectName = NULL;
-  
-  parent->addChild (this);
-}
-
+  if (parent != NULL)
+    {
+      this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
+      parent->addChild (this);
+    }
+  else 
+    this->relCoordinate = Vector(0,0,0);
+}
 
 /**
@@ -80,9 +76,32 @@
   delete &this->absDirection;
   */
-  this->parent = NULL;
+  //this->parent = NULL;
   if( this->objectName) delete this->objectName;
   /* there is currently a problem with cleaning up - fix*/
-}
-
+
+  PNode* pn = this->children->enumerate();
+  while( pn != NULL) 
+    { 
+      delete pn;
+      pn = this->children->nextElement();
+
+    }
+   
+  /* this deletes all children in the list */
+  delete this->children;
+
+  delete []this->objectName;
+}
+
+void PNode::init(PNode* parent)
+{
+  this->children = new tList<PNode>();
+  this->bRelCoorChanged = true;
+  this->bAbsCoorChanged = false;
+  this->bRelDirChanged = true;
+  this->bAbsDirChanged = false;
+  this->parent = parent; 
+  this->objectName = NULL;
+}
 
 /**
@@ -91,4 +110,5 @@
    cleans up all pnodes
 */
+/*
 void PNode::destroy ()
 {
@@ -99,7 +119,10 @@
       pn = this->children->nextElement();
     } 
+  // this deletes all children in the list 
   this->children->destroy ();
-}
-
+
+  static_cast<BaseObject*>(this)->destroy();
+}
+*/
 
 /**
@@ -262,6 +285,4 @@
 {}
 
-
-
 /**
    \brief adds a child and makes this node to a parent
@@ -283,9 +304,14 @@
    use this to add a child to this node.
 */
-void PNode::addChild (PNode* pNode, parentingMode mode)
-{
-  pNode->mode = mode;
+void PNode::addChild (PNode* pNode, int parentingMode)
+{
+  if( pNode->parent != NULL )
+    {
+      PRINTF(2)("PNode::addChild() - reparenting node: removing it and adding it again\n");
+      pNode->parent->children->remove(pNode);
+    }
+  pNode->mode = parentingMode;
   pNode->parent = this;
-  this->children->add (pNode);
+  this->children->add(pNode);
 }
 
@@ -294,8 +320,30 @@
    \brief removes a child from the node
    \param pNode the child to remove from this pNode.
+
+   Children from pNode will not be lost, they are referenced to NullPointer
 */
 void PNode::removeChild (PNode* pNode)
 {
+  pNode->remove();
   this->children->remove (pNode);
+  pNode->parent = NULL;
+}
+
+
+/**
+   \brief remove this pnode from the tree and adds all following to NullParent
+
+   this can be the case, if an entity in the world is been destroyed.
+*/
+void PNode::remove()
+{
+  NullParent* np = NullParent::getInstance();
+  PNode* pn = this->children->enumerate();
+  while( pn != NULL) 
+    { 
+      this->children->remove(pn);
+      np->addChild(pn, pn->getMode());
+      pn = this->children->nextElement();
+    }
 }
 
@@ -307,6 +355,7 @@
 void PNode::setParent (PNode* parent)
 {
-  this->parent = parent;
-}
+  parent->addChild(this);
+}
+
 
 /**
@@ -314,7 +363,17 @@
    \param mode the mode of the bind-type.
 */
-void PNode::setMode (parentingMode mode)
-{
-  this->mode = mode;
+void PNode::setMode (int parentingMode)
+{
+  this->mode = parentingMode;
+}
+
+
+/**
+   \brief gets the mode of this parent manualy
+   \return the mode of the bind-type.
+*/
+int PNode::getMode()
+{
+  return this->mode;
 }
 
@@ -351,42 +410,59 @@
    worry, normaly...
 */
-void PNode::update (float timeStamp)
-{
-  printf ("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
-
-      if( this->mode == MOVEMENT || this->mode == ALL)
+void PNode::update ()
+{
+  PRINTF(2)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
+  // printf("%s", this->objectName);
+  if(this->mode & PNODE_MOVEMENT )
+    {
+      if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
 	{
-	  if( 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( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
+	{
+	  /*this is bad style... must be deleted later - just for testing*/
+	  if( this->parent == NULL)
 	    {
-	      printf("PNode::update () - this->bAbsCoorChanged = true\n");
-	      /* if you have set the absolute coordinates this overrides all other changes */
-	      this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
+	      this->absCoordinate = this->relCoordinate;
 	    }
-	  else if( 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 () + this->relCoordinate;	      /* update the current absCoordinate */
-	    }
+	  else
+	    this->absCoordinate = parent->getAbsCoor() + this->relCoordinate;	      /* update the current absCoordinate */
 	}
-      
-      if( this->mode == ROTATION && this->mode == ALL)
+    }
+  
+  if( this->mode & PNODE_LOCAL_ROTATE)
+    {
+      if( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
 	{
-	  if( 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( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
-	    {
-	      /* update the current absDirection - remember * means rotation around sth.*/
-	      this->absDirection = parent->getAbsDir () * this->relDirection;
-	    }
-	}    
-      // }
+	  /* if you have set the absolute coordinates this overrides all other changes */
+	  this->relDirection = this->absDirection - parent->getAbsDir();
+	}
+      else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
+	{
+	  /* update the current absDirection - remember * means rotation around sth.*/
+	  this->absDirection = parent->getAbsDir() * this->relDirection;
+	}
+    }
+  
+  if( this->mode & PNODE_ROTATE_MOVEMENT)
+    {
+      if( 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( 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 */
+	}
+    }
+  
+  
   PNode* pn = this->children->enumerate();
   while( pn != NULL) 
@@ -397,5 +473,5 @@
       if( this->bRelDirChanged || this->bAbsDirChanged)
 	pn->parentDirChanged ();
-      pn->update(timeStamp);
+      pn->update();
       pn = this->children->nextElement();
     }
@@ -415,5 +491,5 @@
 void PNode::processTick (float dt)
 {
-  this->tick (dt);
+  //this->tick (dt);
   PNode* pn = this->children->enumerate();
   while( pn != NULL) 
@@ -424,9 +500,4 @@
 }
 
-/**
-   \param dt time to tick
-*/
-void PNode::tick (float dt)
-{}
 
 /**
@@ -435,5 +506,5 @@
 void PNode::debug()
 {
-  printf("PNode::debug() - absCoord: (%f, %f, %f)\n", 
+  PRINTF(2)("PNode::debug() - absCoord: (%f, %f, %f)\n", 
 	 this->absCoordinate.x, 
 	 this->absCoordinate.y,
@@ -451,16 +522,8 @@
 void PNode::setName (const char* newName)
 {
-	int l = strlen( newName);
-	
-	if( this->objectName != NULL) delete this->objectName;
-	this->objectName = NULL;
-	
-	if( newName != NULL)
-	{
-		this->objectName = new char[l+1];
-		
-		for( int i = 0; i < l+1; i++)
-			this->objectName[i] = newName[i];
-	}
+  if (this->objectName)
+    delete []this->objectName;
+  this->objectName = new char[strlen(newName)+1];
+  strcpy(this->objectName,newName);
 }
 
@@ -473,2 +536,3 @@
   return this->objectName;
 }
+
Index: orxonox/branches/levelloader/src/lib/coord/p_node.h
===================================================================
--- orxonox/branches/levelloader/src/lib/coord/p_node.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/coord/p_node.h	(revision 3605)
@@ -22,12 +22,23 @@
 #define _P_NODE_H
 
-#include "stdincl.h"
+#include "base_object.h"
 
+// FORWARD DEFINITION \\
 class PNode; /* forward decleration, so that parentEntry has access to PNode */
+class Quaternion;
+class Vector;
 
 //! enumeration for the different translation-binding-types
-typedef enum parentingMode {MOVEMENT = 0, ROTATION, ALL};
+//typedef enum parentingMode {PNODE_LOCAL_ROTATE, PNODE_ROTATE_MOVEMENT, PNODE_ALL, PNODE_MOVEMENT, PNODE_ROTATE_AND_MOVE};
+// linkage modes
+#define PNODE_LOCAL_ROTATE       1    //!< Rotates all the children around their centers.
+#define PNODE_ROTATE_MOVEMENT    2    //!< Moves all the children around the center of their parent, without the rotation around their own centers.
+#define PNODE_MOVEMENT           4    //!< Moves all children along with the parent.
+// special linkage modes
+#define PNODE_ALL                3    //!< Moves all children around the center of their parent, and also rotates their centers
+#define PNODE_ROTATE_AND_MOVE    5    //!< Rotates all children around their axis, and moves them as the Parent Moves, but does not rotate around the center of their parent.
+
 //! The default mode of the translation-binding.
-#define DEFAULT_MODE ALL
+#define DEFAULT_MODE PNODE_ALL
 
 //! Patent Node is a Engine to calculate the position of an Object in respect to the position of its parent.
@@ -39,10 +50,8 @@
   virtual ~PNode ();
 
-  void destroy ();
-
   PNode* parent;            //!< a pointer to the parent node
   tList<PNode>* children;   //!< list of the children
 
-  parentingMode mode;       //!< the mode of the binding
+
 
   Vector getRelCoor ();
@@ -62,14 +71,17 @@
 
   void addChild (PNode* pNode);
-  void addChild (PNode* pNode, parentingMode mode);
+  void addChild (PNode* pNode, int parentingMode);
   void removeChild (PNode* pNode);
+  void remove();
+
+
   void setParent (PNode* parent);
   void parentCoorChanged ();
   void parentDirChanged ();
-  void setMode (parentingMode mode);
+  void setMode (int parentingMode);
+  int getMode();
 
-  virtual void update (float timeStamp);
+  virtual void update ();
   void processTick (float dt);
-  virtual void tick (float dt);
 
   void setName (const char* newName);
@@ -79,4 +91,8 @@
   void debug ();
 
+ private:
+  void init(PNode* parent);
+
+ protected:
   float timeStamp;         //!< this the timeStamp of when the abs{Coordinat, Direction} has been calculated
   char* objectName;        //!< The name of the Object
@@ -91,5 +107,8 @@
   Quaternion absDirection; //!< absolute direvtion in the world ( from (0,0,1) )
 
+  int mode;                //!< the mode of the binding
+
 };
 
 #endif /* _P_NODE_H */
+ 
Index: orxonox/branches/levelloader/src/lib/graphics/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/Makefile.in	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/Makefile.in	(revision 3605)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.2 from Makefile.am.
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
 # @configure_input@
 
@@ -78,4 +78,6 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@
+DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@
 DOXYGEN = @DOXYGEN@
 DOXYGEN_FALSE = @DOXYGEN_FALSE@
@@ -175,7 +177,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/graphics/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/graphics/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -270,12 +272,14 @@
 	tags=; \
 	here=`pwd`; \
-	if (etags --etags-include --version) >/dev/null 2>&1; then \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
+	  empty_fix=.; \
 	else \
 	  include_option=--include; \
+	  empty_fix=; \
 	fi; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -f $$subdir/TAGS && \
+	    test ! -f $$subdir/TAGS || \
 	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
@@ -287,7 +291,9 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
Index: orxonox/branches/levelloader/src/lib/graphics/font/fontset.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/font/fontset.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/font/fontset.cc	(revision 3605)
@@ -45,5 +45,6 @@
 #include <stdarg.h>
 
-#include "../importer/texture.h"
+#include "texture.h"
+#include <string.h>
 
 /** 
Index: orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.in	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.in	(revision 3605)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.2 from Makefile.am.
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
 # @configure_input@
 
@@ -42,5 +42,5 @@
 subdir = src/lib/graphics/importer
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in TODO
+	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -50,5 +50,5 @@
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
-am__installdirs = $(DESTDIR)$(bindir)
+am__installdirs = "$(DESTDIR)$(bindir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
@@ -98,4 +98,6 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@
+DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@
 DOXYGEN = @DOXYGEN@
 DOXYGEN_FALSE = @DOXYGEN_FALSE@
@@ -215,7 +217,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -237,5 +239,5 @@
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	$(mkdir_p) $(DESTDIR)$(bindir)
+	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
@@ -243,6 +245,6 @@
 	  ; then \
 	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
-	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
 	  else :; fi; \
 	done
@@ -252,6 +254,6 @@
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
-	  echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
-	  rm -f $(DESTDIR)$(bindir)/$$f; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
 	done
 
@@ -330,7 +332,9 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
@@ -387,5 +391,7 @@
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 installdirs:
-	$(mkdir_p) $(DESTDIR)$(bindir)
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
 install: install-am
 install-exec: install-exec-am
Index: orxonox/branches/levelloader/src/lib/graphics/importer/array.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/array.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/array.cc	(revision 3605)
@@ -13,4 +13,6 @@
    co-programmer: ...
 */
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
 
 #include "array.h"
@@ -30,5 +32,5 @@
 Array::~Array()
 {
-  PRINTF(2)("deleting array\n");
+  PRINTF(4)("deleting array\n");
   Entry* walker = this->firstEntry;
   Entry* previous;
@@ -49,5 +51,5 @@
 void Array::initializeArray ()
 {
-  PRINTF(2)("crating new Array\n");
+  PRINTF(4)("crating new Array\n");
   this->firstEntry = new Entry;
   this->firstEntry->next =NULL;
@@ -64,5 +66,5 @@
 void Array::finalizeArray (void)
 {
-  PRINTF(3)("Finalizing array. Length: %i\n", entryCount);  
+  PRINTF(4)("Finalizing array. Length: %i\n", entryCount);  
   //  if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL)
   if (!(this->array = new GLfloat [this->entryCount]))
@@ -87,5 +89,5 @@
   if (!this->finalized)
     {
-      PRINTF(3)("adding new Entry to Array: %f\n", entry);
+      PRINTF(5)("adding new Entry to Array: %f\n", entry);
       
       this->currentEntry->value = entry;
@@ -96,5 +98,5 @@
     }
   else 
-    PRINTF(1)("adding failed, because list has been finalized\n");
+    PRINTF(2)("adding failed, because list has been finalized\n");
 }
 
@@ -131,4 +133,4 @@
 void Array::debug ()
 {
-  PRINTF(0)("entryCount=%i, address=%p\n", this->entryCount, this->array);
+  PRINT(0)("entryCount=%i, address=%p\n", this->entryCount, this->array);
 }
Index: orxonox/branches/levelloader/src/lib/graphics/importer/array.h
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/array.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/array.h	(revision 3605)
@@ -8,6 +8,4 @@
 #ifndef _ARRAY_H
 #define _ARRAY_H
-
-extern int verbose; //!< will be obsolete soon
 
 #include "stdincl.h"
Index: orxonox/branches/levelloader/src/lib/graphics/importer/material.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/material.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/material.cc	(revision 3605)
@@ -15,7 +15,10 @@
 */
 
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
+
 #include "material.h"
 
 #include "texture.h"
+#include "debug.h"
 #include <stdlib.h>
 #include <string.h>
@@ -51,5 +54,5 @@
 Material::~Material()
 {
-  PRINTF(2)("delete Material %s.\n", this->name);
+  PRINTF(4)("delete Material %s.\n", this->name);
   if (this->name)
     delete []this->name;
@@ -67,5 +70,5 @@
 Material* Material::addMaterial(char* mtlName)
 {
-  PRINTF(2)("adding Material %s.\n", mtlName);
+  PRINTF(4)("adding Material %s.\n", mtlName);
    Material* tmpMat = this;
   while (tmpMat->nextMat != NULL)
@@ -83,5 +86,5 @@
 void Material::init(void)
 {
-  PRINTF(2)("initializing new Material.\n");
+  PRINTF(4)("initializing new Material.\n");
   this->nextMat = NULL;
   this->name ="";
@@ -112,17 +115,17 @@
 Material* Material::search(char* mtlName)
 {
-  PRINTF(2)("Searching for material %s", mtlName);
+  PRINTF(5)("Searching for material %s", mtlName);
   Material* searcher = this;
   while (searcher != NULL)
     {
-      PRINT(2)(".");
+      PRINT(5)(".");
       if (!strcmp (searcher->getName(), mtlName))
 	{
-	  PRINT(2)("found.\n");
+	  PRINT(5)("found.\n");
 	  return searcher;
 	}
       searcher = searcher->nextMat;
     }
-  PRINT(2)("not found\n");
+  PRINT(2)("material %s not found\n", mtlName);
   return NULL;
 }
@@ -153,8 +156,13 @@
 
   if (this->diffuseTextureSet)
-    glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());
+    {
+      glEnable(GL_TEXTURE_2D);
+      glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());
+    }
   else
-    glBindTexture(GL_TEXTURE_2D, 0);
-  
+    {
+      glDisable(GL_TEXTURE_2D);
+      glBindTexture(GL_TEXTURE_2D, 0);
+    }
 }
 
@@ -166,5 +174,5 @@
 void Material::setName (char* mtlName)
 {
-  PRINTF(3)("setting Material Name to %s.\n", this->name);
+  PRINTF(4)("setting Material Name to %s.\n", this->name);
   this->name = new char [strlen(mtlName)+1];
   strcpy(this->name, mtlName);
@@ -185,7 +193,6 @@
 void Material::setIllum (int illum)
 {
-  PRINTF(3)("setting illumModel of Material %s to %i\n", this->name, illum);
+  PRINTF(4)("setting illumModel of Material %s to %i\n", this->name, illum);
   this->illumModel = illum;
-  //  PRINTF(3)("setting illumModel to: %i\n", illumModel);
 }
 /**
@@ -205,5 +212,5 @@
 void Material::setDiffuse (float r, float g, float b)
 {
-  PRINTF(3)("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);
+  PRINTF(4)("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);
   this->diffuse[0] = r;
   this->diffuse[1] = g;
@@ -231,5 +238,5 @@
 void Material::setAmbient (float r, float g, float b)
 {
-  PRINTF(3)("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);
+  PRINTF(4)("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);
   this->ambient[0] = r;
   this->ambient[1] = g;
@@ -256,5 +263,5 @@
 void Material::setSpecular (float r, float g, float b)
 {
-  PRINTF(3)("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);
+  PRINTF(4)("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);
   this->specular[0] = r;
   this->specular[1] = g;
@@ -296,5 +303,5 @@
 void Material::setTransparency (float trans)
 {
-  PRINTF(3)("setting Transparency of Material %s to %f.\n", this->name, trans);
+  PRINTF(4)("setting Transparency of Material %s to %f.\n", this->name, trans);
   this->transparency = trans;
 }
@@ -325,5 +332,5 @@
 void Material::setDiffuseMap(char* dMap)
 {
-  PRINTF(3)("setting Diffuse Map %s\n", dMap);
+  PRINTF(4)("setting Diffuse Map %s\n", dMap);
   diffuseTexture = new Texture();
   this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
Index: orxonox/branches/levelloader/src/lib/graphics/importer/material.h
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/material.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/material.h	(revision 3605)
@@ -9,7 +9,4 @@
 #define _MATERIAL_H
 
-
-
-extern int verbose; //!< will be obsolete soon.
 
 #if HAVE_CONFIG_H 
Index: orxonox/branches/levelloader/src/lib/graphics/importer/model.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/model.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/model.cc	(revision 3605)
@@ -13,4 +13,6 @@
    co-programmer: ...
 */
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
 
 #include "model.h"
@@ -80,14 +82,14 @@
 Model::~Model(void)
 {
-  PRINTF(3)("Deleting Model ");
+  PRINTF(4)("Deleting Model ");
   if (this->name)
     {
-      PRINT(3)("%s\n", this->name);
+      PRINT(4)("%s\n", this->name);
       delete []this->name;
     }
   else
-      PRINT(3)("\n");
-
-  PRINTF(3)("Deleting display Lists.\n");
+      PRINT(4)("\n");
+
+  PRINTF(4)("Deleting display Lists.\n");
   Group* walker = this->firstGroup;
   while (walker != NULL)
@@ -99,5 +101,5 @@
     }
 
-  PRINTF(3)("Deleting Materials.\n");
+  PRINTF(4)("Deleting Materials.\n");
   if (this->material)
     delete this->material;
@@ -122,9 +124,9 @@
 void Model::draw (void) const
 {
-  PRINTF(2)("drawing the 3D-Models\n"); 
+  PRINTF(4)("drawing the 3D-Models\n"); 
   Group* walker = this->firstGroup;
   while (walker != NULL)
     {
-      PRINTF(3)("Drawing model %s\n", walker->name);
+      PRINTF(5)("Drawing model %s\n", walker->name);
       glCallList (walker->listNumber);
       walker = walker->next;
@@ -142,8 +144,8 @@
   if (groupNumber >= this->groupCount)
     {
-      PRINTF(1)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);
+      PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);
       return;
     }
-  PRINTF(2)("drawing the requested 3D-Models if found.\n"); 
+  PRINTF(4)("drawing the requested 3D-Models if found.\n"); 
   Group* walker = this->firstGroup;
   int counter = 0;
@@ -152,5 +154,5 @@
       if (counter == groupNumber)
 	{
-	  PRINTF(2)("Drawing model number %i named %s\n", counter, walker->name);
+	  PRINTF(4)("Drawing model number %i named %s\n", counter, walker->name);
 	  glCallList (walker->listNumber);
 	  return;
@@ -159,5 +161,5 @@
       walker = walker->next;
     }
-  PRINTF(1)("Model number %i in %s not Found.\n", groupNumber, this->name);
+  PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->name);
   return;
 
@@ -172,5 +174,5 @@
 void Model::draw (char* groupName) const
 {
-  PRINTF(2)("drawing the requested 3D-Models if found.\n"); 
+  PRINTF(4)("drawing the requested 3D-Models if found.\n"); 
   Group* walker = this->firstGroup;
   while (walker != NULL)
@@ -178,5 +180,5 @@
       if (!strcmp(walker->name, groupName))
 	{
-	  PRINTF(2)("Drawing model %s\n", walker->name);
+	  PRINTF(4)("Drawing model %s\n", walker->name);
 	  glCallList (walker->listNumber);
 	  return;
@@ -184,5 +186,5 @@
       walker = walker->next;
     }
-  PRINTF(1)("Model Named %s in %s not Found.\n", groupName, this->name);
+  PRINTF(2)("Model Named %s in %s not Found.\n", groupName, this->name);
   return;
 }
@@ -204,5 +206,5 @@
 bool Model::initialize (void)
 {
-  PRINTF(2)("new 3D-Model is being created\n"); 
+  PRINTF(4)("new 3D-Model is being created\n"); 
 
   this->name = NULL;
@@ -243,5 +245,5 @@
 bool Model::initGroup(Group* group)
 {
-  PRINTF(3)("Adding new Group\n");
+  PRINTF(4)("Adding new Group\n");
   group->name = "";
   group->faceMode = -1;
@@ -277,5 +279,5 @@
 bool Model::cleanup(void)
 {
-  PRINTF(3)("cleaning up the 3D-Model to save Memory.\n");
+  PRINTF(4)("cleaning up the 3D-Model to save Memory.\n");
 
   if (this->vertices)
@@ -296,5 +298,5 @@
 bool Model::cleanupGroup (Group* group)
 {
-  PRINTF(3)("Cleaning up group\n");
+  PRINTF(5)("Cleaning up group\n");
   if (group->firstFace != NULL)
     {
@@ -314,5 +316,5 @@
 bool Model::cleanupFace (Face* face)
 {
-  PRINTF(3)("Cleaning up Face\n");
+  PRINTF(5)("Cleaning up Face\n");
 
   if (face->materialString != NULL)
@@ -355,5 +357,5 @@
 bool Model::addGroup (char* groupString)
 {
-  PRINTF(3)("Read Group: %s.\n", groupString);
+  PRINTF(5)("Read Group: %s.\n", groupString);
   if (this->groupCount != 0 && this->currentGroup->faceCount>0)
     {
@@ -384,5 +386,5 @@
   float subbuffer3;
   sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
-  PRINTF(3)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3);
+  PRINTF(5)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3);
   this->vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor);
   return true;
@@ -398,5 +400,5 @@
 bool Model::addVertex(const float x, const float y, const float z)
 {
-  PRINTF(4)("reading in a vertex: %f %f %f\n", x, y, z);
+  PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z);
   this->vertices->addEntry(x*scaleFactor, y*scaleFactor, z*scaleFactor);
   return true;
@@ -513,5 +515,5 @@
   float subbuffer3;
   sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
-  PRINTF(3)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);
+  PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);
   this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3);
   return true;
@@ -544,5 +546,5 @@
   float subbuffer2;
   sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2);
-  PRINTF(3)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);
+  PRINTF(5)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);
   this->vTexture->addEntry(subbuffer1);
   this->vTexture->addEntry(subbuffer2);
@@ -610,5 +612,5 @@
       if ((this->currentGroup->listNumber = glGenLists(1)) == 0)
 	{
-	  PRINTF(1)("list could not be created for this Model\n");
+	  PRINTF(2)("glList could not be created for this Model\n");
 	  return false;
 	}
@@ -628,8 +630,8 @@
 		{
 		  tmpMat->select();
-		  PRINTF(2)("using material %s for coming Faces.\n", tmpFace->materialString);
+		  PRINTF(5)("using material %s for coming Faces.\n", tmpFace->materialString);
 		}
 	      else 
-		PRINTF(1)("material %s not found.\n", tmpFace->materialString);
+		PRINTF(2)("material %s not found.\n", tmpFace->materialString);
 
 
@@ -646,5 +648,5 @@
 	      
 	      this->currentGroup->faceMode = 3;
-	      PRINTF(3)("found triag.\n");
+	      PRINTF(5)("found triag.\n");
 	    }
 	  
@@ -658,5 +660,5 @@
 		}
 	      this->currentGroup->faceMode = 4;
-	      PRINTF(3)("found quad.\n");
+	      PRINTF(5)("found quad.\n");
 	    }
 	  
@@ -666,5 +668,5 @@
 		glEnd();
 	      glBegin(GL_POLYGON);
-	      PRINTF(3)("Polygon with %i faces found.", tmpFace->vertexCount);
+	      PRINTF(5)("Polygon with %i faces found.", tmpFace->vertexCount);
 	      this->currentGroup->faceMode = tmpFace->vertexCount;
 	    }
@@ -698,5 +700,5 @@
 bool Model::addGLElement (FaceElement* elem)
 {
-  PRINTF(3)("importing grafical Element to openGL.\n");
+  PRINTF(5)("importing grafical Element to openGL.\n");
 
   if (elem->texCoordNumber != -1)
@@ -721,5 +723,5 @@
 {
   
-  PRINTF(2)("Normals are being calculated.\n");
+  PRINTF(4)("Normals are being calculated.\n");
 
   Vector* normArray = new Vector [vertices->getCount()/3];
@@ -778,5 +780,5 @@
     {
       normArray[i].normalize();
-      PRINTF(3)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
+      PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
       
       this->normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z);
@@ -881,5 +883,5 @@
 	//printf ("%f %f\n", vz, sin (vz));
 	if (i==0.0)
-		  printf("%f, %f\n", j/df*2.0*PI, cos(j/df*PI));
+	  PRINTF(0)("%f, %f\n", j/df*2.0*PI, cos(j/df*PI));
       }
     }
Index: orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc	(revision 3605)
@@ -13,4 +13,6 @@
    co-programmer: ...
 */
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
 
 #include "objModel.h"
@@ -86,5 +88,5 @@
 bool OBJModel::importFile (const char* fileName)
 {
-  PRINTF(3)("preparing to read in file: %s\n", fileName);
+  PRINTF(4)("preparing to read in file: %s\n", fileName);
 
 
@@ -107,9 +109,8 @@
   strncpy(this->objPath, fileName, name-fileName);
   this->objPath[name-fileName] = '\0';
-  if (verbose>=2)
-    if (strlen(objPath)> 0)
-      PRINTF(0)("Resolved file %s to folder: %s.\n", name, objPath);
-    else
-      PRINTF(0)("Resolved file %s.\n", name);
+  if (strlen(objPath)> 0)
+    PRINTF(5)("Resolved file %s to folder: %s.\n", name, objPath);
+  else
+    PRINTF(5)("Resolved file %s.\n", name);
   
   this->setName(name);
@@ -144,10 +145,10 @@
       return false;
     }
-  PRINTF(2)("Reading from opened file %s\n", fileName);
+  PRINTF(4)("Reading from opened file %s\n", fileName);
   char Buffer[10000];
   while(!OBJ_FILE->eof())
     {
       OBJ_FILE->getline(Buffer, 10000);
-      PRINTF(3)("Read input line: %s\n", Buffer);
+      PRINTF(5)("Read input line: %s\n", Buffer);
       
 
@@ -192,6 +193,5 @@
       else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented
 	{
-	  if (verbose >= 2)
-	    PRINTF(2)("smoothing groups not supportet yet. line: %s\n", Buffer);
+	  PRINTF(3)("smoothing groups not supportet yet. line: %s\n", Buffer);
 	}
     }
@@ -221,10 +221,10 @@
   
 
-  PRINTF(3)("Opening mtlFile: %s\n", fileName);
+  PRINTF(4)("Opening mtlFile: %s\n", fileName);
 
   ifstream* MTL_FILE = new ifstream (fileName);
   if (MTL_FILE->fail())
     {
-      PRINTF(1)("unable to open file: %s\n", fileName);
+      PRINTF(2)("unable to open file: %s\n", fileName);
       MTL_FILE->close();
       delete []fileName;
@@ -237,5 +237,5 @@
     {
       MTL_FILE->getline(Buffer, 500);
-      PRINTF(4)("found line in mtlFile: %s\n", Buffer);
+      PRINTF(5)("found line in mtlFile: %s\n", Buffer);
       
 
Index: orxonox/branches/levelloader/src/lib/graphics/importer/texture.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/texture.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/texture.cc	(revision 3605)
@@ -17,4 +17,6 @@
 */
 
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
 
 #include "texture.h"
@@ -87,5 +89,5 @@
   if (pName[0] == '\0')
     {
-      PRINTF(3)("not Adding empty Path to the List.\n");
+      PRINTF(2)("not Adding empty Path to the List.\n");
       return;
     }
@@ -99,5 +101,5 @@
       if (status.st_mode & S_IFDIR)
 	{
-	  PRINTF(2)("Adding Path %s to the PathList.\n", pName);
+	  PRINTF(4)("Adding Path %s to the PathList.\n", pName);
 	  PathList* tmpPathList = this;
 	  while (tmpPathList->next)
@@ -193,5 +195,5 @@
 bool Texture::loadTexToGL (Image* pImage)
 {
-  PRINTF(2)("Loading texture to OpenGL-Environment.\n");
+  PRINTF(4)("Loading texture to OpenGL-Environment.\n");
   glGenTextures(1, &this->texture);
   glBindTexture(GL_TEXTURE_2D, this->texture);
@@ -229,5 +231,4 @@
 	pImage->format = GL_RGBA;
 	  
-      PRINTF(0)("Bits Per Pixel: %d\n", pImage->bpp);
       if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb")))
 	for (int i=0;i<map->h * map->w *3;i+=3)
@@ -249,5 +250,5 @@
   else
     {
-      PRINTF(1)("Image not Found: %s\n", imgNameWithPath);
+      PRINTF(2)("Image not Found: %s\n", imgNameWithPath);
       return false;
     }
@@ -268,5 +269,5 @@
       if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4))
 	{
-	  PRINTF(3)("Requested bmp-image. Trying to Import.\n");
+	  PRINTF(4)("Requested bmp-image. Trying to Import.\n");
 	  return this->loadBMP(imgNameWithPath);
 	}
@@ -274,20 +275,20 @@
       else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5))
 	{
-	  PRINTF(3)("Requested jpeg-image. Trying to Import\n");
+	  PRINTF(4)("Requested jpeg-image. Trying to Import\n");
 	  return this->loadJPG(imgNameWithPath);
 	}
       else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4))
 	{
-	  PRINTF(3)("Requested tga-image. Trying to Import\n");
+	  PRINTF(4)("Requested tga-image. Trying to Import\n");
 	  return this->loadTGA(imgNameWithPath);
 	}
       else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4))
 	{
-	  PRINTF(3)("Requested png-image. Trying to Import\n");
+	  PRINTF(4)("Requested png-image. Trying to Import\n");
 	  return this->loadPNG(imgNameWithPath);
 	}
       else
 	{
-	  PRINTF(1)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath);
+	  PRINTF(2)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath);
 	  return false;
 	}
@@ -295,5 +296,5 @@
   else
     {
-      PRINTF(1)("Image not Found: %s\n", imgNameWithPath);
+      PRINTF(2)("Image not Found: %s\n", imgNameWithPath);
       return false;
     }
@@ -316,5 +317,5 @@
   if ((file = fopen(bmpName, "rb"))==NULL)
     {
-      PRINTF(1)("File Not Found : %s\n",bmpName);
+      PRINTF(2)("File Not Found : %s\n",bmpName);
       return false;
     }
@@ -325,5 +326,5 @@
   if ((i = fread(&pImage->width, 4, 1, file)) != 1) 
     {
-      PRINTF(1)("Error reading width from %s.\n", bmpName);
+      PRINTF(2)("Error reading width from %s.\n", bmpName);
       return false;
     }
@@ -331,5 +332,5 @@
   if ((i = fread(&pImage->height, 4, 1, file)) != 1) 
     {
-      PRINTF(1)("Error reading height from %s.\n", bmpName);
+      PRINTF(2)("Error reading height from %s.\n", bmpName);
       return false;
     }
@@ -341,5 +342,5 @@
   if ((fread(&planes, 2, 1, file)) != 1) 
     {
-      PRINTF(1)("Error reading planes from %s.\n", bmpName);
+      PRINTF(2)("Error reading planes from %s.\n", bmpName);
       return false;
     }
@@ -353,10 +354,10 @@
   if ((i = fread(&bpp, 2, 1, file)) != 1) 
     {
-      PRINTF(1)("Error reading bpp from %s.\n", bmpName);
+      PRINTF(2)("Error reading bpp from %s.\n", bmpName);
       return false;
     }
   if (bpp != 24) 
     {
-      PRINTF(1)("Bpp from %s is not 24: %u\n", bmpName, bpp);
+      PRINTF(2)("Bpp from %s is not 24: %u\n", bmpName, bpp);
       return false;
     }
@@ -369,5 +370,5 @@
   if (pImage->data == NULL) 
     {
-      PRINTF(1)("Error allocating memory for color-corrected image data");
+      PRINTF(2)("Error allocating memory for color-corrected image data");
       return false;	
     }
@@ -375,5 +376,5 @@
   if ((i = fread(pImage->data, size, 1, file)) != 1) 
     {
-      PRINTF(1)("Error reading image data from %s.\n", bmpName);
+      PRINTF(2)("Error reading image data from %s.\n", bmpName);
       return false;
     }
@@ -418,5 +419,5 @@
     {
       // Display an error message saying the file was not found, then return NULL
-      PRINTF(1)("Unable to load JPG File %s.\n", jpgName);
+      PRINTF(2)("Unable to load JPG File %s.\n", jpgName);
       return false;
     }
@@ -521,5 +522,5 @@
   if(fTGA == NULL)
     {
-      PRINTF(1)("Error could not open texture file: %s\n", tgaName);
+      PRINTF(2)("Error could not open texture file: %s\n", tgaName);
       return false;
     }
@@ -527,5 +528,5 @@
   if(fread(&tgaHeader, sizeof(TGAHeader), 1, fTGA) == 0)
     {
-      PRINTF(1)("Error could not read file header of %s\n", tgaName);
+      PRINTF(2)("Error could not read file header of %s\n", tgaName);
       if(fTGA != NULL)
 	{
@@ -549,5 +550,5 @@
   else
     {
-      PRINTF(1)("Error TGA file be type 2 or type 10\n");
+      PRINTF(2)("Error TGA file be type 2 or type 10\n");
       if (fTGA)
 	fclose(fTGA);
@@ -576,5 +577,5 @@
   if(fread(header, sizeof(header), 1, fTGA) == 0)
     {
-      PRINTF(1)("Error could not read info header\n");
+      PRINTF(2)("Error could not read info header\n");
       return false;
     }
@@ -586,5 +587,5 @@
   if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32)))
     {
-      PRINTF(1)("Error invalid texture information\n");
+      PRINTF(2)("Error invalid texture information\n");
       return false;
     }
@@ -605,5 +606,5 @@
   if(pImage->data == NULL)
     {
-      PRINTF(1)("Error could not allocate memory for image\n");
+      PRINTF(2)("Error could not allocate memory for image\n");
       return false;
     }
@@ -611,5 +612,5 @@
   if(fread(pImage->data, 1, imageSize, fTGA) != imageSize)
     {
-      PRINTF(1)("Error could not read image data\n");
+      PRINTF(2)("Error could not read image data\n");
       if(pImage->data != NULL)
 	{
@@ -648,5 +649,5 @@
   if(fread(header, sizeof(header), 1, fTGA) == 0)
     {
-      PRINTF(1)("Error could not read info header\n");
+      PRINTF(2)("Error could not read info header\n");
       return false;
     }
@@ -664,5 +665,5 @@
   if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32)))
     {
-      PRINTF(1)("Error Invalid pImage information\n");
+      PRINTF(2)("Error Invalid pImage information\n");
       return false;
     }
@@ -674,5 +675,5 @@
   if(pImage->data == NULL)
     {
-      PRINTF(1)("Error could not allocate memory for image\n");
+      PRINTF(2)("Error could not allocate memory for image\n");
       return false;
     }
@@ -684,5 +685,5 @@
       if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0)
 	{
-	  PRINTF(1)("Error could not read RLE header\n");
+	  PRINTF(2)("Error could not read RLE header\n");
 	  if(pImage->data != NULL)
 	    {
@@ -702,5 +703,5 @@
 	      if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel)
 		{
-		  PRINTF(1)("Error could not read image data\n");
+		  PRINTF(2)("Error could not read image data\n");
 		  if(colorbuffer != NULL)
 		    {
@@ -732,5 +733,5 @@
 	      if(currentpixel > pixelcount)	
 		{
-		  PRINTF(1)("Error too many pixels read\n");
+		  PRINTF(2)("Error too many pixels read\n");
 		  if(colorbuffer != NULL)
 		    {
@@ -754,5 +755,5 @@
 	  if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel) // Attempt to read following color values 
 	    {
-	      PRINTF(1)("Error could not read from file");
+	      PRINTF(2)("Error could not read from file");
 	      if(colorbuffer != NULL)
 		{
@@ -785,5 +786,5 @@
 	      if(currentpixel > pixelcount)
 		{
-		  PRINTF(1)("Error too many pixels read\n");
+		  PRINTF(2)("Error too many pixels read\n");
 		  if(colorbuffer != NULL)
 		    {
Index: orxonox/branches/levelloader/src/lib/graphics/importer/texture.h
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/texture.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/texture.h	(revision 3605)
@@ -10,5 +10,8 @@
 #define _TEXTURE_H
 
-#include "stdincl.h"
+#include "glincl.h"
+
+#include "debug.h"
+
 #ifdef HAVE_SDL_SDL_IMAGE_H
 #include <SDL/SDL_image.h>
Index: orxonox/branches/levelloader/src/lib/graphics/importer/windowHandler.h
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/windowHandler.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/windowHandler.h	(revision 3605)
@@ -7,6 +7,4 @@
 #ifndef _WINDOWHANDLER_H
 #define _WINDOWHANDLER_H
-
-extern int verbose;
 
 #include "stdincl.h"
Index: orxonox/branches/levelloader/src/lib/graphics/light.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/light.cc	(revision 3605)
+++ orxonox/branches/levelloader/src/lib/graphics/light.cc	(revision 3605)
@@ -0,0 +1,524 @@
+
+
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LIGHT
+
+#include "light.h"
+
+#include "glincl.h"
+
+using namespace std;
+
+//! Definition of the Lights
+int lightsV[] = {GL_LIGHT0, GL_LIGHT1, GL_LIGHT2, GL_LIGHT3, GL_LIGHT4, GL_LIGHT5, GL_LIGHT6, GL_LIGHT7};
+
+
+/**
+   \param lightNumber the Light Number to initiate
+*/
+Light::Light(int lightNumber)
+{
+  this->setClassName("Light");
+  char tmpName[7];
+  sprintf(tmpName, "Light%d", lightNumber);
+  this->setName(tmpName);
+
+  PRINTF(4)("initializing Light number %d.\n", lightNumber);
+  // enable The light
+  glEnable(lightsV[lightNumber]); // postSpawn
+  
+  // set values (defaults)
+  this->lightNumber = lightNumber;
+  this->setPosition(0.0, 0.0, 0.0);
+  this->setDiffuseColor(1.0, 1.0, 1.0);
+  this->setSpecularColor(1.0, 1.0, 1.0);
+}
+
+/**
+   \brief destroys a Light
+*/
+Light::~Light(void)
+{
+  glDisable(lightsV[this->lightNumber]);
+}
+
+/**
+   \brief Sets a Position for the Light.
+   \param position The new position of the Light.
+   \todo patrick: is it ok to set a Light Position even if it is derived from p_node??
+*/
+void Light::setPosition(Vector position)
+{
+  this->lightPosition[0] = position.x;
+  this->lightPosition[1] = position.y;
+  this->lightPosition[2] = position.z;
+  this->lightPosition[3] = 0.0;
+
+  this->setAbsCoor(&position);
+
+  glLightfv (lightsV[this->lightNumber], GL_POSITION, this->lightPosition);
+}
+
+/**
+   \brief Sets a Position of this Light.
+   \param x the x-coordinate
+   \param y the y-coordinate
+   \param z the z-coordinate
+*/
+void Light::setPosition(GLfloat x, GLfloat y, GLfloat z)
+{
+  this->setPosition(Vector(x, y, z));
+}
+
+/**
+   \brief sets an emitting Diffuse color of this Light
+   \param r red
+   \param g green
+   \param b blue
+*/
+void Light::setDiffuseColor(GLfloat r, GLfloat g, GLfloat b)
+{
+  this->diffuseColor[0] = r;
+  this->diffuseColor[1] = g;
+  this->diffuseColor[2] = b;
+  this->diffuseColor[3] = 1.0;
+
+  glLightfv (lightsV[this->lightNumber], GL_DIFFUSE, this->diffuseColor);
+}
+
+/**
+   \brief sets an emitting Specular color of this Light
+   \param r red
+   \param g green
+   \param b blue
+*/
+void Light::setSpecularColor(GLfloat r, GLfloat g, GLfloat b)
+{
+  this->specularColor[0] = r;
+  this->specularColor[1] = g;
+  this->specularColor[2] = b;
+  this->specularColor[3] = 1.0;
+
+  glLightfv (lightsV[this->lightNumber], GL_SPECULAR, this->specularColor);
+}
+
+/**
+   \brief Sets the AttenuationType of this Light Source
+   \param constantAttenuation The Constant Attenuation of the Light
+   \param linearAttenuation The Linear Attenuation of the Light
+   \param quadraticAttenuation The Quadratic Attenuation of the Light
+*/
+void Light::setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation)
+{
+  this->constantAttenuation  = constantAttenuation;
+  this->linearAttenuation    = linearAttenuation;
+  this->quadraticAttenuation = quadraticAttenuation;
+
+  glLightf(lightsV[this->lightNumber], GL_CONSTANT_ATTENUATION,  constantAttenuation);
+  glLightf(lightsV[this->lightNumber], GL_LINEAR_ATTENUATION,    linearAttenuation);
+  glLightf(lightsV[this->lightNumber], GL_QUADRATIC_ATTENUATION, quadraticAttenuation);
+}
+
+/**
+   \brief stets the direction of the Spot Light.
+   \param direction The direction of the Spot Light.
+*/
+void Light::setSpotDirection(Vector direction)
+{
+  this->spotDirection[0] = direction.x;
+  this->spotDirection[1] = direction.y;
+  this->spotDirection[2] = direction.z;
+
+  glLightfv(lightsV[this->lightNumber], GL_SPOT_DIRECTION, this->spotDirection);
+}
+
+/**
+   \brief sets the cutoff angle of the Light.
+   \param cutoff The cutoff angle.
+*/
+void Light::setSpotCutoff(GLfloat cutoff)
+{
+  this->spotCutoff = cutoff;
+  glLightf(lightsV[this->lightNumber], GL_SPOT_CUTOFF, cutoff);
+}
+
+/**
+   \returns the Position of the Light
+*/
+Vector Light::getPosition() const
+{
+  return Vector(this->lightPosition[0], this->lightPosition[1], this->lightPosition[2]);
+}
+
+/**
+   \brief draws this Light. Being a World-entity the possibility to do this lies at hand.
+*/ 
+void Light::draw()
+{
+  float pos[4] = {this->getAbsCoor().x, this->getAbsCoor().y, this->getAbsCoor().z, 1.0};
+  PRINTF(4)("Drawing The Lights new Position at %f %f %f\n", pos[0], pos[1], pos[2]);
+  glLightfv(lightsV[this->lightNumber], GL_POSITION, pos);
+}
+
+/**
+   \brief Prints out some nice formated debug information about the Light
+*/
+void Light::debug(void) const
+{
+  PRINT(0)(":: %d ::  -- reference %p\n", this->lightNumber, this);
+  PRINT(0)(" GL-state: ");
+  GLboolean param; 
+  glGetBooleanv(lightsV[this->lightNumber], &param);
+  if (param)
+    PRINT(0)("ON\n");
+  else
+    PRINT(0)("OFF\n");
+  
+  PRINT(0)(" Position:      %f/%f/%f\n", this->lightPosition[0], this->lightPosition[1], this->lightPosition[2]);
+  PRINT(0)(" DiffuseColor:  %f/%f/%f\n", this->diffuseColor[0], this->diffuseColor[1], this->diffuseColor[2]);
+  PRINT(0)(" SpecularColor: %f/%f/%f\n", this->specularColor[0], this->specularColor[1], this->specularColor[2]);
+  PRINT(0)(" Attenuation: constant=%f linear=%f quadratic=%f\n", this->constantAttenuation, this->linearAttenuation, this->quadraticAttenuation);
+}
+
+
+/******************
+** LIGHT-MANAGER **
+******************/
+/**
+   \brief standard constructor for a Light
+*/
+LightManager::LightManager () 
+{
+  this->setClassName ("LightManager");
+
+  glEnable (GL_LIGHTING);
+  this->setAmbientColor(.3, .3, .3);
+  this->lights = new Light*[NUMBEROFLIGHTS];
+  for (int i = 0; i < NUMBEROFLIGHTS; i++)
+    lights[i] = NULL;
+  this->currentLight = NULL;
+}
+
+/**
+   \brief standard deconstructor
+   
+   first disables Lighting
+
+   then deletes the rest of the allocated memory
+   and in the end sets the singleton Reference to zero.
+*/
+LightManager::~LightManager () 
+{
+  glDisable(GL_LIGHTING);
+  
+  // this will be done either by worldEntity, or by pNode as each light is one of them
+  //  for (int i = 0; i < NUMBEROFLIGHTS; i++)
+  //    this->deleteLight(i);
+  delete lights;
+  LightManager::singletonRef = NULL;
+}
+
+/**
+   \brief singleton-Reference to the Light-class
+*/
+LightManager* LightManager::singletonRef = NULL;
+
+/**
+   \returns The Instance of the Lights
+*/
+LightManager* LightManager::getInstance(void)
+{
+  if (!singletonRef)
+    LightManager::singletonRef = new LightManager();
+  return singletonRef;
+}
+
+/**
+   \brief initializes a new Light with default values, and enables GL_LIGHTING
+*/
+void LightManager::initLight(int lightNumber)
+{
+  lights[lightNumber] = new Light(lightNumber);
+}
+
+/**
+   \brief Adds a new Light, by selecting the First free slot.
+
+   if no slot is free error
+*/
+int LightManager::addLight(void)
+{
+  for (int i = 0; i < NUMBEROFLIGHTS; i++)
+    if (!this->lights[i])
+      return addLight(i); 
+  PRINTF(1)("no more light slots availiable. All %d already taken\n", NUMBEROFLIGHTS);
+  return -1;
+}
+
+/**
+   \brief Adds a new Light
+   \param lightNumber The number of the light to add.
+
+   if the Number is not free: warn, automatically choose another slot.
+*/
+int LightManager::addLight(int lightNumber)
+{
+  if (this->lights[lightNumber])
+    {
+      PRINTF(2)("Lightslot %d is allready taken, trying another one\n", lightNumber);
+      return this->addLight();
+    }
+  this->initLight(lightNumber);
+  this->currentLight = this->lights[lightNumber];
+  return lightNumber;
+}
+
+/**
+   \brief select the light to work with
+   \param lightNumber the light to work with
+*/
+void LightManager::editLightNumber(int lightNumber)
+{
+  if (!this->currentLight)
+    { 
+      PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
+      return;
+    }
+  this->currentLight = lights[lightNumber];
+}
+
+/**
+   \brief Delete the current Light
+*/
+void LightManager::deleteLight(void)
+{
+  if (!this->currentLight)
+    { 
+      PRINTF(1)("no Light defined yet. So you cannot delete any Light right now.\n");
+      return;
+    }
+
+  this->deleteLight(this->currentLight->getLightNumber());
+}
+
+/**
+   \brief delete light.
+   \param lightNumber the number of the light to delete
+*/
+void LightManager::deleteLight(int lightNumber)
+{
+  if (this->lights[lightNumber])
+    {
+      PRINTF(4)("deleting Light number %d\n", lightNumber);
+      delete this->lights[lightNumber];
+      this->lights[lightNumber] = NULL;
+    }
+}
+
+/**
+   \brief draws all the Lights in their appropriate position
+*/
+void LightManager::draw()
+{
+  glMatrixMode(GL_MODELVIEW);
+  glLoadIdentity();
+  PRINTF(4)("Drawing the Lights\n");
+  for (int i = 0; i < NUMBEROFLIGHTS; i++)
+    if (this->lights[i])
+      lights[i]->draw();
+}
+
+
+
+// set Attributes
+/**
+   \brief sets the ambient Color of the Scene
+   \param r red
+   \param g green
+   \param b blue
+*/
+void LightManager::setAmbientColor(GLfloat r, GLfloat g, GLfloat b)
+{
+  this->ambientColor[0] = r;
+  this->ambientColor[1] = g;
+  this->ambientColor[2] = b;
+  this->ambientColor[3] = 1.0;
+
+  glLightfv (GL_LIGHT0, GL_AMBIENT, this->ambientColor);
+}
+
+/**
+   \brief sets The Position of the currently selected Light
+   \param position the new Position
+*/
+void LightManager::setPosition(Vector position)
+{
+  this->currentLight->setPosition(position);
+}
+
+/**
+   \brief Sets a Position for the currently selected Light.
+   \param x the x-coordinate
+   \param y the y-coordinate
+   \param z the z-coordinate
+*/
+void LightManager::setPosition(GLfloat x, GLfloat y, GLfloat z)
+{
+  if (!this->currentLight)
+    { 
+      PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
+      return;
+    }
+  this->currentLight->setPosition(x, y, z);
+}
+
+/**
+   \brief sets an emitting Diffuse color of the currently selected Light
+   \param r red
+   \param g green
+   \param b blue
+*/
+void LightManager::setDiffuseColor(GLfloat r, GLfloat g, GLfloat b)
+{
+  if (!this->currentLight)
+    { 
+      PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
+      return;
+    }
+  this->currentLight->setDiffuseColor(r,g,b);
+}
+
+/**
+   \brief sets an emitting Specular color of the currently selected Light
+   \param r red
+   \param g green
+   \param b blue
+*/
+void LightManager::setSpecularColor(GLfloat r, GLfloat g, GLfloat b)
+{
+  if (!this->currentLight)
+    { 
+      PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
+      return;
+    }
+  this->currentLight->setSpecularColor(r, g, b);
+}
+
+/**
+   \brief Sets the AttenuationType of th currently selecte LightSource Light Source
+   \param constantAttenuation The Constant Attenuation of the Light
+   \param linearAttenuation The Linear Attenuation of the Light
+   \param quadraticAttenuation The Quadratic Attenuation of the Light
+*/
+void LightManager::setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation)
+{
+  if (!this->currentLight)
+    { 
+      PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
+      return;
+    }
+  this->currentLight->setAttenuation(constantAttenuation, linearAttenuation, quadraticAttenuation);
+}
+
+
+/**
+   \brief stets the direction of the Spot Light.
+   \param direction The direction of the Spot Light.
+*/
+void LightManager::setSpotDirection(Vector direction)
+{
+  if (!this->currentLight)
+    { 
+      PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
+      return;
+    }
+  this->currentLight->setSpotDirection(direction);
+}
+
+/**
+   \brief sets the cutoff angle of the Light.
+   \param cutoff The cutoff angle.
+*/
+void LightManager::setSpotCutoff(GLfloat cutoff)
+{
+  if (!this->currentLight)
+    { 
+      PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
+      return;
+    }
+  this->currentLight->setSpotCutoff(cutoff);
+}
+
+// get Attributes
+/**
+   \returns the Position of the Light
+*/
+Vector LightManager::getPosition(void) const
+{
+  if (!this->currentLight)
+    { 
+      PRINTF(2)("no Light defined yet\n");
+      return Vector(.0, .0, .0);
+    }
+  else
+    return this->currentLight->getPosition();
+}
+
+/**
+   \returns the Position of Light 
+   \param lightNumber lightnumber
+*/
+Vector LightManager::getPosition(int lightNumber) const
+{
+  if (!this->lights[lightNumber])
+    {
+      PRINTF(2)("no Light defined yet\n");
+      return Vector(.0,.0,.0);
+    }
+  else
+    return this->lights[lightNumber]->getPosition();
+}
+
+/**
+   \returns a pointer to a Light
+   \param lightNumber The light to request the pointer from
+*/
+Light* LightManager::getLight(int lightNumber) const
+{
+  return this->lights[lightNumber];
+}
+
+/**
+   \brief outputs debug information about the Class and its lights
+*/
+void LightManager::debug(void) const
+{
+  PRINT(0)("=================================\n");
+  PRINT(0)("= DEBUG INFORMATION CLASS LIGHT =\n");
+  PRINT(0)("=================================\n");
+  PRINT(0)("Reference: %p\n", LightManager::singletonRef);
+  if (this->currentLight)
+    PRINT(0)("current Light Nr: %d\n", this->currentLight->getLightNumber());
+  PRINT(0)("Ambient Color: %f:%f:%f\n", this->ambientColor[0], this->ambientColor[0], this->ambientColor[0]);
+  PRINT(0)("=== Lights ===\n");
+  for (int i = 0; i < NUMBEROFLIGHTS; i++)
+    if (this->lights[i])
+      {
+	this->lights[i]->debug();
+      }
+  PRINT(0)("--------------------------------\n");
+}
Index: orxonox/branches/levelloader/src/lib/graphics/light.h
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/light.h	(revision 3605)
+++ orxonox/branches/levelloader/src/lib/graphics/light.h	(revision 3605)
@@ -0,0 +1,143 @@
+/*! 
+    \file light.h
+    \brief Handles Lights.
+
+    A Light is one of the more important things in a 3D-environment,
+    without it one sees nothing :)
+    It is here for diffuse-, specular- and Bump-Mappings.
+*/
+
+#ifndef _LIGHT_H
+#define _LIGHT_H
+
+#include "world_entity.h"
+#include "glincl.h"
+
+//! The maximum number of Lights this OpenGL-implementation supports.
+#define NUMBEROFLIGHTS GL_MAX_LIGHTS
+
+// FORWARD DEFINITIONS //
+class Vector;
+
+//! A class that handles Lights. The LightManager operates on this.
+class Light : public WorldEntity
+{
+ public:
+  Light(int lightNumber);
+  virtual ~Light(void);
+
+  void setPosition(Vector position);
+  void setPosition(GLfloat x, GLfloat y, GLfloat z);
+  void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
+  void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
+  void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation);
+  void setSpotDirection(Vector direction);
+  void setSpotCutoff(GLfloat cutoff);
+
+  Vector getPosition() const;
+  /** \returns the lightNumber*/
+  int getLightNumber(void) const {return this->lightNumber;}
+  
+  virtual void draw();
+
+  void debug(void) const;
+
+  // attributes
+ private:
+  int lightNumber;            //!< The number of this Light.
+  GLfloat lightPosition[4];   //!< The Position of this Light.
+  GLfloat diffuseColor[4];    //!< The Diffuse Color this Light emmits.
+  GLfloat specularColor[4];   //!< The specular Color of this Light.
+  float constantAttenuation;  //!< The Factor of the the Constant Attenuation.
+  float linearAttenuation;    //!< The Factor of the the Linear Attenuation.
+  float quadraticAttenuation; //!< The Factor of the the Quadratic Attenuation.
+  GLfloat spotDirection[4];   //!< The direction of the Spot Light.
+  GLfloat spotCutoff;         //!< The cutoff Angle of the Light Source
+};
+
+//! A class that handles Lights
+/**
+   A Light is a source that emits light rays (photons)
+
+   <b>Usage:</b>\n
+   First you have to get the Light Manager up and running by using LightManager::getInstance.
+   This automatically initiates the GL_LIGHTING, and sets some default stuff about the light.\n
+   Then you will create a new light using:
+   \li int addLight(void);
+   \li int addLight(int lightNumber);
+
+   now you can operate on the light as follows:
+   \li void setPosition(Vector position);
+   \li void setPosition(GLfloat x, GLfloat y, GLfloat z);
+   \li void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
+   \li void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
+   \li void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation);
+   \li void setSpotDirection(Vector direction);
+   \li void setSpotCutoff(GLfloat cutoff);
+
+   These functions are preatty selv-explaining, but you can read about them below.\n
+   If you want to fetch info, or the a Light use:
+   \li Vector getPosition(void) const;
+   \li Vector getPosition(int lightNumber) const;
+   \li Light* getLight(int LightNumber) const;
+
+   To redraw the light use
+   \li void draw();
+   
+   and to delete one just use
+   \li void deleteLight(void);
+
+   for some nice output just use:
+   \li void debug(void) const;
+
+   You can also operate on the single Lights themselves, by first retreaving them with 
+   \li Light* getLight(int LightNumber);
+   \n
+   and then using the same functions on this to change settings.
+*/
+class LightManager : public BaseObject
+{
+ private:
+  LightManager(void);
+  void initLight(int LightNumber);
+  
+  static LightManager* singletonRef;    //!< This is the LightHandlers Reference.
+  GLfloat ambientColor[4];       //!< The ambient Color of the scene.
+
+  Light** lights;                //!< An array of Lenght NUMBEROFLIGHTS, that holds pointers to all LightValues.
+  Light* currentLight;           //!< The current Light, we are working with.
+  
+ public:
+  static LightManager* getInstance();
+  virtual ~LightManager(void);
+
+  // set Attributes
+  int addLight(void);
+  int addLight(int lightNumber);
+  void editLightNumber(int lightNumber);
+  void deleteLight(void);
+  void deleteLight(int lightNumber);
+
+  void setAmbientColor(GLfloat r, GLfloat g, GLfloat b);
+
+  void draw();
+
+  //set Attributes
+  void setPosition(Vector position);
+  void setPosition(GLfloat x, GLfloat y, GLfloat z);
+  void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
+  void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
+  void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation);
+  void setSpotDirection(Vector direction);
+  void setSpotCutoff(GLfloat cutoff);
+
+  // get Attributes
+  Vector getPosition(void) const;
+  Vector getPosition(int lightNumber) const;
+  
+  Light* getLight(int lightNumber) const;
+  
+  void debug(void) const;
+};
+
+#endif /* _LIGHT_H */
Index: orxonox/branches/levelloader/src/lib/gui/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/Makefile.in	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/gui/Makefile.in	(revision 3605)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.2 from Makefile.am.
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
 # @configure_input@
 
@@ -78,4 +78,6 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@
+DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@
 DOXYGEN = @DOXYGEN@
 DOXYGEN_FALSE = @DOXYGEN_FALSE@
@@ -177,7 +179,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/gui/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/gui/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -272,12 +274,14 @@
 	tags=; \
 	here=`pwd`; \
-	if (etags --etags-include --version) >/dev/null 2>&1; then \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
+	  empty_fix=.; \
 	else \
 	  include_option=--include; \
+	  empty_fix=; \
 	fi; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -f $$subdir/TAGS && \
+	    test ! -f $$subdir/TAGS || \
 	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
@@ -289,7 +293,9 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
Index: orxonox/branches/levelloader/src/lib/gui/console/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/console/Makefile.in	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/gui/console/Makefile.in	(revision 3605)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.2 from Makefile.am.
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
 # @configure_input@
 
@@ -50,5 +50,5 @@
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
-am__installdirs = $(DESTDIR)$(bindir)
+am__installdirs = "$(DESTDIR)$(bindir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
@@ -96,4 +96,6 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@
+DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@
 DOXYGEN = @DOXYGEN@
 DOXYGEN_FALSE = @DOXYGEN_FALSE@
@@ -203,7 +205,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -225,5 +227,5 @@
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	$(mkdir_p) $(DESTDIR)$(bindir)
+	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
@@ -231,6 +233,6 @@
 	  ; then \
 	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
-	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
 	  else :; fi; \
 	done
@@ -240,6 +242,6 @@
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
-	  echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
-	  rm -f $(DESTDIR)$(bindir)/$$f; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
 	done
 
@@ -297,7 +299,9 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
@@ -354,5 +358,7 @@
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 installdirs:
-	$(mkdir_p) $(DESTDIR)$(bindir)
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
 install: install-am
 install-exec: install-exec-am
Index: orxonox/branches/levelloader/src/lib/gui/gui/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/gui/Makefile.in	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/gui/gui/Makefile.in	(revision 3605)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.2 from Makefile.am.
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
 # @configure_input@
 
@@ -50,5 +50,5 @@
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
-am__installdirs = $(DESTDIR)$(bindir)
+am__installdirs = "$(DESTDIR)$(bindir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
@@ -105,4 +105,6 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@
+DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@
 DOXYGEN = @DOXYGEN@
 DOXYGEN_FALSE = @DOXYGEN_FALSE@
@@ -236,7 +238,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -258,5 +260,5 @@
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	$(mkdir_p) $(DESTDIR)$(bindir)
+	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
@@ -264,6 +266,6 @@
 	  ; then \
 	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
-	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
 	  else :; fi; \
 	done
@@ -273,6 +275,6 @@
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
-	  echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
-	  rm -f $(DESTDIR)$(bindir)/$$f; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
 	done
 
@@ -336,7 +338,9 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
@@ -393,5 +397,7 @@
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 installdirs:
-	$(mkdir_p) $(DESTDIR)$(bindir)
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
 install: install-am
 install-exec: install-exec-am
Index: orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.h
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.h	(revision 3605)
@@ -9,7 +9,4 @@
 #include <config.h> 
 #endif
-
-//! verbose level, soon obsolete
-extern int verbose; // soon obsolete here
 
 #include "debug.h"
Index: orxonox/branches/levelloader/src/lib/lang/base_object.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/lang/base_object.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/lang/base_object.cc	(revision 3605)
@@ -26,5 +26,8 @@
    \brief standard constructor
 */
-BaseObject::BaseObject () {}
+BaseObject::BaseObject () 
+{
+  this->className = NULL;
+}
 
 
@@ -32,10 +35,13 @@
    \brief standard deconstructor
 */
-BaseObject::~BaseObject () {}
-
+BaseObject::~BaseObject () 
+{
+  delete []this->className;
+}
 
 void BaseObject::setClassName (char* className)
 {
-  this->className = className;
+  this->className = new char[strlen(className)+1];
+  strcpy(this->className, className);
 }
 
Index: orxonox/branches/levelloader/src/lib/lang/base_object.h
===================================================================
--- orxonox/branches/levelloader/src/lib/lang/base_object.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/lang/base_object.h	(revision 3605)
@@ -15,5 +15,5 @@
  public:
   BaseObject ();
-  ~BaseObject ();
+  virtual ~BaseObject ();
 
   void setClassName (char* className);
Index: orxonox/branches/levelloader/src/lib/math/curve.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/math/curve.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/math/curve.cc	(revision 3605)
@@ -19,13 +19,31 @@
      local-Time implementation
      NURBS
+     tList implementation
      
 */
 
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_MATH
+
 #include "curve.h"
-#include "matrix.h"
+
 #include "debug.h"
 
 #include <math.h>
 #include <stdio.h>
+
+
+/** 
+    \brief default constructor for a Curve
+*/
+Curve::Curve(void)
+{
+  nodeCount = 0;
+  firstNode = new PathNode;
+  currentNode = firstNode;
+
+  firstNode->position = Vector (.0, .0, .0);
+  firstNode->number = 0;
+  firstNode->next = 0; // not sure if this really points to NULL!!
+}
 
 /**
@@ -131,5 +149,4 @@
   this->derivation = 0;
   dirCurve = new BezierCurve(1);
-  this->init();
 }
 
@@ -141,5 +158,4 @@
   this->derivation = derivation;
   dirCurve=NULL;
-  this->init();
 }
 
@@ -161,20 +177,4 @@
   if (dirCurve)
     delete dirCurve;
-}
-
-/**
-   \brief Initializes a BezierCurve
-*/
-void BezierCurve::init(void)
-{
-  nodeCount = 0;
-  firstNode = new PathNode;
-  currentNode = firstNode;
-
-  firstNode->position = Vector (.0, .0, .0);
-  firstNode->number = 0;
-  firstNode->next = 0; // not sure if this really points to NULL!!
-
-  return;
 }
 
@@ -285,178 +285,2 @@
   return curvePoint;
 }
-
-
-
-///////////////////////////////////
-//// Uniform Point curve  /////////
-///////////////////////////////////
-/**
-   \brief Creates a new UPointCurve
-*/
-UPointCurve::UPointCurve (void)
-{
-  this->derivation = 0;
-  this->init();
-}
-
-/**
-   \brief Creates a new UPointCurve-Derivation-Curve of deriavation'th degree
-*/
-UPointCurve::UPointCurve (int derivation)
-{
-  this->derivation = derivation;
-  dirCurve=NULL;
-  this->init();
-}
-
-/**
-   \brief Deletes a UPointCurve.
-
-   It does this by freeing all the space taken over from the nodes
-*/
-UPointCurve::~UPointCurve(void)
-{
-  PathNode* tmpNode;
-  currentNode = firstNode;
-  while (tmpNode != 0)
-    {
-      tmpNode = currentNode;
-      currentNode = currentNode->next;
-      delete tmpNode;
-    }
-  if (dirCurve)
-    delete dirCurve;
-}
-
-/**
-   \brief Initializes a UPointCurve
-*/
-void UPointCurve::init(void)
-{
-  nodeCount = 0;
-  firstNode = new PathNode;
-  currentNode = firstNode;
-
-  firstNode->position = Vector (.0, .0, .0);
-  firstNode->number = 0;
-  firstNode->next = 0; // not sure if this really points to NULL!!
-
-  return;
-}
-
-/**
-   \brief Rebuilds a UPointCurve
-   
-   \todo very bad algorithm
-*/
-void UPointCurve::rebuild(void)
-{
-  // rebuilding the Curve itself
-  PathNode* tmpNode = this->firstNode;
-  int i=0;
-  Matrix xTmpMat = Matrix(this->nodeCount, this->nodeCount);
-  Matrix yTmpMat = Matrix(this->nodeCount, this->nodeCount);
-  Matrix zTmpMat = Matrix(this->nodeCount, this->nodeCount);
-  Matrix xValMat = Matrix(this->nodeCount, 3);
-  Matrix yValMat = Matrix(this->nodeCount, 3);
-  Matrix zValMat = Matrix(this->nodeCount, 3);
-  while(tmpNode)
-    {
-      Vector fac = Vector(1,1,1);
-      for (int j = 0; j < this->nodeCount; j++)
-	{
-	  xTmpMat(i,j) = fac.x; fac.x *= (float)i/(float)this->nodeCount;//tmpNode->position.x;
-	  yTmpMat(i,j) = fac.y; fac.y *= (float)i/(float)this->nodeCount;//tmpNode->position.y;
-	  zTmpMat(i,j) = fac.z; fac.z *= (float)i/(float)this->nodeCount;//tmpNode->position.z;
-	}
-      xValMat(i,0) = tmpNode->position.x;
-      yValMat(i,0) = tmpNode->position.y;
-      zValMat(i,0) = tmpNode->position.z;
-      ++i;
-      tmpNode = tmpNode->next;
-    }
-  tmpNode = this->firstNode;
-  xValMat = xTmpMat.Inv() *= xValMat;
-  yValMat = yTmpMat.Inv() *= yValMat;
-  zValMat = zTmpMat.Inv() *= zValMat;
-  i = 0;
-  while(tmpNode)
-    {
-      tmpNode->vFactor.x = xValMat(i,0);
-      tmpNode->vFactor.y = yValMat(i,0);
-      tmpNode->vFactor.z = zValMat(i,0);
-
-      i++;
-      tmpNode = tmpNode->next;
-    }
-}
-
-/**
-   \brief calculates the Position on the curve
-   \param t The position on the Curve (0<=t<=1)
-   \return the Position on the Path
-*/
-Vector UPointCurve::calcPos(float t) 
-{
-  PathNode* tmpNode = firstNode;
-  Vector ret = Vector(0.0,0.0,0.0);
-  float factor = 1.0;
-  while(tmpNode)
-    {
-      ret.x += tmpNode->vFactor.x * factor;
-      ret.y += tmpNode->vFactor.y * factor;
-      ret.z += tmpNode->vFactor.z * factor;
-      factor *= t;
-
-      tmpNode = tmpNode->next;
-    }
-  return ret;
-}
-
-/**
-   \brief Calulates the direction of the Curve at time t.
-   \param The time at which to evaluate the curve.
-   \returns The vvaluated Vector.
-*/
-Vector UPointCurve::calcDir (float t)
-{
-  PathNode* tmpNode = firstNode;
-  Vector ret = Vector(0.0,0.0,0.0);
-  float factor = 1.0/t;
-  int k=0;
-  while(tmpNode)
-    {
-      ret.x += tmpNode->vFactor.x * factor *k;
-      ret.y += tmpNode->vFactor.y * factor *k;
-      ret.z += tmpNode->vFactor.z * factor *k;
-      factor *= t;
-      k++;
-      tmpNode = tmpNode->next;
-    }
-  ret.normalize();
-  return ret;
-}
-
-Vector UPointCurve::calcAcc (float t)
-{
-}
-
-/**
-   \brief Calculates the Quaternion needed for our rotations
-   \param t The time at which to evaluate the cuve.
-   \returns The evaluated Quaternion.
-*/
-Quaternion UPointCurve::calcQuat (float t)
-{
-  return Quaternion (calcDir(t), Vector(0,0,1));
-}
-
-
-/**
-  \brief returns the Position of the point calculated on the Curve
-  \return a Vector to the calculated position
-*/
-Vector UPointCurve::getPos(void) const
-{
-  return curvePoint;
-}
Index: orxonox/branches/levelloader/src/lib/math/curve.h
===================================================================
--- orxonox/branches/levelloader/src/lib/math/curve.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/math/curve.h	(revision 3605)
@@ -13,5 +13,5 @@
 
 //! An Enumerator that defines what sort of Curves are availible
-enum CurveType {BEZIERCURVE, UPOINTCURVE};
+enum CurveType {BEZIERCURVE};
 
 
@@ -38,7 +38,10 @@
   PathNode* currentNode; //!< The node we are working with (the Last node).
 
+
  private:
   virtual void rebuild(void) = 0;
  public:
+  Curve(void);
+
   Curve* dirCurve;       //!< The derivation-curve of this Curve.
   void addNode(const Vector& newNode);
@@ -68,6 +71,5 @@
   BezierCurve(void);
   BezierCurve(int derivation);
-  ~BezierCurve(void);
-  void init(void);
+  virtual ~BezierCurve(void);
 
   Vector calcPos(float t);
@@ -91,28 +93,3 @@
 };
 
-//! Uniform Point Curve-class
-/**
-   A UPoint Curve is a A Curve, that flows through all the nodes given it.
-   The Algorithm to buid the curve is rather slow, but Painting and tracing along the curve has high speed, so do not change this curve during the Game.
-
-   This Curve is very erattic, so i do not recommend to use it.
-*/
-class UPointCurve : public Curve
-{
- private:
-  void rebuild(void);
- public:
-  UPointCurve(void);
-  UPointCurve(int derivation);
-  ~UPointCurve(void);
-  void init(void);
-
-  Vector calcPos(float t);
-  Vector calcDir(float t);
-  Vector calcAcc(float t);
-  Quaternion calcQuat(float t);
-  
-  Vector getPos(void) const;
-};
-
 #endif /* _CURVE_H */
Index: orxonox/branches/levelloader/src/lib/math/matrix.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/math/matrix.cc	(revision 3563)
+++ 	(revision )
@@ -1,746 +1,0 @@
-
-/* 
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Benjamin Grauer
-   co-programmer: ...
-
-   \todo Null-Parent => center of the coord system - singleton
-   \todo Smooth-Parent: delay, speed
-   \todo destroy the stuff again, delete...
-*/
-
-#include "matrix.h"
-
-Matrix::Matrix (size_t row, size_t col)
-{
-  _m = new base_mat( row, col, 0);
-}
-
-// copy constructor
-Matrix::Matrix (const Matrix& m)
-{
-    _m = m._m;
-    _m->Refcnt++;
-}
-
-// Internal copy constructor
-void Matrix::clone ()
-{
-    _m->Refcnt--;
-    _m = new base_mat( _m->Row, _m->Col, _m->Val);
-}
-
-// destructor
-Matrix::~Matrix ()
-{
-   if (--_m->Refcnt == 0) delete _m;
-}
-
-// assignment operator
-Matrix& Matrix::operator = (const Matrix& m) 
-{
-    m._m->Refcnt++;
-    if (--_m->Refcnt == 0) delete _m;
-    _m = m._m;
-    return *this;
-}
-
-//  reallocation method
-void Matrix::realloc (size_t row, size_t col)
-{
-   if (row == _m->RowSiz && col == _m->ColSiz)
-   {
-      _m->Row = _m->RowSiz;
-      _m->Col = _m->ColSiz;
-      return;
-   }
-
-   base_mat *m1 = new base_mat( row, col, NULL);
-   size_t colSize = min(_m->Col,col) * sizeof(float);
-   size_t minRow = min(_m->Row,row);
-
-   for (size_t i=0; i < minRow; i++)
-      memcpy( m1->Val[i], _m->Val[i], colSize);
-
-   if (--_m->Refcnt == 0) 
-       delete _m;
-   _m = m1;
-
-   return;
-}
-
-// public method for resizing Matrix
-void Matrix::SetSize (size_t row, size_t col) 
-{
-   size_t i,j;
-   size_t oldRow = _m->Row;
-   size_t oldCol = _m->Col;
-
-   if (row != _m->RowSiz || col != _m->ColSiz)
-      realloc( row, col);
-
-   for (i=oldRow; i < row; i++)
-      for (j=0; j < col; j++)
-	 _m->Val[i][j] = float(0);
-
-   for (i=0; i < row; i++)                      
-      for (j=oldCol; j < col; j++)
-	 _m->Val[i][j] = float(0);
-
-   return;
-}
-
-// subscript operator to get/set individual elements
-float& Matrix::operator () (size_t row, size_t col) 
-{
-   if (row >= _m->Row || col >= _m->Col)
-      printf( "Matrix::operator(): Index out of range!\n");
-   if (_m->Refcnt > 1) clone();
-   return _m->Val[row][col];
-}
-
-// subscript operator to get/set individual elements
-float Matrix::operator () (size_t row, size_t col) const 
-{
-   if (row >= _m->Row || col >= _m->Col)
-      printf( "Matrix::operator(): Index out of range!\n");
-   return _m->Val[row][col];
-}
-
-// input stream function
-istream& operator >> (istream& istrm, Matrix& m)
-{
-   for (size_t i=0; i < m.RowNo(); i++)
-      for (size_t j=0; j < m.ColNo(); j++)
-      {
-         float x;
-         istrm >> x;
-         m(i,j) = x;
-      }
-   return istrm;
-}
-
-// output stream function
-ostream& operator << (ostream& ostrm, const Matrix& m)
-{
-   for (size_t i=0; i < m.RowNo(); i++)
-   {
-      for (size_t j=0; j < m.ColNo(); j++)
-      {
-         float x = m(i,j);
-         ostrm << x << '\t';
-      }
-      ostrm << endl;
-   }
-   return ostrm;
-}
-
-
-// logical equal-to operator
-bool operator == (const Matrix& m1, const Matrix& m2) 
-{
-   if (m1.RowNo() != m2.RowNo() || m1.ColNo() != m2.ColNo())
-      return false;
-
-   for (size_t i=0; i < m1.RowNo(); i++)
-      for (size_t j=0; j < m1.ColNo(); j++)
-	      if (m1(i,j) != m2(i,j))
-	         return false;
-
-   return true;
-}
-
-// logical no-equal-to operator
-bool operator != (const Matrix& m1, const Matrix& m2) 
-{
-    return (m1 == m2) ? false : true;
-}
-
-// combined addition and assignment operator
-Matrix& Matrix::operator += (const Matrix& m) 
-{
-   if (_m->Row != m._m->Row || _m->Col != m._m->Col)
-     printf("Matrix::operator+= : Inconsistent Matrix sizes in addition!\n");
-   if (_m->Refcnt > 1) clone();
-   for (size_t i=0; i < m._m->Row; i++)
-      for (size_t j=0; j < m._m->Col; j++)
-	 _m->Val[i][j] += m._m->Val[i][j];
-   return *this;
-}
-
-// combined subtraction and assignment operator
-Matrix& Matrix::operator -= (const Matrix& m) 
-{
-   if (_m->Row != m._m->Row || _m->Col != m._m->Col)
-      printf( "Matrix::operator-= : Inconsistent Matrix sizes in subtraction!\n");
-   if (_m->Refcnt > 1) clone();
-   for (size_t i=0; i < m._m->Row; i++)
-      for (size_t j=0; j < m._m->Col; j++)
-	 _m->Val[i][j] -= m._m->Val[i][j];
-   return *this;
-}
-
-// combined scalar multiplication and assignment operator
- Matrix&
-Matrix::operator *= (const float& c) 
-{
-    if (_m->Refcnt > 1) clone();
-    for (size_t i=0; i < _m->Row; i++)
-	for (size_t j=0; j < _m->Col; j++)
-	    _m->Val[i][j] *= c;
-    return *this;
-}
-
-// combined Matrix multiplication and assignment operator
- Matrix&
-Matrix::operator *= (const Matrix& m) 
-{
-   if (_m->Col != m._m->Row)
-      printf( "Matrix::operator*= : Inconsistent Matrix sizes in multiplication!\n");
-
-   Matrix temp(_m->Row,m._m->Col);
-
-   for (size_t i=0; i < _m->Row; i++)
-      for (size_t j=0; j < m._m->Col; j++)
-      {
-         temp._m->Val[i][j] = float(0);
-         for (size_t k=0; k < _m->Col; k++)
-            temp._m->Val[i][j] += _m->Val[i][k] * m._m->Val[k][j];
-      }
-   *this = temp;
-
-   return *this;
-}
-
-// combined scalar division and assignment operator
- Matrix&
-Matrix::operator /= (const float& c) 
-{
-    if (_m->Refcnt > 1) clone();
-    for (size_t i=0; i < _m->Row; i++)
-	for (size_t j=0; j < _m->Col; j++)
-	    _m->Val[i][j] /= c;
-
-    return *this;
-}
-
-// combined power and assignment operator
- Matrix&
-Matrix::operator ^= (const size_t& pow) 
-{
-  Matrix temp(*this);
-
-  for (size_t i=2; i <= pow; i++)
-    *this *=  temp; // changed from *this = *this * temp;
-
-  return *this;
-}
-
-// unary negation operator
- Matrix
-Matrix::operator - () 
-{
-   Matrix temp(_m->Row,_m->Col);
-
-   for (size_t i=0; i < _m->Row; i++)
-      for (size_t j=0; j < _m->Col; j++)
-	 temp._m->Val[i][j] = - _m->Val[i][j];
-
-   return temp;
-}
-
-// binary addition operator
- Matrix
-operator + (const Matrix& m1, const Matrix& m2) 
-{
-   Matrix temp = m1;
-   temp += m2;
-   return temp;
-}
-
-// binary subtraction operator
- Matrix
-operator - (const Matrix& m1, const Matrix& m2) 
-{
-   Matrix temp = m1;
-   temp -= m2;
-   return temp;
-}
-
-// binary scalar multiplication operator
- Matrix
-operator * (const Matrix& m, const float& no) 
-{
-   Matrix temp = m;
-   temp *= no;
-   return temp;
-}
-
-
-// binary scalar multiplication operator
- Matrix
-operator * (const float& no, const Matrix& m) 
-{
-   return (m * no);
-}
-
-// binary Matrix multiplication operator
- Matrix
-operator * (const Matrix& m1, const Matrix& m2) 
-{
-   Matrix temp = m1;
-   temp *= m2;
-   return temp;
-}
-
-// binary scalar division operator
- Matrix
-operator / (const Matrix& m, const float& no) 
-{
-    return (m * (float(1) / no));
-}
-
-
-// binary scalar division operator
- Matrix
-operator / (const float& no, const Matrix& m) 
-{
-    return (!m * no);
-}
-
-// binary Matrix division operator
- Matrix
-operator / (const Matrix& m1, const Matrix& m2) 
-{
-    return (m1 * !m2);
-}
-
-// binary power operator
- Matrix
-operator ^ (const Matrix& m, const size_t& pow) 
-{
-   Matrix temp = m;
-   temp ^= pow;
-   return temp;
-}
-
-// unary transpose operator
- Matrix
-operator ~ (const Matrix& m) 
-{
-   Matrix temp(m.ColNo(),m.RowNo());
-
-   for (size_t i=0; i < m.RowNo(); i++)
-      for (size_t j=0; j < m.ColNo(); j++)
-      {
-         float x = m(i,j);
-	      temp(j,i) = x;
-      }
-   return temp;
-}
-
-// unary inversion operator
- Matrix
-operator ! (const Matrix m) 
-{
-   Matrix temp = m;
-   return temp.Inv();
-}
-
-// inversion function
- Matrix
-Matrix::Inv () 
-{
-   size_t i,j,k;
-   float a1,a2,*rowptr;
-
-   if (_m->Row != _m->Col)
-      printf( "Matrix::operator!: Inversion of a non-square Matrix\n");
-
-   Matrix temp(_m->Row,_m->Col);
-   if (_m->Refcnt > 1) clone();
-
-
-   temp.Unit();
-   for (k=0; k < _m->Row; k++)
-   {
-      int indx = pivot(k);
-      if (indx == -1)
-	      printf( "Matrix::operator!: Inversion of a singular Matrix\n");
-
-      if (indx != 0)
-      {
-	      rowptr = temp._m->Val[k];
-	      temp._m->Val[k] = temp._m->Val[indx];
-	      temp._m->Val[indx] = rowptr;
-      }
-      a1 = _m->Val[k][k];
-      for (j=0; j < _m->Row; j++)
-      {
-	      _m->Val[k][j] /= a1;
-	      temp._m->Val[k][j] /= a1;
-      }
-      for (i=0; i < _m->Row; i++)
-	   if (i != k)
-	   {
-	      a2 = _m->Val[i][k];
-	      for (j=0; j < _m->Row; j++)
-	      {
-	         _m->Val[i][j] -= a2 * _m->Val[k][j];
-	         temp._m->Val[i][j] -= a2 * temp._m->Val[k][j];
-	      }
-	   }
-   }
-   return temp;
-}
-
-// solve simultaneous equation
- Matrix
-Matrix::Solve (const Matrix& v) const 
-{
-   size_t i,j,k;
-   float a1;
-
-   if (!(_m->Row == _m->Col && _m->Col == v._m->Row))
-      printf( "Matrix::Solve():Inconsistent matrices!\n");
-
-   Matrix temp(_m->Row,_m->Col+v._m->Col);
-   for (i=0; i < _m->Row; i++)
-   {
-      for (j=0; j < _m->Col; j++)
-	 temp._m->Val[i][j] = _m->Val[i][j];
-      for (k=0; k < v._m->Col; k++)
-	 temp._m->Val[i][_m->Col+k] = v._m->Val[i][k];
-   }
-   for (k=0; k < _m->Row; k++)
-   {
-      int indx = temp.pivot(k);
-      if (indx == -1)
-	 printf( "Matrix::Solve(): Singular Matrix!\n");
-
-      a1 = temp._m->Val[k][k];
-      for (j=k; j < temp._m->Col; j++)
-	 temp._m->Val[k][j] /= a1;
-
-      for (i=k+1; i < _m->Row; i++)
-      {
-	 a1 = temp._m->Val[i][k];
-	 for (j=k; j < temp._m->Col; j++)
-	   temp._m->Val[i][j] -= a1 * temp._m->Val[k][j];
-      }
-   }
-   Matrix s(v._m->Row,v._m->Col);
-   for (k=0; k < v._m->Col; k++)
-      for (int m=int(_m->Row)-1; m >= 0; m--)
-      {
-	 s._m->Val[m][k] = temp._m->Val[m][_m->Col+k];
-	 for (j=m+1; j < _m->Col; j++)
-	    s._m->Val[m][k] -= temp._m->Val[m][j] * s._m->Val[j][k];
-      }
-   return s;
-}
-
-// set zero to all elements of this Matrix
- void
-Matrix::Null (const size_t& row, const size_t& col) 
-{
-    if (row != _m->Row || col != _m->Col)
-	realloc( row,col);
-
-    if (_m->Refcnt > 1) 
-	clone();
-
-    for (size_t i=0; i < _m->Row; i++)
-	for (size_t j=0; j < _m->Col; j++)
-	    _m->Val[i][j] = float(0);
-    return;
-}
-
-// set zero to all elements of this Matrix
- void
-Matrix::Null() 
-{
-    if (_m->Refcnt > 1) clone();   
-    for (size_t i=0; i < _m->Row; i++)
-	for (size_t j=0; j < _m->Col; j++)
-		_m->Val[i][j] = float(0);
-    return;
-}
-
-// set this Matrix to unity
- void
-Matrix::Unit (const size_t& row) 
-{
-    if (row != _m->Row || row != _m->Col)
-	realloc( row, row);
-	
-    if (_m->Refcnt > 1) 
-	clone();
-
-    for (size_t i=0; i < _m->Row; i++)
-	for (size_t j=0; j < _m->Col; j++)
-	    _m->Val[i][j] = i == j ? float(1) : float(0);
-    return;
-}
-
-// set this Matrix to unity
- void
-Matrix::Unit () 
-{
-    if (_m->Refcnt > 1) clone();   
-    size_t row = min(_m->Row,_m->Col);
-    _m->Row = _m->Col = row;
-
-    for (size_t i=0; i < _m->Row; i++)
-	for (size_t j=0; j < _m->Col; j++)
-	    _m->Val[i][j] = i == j ? float(1) : float(0);
-    return;
-}
-
-// private partial pivoting method
- int
-Matrix::pivot (size_t row)
-{
-  int k = int(row);
-  double amax,temp;
-
-  amax = -1;
-  for (size_t i=row; i < _m->Row; i++)
-    if ( (temp = abs( _m->Val[i][row])) > amax && temp != 0.0)
-     {
-       amax = temp;
-       k = i;
-     }
-  if (_m->Val[k][row] == float(0))
-     return -1;
-  if (k != int(row))
-  {
-     float* rowptr = _m->Val[k];
-     _m->Val[k] = _m->Val[row];
-     _m->Val[row] = rowptr;
-     return k;
-  }
-  return 0;
-}
-
-// calculate the determinant of a Matrix
- float
-Matrix::Det () const 
-{
-   size_t i,j,k;
-   float piv,detVal = float(1);
-
-   if (_m->Row != _m->Col)
-      printf( "Matrix::Det(): Determinant a non-squareMatrix!\n");
-   
-   Matrix temp(*this);
-   if (temp._m->Refcnt > 1) temp.clone();
-
-   for (k=0; k < _m->Row; k++)
-   {
-      int indx = temp.pivot(k);
-      if (indx == -1)
-	 return 0;
-      if (indx != 0)
-	 detVal = - detVal;
-      detVal = detVal * temp._m->Val[k][k];
-      for (i=k+1; i < _m->Row; i++)
-      {
-	 piv = temp._m->Val[i][k] / temp._m->Val[k][k];
-	 for (j=k+1; j < _m->Row; j++)
-	    temp._m->Val[i][j] -= piv * temp._m->Val[k][j];
-      }
-   }
-   return detVal;
-}
-
-// calculate the norm of a Matrix
- float
-Matrix::Norm () 
-{
-   float retVal = float(0);
-
-   for (size_t i=0; i < _m->Row; i++)
-      for (size_t j=0; j < _m->Col; j++)
-	 retVal += _m->Val[i][j] * _m->Val[i][j];
-   retVal = sqrt( retVal);
-
-   return retVal;
-}
-
-// calculate the condition number of a Matrix
- float
-Matrix::Cond () 
-{
-   Matrix inv = ! (*this);
-   return (Norm() * inv.Norm());
-}
-
-// calculate the cofactor of a Matrix for a given element
- float
-Matrix::Cofact (size_t row, size_t col) 
-{
-   size_t i,i1,j,j1;
-
-   if (_m->Row != _m->Col)
-      printf( "Matrix::Cofact(): Cofactor of a non-square Matrix!\n");
-
-   if (row > _m->Row || col > _m->Col)
-      printf( "Matrix::Cofact(): Index out of range!\n");
-
-   Matrix temp (_m->Row-1,_m->Col-1);
-
-   for (i=i1=0; i < _m->Row; i++)
-   {
-      if (i == row)
-	continue;
-      for (j=j1=0; j < _m->Col; j++)
-      {
-	 if (j == col)
-	    continue;
-	 temp._m->Val[i1][j1] = _m->Val[i][j];
-	 j1++;
-      }
-      i1++;
-   }
-   float  cof = temp.Det();
-   if ((row+col)%2 == 1)
-      cof = -cof;
-
-   return cof;
-}
-
-
-// calculate adjoin of a Matrix
- Matrix
-Matrix::Adj () 
-{
-   if (_m->Row != _m->Col)
-      printf( "Matrix::Adj(): Adjoin of a non-square Matrix.\n");
-
-   Matrix temp(_m->Row,_m->Col);
-
-   for (size_t i=0; i < _m->Row; i++)
-      for (size_t j=0; j < _m->Col; j++)
-	  temp._m->Val[j][i] = Cofact(i,j);
-   return temp;
-}
-
-// Determine if the Matrix is singular
- bool
-Matrix::IsSingular () 
-{
-   if (_m->Row != _m->Col)
-      return false;
-   return (Det() == float(0));
-}
-
-// Determine if the Matrix is diagonal
- bool
-Matrix::IsDiagonal () 
-{
-   if (_m->Row != _m->Col)
-      return false;
-   for (size_t i=0; i < _m->Row; i++)
-     for (size_t j=0; j < _m->Col; j++)
-	if (i != j && _m->Val[i][j] != float(0))
-	  return false;
-   return true;
-}
-
-// Determine if the Matrix is scalar
- bool
-Matrix::IsScalar () 
-{
-   if (!IsDiagonal())
-     return false;
-   float v = _m->Val[0][0];
-   for (size_t i=1; i < _m->Row; i++)
-     if (_m->Val[i][i] != v)
-	return false;
-   return true;
-}
-
-// Determine if the Matrix is a unit Matrix
- bool
-Matrix::IsUnit () 
-{
-   if (IsScalar() && _m->Val[0][0] == float(1))
-     return true;
-   return false;
-}
-
-// Determine if this is a null Matrix
- bool
-Matrix::IsNull () 
-{
-   for (size_t i=0; i < _m->Row; i++)
-      for (size_t j=0; j < _m->Col; j++)
-	 if (_m->Val[i][j] != float(0))
-	    return false;
-   return true;
-}
-
-// Determine if the Matrix is symmetric
- bool
-Matrix::IsSymmetric () 
-{
-   if (_m->Row != _m->Col)
-      return false;
-   for (size_t i=0; i < _m->Row; i++)
-      for (size_t j=0; j < _m->Col; j++)
-	 if (_m->Val[i][j] != _m->Val[j][i])
-	    return false;
-   return true;
-}
-	   
-// Determine if the Matrix is skew-symmetric
- bool
-Matrix::IsSkewSymmetric () 
-{
-   if (_m->Row != _m->Col)
-      return false;
-   for (size_t i=0; i < _m->Row; i++)
-      for (size_t j=0; j < _m->Col; j++)
-	 if (_m->Val[i][j] != -_m->Val[j][i])
-	    return false;
-   return true;
-}
-   
-// Determine if the Matrix is upper triangular
- bool
-Matrix::IsUpperTriangular () 
-{
-   if (_m->Row != _m->Col)
-      return false;
-   for (size_t i=1; i < _m->Row; i++)
-      for (size_t j=0; j < i-1; j++)
-	 if (_m->Val[i][j] != float(0))
-	    return false;
-   return true;
-}
-
-// Determine if the Matrix is lower triangular
- bool
-Matrix::IsLowerTriangular () 
-{
-   if (_m->Row != _m->Col)
-      return false;
-
-   for (size_t j=1; j < _m->Col; j++)
-      for (size_t i=0; i < j-1; i++)
-	 if (_m->Val[i][j] != float(0))
-	    return false;
-
-   return true;
-}
-
Index: orxonox/branches/levelloader/src/lib/math/matrix.h
===================================================================
--- orxonox/branches/levelloader/src/lib/math/matrix.h	(revision 3563)
+++ 	(revision )
@@ -1,110 +1,0 @@
-#ifndef _MATRIX_H
-#define _MATRIX_H
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <iostream>
-
-using namespace std;
-
-class Matrix
-{
-public:
-  // Constructors
-  Matrix (const Matrix& m);
-  Matrix (size_t row, size_t col);
-  
-  // Destructor
-  ~Matrix ();
-  
-  // Assignment operators
-  Matrix& operator = (const Matrix& m) ;
-  
-  // Value extraction method
-  size_t RowNo () const { return _m->Row; }
-  size_t ColNo () const { return _m->Col; }
-  
-  // Subscript operator
-  float& operator () (size_t row, size_t col);
-   float  operator () (size_t row, size_t col) const;
-
-   // Unary operators
-   Matrix operator + ()  { return *this; }
-   Matrix operator - () ;
-
-   // Combined assignment - calculation operators
-   Matrix& operator += (const Matrix& m);
-   Matrix& operator -= (const Matrix& m);
-   Matrix& operator *= (const Matrix& m);
-   Matrix& operator *= (const float& c) ;
-   Matrix& operator /= (const float& c) ;
-   Matrix& operator ^= (const size_t& pow);
-
-   // Miscellaneous -methods
-   void Null (const size_t& row, const size_t& col) ;
-   void Null () ;
-   void Unit (const size_t& row) ;
-   void Unit () ;
-   void SetSize (size_t row, size_t col) ;
-
-   // Utility methods
-   Matrix Solve (const Matrix& v) const;
-   Matrix Adj ();
-   Matrix Inv ();
-   float Det () const;
-   float Norm () ;
-   float Cofact (size_t row, size_t col);
-   float Cond () ;
-
-   // Type of matrices
-   bool IsSquare ()  { return (_m->Row == _m->Col); } 
-   bool IsSingular ();
-   bool IsDiagonal ();
-   bool IsScalar ();
-   bool IsUnit ();
-   bool IsNull ();
-   bool IsSymmetric ();
-   bool IsSkewSymmetric ();
-   bool IsUpperTriangular ();
-   bool IsLowerTriangular ();
-
-private:
-   struct base_mat
-    {
-	float **Val;
-	size_t Row, Col, RowSiz, ColSiz;
-	int Refcnt;
-
-	base_mat (size_t row, size_t col, float** v)
-	{
-	    Row = row; RowSiz = row;
-	    Col = col; ColSiz = col;
-	    Refcnt = 1;
-
-	    Val = new float* [row];
-	    size_t rowlen = col * sizeof(float);
-
-	    for (size_t i=0; i < row; i++)
-	    {
-		Val[i] = new float [col];
-		if (v) memcpy( Val[i], v[i], rowlen);
-	    }
-	}
-	~base_mat ()
-	{
-	    for (size_t i=0; i < RowSiz; i++)
-		delete [] Val[i];
-	    delete [] Val;
-	}
-    };
-    base_mat *_m;
-
-    void clone ();
-    void realloc (size_t row, size_t col);
-    int pivot (size_t row);
-};
-
-Matrix operator ! (const Matrix m);
-
-#endif /*_MATRIX_H */
Index: orxonox/branches/levelloader/src/lib/math/vector.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/math/vector.cc	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/math/vector.cc	(revision 3605)
@@ -19,7 +19,8 @@
 */
 
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_MATH
 
 #include "vector.h"
-
+#include "debug.h"
 
 using namespace std;
@@ -201,5 +202,4 @@
 }
 
-
 /**
    \brief calculate the angle between two vectors in radiances
@@ -225,4 +225,16 @@
   f = acos( v1 * v2 / (v1.len() * v2.len()));
   return f * 180 / PI;
+}
+
+
+/**
+   \brief Outputs the values of the Vector
+*/
+void Vector::debug(void)
+{
+  PRINT(0)("Vector Debug information\n");
+  PRINT(0)("x: %f; y: %f; z: %f", x, y, z);
+  PRINT(3)(" lenght: %f", len());
+  PRINT(0)("\n");
 }
 
@@ -581,4 +593,13 @@
 
 /**
+   \brief outputs some nice formated debug information about this quaternion
+*/
+void Quaternion::debug(void)
+{
+  PRINT(0)("Quaternion Debug Information\n");
+  PRINT(0)("real a=%f; imag: x=%f y=%f z=%f\n", w, v.x, v.y, v.z);
+}
+
+/**
    \brief create a rotation from a vector
    \param v: a vector
Index: orxonox/branches/levelloader/src/lib/math/vector.h
===================================================================
--- orxonox/branches/levelloader/src/lib/math/vector.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/math/vector.h	(revision 3605)
@@ -41,4 +41,6 @@
   Vector* getNormalized();
   Vector abs();
+
+  void debug();
 };
 
@@ -53,27 +55,28 @@
 {
  public:
-	Vector v;	//!< Imaginary Vector
-	float w;        //!< Real part of the number
-
- 	Quaternion ();
- 	Quaternion (float m[4][4]);
- 	Quaternion (float angle, const Vector& axis);
- 	Quaternion (const Vector& dir, const Vector& up);
- 	Quaternion (float roll, float pitch, float yaw);
- 	
- 	Quaternion operator/ (const float& f) const;
- 	Quaternion operator* (const float& f) const;
- 	Quaternion operator* (const Quaternion& q) const;
-	Quaternion operator+ (const Quaternion& q) const;
-	Quaternion operator- (const Quaternion& q) const;
-	Quaternion conjugate () const;
-	Quaternion inverse () const;
- 	Vector apply (Vector& f) const;
-	float norm () const;
-	void matrix (float m[4][4]) const;
-	void quatSlerp(const Quaternion* from, const Quaternion* to, const float t, Quaternion* res);
-
+  Vector v;	//!< Imaginary Vector
+  float w;        //!< Real part of the number
+  
+  Quaternion ();
+  Quaternion (float m[4][4]);
+  Quaternion (float angle, const Vector& axis);
+  Quaternion (const Vector& dir, const Vector& up);
+  Quaternion (float roll, float pitch, float yaw);
+  
+  Quaternion operator/ (const float& f) const;
+  Quaternion operator* (const float& f) const;
+  Quaternion operator* (const Quaternion& q) const;
+  Quaternion operator+ (const Quaternion& q) const;
+  Quaternion operator- (const Quaternion& q) const;
+  Quaternion conjugate () const;
+  Quaternion inverse () const;
+  Vector apply (Vector& f) const;
+  float norm () const;
+  void matrix (float m[4][4]) const;
+  void quatSlerp(const Quaternion* from, const Quaternion* to, const float t, Quaternion* res);
+  
+  void debug();
  private:
-	float DELTA;      //!< resolution of calculation
+  float DELTA;      //!< resolution of calculation
 
 };
Index: orxonox/branches/levelloader/src/lib/util/list.h
===================================================================
--- orxonox/branches/levelloader/src/lib/util/list.h	(revision 3563)
+++ orxonox/branches/levelloader/src/lib/util/list.h	(revision 3605)
@@ -86,4 +86,5 @@
   T* enumerate();
   T* nextElement();
+  T* nextElement(T* toEntity);
   T* toArray();
   void debug();
@@ -101,9 +102,23 @@
 template<class T>
 tList<T>::~tList () 
-{}
+{
+  this->currentEl = this->first;
+  while(this->currentEl != NULL)
+    {
+      listElement* le = this->currentEl->next;
+      //delete this->currentEl->curr;
+      delete this->currentEl;
+      this->currentEl = le;
+    }
+  this->first = NULL;
+  this->last = NULL;
+  this->size = 0;
+}
+
 
 template<class T>
 void tList<T>::add(T* entity)
 {
+  if( entity == NULL) return;
   listElement* el = new listElement;
   el->prev = this->last;
@@ -113,5 +128,5 @@
   this->last = el;
 
-  if(this->size == 0) this->first = el;
+  if(el->prev == NULL) this->first = el; /* if first element */
   else el->prev->next = el;
   this->size++;
@@ -122,4 +137,5 @@
 void tList<T>::remove(T* entity)
 {
+  if( entity == NULL) return;
   this->currentEl = this->first;
   listElement* te;
@@ -134,7 +150,8 @@
 	  else this->currentEl->next->prev = this->currentEl->prev;
 
-	  te = this->currentEl->next;
+	  te = this->currentEl->next;  // for what am i doing this?
 	  delete this->currentEl;
 	  this->currentEl = te;
+	  this->size--;
 	  return;
 	}
@@ -151,5 +168,5 @@
     {
       listElement* le = this->currentEl->next;
-      delete this->currentEl->curr;
+      //delete this->currentEl->curr;
       delete this->currentEl;
       this->currentEl = le;
@@ -185,4 +202,5 @@
 T* tList<T>::enumerate()
 {
+  //if( this->last == this->first == NULL) return NULL;
   if(this->size == 0) return NULL;
   this->currentEl = this->first;
@@ -194,4 +212,5 @@
 T* tList<T>::nextElement()
 {
+  // if( this->last == this->first == NULL) return NULL;
   if(this->size == 0) return NULL;
   this->currentEl = this->currentEl->next;
@@ -201,4 +220,24 @@
 
 
+/**
+   \brief this returns the next element after toEntity or the first if toEntity is last
+*/
+template<class T>
+T* tList<T>::nextElement(T* toEntity)
+{
+  //if( this->last == this->first == NULL) return NULL;
+  if(this->size == 0) return NULL;
+  if( toEntity == NULL) return this->first->curr;
+  if( toEntity == this->last->curr ) return this->first->curr;
+  this->currentEl = this->first;
+  while(this->currentEl->curr != toEntity && this->currentEl->next != NULL)
+    {
+      this->currentEl = this->currentEl->next;
+    }
+  if(this->currentEl == NULL) return NULL;
+  return this->currentEl->next->curr;
+}
+
+
 template<class T>
 T* tList<T>::toArray()
