Index: orxonox/branches/levelloader/src/Makefile.am
===================================================================
--- orxonox/branches/levelloader/src/Makefile.am	(revision 3606)
+++ orxonox/branches/levelloader/src/Makefile.am	(revision 3746)
@@ -37,4 +37,5 @@
 		 simple_animation.cc \
 		 factory.cc \
+		 garbage_collector.cc \
 		 story_entities/story_entity.cc \
 		 story_entities/campaign.cc \
@@ -45,8 +46,9 @@
 		 world_entities/skysphere.cc \
 		 world_entities/terrain.cc \
-		 world_entities/primitive.cc \
 		 world_entities/weapon.cc \
 		 world_entities/projectile.cc \
 		 world_entities/character_attributes.cc \
+		 world_entities/test_gun.cc \
+		 world_entities/test_bullet.cc \
 		 ai/ai.cc \
 		 lib/coord/p_node.cc \
@@ -54,8 +56,10 @@
 		 lib/coord/helper_parent.cc \
 		 lib/data/data_tank.cc \
+		 lib/graphics/graphics_engine.cc \
 		 lib/graphics/light.cc \
 		 lib/graphics/font/fontset.cc \
 		 lib/graphics/importer/array.cc \
 		 lib/graphics/importer/objModel.cc \
+		 lib/graphics/importer/primitive_model.cc \
 		 lib/graphics/importer/model.cc \
 		 lib/graphics/importer/material.cc \
@@ -66,4 +70,5 @@
 		 lib/util/list.cc \
 		 lib/util/substring.cc \
+		 lib/util/resource_manager.cc \
 		 lib/math/vector.cc \
 		 lib/math/curve.cc \
@@ -73,4 +78,5 @@
 		 lib/xmlparser/tinyxmlparser.cc \
 		 glmenu/glmenu_imagescreen.cc 
+		 glmenu/glmenu_imagescreen.cc
 
 noinst_HEADERS = orxonox.h \
@@ -80,5 +86,4 @@
 		 camera.h \
 		 keynames.h \
-		 proto_class.h \
 		 command_node.h \
 		 message_structures.h \
@@ -86,4 +91,5 @@
 		 track_node.h \
 		 simple_animation.h \
+		 garbage_collector.h \
 		 story_entities/story_entity.h \
 		 story_entities/story_def.h \
@@ -97,12 +103,14 @@
 		 world_entities/power_up.h \
 		 world_entities/terrain.h \
-		 world_entities/primitive.h \
 		 world_entities/weapon.h \
 		 world_entities/projectile.h \
 		 world_entities/character_attributes.h \
+		 world_entities/test_gun.h \
+		 world_entities/test_bullet.h \
 		 ai/ai.h \
 		 network/synchronisable.h \
 		 defs/stdincl.h \
 		 defs/glincl.h \
+		 defs/comincl.h \
 		 defs/error.h \
 		 defs/debug.h \
@@ -110,4 +118,5 @@
 		 lib/coord/null_parent.h \
 		 lib/coord/helper_parent.h \
+		 lib/graphics/graphics_engine.h \
 		 lib/graphics/light.h \
 		 lib/graphics/font/fontset.h \
@@ -117,4 +126,5 @@
 		 lib/util/list.h \
 		 lib/util/list_template.h \
+		 lib/util/resource_manager.h \
 		 lib/util/ini_parser.h \
 		 lib/util/substring.h \
@@ -127,5 +137,9 @@
 
 ## orxonox.conf will be used from home-dir instead.
-EXTRA_DIST = orxonox.conf
+EXTRA_DIST = orxonox.conf \
+	     proto/proto_class.h \
+	     proto/proto_class.cc \
+	     proto/proto_singleton.h \
+	     proto/proto_singleton.cc
 
 if SUB_PROJECTS
Index: orxonox/branches/levelloader/src/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/Makefile.in	(revision 3606)
+++ orxonox/branches/levelloader/src/Makefile.in	(revision 3746)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.8.2 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)
@@ -57,15 +57,17 @@
 	track_manager.$(OBJEXT) track_node.$(OBJEXT) \
 	simple_animation.$(OBJEXT) factory.$(OBJEXT) \
-	story_entity.$(OBJEXT) campaign.$(OBJEXT) world.$(OBJEXT) \
-	world_entity.$(OBJEXT) player.$(OBJEXT) environment.$(OBJEXT) \
-	skysphere.$(OBJEXT) terrain.$(OBJEXT) primitive.$(OBJEXT) \
-	weapon.$(OBJEXT) projectile.$(OBJEXT) \
-	character_attributes.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \
+	garbage_collector.$(OBJEXT) story_entity.$(OBJEXT) \
+	campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \
+	player.$(OBJEXT) environment.$(OBJEXT) skysphere.$(OBJEXT) \
+	terrain.$(OBJEXT) weapon.$(OBJEXT) projectile.$(OBJEXT) \
+	character_attributes.$(OBJEXT) test_gun.$(OBJEXT) \
+	test_bullet.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \
 	null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \
-	data_tank.$(OBJEXT) light.$(OBJEXT) fontset.$(OBJEXT) \
-	array.$(OBJEXT) objModel.$(OBJEXT) model.$(OBJEXT) \
-	material.$(OBJEXT) texture.$(OBJEXT) base_entity.$(OBJEXT) \
-	base_object.$(OBJEXT) ini_parser.$(OBJEXT) list.$(OBJEXT) \
-	substring.$(OBJEXT) vector.$(OBJEXT) curve.$(OBJEXT) \
+	data_tank.$(OBJEXT) graphics_engine.$(OBJEXT) light.$(OBJEXT) \
+	fontset.$(OBJEXT) array.$(OBJEXT) objModel.$(OBJEXT) \
+	primitive_model.$(OBJEXT) model.$(OBJEXT) material.$(OBJEXT) \
+	texture.$(OBJEXT) base_entity.$(OBJEXT) base_object.$(OBJEXT) \
+	ini_parser.$(OBJEXT) list.$(OBJEXT) substring.$(OBJEXT) \
+	resource_manager.$(OBJEXT) vector.$(OBJEXT) curve.$(OBJEXT) \
 	tinystr.$(OBJEXT) tinyxml.$(OBJEXT) tinyxmlerror.$(OBJEXT) \
 	tinyxmlparser.$(OBJEXT) glmenu_imagescreen.$(OBJEXT)
@@ -84,5 +86,7 @@
 @AMDEP_TRUE@	./$(DEPDIR)/environment.Po ./$(DEPDIR)/factory.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/fontset.Po ./$(DEPDIR)/game_loader.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/garbage_collector.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/glmenu_imagescreen.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/graphics_engine.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/helper_parent.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/ini_parser.Po ./$(DEPDIR)/keynames.Po \
@@ -91,10 +95,13 @@
 @AMDEP_TRUE@	./$(DEPDIR)/null_parent.Po ./$(DEPDIR)/objModel.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/orxonox.Po ./$(DEPDIR)/p_node.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/player.Po ./$(DEPDIR)/primitive.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/player.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/primitive_model.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/projectile.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/resource_manager.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/simple_animation.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/skysphere.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/story_entity.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/substring.Po ./$(DEPDIR)/terrain.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/test_bullet.Po ./$(DEPDIR)/test_gun.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/texture.Po ./$(DEPDIR)/tinystr.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/tinyxml.Po ./$(DEPDIR)/tinyxmlerror.Po \
@@ -242,4 +249,5 @@
 		 simple_animation.cc \
 		 factory.cc \
+		 garbage_collector.cc \
 		 story_entities/story_entity.cc \
 		 story_entities/campaign.cc \
@@ -250,8 +258,9 @@
 		 world_entities/skysphere.cc \
 		 world_entities/terrain.cc \
-		 world_entities/primitive.cc \
 		 world_entities/weapon.cc \
 		 world_entities/projectile.cc \
 		 world_entities/character_attributes.cc \
+		 world_entities/test_gun.cc \
+		 world_entities/test_bullet.cc \
 		 ai/ai.cc \
 		 lib/coord/p_node.cc \
@@ -259,8 +268,10 @@
 		 lib/coord/helper_parent.cc \
 		 lib/data/data_tank.cc \
+		 lib/graphics/graphics_engine.cc \
 		 lib/graphics/light.cc \
 		 lib/graphics/font/fontset.cc \
 		 lib/graphics/importer/array.cc \
 		 lib/graphics/importer/objModel.cc \
+		 lib/graphics/importer/primitive_model.cc \
 		 lib/graphics/importer/model.cc \
 		 lib/graphics/importer/material.cc \
@@ -271,4 +282,5 @@
 		 lib/util/list.cc \
 		 lib/util/substring.cc \
+		 lib/util/resource_manager.cc \
 		 lib/math/vector.cc \
 		 lib/math/curve.cc \
@@ -285,5 +297,4 @@
 		 camera.h \
 		 keynames.h \
-		 proto_class.h \
 		 command_node.h \
 		 message_structures.h \
@@ -291,4 +302,5 @@
 		 track_node.h \
 		 simple_animation.h \
+		 garbage_collector.h \
 		 story_entities/story_entity.h \
 		 story_entities/story_def.h \
@@ -302,12 +314,14 @@
 		 world_entities/power_up.h \
 		 world_entities/terrain.h \
-		 world_entities/primitive.h \
 		 world_entities/weapon.h \
 		 world_entities/projectile.h \
 		 world_entities/character_attributes.h \
+		 world_entities/test_gun.h \
+		 world_entities/test_bullet.h \
 		 ai/ai.h \
 		 network/synchronisable.h \
 		 defs/stdincl.h \
 		 defs/glincl.h \
+		 defs/comincl.h \
 		 defs/error.h \
 		 defs/debug.h \
@@ -315,4 +329,5 @@
 		 lib/coord/null_parent.h \
 		 lib/coord/helper_parent.h \
+		 lib/graphics/graphics_engine.h \
 		 lib/graphics/light.h \
 		 lib/graphics/font/fontset.h \
@@ -322,4 +337,5 @@
 		 lib/util/list.h \
 		 lib/util/list_template.h \
+		 lib/util/resource_manager.h \
 		 lib/util/ini_parser.h \
 		 lib/util/substring.h \
@@ -330,5 +346,10 @@
 		 glmenu/glmenu_imagescreen.h 
 
-EXTRA_DIST = orxonox.conf
+EXTRA_DIST = orxonox.conf \
+	     proto/proto_class.h \
+	     proto/proto_class.cc \
+	     proto/proto_singleton.h \
+	     proto/proto_singleton.cc
+
 @SUB_PROJECTS_FALSE@SUB_PROGS = 
 @SUB_PROJECTS_TRUE@SUB_PROGS = lib subprojects
@@ -349,7 +370,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  src/Makefile
+	  $(AUTOMAKE) --gnu  src/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -371,5 +392,5 @@
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	$(mkdir_p) $(DESTDIR)$(bindir)
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
@@ -377,6 +398,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
@@ -386,6 +407,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
 
@@ -416,5 +437,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontset.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/garbage_collector.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glmenu_imagescreen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics_engine.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_parent.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_parser.Po@am__quote@
@@ -429,6 +452,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive_model.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/projectile.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_manager.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_animation.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@
@@ -436,4 +460,6 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/substring.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terrain.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bullet.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gun.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinystr.Po@am__quote@
@@ -592,20 +618,4 @@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o terrain.obj `if test -f 'world_entities/terrain.cc'; then $(CYGPATH_W) 'world_entities/terrain.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/terrain.cc'; fi`
 
-primitive.o: world_entities/primitive.cc
-@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive.o -MD -MP -MF "$(DEPDIR)/primitive.Tpo" -c -o primitive.o `test -f 'world_entities/primitive.cc' || echo '$(srcdir)/'`world_entities/primitive.cc; \
-@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/primitive.Tpo" "$(DEPDIR)/primitive.Po"; else rm -f "$(DEPDIR)/primitive.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/primitive.cc' object='primitive.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/primitive.Po' tmpdepfile='$(DEPDIR)/primitive.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive.o `test -f 'world_entities/primitive.cc' || echo '$(srcdir)/'`world_entities/primitive.cc
-
-primitive.obj: world_entities/primitive.cc
-@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive.obj -MD -MP -MF "$(DEPDIR)/primitive.Tpo" -c -o primitive.obj `if test -f 'world_entities/primitive.cc'; then $(CYGPATH_W) 'world_entities/primitive.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/primitive.cc'; fi`; \
-@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/primitive.Tpo" "$(DEPDIR)/primitive.Po"; else rm -f "$(DEPDIR)/primitive.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/primitive.cc' object='primitive.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/primitive.Po' tmpdepfile='$(DEPDIR)/primitive.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive.obj `if test -f 'world_entities/primitive.cc'; then $(CYGPATH_W) 'world_entities/primitive.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/primitive.cc'; fi`
-
 weapon.o: world_entities/weapon.cc
 @am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT weapon.o -MD -MP -MF "$(DEPDIR)/weapon.Tpo" -c -o weapon.o `test -f 'world_entities/weapon.cc' || echo '$(srcdir)/'`world_entities/weapon.cc; \
@@ -656,4 +666,36 @@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o character_attributes.obj `if test -f 'world_entities/character_attributes.cc'; then $(CYGPATH_W) 'world_entities/character_attributes.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/character_attributes.cc'; fi`
 
+test_gun.o: world_entities/test_gun.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_gun.o -MD -MP -MF "$(DEPDIR)/test_gun.Tpo" -c -o test_gun.o `test -f 'world_entities/test_gun.cc' || echo '$(srcdir)/'`world_entities/test_gun.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/test_gun.Tpo" "$(DEPDIR)/test_gun.Po"; else rm -f "$(DEPDIR)/test_gun.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/test_gun.cc' object='test_gun.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/test_gun.Po' tmpdepfile='$(DEPDIR)/test_gun.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_gun.o `test -f 'world_entities/test_gun.cc' || echo '$(srcdir)/'`world_entities/test_gun.cc
+
+test_gun.obj: world_entities/test_gun.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_gun.obj -MD -MP -MF "$(DEPDIR)/test_gun.Tpo" -c -o test_gun.obj `if test -f 'world_entities/test_gun.cc'; then $(CYGPATH_W) 'world_entities/test_gun.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/test_gun.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/test_gun.Tpo" "$(DEPDIR)/test_gun.Po"; else rm -f "$(DEPDIR)/test_gun.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/test_gun.cc' object='test_gun.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/test_gun.Po' tmpdepfile='$(DEPDIR)/test_gun.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_gun.obj `if test -f 'world_entities/test_gun.cc'; then $(CYGPATH_W) 'world_entities/test_gun.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/test_gun.cc'; fi`
+
+test_bullet.o: world_entities/test_bullet.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_bullet.o -MD -MP -MF "$(DEPDIR)/test_bullet.Tpo" -c -o test_bullet.o `test -f 'world_entities/test_bullet.cc' || echo '$(srcdir)/'`world_entities/test_bullet.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/test_bullet.Tpo" "$(DEPDIR)/test_bullet.Po"; else rm -f "$(DEPDIR)/test_bullet.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/test_bullet.cc' object='test_bullet.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/test_bullet.Po' tmpdepfile='$(DEPDIR)/test_bullet.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_bullet.o `test -f 'world_entities/test_bullet.cc' || echo '$(srcdir)/'`world_entities/test_bullet.cc
+
+test_bullet.obj: world_entities/test_bullet.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_bullet.obj -MD -MP -MF "$(DEPDIR)/test_bullet.Tpo" -c -o test_bullet.obj `if test -f 'world_entities/test_bullet.cc'; then $(CYGPATH_W) 'world_entities/test_bullet.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/test_bullet.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/test_bullet.Tpo" "$(DEPDIR)/test_bullet.Po"; else rm -f "$(DEPDIR)/test_bullet.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/test_bullet.cc' object='test_bullet.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/test_bullet.Po' tmpdepfile='$(DEPDIR)/test_bullet.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_bullet.obj `if test -f 'world_entities/test_bullet.cc'; then $(CYGPATH_W) 'world_entities/test_bullet.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/test_bullet.cc'; fi`
+
 ai.o: ai/ai.cc
 @am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ai.o -MD -MP -MF "$(DEPDIR)/ai.Tpo" -c -o ai.o `test -f 'ai/ai.cc' || echo '$(srcdir)/'`ai/ai.cc; \
@@ -736,4 +778,20 @@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o data_tank.obj `if test -f 'lib/data/data_tank.cc'; then $(CYGPATH_W) 'lib/data/data_tank.cc'; else $(CYGPATH_W) '$(srcdir)/lib/data/data_tank.cc'; fi`
 
+graphics_engine.o: lib/graphics/graphics_engine.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.o -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.o `test -f 'lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`lib/graphics/graphics_engine.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='lib/graphics/graphics_engine.cc' object='graphics_engine.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.o `test -f 'lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`lib/graphics/graphics_engine.cc
+
+graphics_engine.obj: lib/graphics/graphics_engine.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.obj -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.obj `if test -f 'lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) 'lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/graphics_engine.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='lib/graphics/graphics_engine.cc' object='graphics_engine.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.obj `if test -f 'lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) 'lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/graphics_engine.cc'; fi`
+
 light.o: lib/graphics/light.cc
 @am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT light.o -MD -MP -MF "$(DEPDIR)/light.Tpo" -c -o light.o `test -f 'lib/graphics/light.cc' || echo '$(srcdir)/'`lib/graphics/light.cc; \
@@ -800,4 +858,20 @@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o objModel.obj `if test -f 'lib/graphics/importer/objModel.cc'; then $(CYGPATH_W) 'lib/graphics/importer/objModel.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/importer/objModel.cc'; fi`
 
+primitive_model.o: lib/graphics/importer/primitive_model.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive_model.o -MD -MP -MF "$(DEPDIR)/primitive_model.Tpo" -c -o primitive_model.o `test -f 'lib/graphics/importer/primitive_model.cc' || echo '$(srcdir)/'`lib/graphics/importer/primitive_model.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/primitive_model.Tpo" "$(DEPDIR)/primitive_model.Po"; else rm -f "$(DEPDIR)/primitive_model.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='lib/graphics/importer/primitive_model.cc' object='primitive_model.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/primitive_model.Po' tmpdepfile='$(DEPDIR)/primitive_model.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive_model.o `test -f 'lib/graphics/importer/primitive_model.cc' || echo '$(srcdir)/'`lib/graphics/importer/primitive_model.cc
+
+primitive_model.obj: lib/graphics/importer/primitive_model.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive_model.obj -MD -MP -MF "$(DEPDIR)/primitive_model.Tpo" -c -o primitive_model.obj `if test -f 'lib/graphics/importer/primitive_model.cc'; then $(CYGPATH_W) 'lib/graphics/importer/primitive_model.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/importer/primitive_model.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/primitive_model.Tpo" "$(DEPDIR)/primitive_model.Po"; else rm -f "$(DEPDIR)/primitive_model.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='lib/graphics/importer/primitive_model.cc' object='primitive_model.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/primitive_model.Po' tmpdepfile='$(DEPDIR)/primitive_model.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive_model.obj `if test -f 'lib/graphics/importer/primitive_model.cc'; then $(CYGPATH_W) 'lib/graphics/importer/primitive_model.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/importer/primitive_model.cc'; fi`
+
 model.o: lib/graphics/importer/model.cc
 @am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT model.o -MD -MP -MF "$(DEPDIR)/model.Tpo" -c -o model.o `test -f 'lib/graphics/importer/model.cc' || echo '$(srcdir)/'`lib/graphics/importer/model.cc; \
@@ -927,4 +1001,20 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o substring.obj `if test -f 'lib/util/substring.cc'; then $(CYGPATH_W) 'lib/util/substring.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/substring.cc'; fi`
+
+resource_manager.o: lib/util/resource_manager.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.o -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.o `test -f 'lib/util/resource_manager.cc' || echo '$(srcdir)/'`lib/util/resource_manager.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='lib/util/resource_manager.cc' object='resource_manager.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.o `test -f 'lib/util/resource_manager.cc' || echo '$(srcdir)/'`lib/util/resource_manager.cc
+
+resource_manager.obj: lib/util/resource_manager.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.obj -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.obj `if test -f 'lib/util/resource_manager.cc'; then $(CYGPATH_W) 'lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/resource_manager.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='lib/util/resource_manager.cc' object='resource_manager.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.obj `if test -f 'lib/util/resource_manager.cc'; then $(CYGPATH_W) 'lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/resource_manager.cc'; fi`
 
 vector.o: lib/math/vector.cc
@@ -1114,14 +1204,12 @@
 	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; \
@@ -1133,9 +1221,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
@@ -1162,5 +1248,5 @@
 
 distdir: $(DISTFILES)
-	$(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/graphics/font $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/lib/xmlparser $(distdir)/network $(distdir)/story_entities $(distdir)/world_entities
+	$(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/graphics/font $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/lib/xmlparser $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/world_entities
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
@@ -1207,7 +1293,5 @@
 installdirs: installdirs-recursive
 installdirs-am:
-	for dir in "$(DESTDIR)$(bindir)"; do \
-	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
-	done
+	$(mkdir_p) $(DESTDIR)$(bindir)
 install: install-recursive
 install-exec: install-exec-recursive
@@ -1299,4 +1383,5 @@
 	uninstall-binPROGRAMS uninstall-info-am
 
+		 glmenu/glmenu_imagescreen.cc
 
 #  uncomment the following if orxonox requires the math library
Index: orxonox/branches/levelloader/src/camera.cc
===================================================================
--- orxonox/branches/levelloader/src/camera.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/camera.cc	(revision 3746)
@@ -17,31 +17,28 @@
 
 #include "camera.h"
+
 #include "world.h"
 #include "world_entity.h"
+#include "vector.h"
 
 using namespace std;
 
+////////////
+// CAMERA //
+////////////
+
 /**
    \brief creates a Camera
-   
-   This standard constructor sets all parameters to zero
 */
-Camera::Camera (World* world)
+Camera::Camera(void)
 {
-  this->world = world;
-  this->bound = NULL;
-  /* give it some physical live */
-  this->m = 10;
-  this->a = new Vector(0.0, 0.0, 0.0);
-  this->v = new Vector(0.0, 0.0, 0.0);
-  this->fs = new Vector(0.0, 0.0, 0.0);
-  this->cameraMode = NORMAL;
-  this->deltaTime = 3000.0;
-  this->cameraOffset = 1.0;
-  this->cameraOffsetZ = 10.0;
-  this->t = 0.0;
+  this->setClassName("Camera");
+  this->target = new CameraTarget();
 
+  this->setFovy(90);
+  this->setAspectRatio(1.2f);
+  this->setClipRegion(.1, 2000);
 
-  this->setDrawable (false);
+  this->setViewMode(VIEW_NORMAL);
 }
 
@@ -49,142 +46,105 @@
    \brief default destructor
 */
-Camera::~Camera ()
+Camera::~Camera(void)
 {
-  this->bound = NULL;
-  this->world = NULL;
-
 }
 
 /**
-   \brief time based actualisation of camera parameters
-   \param deltaT: The amount of time that has passed in milliseconds
-   
-   This is called by the World in every time_slice, use it to do fancy time dependant effects (such 
-   as smooth camera movement or swaying).
+   \brief focuses the Camera onto a Target
+   \param target the new PNode the Camera should look at.
 */
-void Camera::tick (Uint32 deltaT)
+void Camera::lookAt(PNode* target)
 {
-  if( this->t <= deltaTime)
-    {this->t += deltaT;}
-  //printf("time is: t=%f\n", t );
-  updateDesiredPlace();
-  //jump(NULL);
+  this->target->setParent(target);
 }
 
 /**
-   \brief this calculates the location where the track wants the camera to be
-   
-   This refreshes the placement the camera should have according to the 
-   bound entity's position on the track.
+   \returns The PNode of the Target (from there you can get position and so on
 */
-void Camera::updateDesiredPlace ()
+PNode* Camera::getTarget(void)
 {
-  switch(cameraMode)
-    {
-      
-    case ELLIPTICAL:
-      {
-	/*
-	//r = actual_place.r 
-	Orxonox *orx = Orxonox::getInstance();
-	Location lookat;  
-	Placement plFocus;
-	if( bound != NULL)
-	  {
-	    bound->getLookat (&lookat);
-	    orx->getWorld()->calcCameraPos (&lookat, &plFocus);
-	    Quaternion *fr;
-	    if(t < 20.0)
-	      {
-		Vector *start = new Vector(0.0, 1.0, 0.0);
-		r = *(new Vector(0.0, 5.0, 0.0));
-
-		Vector up(0.0, 0.0, 1.0);
-		
-		Vector op(1.0, 0.0, 0.0);
-		float angle = angleDeg(op, *start);
-		printf("angle is: %f\n", angle);
-
-		//if in one plane
-		from = new Quaternion(angle, up);
-
-		//from = new Quaternion(*start, *up);
-		//&from = &plFocus.w;
-		//fr = &plFocus.w; real quaternion use
-		
+  return (PNode*)this->target;
+}
 
 
-		Vector vDirection(1.0, 0.0, 0.0);
-		//vDirection = plFocus.w.apply(vDirection);
-		to = new Quaternion(vDirection, *start);
-		res = new Quaternion();
-	      }
-	    //printf("vector r = %f, %f, %f\n",r.x, r.y, r.z );
-	    rAbs = r.len();
-	    if(t < 30)
-	      {
-		ka = rAbs / deltaTime*deltaTime;
-	      }
+/**
+   \brief sets a new AspectRatio
+   \param aspectRatio the new aspect ratio to set (width / height)
+*/
+void Camera::setAspectRatio(float aspectRatio)
+{
+  this->aspectRatio = aspectRatio;
+}
 
-	    res->quatSlerp(to, from, t/deltaTime, res);
+/**
+   \brief sets the Field of View to fofy
+   \param fovy new field of view factor (in degrees)
+*/
+void Camera::setFovy(float fovy)
+{
+  this->fovy = fovy;
+}
 
-	    Vector ursp(0.0, 0.0, 0.0);
-	    desiredPlace.r =  ursp - res->apply(r); 
+/**
+  \brief Sets a new clipping region
+  \param nearClip The near clip plane
+  \param farClip The far clip plane
+*/
+void Camera::setClipRegion(float nearClip, float farClip)
+{
+  this->nearClip = nearClip;
+  this->farClip = farClip;
+}
 
-	    printf("desired place is: %f, %f, %f\n", desiredPlace.r.x, desiredPlace.r.y, desiredPlace.r.z);
-	    //plLastBPlace = *bound->get_placement();
-	    
-	  } 
-      */
-      }
+void Camera::setViewMode(ViewMode mode)
+{
+  switch (mode)
+    {
+    default:
+    case VIEW_NORMAL:
+      this->toFovy = 60.0;
+      this->toRelCoor = Vector(-10, 5, 0);
       break;
-    case SMOTH_FOLLOW:
-      {
-	/*
-	Placement *plBound = bound->getPlacement();
-	Location lcBound;
-	if(bound != null)
-	  {
-	    bound->getLookat(&lcBound);
-	    Vector vDirection(0.0, 0.0, 1.0);
-	    vDirection = plBound->w.apply(vDirection);
-	    desiredPlace.r = (vDirection * ((lcBound.dist-10.0))) + Vector(0,0,5.0);
-	  }
-	*/
-	break;
-      }
-      /* this is a camera mode that tries just to follow the entity. */
-    case STICKY:
-      {
-	/*
-	if(bound != null)
-	  {
-	    Placement *plBound = bound->getPlacement();
-	    Vector vDirection(0.0, 0.0, 1.0);
-	    Vector eclipticOffset(0.0, 0.0, 5.0);
-	    vDirection = plBound->w.apply(vDirection);
-	    desiredPlace.r = plBound->r - vDirection*10 + eclipticOffset;
-	  }
-	*/
-	break;
-      }
-      /* the camera is handled like an entity and rolls on the track */
-    case NORMAL:
-      if( bound != NULL && world != NULL )
-	{
-	  //FIXME: camera should be made via relative coordinates
-	  Vector* cameraOffset = new Vector (-10, 5, 0);
-	  this->setRelCoor (cameraOffset);
-	} 
-      else
-	{
-	  /*
-	  desiredPlace.r = Vector (0,0,0);
-	  desiredPlace.w = Quaternion (); 
-	  */
-	}
+    case VIEW_BEHIND:
+      this->toFovy = 120.0;
+      this->toRelCoor = Vector(-7, 0, 0);
       break;
+    case VIEW_FRONT:
+      this->toFovy = 95.0;
+      this->toRelCoor = Vector(12, 5, 0);
+      break;
+    case VIEW_LEFT: 
+      this->toFovy = 90;
+      this->toRelCoor = Vector(0, 2, -10);
+      break;
+    case VIEW_RIGHT:
+      this->toFovy = 90;
+      this->toRelCoor = Vector(0, 2, 10);
+      break;
+    case VIEW_TOP:
+      this->toFovy= 120;
+      this->toRelCoor = Vector(0, 4, 0);
     }
 }
+
+
+/**
+   \brief Updates the position of the camera.
+   \param dt The time that elapsed.
+*/
+void Camera::tick(float dt)
+{
+  dt /= 500;
+  float tmpFovy = (this->toFovy - this->fovy) * dt;
+  if (tmpFovy > .001)
+    this->fovy += (this->toFovy - this->fovy) * dt;
+  Vector tmpPos = (this->toRelCoor - *this->getRelCoor()) * dt;
+  if (tmpPos.len() >= .001)
+    {
+      tmpPos = tmpPos + *this->getRelCoor();
+      this->setRelCoor(&tmpPos);
+    }
+}
+
 
 /**
@@ -196,85 +156,44 @@
 void Camera::apply ()
 {
+  // switching to Projection Matrix
   glMatrixMode (GL_PROJECTION);
   glLoadIdentity ();
-  // view
-  // TO DO: implement options for frustum generation
-  //glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 250.0);
-  gluPerspective(60, 1.2f, 0.1, 2000);
-  
-  //Vector up(0,0,1);
-  //Vector dir(1,0,0);
-  //Quaternion q(dir,up);
-  //float matrix[4][4];
-  //q.conjugate().matrix (matrix);
-  //glMultMatrixf ((float*)matrix);
-  //glTranslatef (10,0,-5);
-  //
-  //dir = Vector(-1,-1,0);
-  //q = Quaternion( dir, up);
-  //glMatrixMode (GL_MODELVIEW);
-  //glLoadIdentity ();
-  //q.matrix (matrix);
-  //glMultMatrixf ((float*)matrix);
-  //glTranslatef (2,2,0);
-  //
-  //glBegin(GL_TRIANGLES);
-  //glColor3f(1,0,0);
-  //glVertex3f(0,0,0.5);
-  //glColor3f(0,1,0);
-  //glVertex3f(-0.5,0,-1);
-  //glColor3f(0,0,1);
-  //glVertex3f(0.5,0,-1);
-  //glEnd();	
 
-  // ===== first camera control calculation option
-  // rotation
-  float matrix[4][4];
-  //this->absDirection.conjugate().matrix (matrix);
-  /* orientation and */
-  //glMultMatrixf ((float*)matrix);
+  // setting up the perspective
+  gluPerspective(this->fovy,
+		 this->aspectRatio,
+		 this->nearClip,
+		 this->farClip);
 
-  /*  translation */
-  //glTranslatef (this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z );
+  // speed-up feature
+  Vector cameraPosition = this->getAbsCoor();
+  Vector targetPosition = this->target->getAbsCoor();
+  Vector up = Vector(0, 1, 0);
+  up = this->getAbsDir().apply(up);
 
+  // Setting the Camera Eye, lookAt and up Vectors
+  gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,
+	    targetPosition.x, targetPosition.y, targetPosition.z,
+	    up.x, up.y, up.z);
 
-  // ===== second camera control calculation option
-  
-  gluLookAt(this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z, 
-	    this->parent->getAbsCoor ().x, this->parent->getAbsCoor ().y, this->parent->getAbsCoor ().z,
-	    0.0, 1.0, 0.0);
-  
-
+  // switching back to Modeling Matrix
   glMatrixMode (GL_MODELVIEW);
-  glLoadIdentity ();
 }
 
 
 
-/**
-  \brief bind the camera to an entity
-  \param entity: The enitity to bind the camera to
-	
-  This sets the focus of the camera to the given entity. This means that it will use the given WorldEntity's
-  Location and get_lookat() to determine the viewpoint the camera will render from.
-  Note that you cannot bind a camera to a free entity.
-*/
-void Camera::bind (WorldEntity* entity)
+///////////////////
+// CAMERA-TARGET //
+///////////////////
+
+
+CameraTarget::CameraTarget()
 {
-  if( entity != NULL)
-    {
-      if( entity->isFree()) printf("Cannot bind camera to free entity");
-      else 
-	{
-	  this->bound = entity;
-	}
-    } 
+  this->setClassName("CameraTarget");
+  this->setMode(PNODE_MOVEMENT);
 }
 
+CameraTarget::~CameraTarget()
+{
 
-void Camera::setWorld(World* world)
-{
-  this->world = world;
 }
-
-
Index: orxonox/branches/levelloader/src/camera.h
===================================================================
--- orxonox/branches/levelloader/src/camera.h	(revision 3606)
+++ orxonox/branches/levelloader/src/camera.h	(revision 3746)
@@ -7,60 +7,57 @@
 #define _CAMERA_H
 
-#include "world_entity.h"
+#include "p_node.h"
+#include "vector.h"
 
 class World;
+class CameraTarget;
+
+enum ViewMode{VIEW_NORMAL, VIEW_BEHIND, VIEW_FRONT, VIEW_LEFT, VIEW_RIGHT, VIEW_TOP};
 
 //! Camera
 /**
-   This class controls the viewpoint from which the World is rendered. To use the 
-   Camera it has to be bound to a WorldEntity which serves as the reference focus 
-   point. The Camera itself calls the WorldEntity::get_lookat() and 
-   World::calc_camera_pos() functions to calculate the position it currently should
-   be in.
+   This class controls the viewpoint from which the World is rendered.
 */
+class Camera : public PNode 
+{
+ private:
+  CameraTarget* target;            //!< The Target of the Camera (where this Camera Looks at)
 
-enum CAMERA_MODE {NORMAL, SMOTH_FOLLOW, STICKY, ELLIPTICAL};
+  float fovy;                      //!< The field of view Angle (in degrees).
+  float aspectRatio;               //!< The aspect ratio (width / height).
+  float nearClip;                  //!< The near clipping plane.
+  float farClip;                   //!< The far clipping plane.
 
-class Camera : public WorldEntity {
- private:
-  WorldEntity* bound;		//!< the WorldEntity the Camera is bound to
-  World* world;
-  
-  /* physical system - not needed yet */
-  float m; //!< mass
-  Vector *fs; //!< seil-kraft
-  Vector *a;  //!< acceleration
-  Vector *v;  //!< velocity
-  
-  /* elliptical camera mode variables */
-  float cameraOffset;
-  float cameraOffsetZ;
-  float deltaTime;
-  float t;
-  Vector r;
-  float rAbs;
-  float ka;
-  float a0;
-
-  Quaternion *from;
-  Quaternion *to;
-  Quaternion *res;
-  
-  
-  CAMERA_MODE cameraMode; //!< saves the camera mode: how the camera follows the entity
-  
-  void updateDesiredPlace ();
+  Vector toRelCoor;
+  float toFovy;
   
  public:
-  Camera (World* world);
-  virtual ~Camera ();
-  
-  void tick (Uint32 deltaT);
-  void apply ();
-  void bind (WorldEntity* entity);
+  Camera(void);
+  virtual ~Camera(void);
 
-  void setWorld(World* world);  
+  void lookAt(PNode* target);
+  PNode* getTarget();
 
+  void setAspectRatio(float aspectRatio);
+  void setFovy(float fovy);
+  void setClipRegion(float nearClip, float farClip);
+
+  void setViewMode(ViewMode mode);
+  void tick(float dt);
+  void apply (void);
 };
 
+//! A CameraTarget is where the Camera is looking at.
+class CameraTarget : public PNode 
+{
+  friend class Camera;             //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it.
+  
+ private:
+  CameraTarget(void);
+  
+ public:
+  virtual ~CameraTarget(void);
+};
+
+
 #endif /* _CAMERA_H */
Index: orxonox/branches/levelloader/src/command_node.cc
===================================================================
--- orxonox/branches/levelloader/src/command_node.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/command_node.cc	(revision 3746)
@@ -22,4 +22,7 @@
 #include "game_loader.h"
 #include "world.h"
+#include "list.h"
+#include "orxonox.h"
+#include "debug.h"
 
 #include <stdio.h>
@@ -279,10 +282,12 @@
   if( this->world->command(cmd)) return;
 
-  WorldEntity* entity = bound->enumerate();
+  tIterator<WorldEntity>* iterator = bound->getIterator();
+  WorldEntity* entity = iterator->nextElement();
   while( entity != NULL)
     {
       entity->command (cmd); /*no absorbtion of command! strange*/
-      entity = bound->nextElement();
-    }
+      entity = iterator->nextElement();
+    }
+  delete iterator;
 }
 
Index: orxonox/branches/levelloader/src/command_node.h
===================================================================
--- orxonox/branches/levelloader/src/command_node.h	(revision 3606)
+++ orxonox/branches/levelloader/src/command_node.h	(revision 3746)
@@ -9,6 +9,8 @@
 #define _COMMAND_NODE_H
 
-#include "stdincl.h"
 
+#include "comincl.h"
+
+template<class T> class tList;
 class WorldEntity;
 class World;
Index: orxonox/branches/levelloader/src/defs/comincl.h
===================================================================
--- orxonox/branches/levelloader/src/defs/comincl.h	(revision 3746)
+++ orxonox/branches/levelloader/src/defs/comincl.h	(revision 3746)
@@ -0,0 +1,13 @@
+/*!
+  \file glincl.h
+  \brief This file includes gl Headers.
+  
+  no Class is defined here, but the opengl Headers
+*/
+
+#ifndef _COMINCL_H
+#define _COMINCL_H
+
+#include "message_structures.h"
+
+#endif /* _COMINCL_H */
Index: orxonox/branches/levelloader/src/defs/debug.h
===================================================================
--- orxonox/branches/levelloader/src/defs/debug.h	(revision 3606)
+++ orxonox/branches/levelloader/src/defs/debug.h	(revision 3746)
@@ -59,12 +59,15 @@
 #define DEBUG_MODULE_ORXONOX            0
 #define DEBUG_MODULE_WORLD              0
-#define DEBUG_MODULE_PNODE              2
+#define DEBUG_MODULE_PNODE              3
 #define DEBUG_MODULE_WORLD_ENTITY       0
 #define DEBUG_MODULE_COMMAND_NODE       0
+#define DEBUG_MODULE_GRAPHICS           0
+#define DEBUG_MODULE_LOAD               0
 
 #define DEBUG_MODULE_IMPORTER           0
 #define DEBUG_MODULE_TRACK_MANAGER      0
-#define DEBUG_MODULE_LIGHT              3
-#define DEBUG_MODULE_PLAYER             0
+#define DEBUG_MODULE_GARBAGE_COLLECTOR  0
+#define DEBUG_MODULE_LIGHT              0
+#define DEBUG_MODULE_PLAYER             3
 #define DEBUG_MODULE_MATH               0
 
Index: orxonox/branches/levelloader/src/defs/stdincl.h
===================================================================
--- orxonox/branches/levelloader/src/defs/stdincl.h	(revision 3606)
+++ orxonox/branches/levelloader/src/defs/stdincl.h	(revision 3746)
@@ -9,6 +9,4 @@
 #define _STDINCL_H
 		
-#define null 0   //!< null
-
 typedef unsigned char byte;
 
@@ -23,4 +21,5 @@
 
 #include <assert.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
@@ -28,6 +27,4 @@
 #include "glincl.h"
 
-#include "error.h"
-#include "debug.h"
 
 // MATH //
@@ -39,8 +36,8 @@
 #include "list_template.h"
 #include "message_structures.h"
-#include "orxonox.h"
 #include "data_tank.h"
 #include "base_object.h"
 #include "factory.h"
+#include "debug.h"
 
 #define CREATE_FACTORY(x) \
Index: orxonox/branches/levelloader/src/game_loader.cc
===================================================================
--- orxonox/branches/levelloader/src/game_loader.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/game_loader.cc	(revision 3746)
@@ -25,4 +25,5 @@
 #include "vector.h"
 #include "factory.h"
+#include "debug.h"
 
 #include <string.h>
@@ -89,5 +90,10 @@
   switch(campaignID)
     {
-      // Debug Level 0: Debug level used to test the base frame work.
+      /* 
+	 Debug Level 0: Debug level used to test the base frame work.
+	 As you can see, all storyentity data is allocated before game
+	 start. the storyentity will load themselfs shortly before start
+	 through the StoryEntity::init() funtion.
+      */
     case DEBUG_CAMPAIGN_0:
       {
@@ -99,6 +105,10 @@
 
 	World* world1 = new World(DEBUG_WORLD_1);
-	world1->setNextStoryID(WORLD_ID_GAMEEND);
+	world1->setNextStoryID(WORLD_ID_2);
 	debugCampaign->addEntity(world1, WORLD_ID_1);
+
+	World* world2 = new World(DEBUG_WORLD_2);
+	world2->setNextStoryID(WORLD_ID_GAMEEND);
+	debugCampaign->addEntity(world2, WORLD_ID_2);
 
 	this->currentCampaign = debugCampaign;
Index: orxonox/branches/levelloader/src/game_loader.h
===================================================================
--- orxonox/branches/levelloader/src/game_loader.h	(revision 3606)
+++ orxonox/branches/levelloader/src/game_loader.h	(revision 3746)
@@ -1,8 +1,15 @@
+/*! 
+    \file game_loader.h
+    \brief loads campaigns, worlds and all other story_entities
+*/ 
+
 #ifndef _GAME_LOADER_H
 #define _GAME_LOADER_H
 
-#include "stdincl.h"
+//#include "stdincl.h"
 #include "story_def.h"
 #include "factory.h"
+#include "comincl.h"
+#include "error.h"
 
 //-----------------------------------------------------------------------------
@@ -14,5 +21,16 @@
 class CammandNode;
 
-
+//! The GameLoader
+/**
+   The game loader loads all game date. this is performed in the following way:
+   1. Read the structure of campaings and worlds
+   2. Create the instances of the tree: here _ALL_ StoryEntities are created
+      also if they are not yet used. the worlds should load their data in
+      the StoryEntity::load() and StoryEntity::init() functions! NOWHERE ELSE!
+      Elsewhere, all the data will be allocated at the beginning... mess...
+   3. StoryEntities are load() and init() before they start
+   4. once the gamloader starts the game there will be a campaing starting a
+      world. this is done by callaing those StoryEntity::start()
+*/
 class GameLoader 
 {
Index: orxonox/branches/levelloader/src/garbage_collector.cc
===================================================================
--- orxonox/branches/levelloader/src/garbage_collector.cc	(revision 3746)
+++ orxonox/branches/levelloader/src/garbage_collector.cc	(revision 3746)
@@ -0,0 +1,149 @@
+
+
+/* 
+   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: Patrick Boenzli
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GARBAGE_COLLECTOR
+
+#include "garbage_collector.h"
+
+#include "world.h"
+#include "world_entity.h"
+#include "null_parent.h"
+
+#include "list.h"
+
+using namespace std;
+
+
+GarbageCollector* GarbageCollector::singletonRef = 0;
+
+/**
+   \brief standard constructor
+   \todo this constructor is not jet implemented - do it
+*/
+GarbageCollector::GarbageCollector () 
+{
+   this->setClassName ("GarbageCollection");
+   this->time = 0;
+   this->delay = 1.5f; /* clean up all 5.0 seconds */
+}
+
+
+/**
+   \brief standard deconstructor
+
+*/
+GarbageCollector::~GarbageCollector () 
+{
+  // delete what has to be deleted here
+}
+
+
+/**
+   \brief this returns the singleton reference this this class
+   \returns singleton reference
+*/
+GarbageCollector* GarbageCollector::getInstance()
+{
+  if( singletonRef == NULL)
+    singletonRef = new GarbageCollector();
+  return singletonRef;
+}
+
+
+/**
+   \brief this sets the collection delay
+   \param delay
+   
+   after this delay, the garbage collector starts its work and begins to collect unused object
+   to delete them afterwards. only objects in the worldentity list from the world object are lookded
+   at. 
+*/
+void GarbageCollector::setCollectionDelay(float delay)
+{
+  this->delay = delay;
+}
+
+
+/**
+   \brief this foreces a garbage collection
+
+   if this function is called, the gc tries to initiate the garbage collection routines. actually
+   this should always work.
+*/
+void GarbageCollector::forceCollection()
+{
+  /* just make the time slitely bigger than the delay */
+  this->time = this->delay + 1;
+  /* and update, to get rid of the unused objects */
+  this->update();
+}
+
+
+/**
+   \brief this ticks the GarbageCollector to give it the time pulse
+   \param the time passed since last tick
+
+   like every other tick function eg. worldentity
+*/
+void GarbageCollector::tick(float time)
+{
+  this->time += time;
+}
+
+
+/**
+   \brief this updated the gargabe collection, if the time is ready
+
+
+*/
+void GarbageCollector::update()
+{
+  if( this->time < this->delay)
+    return;
+  /* garbage collect */
+  PRINTF(3)("=============================\n");
+  PRINTF(3)("Processing Garbage Collection\n");
+  PRINTF(3)("=============================\n");
+  int counter = 0;
+  WorldInterface* wi = WorldInterface::getInstance();
+  tList<WorldEntity>* list = wi->getEntityList();
+
+  tIterator<WorldEntity>* iterator = list->getIterator();
+  WorldEntity* entity = iterator->nextElement();
+  while( entity != NULL) 
+    { 
+      if( entity->isFinalized())
+	{
+	  PRINTF(4)("= finalizing object\n");
+	  ++counter;
+	  
+	  /* first remove out of entity list */
+	  list->remove(entity);
+	  /* second remove out of pnode tree */
+	  entity->remove();
+	  /* then finaly delete reference */
+	  delete entity;
+	}
+      entity = iterator->nextElement();
+    }
+
+  PRINTF(3)("= collected %i unused objects\n", counter);
+  PRINTF(3)("=============================\n");
+
+  /* reset time to count again up to this->delay */
+  this->time = 0;
+}
Index: orxonox/branches/levelloader/src/garbage_collector.h
===================================================================
--- orxonox/branches/levelloader/src/garbage_collector.h	(revision 3746)
+++ orxonox/branches/levelloader/src/garbage_collector.h	(revision 3746)
@@ -0,0 +1,42 @@
+/*! 
+    \file proto_class.h
+    \brief Definition of the proto class template, used quickly start work
+    \todo Example: this shows how to use simply add a Marker that here has to be done something.
+
+    The Protoclass exists, to help you quikly getting the run for how to develop in orxonox.
+    It is an example for the CODING-CONVENTION, and a starting-point for every class.
+*/
+
+#ifndef _GARBAGE_COLLECTOR_H
+#define _GARBAGE_COLLECTOR_H
+
+#include "base_object.h"
+
+
+//! this class maintains the garbage collection.
+/**
+   the class is been ticked by the world.cc and goes through the 
+   world_entity list to clean out all unused entities.
+*/
+class GarbageCollector : public BaseObject {
+
+ public:
+  GarbageCollector();
+  virtual ~GarbageCollector();
+  static GarbageCollector* getInstance();
+
+  void setCollectionDelay(float delay);
+
+  void forceCollection();
+
+  void tick(float time);
+  void update();
+
+ private:
+  static GarbageCollector* singletonRef;
+  float delay;                                        //!< this is the delay to wait until collection
+  float time;                                         //!< the current time
+
+};
+
+#endif /* _GARBAGE_COLLECTOR_H */
Index: orxonox/branches/levelloader/src/glmenu/glmenu_imagescreen.cc
===================================================================
--- orxonox/branches/levelloader/src/glmenu/glmenu_imagescreen.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/glmenu/glmenu_imagescreen.cc	(revision 3746)
@@ -41,4 +41,5 @@
 {
    this->setClassName ("GLMenuImageScreen");
+   this->init();
 }
 
@@ -50,6 +51,6 @@
 GLMenuImageScreen::~GLMenuImageScreen() 
 {
-  if (backMat)
-    delete backMat;
+  if (this->backMat)
+    delete this->backMat;
 }
 
@@ -81,5 +82,5 @@
   // Select Our VU Meter Background Texture
   this->backMat = new Material("load_screen");
-  this->backMat->setDiffuseMap("../data/pictures/load_screen.jpg");
+  this->backMat->setDiffuseMap("pictures/load_screen.jpg");
   this->maxValue = 10;
   this->currentValue = 0;
@@ -110,30 +111,9 @@
 void GLMenuImageScreen::draw ()
 {
-  /*
-  // Display a quad texture to the screen
-  glEnable(GL_TEXTURE_2D);
-  glBegin(GL_QUADS);
-  
-  // Display the top left vertice
-  glTexCoord2f(0.0f, 1.0f);
-  glVertex3f(-2.5, 2.5, 0);
-  
-  // Display the bottom left vertice
-  glTexCoord2f(0.0f, 0.0f);
-  glVertex3f(-2.5, -2.5, 0);
-  
-  // Display the bottom right vertice
-  glTexCoord2f(1.0f, 0.0f);
-  glVertex3f(2.5, -2.5, 0);
-  
-  // Display the top right vertice
-  glTexCoord2f(1.0f, 1.0f);
-  glVertex3f(2.5, 2.5, 0);
-
-  glEnd();
-  glEnable(GL_TEXTURE_2D);  
-  */
 
   glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+
+  PRINTF(4)("GLMenuImagEscreen::draw() - drawing step %i/%i\n", 
+	 this->currentValue, this->maxValue);
 
   /* screen size */
@@ -154,6 +134,8 @@
   int barWidth = 230;
   int barHeight = 30;
-
-  int val = (int)((float)this->currentValue/(float)this->maxValue) * barWidth;
+  
+  float val = ((float)this->currentValue/(float)this->maxValue) * barWidth;
+  if( val > (float)barWidth)
+    val = (float)barWidth;
 
   glMatrixMode(GL_PROJECTION);
@@ -170,9 +152,10 @@
   glDisable(GL_LIGHTING);
 
+  /* draw the progress bar */
   glBegin(GL_QUADS);
   glColor3f(0.96, 0.84, 0.34);
   glVertex2i(barX, barY);
-  glVertex2i(barX + val, barY);
-  glVertex2i(barX + val, barY + barHeight);
+  glVertex2i(barX + (int)val, barY);
+  glVertex2i(barX + (int)val, barY + barHeight);
   glVertex2i(barX, barY + barHeight);
   glColor3f(1.0, 1.0, 1.0);
@@ -223,5 +206,5 @@
   glPopAttrib();
 
-  SDL_GL_SwapBuffers();                    
+  SDL_GL_SwapBuffers();              
 }
  
Index: orxonox/branches/levelloader/src/glmenu/glmenu_imagescreen.h
===================================================================
--- orxonox/branches/levelloader/src/glmenu/glmenu_imagescreen.h	(revision 3606)
+++ orxonox/branches/levelloader/src/glmenu/glmenu_imagescreen.h	(revision 3746)
@@ -45,4 +45,6 @@
   float offsetX, offsetY;    //!< offset of the image from left and up
   Material* backMat;         //!< Background Material.
+
+  /* progress bar values */
   int currentValue;          //!< the current count of step() calls fired yet
   int maxValue;              //!< total count of steps
Index: orxonox/branches/levelloader/src/lib/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/lib/Makefile.in	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/Makefile.in	(revision 3746)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.8.2 from Makefile.am.
 # @configure_input@
 
@@ -183,7 +183,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  src/lib/Makefile
+	  $(AUTOMAKE) --gnu  src/lib/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -278,14 +278,12 @@
 	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; \
@@ -297,9 +295,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
Index: orxonox/branches/levelloader/src/lib/coord/helper_parent.h
===================================================================
--- orxonox/branches/levelloader/src/lib/coord/helper_parent.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/coord/helper_parent.h	(revision 3746)
@@ -8,5 +8,5 @@
 #define _HELPER_PARENT_H
 
-#include "stdincl.h"
+
 #include "p_node.h"
 
Index: orxonox/branches/levelloader/src/lib/coord/null_parent.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/coord/null_parent.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/coord/null_parent.cc	(revision 3746)
@@ -19,4 +19,7 @@
 
 #include "null_parent.h"
+#include "stdincl.h"
+#include "vector.h"
+#include "list.h"
 
 
@@ -51,5 +54,5 @@
   this->parent = this;
   this->mode = PNODE_ALL;
-  this->absCoordinate = *absCoordinate;
+  *this->absCoordinate = *absCoordinate;
   this->setName("NullParent");
 }
@@ -74,12 +77,14 @@
    worry, normaly...
 */
-void NullParent::update ()
+void NullParent::update (float dt)
 {
 
-  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;
-  
-  PNode* pn = this->children->enumerate ();
+  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;
+
+  tIterator<PNode>* iterator = this->children->getIterator();
+  //PNode* pn = this->children->enumerate ();
+  PNode* pn = iterator->nextElement();
   while( pn != NULL) 
     { 
@@ -89,6 +94,7 @@
       if( this->bRelDirChanged || this->bAbsDirChanged)
 	pn->parentDirChanged ();
-      pn->update ();
-      pn = this->children->nextElement ();
+      pn->update (dt);
+      //pn = this->children->nextElement ();
+      pn = iterator->nextElement();
     }
 
Index: orxonox/branches/levelloader/src/lib/coord/null_parent.h
===================================================================
--- orxonox/branches/levelloader/src/lib/coord/null_parent.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/coord/null_parent.h	(revision 3746)
@@ -8,5 +8,5 @@
 #define _NULL_PARENT_H
 
-#include "stdincl.h"
+
 #include "p_node.h"
 
@@ -19,6 +19,6 @@
 
 
-  virtual void update ();
-
+  virtual void update (float dt);
+  
  private:
   NullParent ();
Index: orxonox/branches/levelloader/src/lib/coord/p_node.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/coord/p_node.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/coord/p_node.cc	(revision 3746)
@@ -21,7 +21,15 @@
 
 #include "p_node.h"
-
+#include "stdincl.h"
+
+#include "error.h"
+#include "debug.h"
+#include "list.h"
+#include "vector.h"
 #include "null_parent.h"
-#include "vector.h"
+
+
+//#include "vector.h"
+//#include "quaternion.h"
 
 using namespace std;
@@ -52,12 +60,12 @@
   this->init(parent);
 
-  this->absCoordinate = *absCoordinate;
+  *this->absCoordinate = *absCoordinate;
   if (parent != NULL)
     {
-      this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
+      *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
       parent->addChild (this);
     }
   else 
-    this->relCoordinate = Vector(0,0,0);
+    this->relCoordinate = new Vector(0,0,0);
 }
 
@@ -94,4 +102,5 @@
 }
 
+
 void PNode::init(PNode* parent)
 {
@@ -103,4 +112,10 @@
   this->parent = parent; 
   this->objectName = NULL;
+
+  this->absCoordinate = new Vector();
+  this->relCoordinate = new Vector();
+  this->absDirection = new Quaternion();
+  this->relDirection = new Quaternion();
+  this->lastAbsCoordinate = new Vector();
 }
 
@@ -129,9 +144,12 @@
    \brief get relative coordinates
    \returns relative coordinates to its parent
-*/
-Vector PNode::getRelCoor ()
-{
-  Vector r = this->relCoordinate; /* return a copy, so it can't be modified */
-  return r;
+   
+   the reference that is returned is a pointer to the real relCoor, so don't 
+   change it unless you realy know what you are doing.
+*/
+Vector* PNode::getRelCoor ()
+{
+  //Vector r = *this->relCoordinate; /* return a copy, so it can't be modified */
+  return this->relCoordinate;
 }
 
@@ -148,5 +166,20 @@
 {
   this->bRelCoorChanged = true;
-  this->relCoordinate = *relCoord;
+  *this->relCoordinate = *relCoord;
+}
+
+
+/**
+   \brief set relative coordinates
+   \param relCoord relative coordinates to its parent
+
+   it is very importand, that you use this function, if you want to update the
+   relCoordinates. If you don't use this, the PNode won't recognize, that something
+   has changed and won't update the children Nodes.
+*/
+void PNode::setRelCoor (Vector relCoord)
+{
+  this->bRelCoorChanged = true;
+  *this->relCoordinate = relCoord;
 }
 
@@ -158,5 +191,5 @@
 Vector PNode::getAbsCoor ()
 {
-  return this->absCoordinate;
+  return *this->absCoordinate;
 }
 
@@ -172,5 +205,20 @@
 {
   this->bAbsCoorChanged = true;
-  this->absCoordinate = *absCoord;
+  *this->absCoordinate = *absCoord;
+}
+
+
+
+/**
+   \param absCoord set absolute coordinate
+
+   it is very importand, that you use this function, if you want to update the
+   absCoordinates. If you don't use this, the PNode won't recognize, that something
+   has changed and won't update the children Nodes.
+*/
+void PNode::setAbsCoor (Vector absCoord)
+{
+  this->bAbsCoorChanged = true;
+  *this->absCoordinate = absCoord;
 }
 
@@ -200,9 +248,44 @@
   if( this->bAbsCoorChanged)
     {
-      this->absCoordinate = this->absCoordinate + *shift;
+      *this->absCoordinate = *this->absCoordinate + *shift;
     }
   else 
     {
-      this->relCoordinate = this->relCoordinate + *shift;
+      *this->relCoordinate = *this->relCoordinate + *shift;
+      this->bRelCoorChanged = true;
+    }
+}
+
+
+
+/**
+   \brief shift coordinate (abs and rel)
+   \param shift vector
+
+   this function shifts the current coordinates about the vector shift. this is
+   usefull because from some place else you can:
+   PNode* someNode = ...;
+   Vector objectMovement = calculateShift();
+   someNode->shiftCoor(objectMovement);
+
+   elsewhere you would have to:
+   PNode* someNode = ...;
+   Vector objectMovement = calculateShift();
+   Vector currentCoor = someNode->getRelCoor();
+   Vector newCoor = currentCoor + objectMovement;
+   someNode->setRelCoor(newCoor);
+   
+   yea right... shorter...
+
+*/
+void PNode::shiftCoor (Vector shift)
+{
+  if( this->bAbsCoorChanged)
+    {
+      *this->absCoordinate = *this->absCoordinate + shift;
+    }
+  else 
+    {
+      *this->relCoordinate = *this->relCoordinate + shift;
       this->bRelCoorChanged = true;
     }
@@ -217,5 +300,5 @@
 Quaternion PNode::getRelDir ()
 {
-  return this->relDirection;
+  return *this->relDirection;
 }
 
@@ -232,5 +315,12 @@
 {
   this->bRelCoorChanged = true;
-  this->relDirection = *relDir;
+  *this->relDirection = *relDir;
+}
+
+
+void PNode::setRelDir (Quaternion relDir)
+{
+  this->bRelCoorChanged = true;
+  *this->relDirection = relDir;
 }
 
@@ -242,5 +332,5 @@
 Quaternion PNode::getAbsDir ()
 {
-  return this->absDirection;
+  return *this->absDirection;
 }
 
@@ -257,6 +347,23 @@
 {
   this->bAbsDirChanged = true;
-  this->absDirection = *absDir;
-}
+  *this->absDirection = *absDir;
+}
+
+
+
+/**
+   \brief sets the absolute direction (0,0,1)
+   \param absDir absolute coordinates
+
+   it is very importand, that you use this function, if you want to update the
+   absDirection. If you don't use this, the PNode won't recognize, that something
+   has changed and won't update the children Nodes.
+*/
+void PNode::setAbsDir (Quaternion absDir)
+{
+  this->bAbsDirChanged = true;
+  *this->absDirection = absDir;
+}
+
 
 
@@ -285,4 +392,44 @@
 {}
 
+
+/**
+   \brief shift coordinate (abs and rel)
+   \param shift vector
+
+   this function shifts the current coordinates about the vector shift. this is
+   usefull because from some place else you can:
+   PNode* someNode = ...;
+   Quaternion objectMovement = calculateShift();
+   someNode->shiftCoor(objectMovement);
+
+   elsewhere you would have to:
+   PNode* someNode = ...;
+   Quaternion objectMovement = calculateShift();
+   Quaternion currentCoor = someNode->getRelCoor();
+   Quaternion newCoor = currentCoor + objectMovement;
+   someNode->setRelCoor(newCoor);
+   
+   yea right... shorter...
+
+   \todo implement this
+*/
+void PNode::shiftDir (Quaternion shift)
+{}
+
+
+/**
+   \brief this calculates the current movement speed of the node
+*/
+float PNode::getSpeed()
+{
+  if(this->time == 0)
+    return 1000;
+  Vector diff;
+  diff = *this->absCoordinate - *this->lastAbsCoordinate;
+  float x = diff.len();
+  return x / this->time;
+}
+
+
 /**
    \brief adds a child and makes this node to a parent
@@ -308,5 +455,5 @@
   if( pNode->parent != NULL )
     {
-      PRINTF(2)("PNode::addChild() - reparenting node: removing it and adding it again\n");
+      PRINTF(3)("PNode::addChild() - reparenting node: removing it and adding it again\n");
       pNode->parent->children->remove(pNode);
     }
@@ -338,12 +485,17 @@
 void PNode::remove()
 {
-  NullParent* np = NullParent::getInstance();
-  PNode* pn = this->children->enumerate();
+  NullParent* nullParent = NullParent::getInstance();
+
+  tIterator<PNode>* iterator = this->children->getIterator();
+  PNode* pn = iterator->nextElement();
+ 
   while( pn != NULL) 
     { 
-      this->children->remove(pn);
-      np->addChild(pn, pn->getMode());
-      pn = this->children->nextElement();
-    }
+      //this->children->remove(pn);
+      nullParent->addChild(pn, pn->getMode());
+      pn = iterator->nextElement();
+    }
+  delete iterator;
+  this->parent->children->remove(this);
 }
 
@@ -410,8 +562,9 @@
    worry, normaly...
 */
-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);
+void PNode::update (float dt)
+{
+  *this->lastAbsCoordinate = *this->absCoordinate;
+  this->time = dt;
+  PRINTF(4)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate->x, this->absCoordinate->y, this->absCoordinate->z);
   if(this->mode & PNODE_MOVEMENT )
     {
@@ -419,5 +572,5 @@
 	{
 	  /* if you have set the absolute coordinates this overrides all other changes */
-	  this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
+	  *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
 	}
       else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
@@ -426,8 +579,8 @@
 	  if( this->parent == NULL)
 	    {
-	      this->absCoordinate = this->relCoordinate;
+	      *this->absCoordinate = *this->relCoordinate;
 	    }
 	  else
-	    this->absCoordinate = parent->getAbsCoor() + this->relCoordinate;	      /* update the current absCoordinate */
+	    *this->absCoordinate = parent->getAbsCoor() + *this->relCoordinate;	      /* update the current absCoordinate */
 	}
     }
@@ -438,10 +591,10 @@
 	{
 	  /* if you have set the absolute coordinates this overrides all other changes */
-	  this->relDirection = this->absDirection - parent->getAbsDir();
+	  *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;
+	  *this->absDirection = parent->getAbsDir() * *this->relDirection;
 	}
     }
@@ -452,5 +605,5 @@
 	{
 	  /* if you have set the absolute coordinates this overrides all other changes */
-	  this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
+	  *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
 	}
       else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
@@ -458,12 +611,14 @@
 	  /*this is bad style... must be deleted later - just for testing*/
 	  if( this->parent == NULL)
-	    this->absCoordinate = this->relCoordinate;
+	    *this->absCoordinate = *this->relCoordinate;
 	  else
-	    this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(this->relCoordinate);	      /* update the current absCoordinate */
+	    *this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(*this->relCoordinate);	      /* update the current absCoordinate */
 	}
     }
   
   
-  PNode* pn = this->children->enumerate();
+  tIterator<PNode>* iterator = this->children->getIterator();
+  //PNode* pn = this->children->enumerate();
+  PNode* pn = iterator->nextElement();
   while( pn != NULL) 
     { 
@@ -473,7 +628,10 @@
       if( this->bRelDirChanged || this->bAbsDirChanged)
 	pn->parentDirChanged ();
-      pn->update();
-      pn = this->children->nextElement();
-    }
+
+      pn->update(dt);
+      //pn = this->children->nextElement();
+      pn = iterator->nextElement();
+    }
+  delete iterator;
 
   this->timeStamp = timeStamp;
@@ -507,7 +665,7 @@
 {
   PRINTF(2)("PNode::debug() - absCoord: (%f, %f, %f)\n", 
-	 this->absCoordinate.x, 
-	 this->absCoordinate.y,
-	 this->absCoordinate.z);
+	 this->absCoordinate->x, 
+	 this->absCoordinate->y,
+	 this->absCoordinate->z);
 }
 
Index: orxonox/branches/levelloader/src/lib/coord/p_node.h
===================================================================
--- orxonox/branches/levelloader/src/lib/coord/p_node.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/coord/p_node.h	(revision 3746)
@@ -23,4 +23,5 @@
 
 #include "base_object.h"
+//#include "vector.h"
 
 // FORWARD DEFINITION \\
@@ -28,4 +29,5 @@
 class Quaternion;
 class Vector;
+template<class T> class tList;
 
 //! enumeration for the different translation-binding-types
@@ -55,18 +57,24 @@
 
 
-  Vector getRelCoor ();
+  Vector* getRelCoor ();
   void setRelCoor (Vector* relCoord);
-  //void setRelCoor (Vector relCoord);
+  void setRelCoor (Vector relCoord);
   Vector getAbsCoor ();
   void setAbsCoor (Vector* absCoord);
-  //void setAbsCoor (Vector absCoord);
+  void setAbsCoor (Vector absCoord);
   void shiftCoor (Vector* shift);
+  void shiftCoor (Vector shift);
   //void shiftCoor (Vector shift);
 
   Quaternion getRelDir ();
   void setRelDir (Quaternion* relDir);
+  void setRelDir (Quaternion relDir);
   Quaternion getAbsDir ();
   void setAbsDir (Quaternion* absDir);
+  void setAbsDir (Quaternion absDir);
   void shiftDir (Quaternion* shift);
+  void shiftDir (Quaternion shift);
+
+  float getSpeed();
 
   void addChild (PNode* pNode);
@@ -82,5 +90,5 @@
   int getMode();
 
-  virtual void update ();
+  virtual void update (float dt);
   void processTick (float dt);
 
@@ -90,7 +98,4 @@
 
   void debug ();
-
- private:
-  void init(PNode* parent);
 
  protected:
@@ -102,11 +107,16 @@
   bool bRelDirChanged;     //!< If Relative Direction has changed since last time we checked
 
-  Vector relCoordinate;    //!< coordinates relative to the parent
-  Vector absCoordinate;    //!< absolute coordinates in the world ( from (0,0,0) )
-  Quaternion relDirection; //!< direction relative to the parent
-  Quaternion absDirection; //!< absolute direvtion in the world ( from (0,0,1) )
+  Vector* relCoordinate;    //!< coordinates relative to the parent
+  Vector* absCoordinate;    //!< absolute coordinates in the world ( from (0,0,0) )
+  Quaternion* relDirection; //!< direction relative to the parent
+  Quaternion* absDirection; //!< absolute direvtion in the world ( from (0,0,1) )
 
   int mode;                //!< the mode of the binding
 
+ private:
+  void init(PNode* parent);
+
+  Vector* lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate
+  float time;                //!< time since last update
 };
 
Index: orxonox/branches/levelloader/src/lib/graphics/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/Makefile.in	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/Makefile.in	(revision 3746)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.8.2 from Makefile.am.
 # @configure_input@
 
@@ -177,7 +177,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  src/lib/graphics/Makefile
+	  $(AUTOMAKE) --gnu  src/lib/graphics/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -272,14 +272,12 @@
 	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; \
@@ -291,9 +289,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
Index: orxonox/branches/levelloader/src/lib/graphics/graphics_engine.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/graphics_engine.cc	(revision 3746)
+++ orxonox/branches/levelloader/src/lib/graphics/graphics_engine.cc	(revision 3746)
@@ -0,0 +1,198 @@
+/* 
+   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_GRAPHICS
+
+#include "graphics_engine.h"
+
+#include "debug.h"
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+   \todo this constructor is not jet implemented - do it
+*/
+GraphicsEngine::GraphicsEngine () 
+{
+  this->setClassName ("GraphicsEngine");
+  this->initVideo();
+
+  this->listModes();
+}
+
+/**
+   \brief The Pointer to this GraphicsEngine
+*/
+GraphicsEngine* GraphicsEngine::singletonRef = NULL;
+
+/**
+   \returns A pointer to this GraphicsEngine
+*/
+GraphicsEngine* GraphicsEngine::getInstance()
+{
+  if (!GraphicsEngine::singletonRef)
+    GraphicsEngine::singletonRef = new GraphicsEngine();
+  return GraphicsEngine::singletonRef;
+}
+
+
+/**
+   \brief destructs the graphicsEngine.
+*/
+GraphicsEngine::~GraphicsEngine () 
+{
+  // delete what has to be deleted here
+}
+
+/**
+   \brief initializes the Video for openGL.
+
+   This has to be done only once when starting orxonox.
+*/
+int GraphicsEngine::initVideo()
+{
+  // initialize SDL_VIDEO
+  if (SDL_Init(SDL_INIT_VIDEO) == -1)
+    {
+      PRINTF(1)("could not initialize SDL Video\n");
+      //      return -1;
+    }
+  // initialize SDL_GL-settings
+  this->setGLattribs();
+
+  // setting the Video Flags.
+  this->videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE | SDL_DOUBLEBUF;
+
+  /* query SDL for information about our video hardware */
+  const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
+  if( videoInfo == NULL)
+    {
+      PRINTF(1)("Failed getting Video Info :%s\n", SDL_GetError()); 
+      SDL_Quit ();
+    }
+  if( videoInfo->hw_available)
+    this->videoFlags |= SDL_HWSURFACE;
+  else 
+    this->videoFlags |= SDL_SWSURFACE;
+  /*
+  if(VideoInfo -> blit_hw)
+    VideoFlags |= SDL_HWACCEL;
+  */
+
+  // setting up the Resolution
+  this->setResolution(800, 600, 16);
+  
+  // Set window labeling
+  SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
+  
+  // TO DO: Create a cool icon and use it here
+  SDL_WM_SetIcon(SDL_LoadBMP("../data/pictures/orxonox-icon32x32.bmp"), NULL);  
+
+  // Enable default GL stuff
+  glEnable(GL_DEPTH_TEST);
+}
+
+/**
+   \brief Sets the GL-attributes
+*/
+int GraphicsEngine::setGLattribs(void)
+{
+  // Set video mode
+  // TO DO: parse arguments for settings
+  //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
+  //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
+  //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
+  //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
+  
+
+  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
+  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);    
+  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0);  
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
+}
+
+/**
+   \brief sets the Resolution of the Screen to display the Graphics to.
+   \param width The width of the window
+   \param height The height of the window
+   \param bpp bits per pixel
+*/
+int GraphicsEngine::setResolution(int width, int height, int bpp)
+{
+  this->resolutionX = width;
+  this->resolutionY = height;
+  this->bitsPerPixel = bpp;
+  
+  printf ("ok\n");
+  if((this->screen = SDL_SetVideoMode(this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags)) == NULL)
+    {
+      PRINTF(1)("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags, SDL_GetError());
+      SDL_Quit();
+      //    return -1;
+    }
+
+}
+
+/**
+   \brief Signalhandler, for when the resolution has changed
+   \param resizeInfo SDL information about the size of the new screen size
+*/
+int GraphicsEngine::resolutionChanged(SDL_ResizeEvent* resizeInfo)
+{
+  this->setResolution(resizeInfo->w, resizeInfo->h, this->bitsPerPixel);
+}
+
+/**
+   \brief if Textures should be enabled
+*/
+bool GraphicsEngine::texturesEnabled = true;
+
+
+
+
+
+
+
+/**
+   \brief outputs all the Fullscreen modes.
+*/
+void GraphicsEngine::listModes(void)
+{
+  /* Get available fullscreen/hardware modes */
+  this->videoModes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
+  
+  /* Check is there are any modes available */
+  if(this->videoModes == (SDL_Rect **)0){
+    PRINTF(1)("No modes available!\n");
+    exit(-1);
+  }
+  
+  /* Check if our resolution is restricted */
+  if(this->videoModes == (SDL_Rect **)-1){
+    PRINTF(1)("All resolutions available.\n");
+  }
+  else{
+    /* Print valid modes */
+    PRINT(0)("Available Resoulution Modes are\n");
+    for(int i = 0; this->videoModes[i]; ++i)
+      PRINT(0)(" |  %d x %d\n", this->videoModes[i]->w, this->videoModes[i]->h);
+  }
+  
+}
Index: orxonox/branches/levelloader/src/lib/graphics/graphics_engine.h
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/graphics_engine.h	(revision 3746)
+++ orxonox/branches/levelloader/src/lib/graphics/graphics_engine.h	(revision 3746)
@@ -0,0 +1,48 @@
+/*! 
+    \file graphics_engine.h
+    
+    \brief defines a Interface between orxonox and graphical input
+
+    handles graphical SDL-initialisation, textures, resolutions, and so on
+*/
+
+#ifndef _GRAPHICS_ENGINE_H
+#define _GRAPHICS_ENGINE_H
+
+#include "glincl.h"
+
+#include "base_object.h"
+
+// FORWARD DEFINITION \\
+
+
+class GraphicsEngine : public BaseObject 
+{
+ public:
+  static GraphicsEngine* getInstance();
+  virtual ~GraphicsEngine();
+
+  int initVideo();
+  int setGLattribs(void);
+  int setResolution(int width, int height, int bpp);
+  int resolutionChanged(SDL_ResizeEvent* resizeInfo);
+  void listModes(void);
+
+  static bool texturesEnabled;
+
+ private:
+  GraphicsEngine();
+  static GraphicsEngine* singletonRef;
+
+
+  SDL_Surface* screen;
+  int resolutionX;
+  int resolutionY;
+  int bitsPerPixel;
+  bool fullscreen;
+  Uint32 videoFlags;
+
+  SDL_Rect **videoModes;
+};
+
+#endif /* _GRAPHICS_ENGINE_H */
Index: orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.am
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.am	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.am	(revision 3746)
@@ -5,5 +5,5 @@
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/data
-AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gaphics
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/importer
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/lang
@@ -27,8 +27,12 @@
 	  	  model.cc \
 		  objModel.cc \
+		  primitive_model.cc \
 	  	  array.cc \
 	  	  material.cc \
 		  texture.cc \
-		  $(MAINSRCDIR)/lib/math/vector.cc
+		  $(MAINSRCDIR)/lib/graphics/graphics_engine.cc \
+		  $(MAINSRCDIR)/lib/lang/base_object.cc \
+		  $(MAINSRCDIR)/lib/math/vector.cc \
+		  $(MAINSRCDIR)/lib/util/resource_manager.cc
 
 noinst_HEADERS= framework.h \
@@ -36,4 +40,5 @@
 	  	model.h \
 		objModel.h \
+		primitive_model.h \
 	  	array.h \
 		material.h \
Index: orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.in	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.in	(revision 3746)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.8.2 from Makefile.am.
 # @configure_input@
 
@@ -42,5 +42,5 @@
 subdir = src/lib/graphics/importer
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
+	$(srcdir)/Makefile.in TODO
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -50,10 +50,12 @@
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
+am__installdirs = $(DESTDIR)$(bindir)
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
 am_importer_OBJECTS = framework.$(OBJEXT) windowHandler.$(OBJEXT) \
-	model.$(OBJEXT) objModel.$(OBJEXT) array.$(OBJEXT) \
-	material.$(OBJEXT) texture.$(OBJEXT) vector.$(OBJEXT)
+	model.$(OBJEXT) objModel.$(OBJEXT) primitive_model.$(OBJEXT) \
+	array.$(OBJEXT) material.$(OBJEXT) texture.$(OBJEXT) \
+	graphics_engine.$(OBJEXT) base_object.$(OBJEXT) \
+	vector.$(OBJEXT) resource_manager.$(OBJEXT)
 importer_OBJECTS = $(am_importer_OBJECTS)
 importer_LDADD = $(LDADD)
@@ -61,8 +63,14 @@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po ./$(DEPDIR)/framework.Po \
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/base_object.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/framework.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/graphics_engine.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/material.Po ./$(DEPDIR)/model.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/objModel.Po ./$(DEPDIR)/texture.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/vector.Po ./$(DEPDIR)/windowHandler.Po
+@AMDEP_TRUE@	./$(DEPDIR)/objModel.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/primitive_model.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/resource_manager.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/texture.Po ./$(DEPDIR)/vector.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/windowHandler.Po
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
@@ -185,5 +193,5 @@
 target_vendor = @target_vendor@
 MAINSRCDIR = ../../..
-AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/gaphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai
+AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai
 AM_LDFLAGS = $(MWINDOWS)
 importer_SOURCES = framework.cc \
@@ -191,8 +199,12 @@
 	  	  model.cc \
 		  objModel.cc \
+		  primitive_model.cc \
 	  	  array.cc \
 	  	  material.cc \
 		  texture.cc \
-		  $(MAINSRCDIR)/lib/math/vector.cc
+		  $(MAINSRCDIR)/lib/graphics/graphics_engine.cc \
+		  $(MAINSRCDIR)/lib/lang/base_object.cc \
+		  $(MAINSRCDIR)/lib/math/vector.cc \
+		  $(MAINSRCDIR)/lib/util/resource_manager.cc
 
 noinst_HEADERS = framework.h \
@@ -200,4 +212,5 @@
 	  	model.h \
 		objModel.h \
+		primitive_model.h \
 	  	array.h \
 		material.h \
@@ -217,7 +230,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile
+	  $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -239,5 +252,5 @@
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	$(mkdir_p) $(DESTDIR)$(bindir)
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
@@ -245,6 +258,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
@@ -254,6 +267,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
 
@@ -271,8 +284,12 @@
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_object.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/framework.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics_engine.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objModel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive_model.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_manager.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@
@@ -295,4 +312,36 @@
 @am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
+graphics_engine.o: $(MAINSRCDIR)/lib/graphics/graphics_engine.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.o -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.o `test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/graphics/graphics_engine.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' object='graphics_engine.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.o `test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/graphics/graphics_engine.cc
+
+graphics_engine.obj: $(MAINSRCDIR)/lib/graphics/graphics_engine.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.obj -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.obj `if test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' object='graphics_engine.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.obj `if test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; fi`
+
+base_object.o: $(MAINSRCDIR)/lib/lang/base_object.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT base_object.o -MD -MP -MF "$(DEPDIR)/base_object.Tpo" -c -o base_object.o `test -f '$(MAINSRCDIR)/lib/lang/base_object.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/lang/base_object.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/base_object.Tpo" "$(DEPDIR)/base_object.Po"; else rm -f "$(DEPDIR)/base_object.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/lang/base_object.cc' object='base_object.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/base_object.Po' tmpdepfile='$(DEPDIR)/base_object.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o base_object.o `test -f '$(MAINSRCDIR)/lib/lang/base_object.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/lang/base_object.cc
+
+base_object.obj: $(MAINSRCDIR)/lib/lang/base_object.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT base_object.obj -MD -MP -MF "$(DEPDIR)/base_object.Tpo" -c -o base_object.obj `if test -f '$(MAINSRCDIR)/lib/lang/base_object.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/lang/base_object.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/lang/base_object.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/base_object.Tpo" "$(DEPDIR)/base_object.Po"; else rm -f "$(DEPDIR)/base_object.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/lang/base_object.cc' object='base_object.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/base_object.Po' tmpdepfile='$(DEPDIR)/base_object.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o base_object.obj `if test -f '$(MAINSRCDIR)/lib/lang/base_object.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/lang/base_object.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/lang/base_object.cc'; fi`
+
 vector.o: $(MAINSRCDIR)/lib/math/vector.cc
 @am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vector.o -MD -MP -MF "$(DEPDIR)/vector.Tpo" -c -o vector.o `test -f '$(MAINSRCDIR)/lib/math/vector.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/math/vector.cc; \
@@ -310,4 +359,20 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vector.obj `if test -f '$(MAINSRCDIR)/lib/math/vector.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/math/vector.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/math/vector.cc'; fi`
+
+resource_manager.o: $(MAINSRCDIR)/lib/util/resource_manager.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.o -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.o `test -f '$(MAINSRCDIR)/lib/util/resource_manager.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/resource_manager.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/util/resource_manager.cc' object='resource_manager.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.o `test -f '$(MAINSRCDIR)/lib/util/resource_manager.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/resource_manager.cc
+
+resource_manager.obj: $(MAINSRCDIR)/lib/util/resource_manager.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.obj -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.obj `if test -f '$(MAINSRCDIR)/lib/util/resource_manager.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/resource_manager.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/util/resource_manager.cc' object='resource_manager.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.obj `if test -f '$(MAINSRCDIR)/lib/util/resource_manager.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/resource_manager.cc'; fi`
 uninstall-info-am:
 
@@ -332,9 +397,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
@@ -391,7 +454,5 @@
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
-	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
-	done
+	$(mkdir_p) $(DESTDIR)$(bindir)
 install: install-am
 install-exec: install-exec-am
Index: orxonox/branches/levelloader/src/lib/graphics/importer/framework.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/framework.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/framework.cc	(revision 3746)
@@ -17,4 +17,7 @@
 
 #include "vector.h"
+
+#include "primitive_model.h"
+
 
 int verbose;
@@ -76,45 +79,6 @@
     obj = new OBJModel(argv[1]);
   else 
-    {
-      // This is an example, of how it is possible, to create a new Model, and adding some vertex-information.
-      // This also packs everything into a DisplayList, and can be handled exactly as any other model.
-      // This is an example of a cube with Texture-Coordinates, but without explicite Vertex-Normals. (they are soft-created).
-      /*
-      obj = (OBJModel*) new Model();
-      obj->setName("CUBE");
-      obj->addVertex (-0.5, -0.5, 0.5);
-      obj->addVertex (0.5, -0.5, 0.5);
-      obj->addVertex (-0.5, 0.5, 0.5);
-      obj->addVertex (0.5, 0.5, 0.5);
-      obj->addVertex (-0.5, 0.5, -0.5);
-      obj->addVertex (0.5, 0.5, -0.5);
-      obj->addVertex (-0.5, -0.5, -0.5);
-      obj->addVertex (0.5, -0.5, -0.5);
-      
-      obj->addVertexTexture (0.0, 0.0);
-      obj->addVertexTexture (1.0, 0.0);
-      obj->addVertexTexture (0.0, 1.0);
-      obj->addVertexTexture (1.0, 1.0);
-      obj->addVertexTexture (0.0, 2.0);
-      obj->addVertexTexture (1.0, 2.0);
-      obj->addVertexTexture (0.0, 3.0);
-      obj->addVertexTexture (1.0, 3.0);
-      obj->addVertexTexture (0.0, 4.0);
-      obj->addVertexTexture (1.0, 4.0);
-      obj->addVertexTexture (2.0, 0.0);
-      obj->addVertexTexture (2.0, 1.0);
-      obj->addVertexTexture (-1.0, 0.0);
-      obj->addVertexTexture (-1.0, 1.0);
-
-      obj->addFace ("1 2 4 3");
-      obj->addFace ("3 4 6 5");
-      obj->addFace ("5 6 8 7");
-      obj->addFace ("7 8 2 1");
-      obj->addFace ("2 8 6 4");
-      obj->addFace ("7 1 3 5");
-      obj->finalize();
-      */
-      obj = (OBJModel*) new Model(CYLINDER);
-    }
+    obj = new PrimitiveModel(SPHERE);
+
   M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0); 
   rotAxis = Vector (0.0,1.0,0.0);
@@ -166,5 +130,5 @@
       switch (event.type) {
       case SDL_MOUSEMOTION:
-	PRINTF(3)("Mouse motion about %d,%d Pixels to (%d,%d).\n", 
+	PRINTF(4)("Mouse motion about %d,%d Pixels to (%d,%d).\n", 
 		  event.motion.xrel, event.motion.yrel,
 		  event.motion.x, event.motion.y);
@@ -205,10 +169,10 @@
 	if (event.button.button == 4)
 	  {
-	    PRINTF(0)("MouseWheel up\n");
+	    PRINTF(4)("MouseWheel up\n");
 	    zoomTo *= .5;
 	  }
 	else if (event.button.button == 5)
 	  {
-	    PRINTF(2)("MouseWheel down\n");
+	    PRINTF(4)("MouseWheel down\n");
 	    zoomTo *= 2.0;
 	  }
@@ -240,5 +204,5 @@
 	else 
 	    {
-	      PRINTF(2)("MouseButton %d released at (%d,%d).\n",
+	      PRINTF(4)("MouseButton %d released at (%d,%d).\n",
 			event.button.button, event.button.x, event.button.y);
 	    }
Index: orxonox/branches/levelloader/src/lib/graphics/importer/framework.h
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/framework.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/framework.h	(revision 3746)
@@ -4,4 +4,5 @@
 #include "windowHandler.h" // Include the Whandler Basecode
 #include "objModel.h"
+#include "vector.h"
 
 class Vector;
@@ -34,5 +35,5 @@
 
 WindowHandler wHandler;  // Create an instance of the whandler basecode class
-OBJModel* obj;
+Model* obj;
 
 
Index: orxonox/branches/levelloader/src/lib/graphics/importer/material.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/material.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/material.cc	(revision 3746)
@@ -21,6 +21,10 @@
 #include "texture.h"
 #include "debug.h"
+#include "resource_manager.h"
 #include <stdlib.h>
 #include <string.h>
+
+//! \todo check if we are in RESOURCE MANAGER-mode
+#include "resource_manager.h"
 
 using namespace std;
@@ -58,5 +62,5 @@
     delete []this->name;
   if (this->diffuseTexture)
-    this->diffuseTexture;
+    ResourceManager::getInstance()->unload(this->diffuseTexture);
   if (this->nextMat)
     delete this->nextMat;
@@ -89,5 +93,5 @@
   this->nextMat = NULL;
   this->name ="";
-  this->setIllum(1);
+  this->setIllum(3);
   this->setDiffuse(0,0,0);
   this->setAmbient(0,0,0);
@@ -104,6 +108,4 @@
   this->ambientTextureSet = false;
   this->specularTextureSet = false;
-
-  
 }
 
@@ -167,5 +169,4 @@
 }
 
-
 /**
    \brief Set the Name of the Material. (Important for searching)
@@ -321,5 +322,5 @@
 void Material::addTexturePath(char* pathName)
 {
-  PathList::getInstance()->addPath(pathName);
+  ResourceManager::getInstance()->addImageDir(pathName);
 }
 
@@ -333,7 +334,10 @@
 {
   PRINTF(4)("setting Diffuse Map %s\n", dMap);
-  diffuseTexture = new Texture();
-  this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
-
+  //    diffuseTexture = new Texture();
+  //    this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
+
+  //! \todo check if RESOURCE MANAGER is availiable
+  //! \todo Textures from .mtl-file need special care.
+  this->diffuseTextureSet = this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE);
 }
 
Index: orxonox/branches/levelloader/src/lib/graphics/importer/model.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/model.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/model.cc	(revision 3746)
@@ -34,34 +34,4 @@
 {
   this->initialize();
-}
-
-/**
-   \brief Creates a 3D-Model of Primitive-Type type
-
-   if you want to just display a Cube/Sphere/Cylinder/... without any material.
-   
-   \todo implement Cube/Sphere/Cylinder/...
-*/
-Model::Model(PRIMITIVE type)
-{
-  this->initialize();
-
-  switch (type)
-    {
-    default:
-    case CUBE:
-      this->cubeModel();
-      break;
-    case SPHERE:
-      this->sphereModel();
-      break;
-    case CYLINDER:
-      this->cylinderModel();
-      break;
-
-    }
-  this->importToGL ();
-
-  this->cleanup();
 }
 
@@ -492,7 +462,7 @@
 
       tmpElem->vertexNumber = va_arg (itemlist, int) -1;
-      if (type >= 2)
+      if (type & TEXCOORD)
 	tmpElem->texCoordNumber = va_arg (itemlist, int) -1;
-      if (type == 1 || type ==3)
+      if (type & NORMAL)
  	tmpElem->normalNumber = va_arg(itemlist, int) -1;
       this->currentGroup->currentFace->vertexCount++;
@@ -797,52 +767,52 @@
 void Model::cubeModel(void)
 {
-  this->addVertex ("-0.5 -0.5 0.5");
-  this->addVertex ("0.5 -0.5 0.5");
-  this->addVertex ("-0.5 0.5 0.5");
-  this->addVertex ("0.5 0.5 0.5");
-  this->addVertex ("-0.5 0.5 -0.5");
-  this->addVertex ("0.5 0.5 -0.5");
-  this->addVertex ("-0.5 -0.5 -0.5");
-  this->addVertex ("0.5 -0.5 -0.5");
-
-  this->addVertexTexture ("0.0 0.0");
-  this->addVertexTexture ("1.0 0.0");
-  this->addVertexTexture ("0.0 1.0");
-  this->addVertexTexture ("1.0 1.0");
-  this->addVertexTexture ("0.0 2.0");
-  this->addVertexTexture ("1.0 2.0");
-  this->addVertexTexture ("0.0 3.0");
-  this->addVertexTexture ("1.0 3.0");
-  this->addVertexTexture ("0.0 4.0");
-  this->addVertexTexture ("1.0 4.0");
-  this->addVertexTexture ("2.0 0.0");
-  this->addVertexTexture ("2.0 1.0");
-  this->addVertexTexture ("-1.0 0.0");
-  this->addVertexTexture ("-1.0 1.0");
-
-  this->addVertexNormal ("0.0 0.0 1.0");
-  this->addVertexNormal ("0.0 0.0 1.0");
-  this->addVertexNormal ("0.0 0.0 1.0");
-  this->addVertexNormal ("0.0 0.0 1.0");
-  this->addVertexNormal ("0.0 1.0 0.0");
-  this->addVertexNormal ("0.0 1.0 0.0");
-  this->addVertexNormal ("0.0 1.0 0.0");
-  this->addVertexNormal ("0.0 1.0 0.0");
-  this->addVertexNormal ("0.0 0.0 -1.0");
-  this->addVertexNormal ("0.0 0.0 -1.0");
-  this->addVertexNormal ("0.0 0.0 -1.0");
-  this->addVertexNormal ("0.0 0.0 -1.0");
-  this->addVertexNormal ("0.0 -1.0 0.0");
-  this->addVertexNormal ("0.0 -1.0 0.0");
-  this->addVertexNormal ("0.0 -1.0 0.0");
-  this->addVertexNormal ("0.0 -1.0 0.0");
-  this->addVertexNormal ("1.0 0.0 0.0");
-  this->addVertexNormal ("1.0 0.0 0.0");
-  this->addVertexNormal ("1.0 0.0 0.0");
-  this->addVertexNormal ("1.0 0.0 0.0");
-  this->addVertexNormal ("-1.0 0.0 0.0");
-  this->addVertexNormal ("-1.0 0.0 0.0");
-  this->addVertexNormal ("-1.0 0.0 0.0");
-  this->addVertexNormal ("-1.0 0.0 0.0");
+  this->addVertex (-0.5, -0.5, 0.5);
+  this->addVertex (0.5, -0.5, 0.5);
+  this->addVertex (-0.5, 0.5, 0.5);
+  this->addVertex (0.5, 0.5, 0.5);
+  this->addVertex (-0.5, 0.5, -0.5);
+  this->addVertex (0.5, 0.5, -0.5);
+  this->addVertex (-0.5, -0.5, -0.5);
+  this->addVertex (0.5, -0.5, -0.5);
+
+  this->addVertexTexture (0.0, 0.0);
+  this->addVertexTexture (1.0, 0.0);
+  this->addVertexTexture (0.0, 1.0);
+  this->addVertexTexture (1.0, 1.0);
+  this->addVertexTexture (0.0, 2.0);
+  this->addVertexTexture (1.0, 2.0);
+  this->addVertexTexture (0.0, 3.0);
+  this->addVertexTexture (1.0, 3.0);
+  this->addVertexTexture (0.0, 4.0);
+  this->addVertexTexture (1.0, 4.0);
+  this->addVertexTexture (2.0, 0.0);
+  this->addVertexTexture (2.0, 1.0);
+  this->addVertexTexture (-1.0, 0.0);
+  this->addVertexTexture (-1.0, 1.0);
+
+  this->addVertexNormal (0.0, 0.0, 1.0);
+  this->addVertexNormal (0.0, 0.0, 1.0);
+  this->addVertexNormal (0.0, 0.0, 1.0);
+  this->addVertexNormal (0.0, 0.0, 1.0);
+  this->addVertexNormal (0.0, 1.0, 0.0);
+  this->addVertexNormal (0.0, 1.0, 0.0);
+  this->addVertexNormal (0.0, 1.0, 0.0);
+  this->addVertexNormal (0.0, 1.0, 0.0);
+  this->addVertexNormal (0.0, 0.0, -1.0);
+  this->addVertexNormal (0.0, 0.0, -1.0);
+  this->addVertexNormal (0.0, 0.0, -1.0);
+  this->addVertexNormal (0.0, 0.0, -1.0);
+  this->addVertexNormal (0.0, -1.0, 0.0);
+  this->addVertexNormal (0.0, -1.0, 0.0);
+  this->addVertexNormal (0.0, -1.0, 0.0);
+  this->addVertexNormal (0.0, -1.0, 0.0);
+  this->addVertexNormal (1.0, 0.0, 0.0);
+  this->addVertexNormal (1.0, 0.0, 0.0);
+  this->addVertexNormal (1.0, 0.0, 0.0);
+  this->addVertexNormal (1.0, 0.0, 0.0);
+  this->addVertexNormal (-1.0, 0.0, 0.0);
+  this->addVertexNormal (-1.0, 0.0, 0.0);
+  this->addVertexNormal (-1.0, 0.0, 0.0);
+  this->addVertexNormal (-1.0, 0.0, 0.0);
 
   /* normaleLess-testingMode
@@ -855,102 +825,10 @@
   */
 
-  this->addFace ("1/1/1 2/2/2 4/4/3 3/3/4");
-  this->addFace ("3/3/5 4/4/6 6/6/7 5/5/8");
-  this->addFace ("5/5/9 6/6/10 8/8/11 7/7/12");
-  this->addFace ("7/7/13 8/8/14 2/10/15 1/9/16");
-  this->addFace ("2/2/17 8/11/18 6/12/19 4/4/20");
-  this->addFace ("7/13/21 1/1/22 3/3/23 5/14/24");
-
-}
-
-/**
-   \brief Builds a Sphere into the Model
-*/
-void Model::sphereModel()
-{
-  int detail = 30;
-  if (detail <= 0) detail = 1;
-  float df = (float)detail;
-  for (float i = 0.0; i < df/2; i+=1.0)
-    {
-      for (float j = 0.0; j < df; j+=1.0)
-      {
-	float vz = i/df *2.0*PI - PI/2.0;
-	this->addVertex(cos(j/df*2.0*PI) * cos(vz) ,
-			sin(j/df*2.0*PI) * cos(vz),
-			sin(vz));
-	//if (j==0.0)
-	//printf ("%f %f\n", vz, sin (vz));
-	if (i==0.0)
-	  PRINTF(0)("%f, %f\n", j/df*2.0*PI, cos(j/df*PI));
-      }
-    }
-  vertices->debug();
-  for (int i = 0; i < detail/2; i++)
-    for (int j = 1; j < detail; j++)
-      {
-	unsigned int v1,v2,v3,v4;
-	v1 = i*detail +j;
-
-	/*	if (j+1 == detail)
-	  {
-	    v2 = i*detail +1;
-	    v3 = i*detail+detail + 1;
-	  }
-	  else*/
-	  {
-	    v2 = i*detail +j+1;
-	    v3 = i*detail+detail + j+1;
-	  }
-	v4 = i*detail+detail + j;
-	//printf("%i %i %i %i\n", v1, v2, v3, v4);
-	this->addFace(4, 0, v1, v2, v3, v4);
-      }
-}
-
-/**
-   \brief Creates a Cylinder.
-*/
-void Model::cylinderModel(void)
-{
-  unsigned int detail = 20;
-  float size = 1.0;
-
-  // check if devision by zero
-  if (detail <= 3)
-    detail = 3;
-  int count = 0;
-  // defining Points of the Cylinder.
-  for (float phi = 0.0; phi < 2.0*PI; phi += 2.0*PI/(float)detail)
-    {
-      this->addVertex(size*cos(phi), size*sin(phi), -size);
-      this->addVertex(size*cos(phi), size*sin(phi), size);
-      count ++;
-    }
-  this->addVertex(0, 0, -size);
-  this->addVertex(0, 0, size);
-
-  
-  if (count != detail)
-    PRINTF(1)("calculation error, count should be %d but is %d.\n", detail, count);
-  vertices->debug();
-
-  // adding Faces
-  for (int i = 0; i < detail-1; i++)
-    {
-      int p1, p2, p3, p4;
-      p1 = 2*i+1;
-      p2 = 2*i+2;
-      if (i <= detail);
-      p3 = 2*i+4;
-      p4 = 2*i+3;
-      // something is wrong here
-      this->addFace(4, 0, p1, p2, p3, p4);
-      this->addFace(3, 0, p4, p1, 2*detail+1);
-      this->addFace(3, 0, p2, p3, 2*detail+2);
-    }
-  addFace(4,0, 2*detail-1, 2*detail, 2, 1);
-  this->addFace(3, 0, 1, 2*detail-1, 2*detail+1);
-  this->addFace(3, 0, 2*detail, 2, 2*detail+2);
-
-}
+  this->addFace (4, 3, 1,1,1, 2,2,2, 4,4,3, 3,3,4);
+  this->addFace (4, 3, 3,3,5, 4,4,6, 6,6,7, 5,5,8);
+  this->addFace (4, 3, 5,5,9, 6,6,10, 8,8,11, 7,7,12);
+  this->addFace (4, 3, 7,7,13, 8,8,14, 2,10,15, 1,9,16);
+  this->addFace (4, 3, 2,2,17, 8,11,18, 6,12,19, 4,4,20);
+  this->addFace (4, 3, 7,13,21, 1,1,22, 3,3,23, 5,14,24);
+
+}
Index: orxonox/branches/levelloader/src/lib/graphics/importer/model.h
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/model.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/model.h	(revision 3746)
@@ -15,6 +15,8 @@
 using namespace std;
 
-//! Specification of different primitives the Model knows
-enum PRIMITIVE {PLANE, CUBE, SPHERE, CYLINDER};
+// definition of different modes for setting up Faces
+#define VERTEX 0       //!< If Faces are created WITH Vertex-Coordinate
+#define NORMAL 1       //!< If Faces are created WITH Normals (otherwise autocalculate)
+#define TEXCOORD 2     //!< If Faces are created WITH TextureCoordinate
 
 //! Class that handles 3D-Models. it can also read them in and display them.
@@ -23,5 +25,4 @@
  public:
   Model(void);
-  Model(PRIMITIVE type);
   Model(char* modelName);
   virtual ~Model(void);
@@ -114,6 +115,4 @@
 
   void cubeModel(void);
-  void sphereModel(void);
-  void cylinderModel(void);
 };
 
Index: orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc	(revision 3746)
@@ -21,19 +21,4 @@
 
 #include "debug.h"
-
-/**
-   \brief Crates a 3D-Model and loads in a File.
-   \param fileName file to parse and load (must be a .obj file)
-*/
-OBJModel::OBJModel(const char* fileName)
-{
-  this->initializeOBJ();
-
-  this->importFile (fileName);
-
-  this->importToGL ();
-
-  this->cleanup();
-}
 
 /**
@@ -193,5 +178,5 @@
       else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented
 	{
-	  PRINTF(3)("smoothing groups not supportet yet. line: %s\n", Buffer);
+	  PRINTF(2)("smoothing groups not supportet yet. line: %s\n", Buffer);
 	}
     }
@@ -200,5 +185,4 @@
   delete []fileName;
   return true;
-
 }
 
Index: orxonox/branches/levelloader/src/lib/graphics/importer/objModel.h
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/objModel.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/objModel.h	(revision 3746)
@@ -13,6 +13,5 @@
 {
  public:
-  OBJModel(const char* fileName);
-  OBJModel(const char* fileName, float scaling);
+  OBJModel(const char* fileName, float scaling = 1.0);
   virtual ~OBJModel();
   void initializeOBJ(void);
@@ -28,5 +27,4 @@
   bool readFromObjFile (void);
   bool readMtlLib (const char* matFile);
-
 };
 
Index: orxonox/branches/levelloader/src/lib/graphics/importer/primitive_model.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/primitive_model.cc	(revision 3746)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/primitive_model.cc	(revision 3746)
@@ -0,0 +1,242 @@
+/* 
+   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_WORLD_MODEL
+
+#include "primitive_model.h"
+
+#include <math.h>
+#include "vector.h"
+#include "debug.h"
+
+using namespace std;
+
+/**
+   \brief Creates a 3D-Model of Primitive-Type type
+
+   if you want to just display a Cube/Sphere/Cylinder/... without any material.
+   
+   \todo implement Cube/Sphere/Cylinder/...
+*/
+PrimitiveModel::PrimitiveModel(PRIMITIVE type, float size, unsigned int detail)
+{
+  this->initialize();
+
+  switch (type)
+    {
+    default:
+    case CUBE:
+      this->cubeModel();
+      break;
+    case SPHERE:
+      this->sphereModel(size, detail);
+      break;
+    case CYLINDER:
+      this->cylinderModel();
+      break;
+    case CONE:
+      this->coneModel(size, detail);
+      break;
+    case PLANE:
+      this->planeModel(size, detail);
+      break;
+    }
+  this->importToGL ();
+
+  this->cleanup();
+}
+
+/**
+   \brief standard deconstructor
+
+*/
+PrimitiveModel::~PrimitiveModel () 
+{
+  // delete what has to be deleted here
+}
+
+/**
+   \brief Builds a Sphere into the Model.
+   \param size The diameter of the Sphere.
+   \param detail The detail of the Sphere.
+*/
+void PrimitiveModel::sphereModel(float size, unsigned int detail)
+{
+  int vertexCount = 0;
+  if (detail <= 0) 
+    detail = 1;
+  size /= 2;
+  //  detail = 2; // make it even
+  float df = (float)detail;
+  
+  // defining the Vertices
+  for (float i = 0; i < df *2.0; i+=1.0)
+    {
+      float vi = i/df *PI;
+      for (float j = -df / 2.0 +1.0; j < df / 2.0; j+=1.0 *df/(df+1.0))
+	{
+	  float vj = j/df *PI;
+	  this->addVertex(size * cos(vi) * cos(vj),
+			  size * sin(vj),
+			  size * sin(vi) * cos(vj));
+	  this->addVertexTexture(i / (df *2.0), (j-1.0)/(df)+.5);
+	  vertexCount++;
+	}
+    }
+  this->addVertex(0, -size, 0);
+  this->addVertex(0, size, 0);
+
+  // defining the binding Faces.
+  unsigned int v1, v2, v3, v4;
+  for (int i = 0; i <= detail * 2 -1; i++)
+    {
+      for (int j = 0; j <= detail; j++)
+	{
+	  
+	  v1 = i*detail + j;
+	  v4 = i*detail + (j+1);
+	  
+	  if (i == detail*2 -1)
+	    {
+	      v2 = j;
+	      v3 = j+1;
+	    }
+	  else
+	    {
+	      v2 = (i+1)*detail + j;
+	      v3 = (i+1)*detail + (j+1);
+	    }
+	  
+	  if (j == 0)
+	    {
+	      v1 = vertexCount+1;
+	      this->addFace(3, TEXCOORD, v1, v1, v3, v3, v4, v4);
+	    }
+	  else if (j == detail)
+	    {
+	      v3 = vertexCount+2;
+	      this->addFace(3, TEXCOORD, v1, v1, v2, v2, v3, v3);
+	    }
+	  else
+	    this->addFace(4, TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4);
+	}
+    }
+}
+/**
+   \brief Creates a Cylinder.
+*/
+void PrimitiveModel::cylinderModel(float size, unsigned int detail)
+{
+  // check if devision by zero
+  if (detail <= 3)
+    detail = 3;
+  int count = 0;
+  // defining Points of the Cylinder.
+  for (float phi = 0.0; phi < 2.0*PI; phi += 2.0*PI/(float)detail)
+    {
+      this->addVertex(size*cos(phi), size*sin(phi), -size);
+      this->addVertex(size*cos(phi), size*sin(phi), size);
+      count ++;
+    }
+  this->addVertex(0, 0, -size);
+  this->addVertex(0, 0, size);
+
+  if (count != detail)
+    PRINTF(1)("calculation error, count should be %d but is %d.\n", detail, count);
+
+  // adding Faces
+  for (int i = 0; i < detail-1; i++)
+    {
+      int p1, p2, p3, p4;
+      p1 = 2*i+1;
+      p2 = 2*i+2;
+      if (i <= detail);
+      p3 = 2*i+4;
+      p4 = 2*i+3;
+      // something is wrong here
+      this->addFace(4, 0, p1, p2, p3, p4);
+      this->addFace(3, 0, p4, p1, 2*detail+1);
+      this->addFace(3, 0, p2, p3, 2*detail+2);
+    }
+  addFace(4,0, 2*detail-1, 2*detail, 2, 1);
+  this->addFace(3, VERTEX, 1, 2*detail-1, 2*detail+1);
+  this->addFace(3, VERTEX, 2*detail, 2, 2*detail+2);
+}
+
+/**
+   \brief creates a cone inside of this Model
+   \param size The size of the cone
+   \param detail the Detail-level of this cone
+*/
+void PrimitiveModel::coneModel(float size, unsigned int detail)
+{
+  this->addVertex(0,-size,0);
+  this->addVertex(0,size,0);
+  if (detail <= 0) 
+    detail = 1;
+  float df = (float)detail;
+  
+  // defining the Vertices
+  for (float i = 0; i < df; i+=1.0)
+    {
+      float vi = i/df *2.0*PI;
+      this->addVertex(size* sin(vi),
+		      -size,
+		      size* cos(vi));
+    }
+
+  //defining Faces
+  for (int i = 0; i < detail; i++)
+    {
+      unsigned int v1, v2;
+      v1 = i+3;
+      if (i == detail -1)
+	v2 = 3;
+      else
+	v2 = i+4;
+      this->addFace(3, VERTEX, 1, v1, v2);
+      this->addFace(3, VERTEX, 2, v1, v2); 
+    }
+}
+
+/**
+   \brief creates a Plane inside of this Model
+   \param size The size of this plane
+   \param detail the Detail-level of this plane.
+*/
+void PrimitiveModel::planeModel(float size, unsigned int detail)
+{
+  //defining vertices
+  for (int i = 0; i < detail; i++)
+    for (int j = 0; j < detail; j++)
+      {
+	this->addVertex(((float)i/(float)(detail-1) -.5)*size,
+			0,
+			((float)j/(float)(detail-1) -.5)*size);
+	this->addVertexTexture((float)i/(float)(detail-1),
+			       (float)j/(float)(detail-1));
+      }
+  //defining Faces
+  unsigned int v1, v2, v3, v4;
+  for (int i = 0; i < detail-1; i++)
+    for (int j = 1; j < detail; j++)
+      {
+	v1 = i*detail + j;
+	v2 = (i+1)*detail + j;
+	v3 = (i+1)*detail + (j+1);
+	v4 = i*detail + (j+1);
+	this->addFace(4, TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4);
+      }
+}
Index: orxonox/branches/levelloader/src/lib/graphics/importer/primitive_model.h
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/primitive_model.h	(revision 3746)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/primitive_model.h	(revision 3746)
@@ -0,0 +1,31 @@
+/*! 
+    \file primitive_model.h 
+    \brief a Class to handle different simple models like planes cubes spheres and so on.
+    (cube is also an option of Model, but is extended here.
+*/
+
+#ifndef _PRIMITIVE_MODEL_H
+#define _PRIMITIVE_MODEL_H
+
+#include "model.h"
+
+//! Specification of different primitives the Model knows
+enum PRIMITIVE {CUBE, SPHERE, PLANE, CYLINDER, CONE};
+
+// FORWARD DEFINITION \\
+
+//! A Class to create some default Models
+class PrimitiveModel : public Model {
+
+ public:
+  PrimitiveModel(PRIMITIVE type, float size = 1.0, unsigned int detail = 10);
+  virtual ~PrimitiveModel();
+
+ protected:
+  void sphereModel(float size = 1.0, unsigned int detail = 10);
+  void cylinderModel(float size = 1.0, unsigned int detail = 10);
+  void coneModel(float size = 1.0, unsigned int detail = 10);
+  void planeModel(float size = 1.0, unsigned int detail = 1);
+};
+
+#endif /* _PRIMITIVE_MODEL_H */
Index: orxonox/branches/levelloader/src/lib/graphics/importer/texture.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/texture.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/texture.cc	(revision 3746)
@@ -22,98 +22,5 @@
 #include "texture.h"
 
-// headers only for PathList
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <fstream>
-
-/**
-   \brief creates a ned PathList.
-   
-   It is a good idea to use this as an initial List,
-   because if you give on a name the Path will not be checked for its existence.
-*/
-PathList::PathList()
-{
-  this->pathName = NULL;
-  this->next = NULL;
-}
-
-/**
-   \brief Creates a new PathList with a Name.
-   \param pName the Name of The Path.
-
-   This function just adds the Path without checking if it exists.
-*/
-PathList::PathList(char* pName)
-{
-  this->pathName = new char [strlen(pName)+1];
-  strcpy (this->pathName, pName);
-  this->next = NULL;
-}
-
-/**
-   \brief destroys a PathList
-
-   It does this by deleting the Name and then delete its preceding PathList.
-*/
-PathList::~PathList()
-{
-  if (this->pathName)
-    delete []this->pathName;
-  if (this->next)
-    delete this->next;
-}
-
-PathList* PathList::firstPath = NULL;
-
-/**
-   \returns A Pointer to the first Path of the Pathlist
-*/
-PathList* PathList::getInstance(void)
-{
-  if (firstPath)
-    return firstPath;
-  firstPath = new PathList();
-}
-/**
-   \brief Adds a new Pathlist Element.
-   \param pName
-   
-   Adding a Path automatically checks if the Path exists,
-   and if it does not it will not add it to the List.
-*/
-void PathList::addPath (char* pName)
-{
-  if (pName[0] == '\0')
-    {
-      PRINTF(2)("not Adding empty Path to the List.\n");
-      return;
-    }
-  char* tmpPName = new char[strlen(pName)];
-  strncpy(tmpPName, pName, strlen(pName)-1);
-  tmpPName[strlen(pName)-1] = '\0';
-  if (access (tmpPName, F_OK) == 0)
-    {
-      struct stat status;
-      stat(tmpPName, &status);
-      if (status.st_mode & S_IFDIR)
-	{
-	  PRINTF(4)("Adding Path %s to the PathList.\n", pName);
-	  PathList* tmpPathList = this;
-	  while (tmpPathList->next)
-	    tmpPathList = tmpPathList->next;
-	  tmpPathList->next = new PathList(pName);
-	}
-      else
-	PRINTF(2)("You tried to add non-folder %s to a PathList.\n", tmpPName);
-    }
-  else
-      PRINTF(2)("You tried to add non-existing folder %s to a PathList.\n", tmpPName);
-  delete []tmpPName;
-}
-
-
+#include "graphics_engine.h"
 
 /**
@@ -127,4 +34,16 @@
   this->texture = 0;
 }
+
+/**
+   \brief Constructor for a Texture
+*/
+Texture::Texture(const char* imageName)
+{
+  this->pImage = new Image;
+  this->pImage->data = NULL;
+  this->map = NULL;
+  this->texture = 0;
+  this->loadImage(imageName);
+}  
 
 /**
@@ -143,37 +62,4 @@
 
 /**
-   \brief Searches for a Texture inside one of the defined Paths
-   \param texName The name of the texture o search for.
-   \returns pathName+texName if texName was found in the pathList. NULL if the Texture is not found.
-*/
-char* Texture::searchTextureInPaths(char* texName) const
-{
-  char* tmpName = NULL;
-  PathList* pList = PathList::getInstance();
-  while (pList)
-    {
-      if (pList->pathName)
-	{
-	  tmpName = new char [strlen(pList->pathName)+strlen(texName)+1];
-	  strcpy(tmpName, pList->pathName);
-	}
-      else
-	{
-	  tmpName = new char [strlen(texName)+1];
-	  tmpName[0]='\0';
-	}
-      strcat(tmpName, texName);
-      if (access (tmpName, F_OK) == 0)
-	return tmpName;
-      
-      if (tmpName)
-	delete []tmpName;
-      tmpName = NULL;
-      pList = pList->next;
-    }
-  return NULL;
-}
-
-/**
    \brief a Simple function that switches two char values
    \param a The first value
@@ -195,61 +81,65 @@
 bool Texture::loadTexToGL (Image* pImage)
 {
-  PRINTF(4)("Loading texture to OpenGL-Environment.\n");
-  glGenTextures(1, &this->texture);
-  glBindTexture(GL_TEXTURE_2D, this->texture);
-  /* not Working, and not needed. 
-  glTexImage2D( GL_TEXTURE_2D, 0, 3, width,
-		height, 0, GL_BGR,
-		GL_UNSIGNED_BYTE, map->pixels );
-  */ 
-  gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImage->width, pImage->height, pImage->format, GL_UNSIGNED_BYTE, pImage->data);
-  
-  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
-  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);	
-}
-
+  if (GraphicsEngine::texturesEnabled)
+    {
+      PRINTF(4)("Loading texture to OpenGL-Environment.\n");
+      glGenTextures(1, &this->texture);
+      glBindTexture(GL_TEXTURE_2D, this->texture);
+      /* not Working, and not needed. 
+	 glTexImage2D( GL_TEXTURE_2D, 0, 3, width,
+	 height, 0, GL_BGR,
+	 GL_UNSIGNED_BYTE, map->pixels );
+      */ 
+      gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImage->width, pImage->height, pImage->format, GL_UNSIGNED_BYTE, pImage->data);
+      
+      glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
+      glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);	
+    }
+}
 
 #ifdef HAVE_SDL_SDL_IMAGE_H
-bool Texture::loadImage(char* imageName)
-{
-  char* imgNameWithPath = searchTextureInPaths(imageName);
-  if (imgNameWithPath)
-    {
-      this->map=IMG_Load(imgNameWithPath);
-      if(!map)
-	{
-	  PRINTF(1)("IMG_Load: %s\n", IMG_GetError());
+bool Texture::loadImage(const char* imageName)
+{
+  if (GraphicsEngine::texturesEnabled)
+    {
+      if (imageName)
+	{
+	  this->map=IMG_Load(imageName);
+	  if(!map)
+	    {
+	      PRINTF(1)("IMG_Load: %s\n", IMG_GetError());
+	      return false;
+	    }
+	  pImage->height = map->h;
+	  pImage->width  = map->w;
+	  pImage->data   = (GLubyte*)map->pixels;
+	  pImage->bpp    = map->format->BytesPerPixel;
+	  if (pImage->bpp == 3)
+	    pImage->format = GL_RGB;
+	  else if (pImage->bpp == 4)
+	    pImage->format = GL_RGBA;
+	  
+	  if( !IMG_isPNG(SDL_RWFromFile(imageName, "rb")) && !IMG_isJPG(SDL_RWFromFile(imageName, "rb")))
+	    for (int i=0;i<map->h * map->w *3;i+=3)
+	      { 
+		GLuint temp = pImage->data[i];
+		pImage->data[i] = pImage->data[i+2];
+		pImage->data[i+2] = temp;
+	      }
+	  /* this is the real swapping algorithm */
+	  for( int i = 0 ; i < (pImage->height / 2) ; ++i )
+	    for( int j = 0 ; j < pImage->width * pImage->bpp; j += pImage->bpp )
+	      for(int k = 0; k < pImage->bpp; ++k)
+		swap( pImage->data[ (i * pImage->width * pImage->bpp) + j + k], pImage->data[ ( (pImage->height - i - 1) * pImage->width * pImage->bpp ) + j + k]);
+	  
+	  this->loadTexToGL (this->pImage);
+	  SDL_FreeSurface(map);
+	  this->pImage->data = NULL;
+	}
+      else
+	{
+	  PRINTF(2)("Image not Found: %s\n", imageName);
 	  return false;
 	}
-      pImage->height = map->h;
-      pImage->width  = map->w;
-      pImage->data   = (GLubyte*)map->pixels;
-      pImage->bpp    = map->format->BytesPerPixel;
-      if (pImage->bpp == 3)
-	pImage->format = GL_RGB;
-      else if (pImage->bpp == 4)
-	pImage->format = GL_RGBA;
-	  
-      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)
-	  { 
-	    GLuint temp = pImage->data[i];
-	    pImage->data[i] = pImage->data[i+2];
-	    pImage->data[i+2] = temp;
-	  }
-      /* this is the real swapping algorithm */
-      for( int i = 0 ; i < (pImage->height / 2) ; ++i )
-	for( int j = 0 ; j < pImage->width * pImage->bpp; j += pImage->bpp )
-	  for(int k = 0; k < pImage->bpp; ++k)
-	    swap( pImage->data[ (i * pImage->width * pImage->bpp) + j + k], pImage->data[ ( (pImage->height - i - 1) * pImage->width * pImage->bpp ) + j + k]);
- 
-      this->loadTexToGL (this->pImage);
-      SDL_FreeSurface(map);
-      this->pImage->data = NULL;
-    }
-  else
-    {
-      PRINTF(2)("Image not Found: %s\n", imgNameWithPath);
-      return false;
     }
 }
@@ -262,43 +152,44 @@
    \todo Checks where to find the Image
 */
-bool Texture::loadImage(char* imageName)
-{
-  char* imgNameWithPath = searchTextureInPaths(imageName);
-  if (imgNameWithPath)
-    {
-      if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4))
-	{
-	  PRINTF(4)("Requested bmp-image. Trying to Import.\n");
-	  return this->loadBMP(imgNameWithPath);
-	}
-      
-      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5))
-	{
-	  PRINTF(4)("Requested jpeg-image. Trying to Import\n");
-	  return this->loadJPG(imgNameWithPath);
-	}
-      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4))
-	{
-	  PRINTF(4)("Requested tga-image. Trying to Import\n");
-	  return this->loadTGA(imgNameWithPath);
-	}
-      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4))
-	{
-	  PRINTF(4)("Requested png-image. Trying to Import\n");
-	  return this->loadPNG(imgNameWithPath);
+bool Texture::loadImage(const char* imageName)
+{
+  if (GraphicsEngine::texturesEnabled)
+    {
+      if (imageName)
+	{
+	  if (!strncmp(imageName+strlen(imageName)-4, ".bmp", 4))
+	    {
+	      PRINTF(4)("Requested bmp-image. Trying to Import.\n");
+	      return this->loadBMP(imageName);
+	    }
+	  
+	  else if (!strncmp(imageName+strlen(imageName)-4, ".jpg", 4) || !strncmp(imageName+strlen(imageName)-5, ".jpg", 5))
+	    {
+	      PRINTF(4)("Requested jpeg-image. Trying to Import\n");
+	      return this->loadJPG(imageName);
+	    }
+	  else if (!strncmp(imageName+strlen(imageName)-4, ".tga", 4))
+	    {
+	      PRINTF(4)("Requested tga-image. Trying to Import\n");
+	      return this->loadTGA(imageName);
+	    }
+	  else if (!strncmp(imageName+strlen(imageName)-4, ".png", 4))
+	    {
+	      PRINTF(4)("Requested png-image. Trying to Import\n");
+	      return this->loadPNG(imageName);
+	    }
+	  else
+	    {
+	      PRINTF(2)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imageName);
+	      return false;
+	    }
 	}
       else
 	{
-	  PRINTF(2)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath);
+	  PRINTF(2)("Image not Found: %s\n", imageName);
 	  return false;
 	}
     }
-  else
-    {
-      PRINTF(2)("Image not Found: %s\n", imgNameWithPath);
-      return false;
-    }
-}
-
+}
 /**
    \brief reads in a Windows BMP-file, and imports it to openGL.
Index: orxonox/branches/levelloader/src/lib/graphics/importer/texture.h
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/importer/texture.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/importer/texture.h	(revision 3746)
@@ -28,28 +28,4 @@
 #endif /* HAVE_SDL_SDL_IMAGE_H */
 
-
-
-//! Class to handle lists of paths.
-/**
-   \todo Ability to return Paths by itself.
-
-   It is simple to use, and good, for all PathList you want.
-   just create a new Pathlist, and add Paths.
-*/
-class PathList
-{
- private:
-  PathList();
-  static PathList* firstPath; //!< A static Pointer to the first PathList in the List.
- public:
-  PathList(char* pName);
-  ~PathList();
-  static PathList* getInstance(void);
-  
-  void addPath (char* pName);
-  char* pathName;              //!< The Name of the current Path.
-  PathList* next;              //!< Pointer to the next Pathlist.
-};
-
 //! A Class, that reads in Textures from different fileformats.
 class Texture
@@ -70,8 +46,9 @@
   GLuint texture;   //!< The Texture-ID of opengl from this Texture.
   SDL_Surface* map; //!< The map SDL initializes for this element.
-  char* searchTextureInPaths(char* texName) const;
+  char* searchTextureInPaths(const char* texName) const;
   inline void swap(unsigned char &a, unsigned char &b);
  public:
   Texture(void);
+  Texture(const char* imageName);
   ~Texture(void);
   /** \returns The textureID of this texture.  */
@@ -79,5 +56,5 @@
   bool loadTexToGL (Image* pImage);
 
-  bool loadImage(char* imageName);
+  bool loadImage(const char* imageName);
 #ifndef HAVE_SDL_SDL_IMAGE_H
 
Index: orxonox/branches/levelloader/src/lib/graphics/light.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/graphics/light.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/graphics/light.cc	(revision 3746)
@@ -21,4 +21,5 @@
 
 #include "glincl.h"
+#include "vector.h"
 
 using namespace std;
Index: orxonox/branches/levelloader/src/lib/gui/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/Makefile.in	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/gui/Makefile.in	(revision 3746)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.8.2 from Makefile.am.
 # @configure_input@
 
@@ -179,7 +179,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  src/lib/gui/Makefile
+	  $(AUTOMAKE) --gnu  src/lib/gui/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -274,14 +274,12 @@
 	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,9 +291,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
 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 3606)
+++ orxonox/branches/levelloader/src/lib/gui/console/Makefile.in	(revision 3746)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.8.2 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)
@@ -205,7 +205,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile
+	  $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -227,5 +227,5 @@
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	$(mkdir_p) $(DESTDIR)$(bindir)
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
@@ -233,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
@@ -242,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
 
@@ -299,9 +299,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
@@ -358,7 +356,5 @@
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
-	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
-	done
+	$(mkdir_p) $(DESTDIR)$(bindir)
 install: install-am
 install-exec: install-exec-am
Index: orxonox/branches/levelloader/src/lib/gui/gui/Makefile.am
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/gui/Makefile.am	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/gui/gui/Makefile.am	(revision 3746)
@@ -21,5 +21,5 @@
 
 #AM_LDFLAGS=$(GTK2_LIBS)   $(GTHREAD_LIBS)
-LIBS=$(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
+AM_LDFLAGS=$(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
 
 bin_PROGRAMS=gui
Index: orxonox/branches/levelloader/src/lib/gui/gui/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/gui/Makefile.in	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/gui/gui/Makefile.in	(revision 3746)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.8.2 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)
@@ -131,7 +131,5 @@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
-
-#AM_LDFLAGS=$(GTK2_LIBS)   $(GTHREAD_LIBS)
-LIBS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
+LIBS = @LIBS@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
@@ -195,4 +193,7 @@
 MAINSRCDIR = ../../..
 AM_CXXFLAGS = $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/gaphics -I$(MAINSRCDIR)/lib/graphics/font -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai
+
+#AM_LDFLAGS=$(GTK2_LIBS)   $(GTHREAD_LIBS)
+AM_LDFLAGS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
 gui_SOURCES = orxonox_gui.cc \
 	    orxonox_gui_gtk.cc \
@@ -238,7 +239,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile
+	  $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -260,5 +261,5 @@
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	$(mkdir_p) $(DESTDIR)$(bindir)
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
@@ -266,6 +267,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
@@ -275,6 +276,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
 
@@ -338,9 +339,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
@@ -397,7 +396,5 @@
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
-	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
-	done
+	$(mkdir_p) $(DESTDIR)$(bindir)
 install: install-am
 install-exec: install-exec-am
Index: orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui.cc	(revision 3746)
@@ -95,5 +95,5 @@
 
   // Reading Values from File
-  exec->setFilename("~/.orxonox.conf");
+  exec->setConfFile("~/.orxonox/orxonox.conf");
   exec->readFromFile(orxonoxGUI);
   // Merging changes to the Options from appended flags.
Index: orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.cc	(revision 3746)
@@ -25,6 +25,11 @@
 
 #include "orxonox_gui_exec.h"
+
 #include <iostream>
 #include <string>
+
+#include <sys/stat.h>
+#include <sys/types.h>
+
 
 HashTable* orxonoxFlagHash;
@@ -50,5 +55,5 @@
   this->saveSettings->saveability();
   this->execBox->fill(this->saveSettings);
-  this->verboseMode = new Menu("verbose mode", "no output", "error", "warning", "info", "lastItem");
+  this->verboseMode = new Menu("verbose mode", "nothing", "error", "warning", "info", "lastItem");
   this->verboseMode->setFlagName("verbose", "v", 0);
   this->verboseMode->saveability();
@@ -90,6 +95,61 @@
 
 /**
+   \brief sets the confDir and File-name out of an input-string
+*/
+void OrxonoxGuiExec::setConfFile(char* confFile)
+{
+  char splitter = 
+#ifdef __WIN32__ 
+    '\\';
+#else
+  '/';
+#endif
+  char* tmpConfFile = new char[strlen(confFile)+1];
+  strcpy(tmpConfFile, confFile);
+  char* tmp = strrchr(tmpConfFile, splitter);
+  if (tmp)
+    {
+      tmp[0] = '\0';
+      this->setConfDir(tmpConfFile);
+      this->setFileName(tmp+1);
+    }
+  else
+    {
+      this->setConfDir("~/");
+      this->setFileName(tmpConfFile);
+    }
+  delete []tmp;
+  delete []tmpConfFile;
+}
+
+/**
+   \brief sets the Directory of the configuration files
+   \param confDir the Directory for the configuration files
+*/
+void OrxonoxGuiExec::setConfDir(char* confDir)
+{
+  if (!strncmp(confDir, "~/", 2))
+    {
+      char tmp[500];
+#ifdef __WIN32__
+      strcpy(tmp, getenv("USERPROFILE"));
+#else
+      strcpy(tmp, getenv("HOME"));
+#endif
+      this->confDir = new char[strlen(tmp)+strlen(confDir)];
+      sprintf(this->confDir, "%s%s", tmp, confDir+1);
+    }
+  else
+    {
+      this->confDir = new char[strlen(confDir)+1];
+      strcpy(this->confDir, confDir);
+    }
+  PRINTF(3)("Config Directory is: %s.\n", this->confDir);
+  mkdir(this->confDir, 0755);
+}
+
+/**
    \brief Sets the location of the configuration File.
-   \param filename the location of the configFile
+   \param fileName the location of the configFile
 
    \todo: memory allocation could be better.
@@ -97,19 +157,11 @@
    The name will be parsed from ~/ to /home/[username] on unix and c:/Documents and Settings/username/Settings/ on Windows
 */
-void OrxonoxGuiExec::setFilename(char* filename)
-{
-  char* buffer = (char*)malloc(2048*sizeof(char));
-  sprintf(buffer, "%s", filename);
-  if(!strncmp(buffer, "~/", 2))
-  {
-#ifdef __WIN32__
-    sprintf(configFile, "%s/%s", getenv("USERPROFILE"), buffer+2);
-#else
-    sprintf(configFile, "%s/%s", getenv("HOME"), buffer+2);
-#endif
-  }
-  else if(buffer)
-    strcpy(this->configFile, buffer);
-  free (buffer);
+void OrxonoxGuiExec::setFileName(char* fileName)
+{
+  if (!this->confDir)
+    this->setConfDir("~/");
+  this->configFile = new char[strlen(this->confDir)+strlen(fileName)+2];
+  sprintf(this->configFile, "%s/%s", this->confDir, fileName);
+  PRINTF(3)("ConfigurationFile is %s.\n", this->configFile);
 }
 
@@ -117,5 +169,5 @@
    \returns The name of the Configuration-File
 */
-char* OrxonoxGuiExec::getConfigFile(void)
+char* OrxonoxGuiExec::getConfigFile(void) const
 {
   return this->configFile;
@@ -190,8 +242,5 @@
 	    space2under[0] = '_';
 	  }
-	if(widget->isOption <=3)
-	  fprintf(CONFIG_FILE, "%s = %d\n", Buffer, static_cast<Option*>(widget)->value);
-	else if(widget->isOption == 5)
-	  fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<OptionLabel*>(widget)->cValue);
+	  fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<Option*>(widget)->save());
       }
 
@@ -259,11 +308,6 @@
     {
       PRINT(3)("Located Option %s.\n", widget->title);
-      if(widget->isOption >= 1 && widget->isOption <= 3)
-	{
-	  static_cast<Option*>(widget)->value = atoi(info->variableValue);
-	  static_cast<Option*>(widget)->redraw(); //!< \todo change this to setValue.
-	}
-      else if(widget->isOption == 5)
-	static_cast<OptionLabel*>(widget)->setValue(info->variableValue);
+      if(widget->isOption >= 1)
+	  static_cast<Option*>(widget)->load(info->variableValue);
     }
 }
Index: orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.h
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.h	(revision 3746)
@@ -22,4 +22,5 @@
   CheckButton* alwaysShow;     //!< A CheckButton, for if orxonox should start with or without gui.
   Button* quit;                //!< A Button to quit the Gui without starting orxonox.
+  char* confDir;               //!< The directory of the orxonox-configuration-files.
   char* configFile;            //!< The name of the .orxonox.conf(ig)-file.
   FILE* CONFIG_FILE;           //!< Filehandler for reading and writing.
@@ -37,7 +38,9 @@
   
   Widget* getWidget(void);
-  
-  void setFilename(char* filename);
-  char* getConfigFile(void);
+
+  void setConfFile(char* confFile);
+  void setConfDir(char* confDir);
+  void setFileName(char* fileName);
+  char* getConfigFile(void) const;
   int shouldsave(void);
   void writeToFile(Widget* widget);
Index: orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.cc	(revision 3746)
@@ -25,7 +25,8 @@
 
 
+#include "orxonox_gui_gtk.h"
+
+#include <stdarg.h>
 #include <iostream>
-
-#include "orxonox_gui_gtk.h"
 
 
@@ -68,8 +69,12 @@
 #else /* HAVE_GTK2 */
   char boolAns = 'y';
-  char ans[10]; 
+  char ans[10];
+  PRINT(0)("================================\n");
+  PRINT(0)("= ORXONOX CONFIGURATION WIZARD =\n");
+  PRINT(0)("================================    - version:" PACKAGE_VERSION "\n");
+
   while(true)
     {
-      PRINT(0)(" Listing all the Orxonox Options: \n");
+      PRINT(0)("\n Listing all the Orxonox Options: \n");
       PRINT(0)("  #############################\n");
       Window::mainWindow->walkThrough(Widget::listOptionsAndGroups, 1);
@@ -122,4 +127,5 @@
       //! \todo move this into the gui-gtk-file
       //! \todo finish it.
+      //! \todo memory leek at save(); and save is a BAD word, use saveString instead, or something like it.
     }
 #endif /* HAVE_GTK2 */
@@ -133,19 +139,8 @@
 
 /* WIDGET */
-
-/**
-   \brief deletes any given Widget
-   This is still pretty crappy.
-*/
-Widget::~Widget(void)
-{
-  this->destroy();
-}
-
-/**
-   \brief Initializes a widget.
-   Initializes the next Pointer and the other Widget-specific Defaults.
-*/
-void Widget::init(void)
+/**
+   \brief constructs a Widget
+*/
+Widget::Widget(void)
 {
   next = NULL;
@@ -155,9 +150,10 @@
 
 /**
-   \brief Destroys a Widget 
-*/
-void Widget::destroy(void)
-{
-  if (this->title)
+   \brief deletes any given Widget
+   This is still pretty crappy.
+*/
+Widget::~Widget(void)
+{
+    if (this->title)
     {
       delete []this->title;
@@ -172,8 +168,19 @@
     delete this->next;
   this->next = NULL;
-
   //!  \todo not hiding widget, deleting.
   //  this->hide();
   //  delete this->widget;
+}
+
+/**
+   \brief sets a new Title to a Widget
+   \param title The new Title to set to the Widget
+*/
+void Widget::setTitle(const char* title)
+{
+  if (this->title)
+    delete []this->title;
+  this->title = new char[strlen(title)+1];
+  strcpy(this->title, title);
 }
 
@@ -273,9 +280,9 @@
 {
   if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
-    cout << "[" << static_cast<Packer*>(widget)->groupName << "]\n";
-  if (widget->isOption >= 1 && widget->isOption <= 3)
-    cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
-  else if (widget->isOption == 5)
-    cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
+    PRINT(0)("[%s]\n", static_cast<Packer*>(widget)->groupName);
+  if (widget->isOption >= 1)
+    {
+      Widget::listOptions(widget);
+    }
 }
 
@@ -286,8 +293,6 @@
 void Widget::listOptions(Widget* widget)
 {
-  if (widget->isOption >= 1 && widget->isOption <= 3)
-    cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
-  else if (widget->isOption == 5)
-    cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
+  if(widget->isOption >= 1)
+    PRINT(0)("  %s is %s\n", static_cast<Option*>(widget)->title, static_cast<Option*>(widget)->save());
 }
 
@@ -300,15 +305,9 @@
 {
   
-  if (widget->isOption >= 1 && widget->isOption <= 3)
+  if (widget->isOption >= 1)
     {
       int* count =(int*)data;
       *count = *count +1;
-      cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
-    }
-  else if (widget->isOption == 5)
-    {
-      int* count =(int*)data;
-      *count = *count +1;
-      cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
+      PRINT(0)(" %d:%s is %s\n", *count, static_cast<Option*>(widget)->title, static_cast<Option*>(widget)->save());
     }
 }
@@ -513,18 +512,11 @@
 
 /* PACKERS */
-
-/**
-   \brief Initializes a Packer.
-
-   Sets the down-pinter to NULL and other PackerSpecific-values to their defaults.
-*/
-void Packer::init(void)
+/**
+   \brief Constructs a Packer
+*/
+Packer::Packer(void)
 {
   this->down = NULL;
   this->groupName = NULL;
-
-
-  static_cast<Widget*>(this)->init();
-  return;
 }
 
@@ -532,5 +524,5 @@
    \brief Destroys a Packer.
 */
-void Packer::destroy(void)
+Packer::~Packer(void)
 { 
   PRINTF(4)("deleting the Packer part.\n");
@@ -543,6 +535,4 @@
     delete this->down;
   this->down = NULL;
-
-  static_cast<Widget*>(this)->destroy();
 }
 
@@ -575,11 +565,7 @@
    sets the Container-Specific defaults.
 */
-void Container::init(void)
+Container::Container(void)
 {
   this->isOption = -1;
-
-  static_cast<Packer*>(this)->init();
-
-  return;
 }
 
@@ -587,9 +573,7 @@
    \brief Destroys a Container.
 */
-void Container::destroy(void)
+Container::~Container(void)
 { 
   PRINTF(4)("deleting the Container part.\n");
-
-  static_cast<Packer*>(this)->destroy();
 }
 
@@ -665,5 +649,9 @@
 Window::~Window(void)
 {
-  this->destroy();
+  if (this->title)
+    PRINTF(3)("deleting the Window: %s\n", this->title);
+  else 
+    PRINTF(3)("deleting the Window.\n");
+  //  this->hide();
 }
 
@@ -677,6 +665,4 @@
   
   isOpen = false;
-
-  static_cast<Container*>(this)->init();
 
 #ifdef HAVE_GTK2
@@ -691,18 +677,4 @@
 
 /**
-   \brief Destroys a Window.
-*/
-void Window::destroy(void)
-{ 
-  if (this->title)
-    PRINTF(3)("deleting the Window: %s\n", this->title);
-  else 
-    PRINTF(3)("deleting the Window.\n");
-  //  this->hide();
-  static_cast<Container*>(this)->destroy();
-  
-}
-
-/**
    \brief Shows all Widgets that are included within this->widget.
 */
@@ -730,5 +702,5 @@
    \param title title the Window should get.
 */
-void Window::setTitle(char* title)
+void Window::setTitle(const char* title)
 {
   if (this->title)
@@ -823,31 +795,19 @@
 Frame::~Frame(void)
 {
-  this->destroy();
-}
-
-/** 
-    \brief Initializes a new Frame with default settings
-*/
-void Frame::init(void)
-{
-  static_cast<Container*>(this)->init();
-
-#ifdef HAVE_GTK2
-  this->widget = gtk_frame_new("");
-  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
-#endif /* HAVE_GTK2 */
-}
-
-/**
-   \brief Destroys a Frame.
-*/
-void Frame::destroy(void)
-{ 
   if (this->title)
     PRINTF(3)("deleting the Frame: %s\n", this->title);
   else 
     PRINTF(3)("deleting the Frame.\n");
-
-   static_cast<Container*>(this)->destroy();
+}
+
+/** 
+    \brief Initializes a new Frame with default settings
+*/
+void Frame::init(void)
+{
+#ifdef HAVE_GTK2
+  this->widget = gtk_frame_new("");
+  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
+#endif /* HAVE_GTK2 */
 }
 
@@ -856,5 +816,5 @@
    \param title The title the Frame should get.
 */
-void Frame::setTitle(char* title)
+void Frame::setTitle(const char* title)
 {
   if (this->title)
@@ -892,46 +852,21 @@
 EventBox::~EventBox(void)
 {
-  this->destroy();
-
-}
-
-/**
-   \brief Initializes a new EventBox
-*/
-void EventBox::init(void)
-{
-  this->isOption = -1;
-
-  static_cast<Container*>(this)->init();
-
-#ifdef HAVE_GTK2
-  this->widget = gtk_event_box_new();
-  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
-#endif /* HAVE_GTK2 */
-}
-
-/**
-   \brief Destroys an EventBox.
-*/
-void EventBox::destroy(void)
-{ 
   if (this->title)
     PRINTF(3)("deleting the EventBox: %s\n", this->title);
   else 
     PRINTF(3)("deleting the EventBox.\n");
-
-  static_cast<Container*>(this)->destroy();
-}
-
-/**
-   \brief Sets the Title of the EventBox(not implemented)
-   \param title Name the EventBox should get(only datastructure-internal).
-*/
-void EventBox::setTitle(char* title)
-{
-  if (this->title)
-    delete []this->title;
-  this->title = new char[strlen(title)+1];
-  strcpy(this->title, title);
+}
+
+/**
+   \brief Initializes a new EventBox
+*/
+void EventBox::init(void)
+{
+  this->isOption = -1;
+
+#ifdef HAVE_GTK2
+  this->widget = gtk_event_box_new();
+  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
+#endif /* HAVE_GTK2 */
 }
 
@@ -960,33 +895,4 @@
 Box::~Box(void)
 {
-  this->destroy();
-}
-
-/**
-   \brief Initializes a new Box with type boxtype
-   \param boxtype see Box(char boxtype)
-*/
-void Box::init(char boxtype)
-{
-  this->isOption = -2;
-
-  static_cast<Packer*>(this)->init();
-#ifdef HAVE_GTK2
-  if (boxtype == 'v')
-    {
-      this->widget = gtk_vbox_new(FALSE, 0);
-    }
-  else
-    {
-      this->widget = gtk_hbox_new(FALSE, 0);
-    }
-#endif /* HAVE_GTK2 */
-}
-
-/**
-   \brief Destroys a Box.
-*/
-void Box::destroy(void)
-{ 
   if (this->title)
     PRINTF(3)("deleting the Box: %s\n", this->title);
@@ -994,5 +900,24 @@
     PRINTF(3)("deleting the Box.\n");
 
-  static_cast<Packer*>(this)->destroy();
+}
+
+/**
+   \brief Initializes a new Box with type boxtype
+   \param boxtype see Box(char boxtype)
+*/
+void Box::init(char boxtype)
+{
+  this->isOption = -2;
+
+#ifdef HAVE_GTK2
+  if (boxtype == 'v')
+    {
+      this->widget = gtk_vbox_new(FALSE, 0);
+    }
+  else
+    {
+      this->widget = gtk_hbox_new(FALSE, 0);
+    }
+#endif /* HAVE_GTK2 */
 }
 
@@ -1022,16 +947,4 @@
 }
 
-/**
-   \brief Sets the Title of a Box.
-   \param title the new Title to set.
-*/
-void Box::setTitle(char* title)
-{
-  if (this->title)
-    delete []this->title;
-  this->title = new char[strlen(title)+1];
-  strcpy(this->title, title);
-}
-
 /* OPTION */
 
@@ -1040,5 +953,5 @@
    sets all Option-Specific-Values to their defaults.
 */
-void Option::init(void)
+Option::Option(void)
 {
   this->value = 0;
@@ -1047,8 +960,4 @@
   this->saveable = false;
   this->defaultValue = 0;
-
-  static_cast<Widget*>(this)->init();
-
-  return;
 }
 
@@ -1056,5 +965,5 @@
    \brief Destroys an Option.
 */
-void Option::destroy(void)
+Option::~Option(void)
 { 
   PRINTF(4)("deleting the Option Part.\n");
@@ -1063,6 +972,4 @@
   if (this->flagNameShort)
     delete []this->flagNameShort;
-
-  static_cast<Widget*>(this)->destroy();
 }
 
@@ -1123,4 +1030,28 @@
 
 /**
+   \brief saves an Option
+   \returns the String that should be saved.
+
+   this is a default Option save
+*/
+char* Option::save(void)
+{
+  char* value = new char [10];
+  sprintf (value, "%d", this->value);
+  return value;
+}
+
+/**
+   \brief loads an Option from of its loadString
+   \param loadString the string from which to load the data from
+*/
+void Option::load(char* loadString)
+{
+  this->value = atoi(loadString);
+  PRINT(3)("Loading %s: %s %d\n", this->title, loadString, value); 
+  this->redraw();
+}
+
+/**
    \returns The saveable-state.
 */
@@ -1161,26 +1092,4 @@
 Button::~Button(void)
 {
-  this->destroy();
-}
-
-/**
-   \brief Initializes a new Button
-*/
-void Button::init(void)
-{
-  isOption = 0;
-
-  static_cast<Option*>(this)->init();
-
-#ifdef HAVE_GTK2
-  widget = gtk_button_new_with_label("");
-#endif /* HAVE_GTK2 */
-}
-
-/**
-   \brief Destroys a Button.
-*/
-void Button::destroy(void)
-{ 
   if (this->title)
     PRINTF(3)("deleting the Label: %s\n", this->title);
@@ -1188,5 +1097,16 @@
     PRINTF(3)("deleting the Label.\n");
 
-  static_cast<Option*>(this)->destroy();
+}
+
+/**
+   \brief Initializes a new Button
+*/
+void Button::init(void)
+{
+  isOption = 0;
+
+#ifdef HAVE_GTK2
+  widget = gtk_button_new_with_label("");
+#endif /* HAVE_GTK2 */
 }
 
@@ -1195,5 +1115,5 @@
    \param title The name the Button should get
 */
-void Button::setTitle(char *title)
+void Button::setTitle(const char *title)
 {
   if (this->title)
@@ -1245,32 +1165,20 @@
 CheckButton::~CheckButton(void)
 {
-  this->destroy();
-}
-
-/**
-   \brief Initialize a new CheckButton with default settings
-*/
-void CheckButton::init(void)
-{
-  this->isOption = 1;
-
-  static_cast<Option*>(this)->init();
-
-#ifdef HAVE_GTK2
-  this->widget = gtk_check_button_new_with_label("");
-#endif /* HAVE_GTK2 */
-}
-
-/**
-   \brief Destroys a CheckButton.
-*/
-void CheckButton::destroy(void)
-{ 
   if (this->title)
     PRINTF(3)("deleting the CheckButton: %s\n", this->title);
   else 
     PRINTF(3)("deleting the CheckButton.\n");
-
-  static_cast<Option*>(this)->destroy();
+}
+
+/**
+   \brief Initialize a new CheckButton with default settings
+*/
+void CheckButton::init(void)
+{
+  this->isOption = 1;
+
+#ifdef HAVE_GTK2
+  this->widget = gtk_check_button_new_with_label("");
+#endif /* HAVE_GTK2 */
 }
 
@@ -1279,5 +1187,5 @@
    \param title The new Name the CheckButton should display.
 */
-void CheckButton::setTitle(char* title)
+void CheckButton::setTitle(const char* title)
 {
   if (this->title)
@@ -1306,5 +1214,5 @@
 #else /* HAVE_GTK2 */
   char tmpChar[20];
-  cout << "\nPlease give me a new value for " << this->title << " [0,1](defualt:" << this->defaultValue << "): ";
+  cout << "\nPlease give me a new value for " << this->title << " [0,1](default:" << this->defaultValue << "): ";
   cin >> tmpChar;
 
@@ -1350,48 +1258,23 @@
 Slider::~Slider(void)
 {
-  this->destroy();
-}
-
-/**
-   \brief Initializes a Slider with start and end Values
-   params: see Slider::Slider(char* slidername, int start, int end)
-*/
-void Slider::init(int start, int end)
-{
-  this->isOption = 2;
-
-  static_cast<Option*>(this)->init();
-
-  this->start = start;
-  this->end = end;
-#ifdef HAVE_GTK2
- widget = gtk_hscale_new_with_range(this->start, this->end, 5);
-#endif /* HAVE_GTK2 */
-}
-
-/**
-   \brief Destroys a Slider.
-*/
-void Slider::destroy(void)
-{ 
   if (this->title)
     PRINTF(3)("deleting the Slider: %s\n", this->title);
   else 
     PRINTF(3)("deleting the Slider.\n");
-
-  static_cast<Option*>(this)->destroy();
-
-}
-
-/**
-   \brief Sets a new Title to the Slider
-   \param title The new Name of the slider
-*/
-void Slider::setTitle(char* title)
-{
-  if (this->title)
-    delete []this->title;
-  this->title = new char[strlen(title)+1];
-  strcpy(this->title, title);
+}
+
+/**
+   \brief Initializes a Slider with start and end Values
+   params: see Slider::Slider(char* slidername, int start, int end)
+*/
+void Slider::init(int start, int end)
+{
+  this->isOption = 2;
+
+  this->start = start;
+  this->end = end;
+#ifdef HAVE_GTK2
+ widget = gtk_hscale_new_with_range(this->start, this->end, 5);
+#endif /* HAVE_GTK2 */
 }
 
@@ -1425,5 +1308,5 @@
 #else /* HAVE_GTK2 */
   char tmpChar[20];
-  cout << "\nPlease give me a new value for " << this->title << " [" <<this->start << "-" << this->end << "](defualt:" << this->defaultValue << "): ";
+  cout << "\nPlease give me a new value for " << this->title << " [" <<this->start << "-" << this->end << "](default:" << this->defaultValue << "): ";
   cin >> tmpChar;
 
@@ -1437,4 +1320,14 @@
 
 /* MENU */
+
+/**
+   \brief constructs a new Menu, without adding any items to it.
+   \param menuName the Name the Menu gets.
+*/
+Menu::Menu(const char* menuName)
+{
+  this->init();
+  this->setTitle(menuName);
+}
 
 /** 
@@ -1448,8 +1341,8 @@
   this->init();
   this->setTitle(menuname);
-    
+  va_list itemlist;                     //!< The list to readin multiple Options.
+
   char *itemName;
 
-#ifdef HAVE_GTK2             /////////////////////// REINPLEMENT
   va_start(itemlist, menuname);
   while(strcmp(itemName = va_arg(itemlist, char*), "lastItem"))
@@ -1458,10 +1351,4 @@
     }
   va_end(itemlist);
-#endif /* HAVE_GTK2 */
-
-#ifdef HAVE_GTK2
-  gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu);
-  this->connectSignal("changed", this->OptionChange);
-#endif /* HAVE_GTK2 */
 }
 
@@ -1471,28 +1358,4 @@
 Menu::~Menu(void)
 {
-  this->destroy();
-}
-
-/**
-   \brief Initializes a new Menu with no items
-*/
-void Menu::init(void)
-{
-  this->isOption = 2;
-
-  static_cast<Option*>(this)->init();
-
-#ifdef HAVE_GTK2
-  this->widget = gtk_option_menu_new();
-  this->menu = gtk_menu_new();
-#endif /* HAVE_GTK2 */
-
-}
-
-/**
-   \brief Destroys a Menu.
-*/
-void Menu::destroy(void)
-{ 
   if (this->title)
     PRINTF(3)("deleting the Menu: %s\n", this->title);
@@ -1500,19 +1363,70 @@
     PRINTF(3)("deleting the Menu.\n");
   //! \todo destroy menu
-  
-  static_cast<Option*>(this)->destroy();
-}
-
-
-/**
- * Sets the Database-Name of this Menu
- \param title Database-Name to be set.
-*/
-void Menu::setTitle(char* title)
-{
-  if (this->title)
-    delete []this->title;
-  this->title = new char[strlen(title)+1];
-  strcpy(this->title, title);
+  this->currItem = this->firstItem;
+  while(this->currItem)
+    {
+      delete []this->currItem->name;
+      /*
+	#ifdef HAVE_GTK2
+	free(this->currItem->item);
+	#endif /* HAVE_GTK2 */
+      MenuItem* tmpItem = this->currItem;
+      this->currItem = this->currItem->next;
+      delete tmpItem;
+    }
+}
+
+/**
+   \brief Initializes a new Menu with no items
+*/
+void Menu::init(void)
+{
+  this->isOption = 2;
+  this->firstItem = NULL;
+
+#ifdef HAVE_GTK2
+  this->widget = gtk_option_menu_new();
+  this->menu = gtk_menu_new();
+  gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu);
+  this->connectSignal("changed", this->OptionChange);
+#endif /* HAVE_GTK2 */
+}
+
+/**
+   \brief saves the Label of the Menu
+   \returns the name of the selected Menu-Item
+*/
+char* Menu::save(void)
+{
+  MenuItem* tmpItem = this->firstItem;
+  for (int i = 0; i<this->value; i++)
+    tmpItem = tmpItem->next;
+      
+  return tmpItem->name;
+}
+
+/**
+   \brief loads a Menu from of its loadString
+   \param loadString the string from which to load the data from
+*/
+void Menu::load(char* loadString)
+{
+  MenuItem* tmpItem = firstItem;
+  bool foundItem = false;
+  while (tmpItem)
+    {
+      if (!strcmp(loadString, tmpItem->name))
+	{foundItem = true; break;}
+      tmpItem = tmpItem->next;
+    }
+  if (foundItem)
+    this->value = tmpItem->itemNumber;
+  else
+    {
+      this->value = 0;
+      PRINTF(2)("Sorry, but %s has not been found in the Itemlist of %s\n", loadString, this->title);
+    }
+  PRINTF(3)( "Loading %s: setting to %d\n", this->title, this->value); 
+  this->redraw();
 }
 
@@ -1520,13 +1434,27 @@
    \brief appends a new Item to the Menu-List.
    \param itemName the itemName to be appendet.
-
-   \todo make the item-list readable without GTK
 */
 void Menu::addItem(char* itemName)
 {
-#ifdef HAVE_GTK2
-  this->item = gtk_menu_item_new_with_label(itemName);
-  gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->item);
-#endif /* HAVE_GTK2 */
+  if (!this->firstItem)
+    {
+      this->firstItem = this->currItem = new MenuItem;
+      this->currItem->itemNumber = 0;
+    }
+  else
+    {
+      int tmpI = this->currItem->itemNumber;
+      this->currItem = this->currItem->next = new MenuItem;
+      this->currItem->itemNumber = tmpI+1;
+    }
+
+  this->currItem->name = new char[strlen(itemName)+1];
+  strcpy(this->currItem->name, itemName);
+
+#ifdef HAVE_GTK2
+  this->currItem->item = gtk_menu_item_new_with_label(itemName);
+  gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->currItem->item);
+#endif /* HAVE_GTK2 */
+  this->currItem->next = NULL;
 }
 
@@ -1551,5 +1479,5 @@
 #else /* HAVE_GTK2 */
   char tmpChar[20];
-  cout << "\nPlease give me a new value for " << this->title << "(defualt:" << this->defaultValue << "): ";
+  cout << "\nPlease give me a new value for " << this->title << "(default:" << this->defaultValue << "): ";
   cin >> tmpChar;
   this->value = atoi(tmpChar);
@@ -1578,27 +1506,4 @@
 OptionLabel::~OptionLabel(void)
 {
-  this->destroy();
-}
-
-/**
-   \brief Initializes an OptionLabel
-*/
-void OptionLabel::init(void)
-{
-  this->isOption = 5;
-  static_cast<Option*>(this)->init();
-
-  cValue = NULL;
-
-#ifdef HAVE_GTK2
-  this->widget = gtk_label_new("");
-#endif /* HAVE_GTK2 */
-}
-
-/**
-   \brief Destroys a OptionLabel.
-*/
-void OptionLabel::destroy(void)
-{ 
   if (this->title)
     PRINTF(3)("deleting the OptionLabel: %s\n", this->title);
@@ -1607,8 +1512,18 @@
   if (this->cValue)
     delete []this->cValue;
-
-  static_cast<Option*>(this)->destroy();
-}
-
+}
+
+/**
+   \brief Initializes an OptionLabel
+*/
+void OptionLabel::init(void)
+{
+  this->isOption = 5;
+  cValue = NULL;
+
+#ifdef HAVE_GTK2
+  this->widget = gtk_label_new("");
+#endif /* HAVE_GTK2 */
+}
 
 /**
@@ -1628,17 +1543,4 @@
 
 /**
-   \brief Sets a ned Title to the OptionLabel.
-   \param title The now title of the OptionLabel.
-*/
-void OptionLabel::setTitle(char* title)
-{
-  if (this->title)
-    delete []this->title;
-  this->title = new char [strlen(title)+1];
-  strcpy(this->title, title);
-  this->redraw();
-}
-
-/**
    \brief Redraws an OptionLabel(not implemented yet, but it works).
 */
@@ -1666,4 +1568,23 @@
 
 /**
+   \brief creates the Optionlabel save-string
+   \returns the String to save.
+*/
+char* OptionLabel::save(void)
+{
+  return cValue;
+}
+
+/**
+   \brief loads an Option from of its loadString
+   \param loadString the string from which to load the data from
+*/
+void OptionLabel::load(char* loadString)
+{
+  PRINTF(3)( "Loading %s: setting to %s\n", this->title, loadString); 
+  this->setValue(loadString);
+}
+
+/**
    \brief Creates a new default Label with no Text.
    You migth consider adding Label::setTitle with this.
@@ -1689,33 +1610,21 @@
 Label::~Label(void)
 {
-  this->destroy();
-}
-
-/**
-   \brief initializes a new Label
-*/
-void Label::init(void)
-{
-  this->isOption = 0;
-
-  static_cast<Widget*>(this)->init();
-
-#ifdef HAVE_GTK2
-  this->widget = gtk_label_new("");
-  gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);
-#endif /* HAVE_GTK2 */
-}
-
-/**
-   \brief Destroys a Label.
-*/
-void Label::destroy(void)
-{ 
   if (this->title)
     PRINTF(3)("deleting the Label: %s\n", this->title);
   else 
     PRINTF(3)("deleting the Label.\n");
-
-  static_cast<Widget*>(this)->destroy();
+}
+
+/**
+   \brief initializes a new Label
+*/
+void Label::init(void)
+{
+  this->isOption = 0;
+
+#ifdef HAVE_GTK2
+  this->widget = gtk_label_new("");
+  gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);
+#endif /* HAVE_GTK2 */
 }
 
@@ -1813,5 +1722,8 @@
 ProgressBar::~ProgressBar(void)
 {
-  this->destroy();
+  if (this->title)
+    PRINTF(3)("deleting the ProgressBar: %s\n", this->title);
+  else 
+    PRINTF(3)("deleting the ProgressBar.\n");
 }
 
@@ -1825,34 +1737,8 @@
   this->totalSize = 0.0;
 
-  static_cast<Widget*>(this)->init();
 #ifdef HAVE_GTK2
   this->adjustment =(GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0);
   this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment);
 #endif /* HAVE_GTK2 */
-}
-
-/**
-   \brief Destroys a ProgressBar.
-*/
-void ProgressBar::destroy(void)
-{ 
-  if (this->title)
-    PRINTF(3)("deleting the ProgressBar: %s\n", this->title);
-  else 
-    PRINTF(3)("deleting the ProgressBar.\n");
-
-  static_cast<Widget*>(this)->destroy();
-}
-
-/**
-   \brief Sets a ned Title to the ProgressBar.
-   \param title The now title of the ProgressBar.
-*/
-void ProgressBar::setTitle(char* title)
-{
-  if (this->title)
-    delete []this->title;
-  this->title = new char [strlen(title)+1];
-  strcpy(this->title, title);
 }
 
@@ -1913,39 +1799,15 @@
 Image::~Image(void)
 {
-  this->destroy();
-}
-
-/** 
-    \brief Initializes a new Image
-*/
-void Image::init(void)
-{
-  isOption = 0;
-
-  static_cast<Widget*>(this)->init();
-}
-
-/**
-   \brief Destroys a Image.
-*/
-void Image::destroy(void)
-{ 
   if (this->title)
     PRINTF(3)("deleting the Image: %s\n", this->title);
   else 
     PRINTF(3)("deleting the Image.\n");
-
-  static_cast<Widget*>(this)->destroy();
-}
-
-/**
-   \brief Sets a ned Title to the Image.
-   \param title The now title of the OptionLabel.
-*/
-void Image::setTitle(char* title)
-{
-  if (this->title)
-    delete []this->title;
-  this->title = new char [strlen(title)+1];
-  strcpy(this->title, title);
-}
+}
+
+/** 
+    \brief Initializes a new Image
+*/
+void Image::init(void)
+{
+  isOption = 0;
+}
Index: orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.h
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.h	(revision 3746)
@@ -39,12 +39,11 @@
 
  public:
+  Widget(void);
   virtual ~Widget(void);
-  void init(void);
-  void destroy(void);
 
   void show(void);
   void hide(void);
   void setSize(int width, int height);
-  virtual void setTitle(char* title) = 0;  //!< An abstract Function, that sets the title of Widgets.
+  virtual void setTitle(const char* title);  //!< An abstract Function, that sets the title of Widgets.
 
   Widget* findWidgetByName(char* name, unsigned int depth);
@@ -90,9 +89,9 @@
 {
  public:
+  Packer(void);
+  virtual ~Packer(void);
+
   Widget* down; //!< this points to the Widget below this.
   char* groupName; //!< For each Packer you can specify a Groupname under which the lowerWidgets will be saved.
-
-  void init(void);
-  void destroy(void);
 
   void setGroupName(char* name);
@@ -115,9 +114,7 @@
   
  public:
-  void init(void);
-  void destroy(void);
-
+  Container(void);
+  virtual ~Container(void);
   //  void setBorderWidth(int borderwidth);
-  //  virtual void setTitle(char* title) = 0;
   void fill(Widget* lowerWidget);
 };
@@ -138,9 +135,8 @@
   Window(void);
   Window(char* windowName);
-  ~Window(void);
-  void init(void);
-  void destroy(void);
-  
-  void setTitle(char* title);
+  virtual ~Window(void);
+  void init(void);
+  
+  void setTitle(const char* title);
   void showall(void);
   void open(void);
@@ -164,9 +160,8 @@
   Frame(void);
   Frame(char* frameName);
-  ~Frame(void);
-  void init(void);
-  void destroy(void);
-  
-  void setTitle(char* title);
+  virtual ~Frame(void);
+  void init(void);
+
+  void setTitle(const char* title);
 };
 
@@ -180,9 +175,6 @@
   EventBox(void);
   EventBox(char* eventBoxName);
-  ~EventBox(void);
-  void init(void);
-  void destroy(void);
-  
-  void setTitle(char* title);
+  virtual ~EventBox(void);
+  void init(void);
 };
 
@@ -198,11 +190,8 @@
   Box(void);
   Box(char boxtype);
-  ~Box(void);
+  virtual ~Box(void);
   void init(char boxtype);
-  void destroy(void);
   
   void fill(Widget* lowerWidget);
-
-  void setTitle(char* title);
 };
 
@@ -217,6 +206,7 @@
   
  public:
-  void init(void);
-  void destroy(void);
+  Option(void);
+  virtual ~Option(void);
+  void init(void);
 
   int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume
@@ -227,4 +217,7 @@
   void saveability(void);
   void saveability(bool isSaveable);
+  virtual char* save(void);
+  virtual void load(char* loadString);
+
   bool isSaveable(void);
   void setFlagName(char* flagname, int defaultvalue);
@@ -246,9 +239,8 @@
  public:
   Button(char* buttonname);
-  ~Button(void);
-  void init(void);
-  void destroy(void);
-
-  void setTitle(char* title);
+  virtual ~Button(void);
+  void init(void);
+
+  void setTitle(const char* title);
   void redraw(void);
   void changeOption(void);
@@ -262,9 +254,8 @@
  public:
   CheckButton(char* buttonname);
-  ~CheckButton(void);
-  void init(void);
-  void destroy(void);
-
-  void setTitle(char* title);
+  virtual ~CheckButton(void);
+  void init(void);
+
+  void setTitle(const char* title);
   bool isActive(void);           //!< a Bool value to see, if this CheckButton is active.
   void redraw(void);
@@ -283,9 +274,7 @@
  public:
   Slider(char* slidername, int start, int end);
-  ~Slider(void);
+  virtual ~Slider(void);
   void init(int start, int end);
-  void destroy(void);
-
-  void setTitle(char* title);
+
   void setValue(int value);
   void redraw(void);
@@ -299,15 +288,28 @@
 #ifdef HAVE_GTK2
   GtkWidget* menu;                      //!< The menu That will hold the Options.
-  GtkWidget* item;                      //!< One Item From a Menu.
-#endif /* HAVE_GTK2 */
-  va_list itemlist;                     //!< The list to readin multiple Options.
-  
- public:
+#endif /* HAVE_GTK2 */
+
+  //! A struct to handle the MenuItems
+  struct MenuItem
+  {
+    char* name;                         //!< The name of this entry.
+    int itemNumber;                     //!< The n'th entry of this menu;
+#ifdef HAVE_GTK2
+    GtkWidget* item;                    //!< One Item From a Menu.
+#endif /* HAVE_GTK2 */
+    MenuItem* next;                     //!< Pointer to the next MenuItem.
+  };
+  MenuItem* firstItem;                  //!< Pointer to the first Item.
+  MenuItem* currItem;                   //!< Pointer to the current Item.
+  
+ public:
+  Menu(const char* menuName);
   Menu(char* menuname, ...);
-  ~Menu(void);
-  void init(void);
-  void destroy(void);
-  
-  void setTitle(char* title);
+  virtual ~Menu(void);
+  void init(void);
+
+  virtual char* save(void);
+  virtual void load(char* loadString);
+  
   void addItem(char* itemName);
   void redraw(void);
@@ -322,11 +324,12 @@
  public:
   OptionLabel(char* label, char* value);
-  ~OptionLabel(void);
-  void init(void);
-  void destroy(void);
-  
+  virtual ~OptionLabel(void);
+  void init(void);
   
   void setValue(char* newValue);
-  void setTitle(char* title);
+
+  virtual char* save(void);
+  virtual void load(char* loadString);
+
   void redraw(void);
   void changeOption(void);
@@ -342,7 +345,6 @@
   Label(void);
   Label(char* text);
-  ~Label(void);
-  void init(void);
-  void destroy(void);
+  virtual ~Label(void);
+  void init(void);
   
   void setTitle(char* text);
@@ -359,9 +361,7 @@
   ProgressBar(void);
   ProgressBar(char* label);
-  ~ProgressBar(void);
-  void init(void);
-  void destroy(void);
-
-  void setTitle(char* title);
+  virtual ~ProgressBar(void);
+  void init(void);
+
   void setProgress(double progress);
   void setTotalSize(double totalSize);
@@ -385,9 +385,6 @@
  public:
   Image(char* imgaename);
-  ~Image(void);
-  void init(void);
-  void destroy(void);
-
-  void setTitle(char* title);
+  virtual ~Image(void);
+  void init(void);
 };
 
Index: orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.cc	(revision 3746)
@@ -27,4 +27,6 @@
 #include "orxonox_gui_video.h"
 
+#include "glincl.h"
+
 /**
    \brief Creates the Video-Option-Frame
@@ -40,5 +42,6 @@
   this->fullscreen->saveability();
   this->videoBox->fill(this->fullscreen);
-  this->resolution = new Menu("Resolution", "640x480", "800x600", "1024x768", "1280x1024", "1400x1050", "1600x1200", "1920x1200", "lastItem");
+  this->resolution = new Menu("Resolution");
+  this->getResolutions(this->resolution);
   this->resolution->saveability();
   this->videoBox->fill(this->resolution);
@@ -146,2 +149,39 @@
 }
 
+void OrxonoxGuiVideo::getResolutions(Menu* menu)
+{
+  SDL_Init(SDL_INIT_VIDEO);
+  SDL_Rect **modes;
+  int i;
+  int x = 0,y =0; // check for difference
+  char tmpChar[100];
+  
+  /* Get available fullscreen/hardware modes */
+  modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
+  
+  /* Check is there are any modes available */
+  if(modes == (SDL_Rect **)0){
+    PRINTF(2)("No video-modes available!\n");
+    exit(-1);
+  }
+  
+  /* Check if our resolution is restricted */
+  if(modes == (SDL_Rect **)-1){
+    PRINTF(2)("All resolutions available.\n");
+  }
+  else{
+    /* Print valid modes */
+    PRINT(4)("Available Modes\n");
+    for(i = 0; modes[i] ;++i)
+      {
+	if (x != modes[i]->w || y != modes[i]->h)
+	  { 
+	    PRINT(4)("  %d x %d\n", modes[i]->w, modes[i]->h);
+	    sprintf(tmpChar, "%dx%d", modes[i]->w, modes[i]->h);
+	    menu->addItem(tmpChar);
+	    x = modes[i]->w; y = modes[i]->h;
+	  }
+      }
+  }
+  SDL_Quit();
+}
Index: orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.h
===================================================================
--- orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.h	(revision 3746)
@@ -45,6 +45,10 @@
   OrxonoxGuiVideo(void);
   ~OrxonoxGuiVideo(void);
+
+  Widget* getWidget(void);
+
+  void getResolutions(Menu* menu);
   
-  Widget* getWidget(void);
+
 };
 #endif /* _ORXONOX_GUI_VIDEO_H */
Index: orxonox/branches/levelloader/src/lib/lang/base_object.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/lang/base_object.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/lang/base_object.cc	(revision 3746)
@@ -18,4 +18,5 @@
 
 #include "base_object.h"
+#include "stdincl.h"
 
 
@@ -29,4 +30,5 @@
 {
   this->className = NULL;
+  this->finalized = false;
 }
 
@@ -57,2 +59,14 @@
   return true;
 }
+
+/*
+bool BaseObject::isFinalized()
+{
+  
+}
+*/
+
+void BaseObject::finalize()
+{
+  this->finalized = true;
+}
Index: orxonox/branches/levelloader/src/lib/lang/base_object.h
===================================================================
--- orxonox/branches/levelloader/src/lib/lang/base_object.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/lang/base_object.h	(revision 3746)
@@ -21,7 +21,10 @@
   bool isA (char* className);
 
+  inline bool isFinalized() { return this->finalized; }
+  void finalize();
+
  private:
   char* className;
-
+  bool finalized;
 };
 
Index: orxonox/branches/levelloader/src/lib/math/quaternion.h
===================================================================
--- orxonox/branches/levelloader/src/lib/math/quaternion.h	(revision 3746)
+++ orxonox/branches/levelloader/src/lib/math/quaternion.h	(revision 3746)
@@ -0,0 +1,413 @@
+/*! 
+    \file vector.h
+    \brief A basic 3D math framework
+    
+    Contains classes to handle vectors, lines, rotations and planes
+*/ 
+
+#ifndef _QUATERNION_H
+#define _QUATERNION_H
+
+#include <math.h>
+//! PI the circle-constant
+
+//! Quaternion
+/**
+	Class to handle 3-dimensional rotation efficiently
+*/
+class Quaternion
+{
+ 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);
+  
+  void debug();
+ private:
+  float DELTA;      //!< resolution of calculation
+
+};
+
+
+/**
+	\brief creates a multiplicational identity Quaternion
+*/
+Quaternion::Quaternion ()
+{
+	w = 1;
+	v = Vector(0,0,0);
+}
+
+/**
+	\brief turns a rotation along an axis into a Quaternion
+	\param angle: the amount of radians to rotate
+	\param axis: the axis to rotate around
+*/
+Quaternion::Quaternion (float angle, const Vector& axis)
+{
+	w = cos(angle/2);
+	v = axis * sin(angle/2);
+}
+
+/**
+   \brief calculates a lookAt rotation
+   \param dir: the direction you want to look
+   \param up: specify what direction up should be
+   
+   Mathematically this determines the rotation a (0,0,1)-Vector has to undergo to point
+   the same way as dir. If you want to use this with cameras, you'll have to reverse the
+   dir Vector (Vector(0,0,0) - your viewing direction) or you'll point the wrong way. You
+   can use this for meshes as well (then you do not have to reverse the vector), but keep 
+   in mind that if you do that, the model's front has to point in +z direction, and left 
+   and right should be -x or +x respectively or the mesh wont rotate correctly.
+*/
+Quaternion::Quaternion (const Vector& dir, const Vector& up)
+{
+  Vector z = dir;
+  z.normalize(); 
+  Vector x = up.cross(z);
+  x.normalize(); 
+  Vector y = z.cross(x);
+  
+  float m[4][4];
+  m[0][0] = x.x;
+  m[0][1] = x.y;
+  m[0][2] = x.z;
+  m[0][3] = 0;
+  m[1][0] = y.x;
+  m[1][1] = y.y;
+  m[1][2] = y.z;
+  m[1][3] = 0;
+  m[2][0] = z.x;
+  m[2][1] = z.y;
+  m[2][2] = z.z;
+  m[2][3] = 0;
+  m[3][0] = 0;
+  m[3][1] = 0;
+  m[3][2] = 0;
+  m[3][3] = 1;
+  
+  *this = Quaternion (m);
+}
+
+/**
+	\brief calculates a rotation from euler angles
+	\param roll: the roll in radians
+	\param pitch: the pitch in radians
+	\param yaw: the yaw in radians
+	
+	I DO HONESTLY NOT EXACTLY KNOW WHICH ANGLE REPRESENTS WHICH ROTATION. And I do not know 
+	in what order they are applied,	I just copy-pasted the code.
+*/
+Quaternion::Quaternion (float roll, float pitch, float yaw)
+{
+	float cr, cp, cy, sr, sp, sy, cpcy, spsy;
+	
+	// calculate trig identities
+	cr = cos(roll/2);
+	cp = cos(pitch/2);
+	cy = cos(yaw/2);
+	
+	sr = sin(roll/2);
+	sp = sin(pitch/2);
+	sy = sin(yaw/2);
+	
+	cpcy = cp * cy;
+	spsy = sp * sy;
+	
+	w = cr * cpcy + sr * spsy;
+	v.x = sr * cpcy - cr * spsy;
+	v.y = cr * sp * cy + sr * cp * sy;
+	v.z = cr * cp * sy - sr * sp * cy;
+}
+
+/**
+	\brief rotates one Quaternion by another
+	\param q: another Quaternion to rotate this by
+	\return a quaternion that represents the first one rotated by the second one (WARUNING: this operation is not commutative! e.g. (A*B) != (B*A))
+*/
+Quaternion Quaternion::operator*(const Quaternion& q) const
+{
+	float A, B, C, D, E, F, G, H;
+	Quaternion r;
+	
+	A = (w   + v.x)*(q.w   + q.v.x);
+	B = (v.z - v.y)*(q.v.y - q.v.z);
+	C = (w   - v.x)*(q.v.y + q.v.z); 
+	D = (v.y + v.z)*(q.w   - q.v.x);
+	E = (v.x + v.z)*(q.v.x + q.v.y);
+	F = (v.x - v.z)*(q.v.x - q.v.y);
+	G = (w   + v.y)*(q.w   - q.v.z);
+	H = (w   - v.y)*(q.w   + q.v.z);
+	
+	r.w = B +  (-E - F + G + H)/2;
+	r.v.x = A - (E + F + G + H)/2; 
+	r.v.y = C + (E - F + G - H)/2; 
+	r.v.z = D + (E - F - G + H)/2;
+	
+	return r;
+}
+
+/**
+	\brief add two Quaternions
+	\param q: another Quaternion
+	\return the sum of both Quaternions
+*/
+Quaternion Quaternion::operator+(const Quaternion& q) const
+{
+	Quaternion r(*this);
+	r.w = r.w + q.w;
+	r.v = r.v + q.v;
+	return r;
+}
+
+/**
+	\brief subtract two Quaternions
+	\param q: another Quaternion
+	\return the difference of both Quaternions
+*/
+Quaternion Quaternion::operator- (const Quaternion& q) const
+{
+	Quaternion r(*this);
+	r.w = r.w - q.w;
+	r.v = r.v - q.v;
+	return r;
+}
+
+/**
+	\brief rotate a Vector by a Quaternion
+	\param v: the Vector
+	\return a new Vector representing v rotated by the Quaternion
+*/
+Vector Quaternion::apply (Vector& v) const
+{
+	Quaternion q;
+	q.v = v;
+	q.w = 0;
+	q = *this * q * conjugate();
+	return q.v;
+}
+
+/**
+	\brief multiply a Quaternion with a real value
+	\param f: a real value
+	\return a new Quaternion containing the product
+*/
+Quaternion Quaternion::operator*(const float& f) const
+{
+	Quaternion r(*this);
+	r.w = r.w*f;
+	r.v = r.v*f;
+	return r;
+}
+
+/**
+	\brief divide a Quaternion by a real value
+	\param f: a real value
+	\return a new Quaternion containing the quotient
+*/
+Quaternion Quaternion::operator/(const float& f) const
+{
+	if( f == 0) return Quaternion();
+	Quaternion r(*this);
+	r.w = r.w/f;
+	r.v = r.v/f;
+	return r;
+}
+
+/**
+	\brief calculate the conjugate value of the Quaternion
+	\return the conjugate Quaternion
+*/
+Quaternion Quaternion::conjugate() const
+{
+	Quaternion r(*this);
+	r.v = Vector() - r.v;
+	return r;
+}
+
+/**
+	\brief calculate the norm of the Quaternion
+	\return the norm of The Quaternion
+*/
+float Quaternion::norm() const
+{
+	return w*w + v.x*v.x + v.y*v.y + v.z*v.z;
+}
+
+/**
+	\brief calculate the inverse value of the Quaternion
+	\return the inverse Quaternion
+	
+	Note that this is equal to conjugate() if the Quaternion's norm is 1
+*/
+Quaternion Quaternion::inverse() const
+{
+	float n = norm();
+	if (n != 0)
+	{
+		return conjugate() / norm();
+	}
+	else return Quaternion();
+}
+
+/**
+	\brief convert the Quaternion to a 4x4 rotational glMatrix
+	\param m: a buffer to store the Matrix in
+*/
+void Quaternion::matrix (float m[4][4]) const
+{
+  float wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2; 
+  
+  // calculate coefficients
+  x2 = v.x + v.x;
+  y2 = v.y + v.y; 
+  z2 = v.z + v.z;
+  xx = v.x * x2; xy = v.x * y2; xz = v.x * z2;
+  yy = v.y * y2; yz = v.y * z2; zz = v.z * z2;
+  wx = w * x2; wy = w * y2; wz = w * z2;
+  
+  m[0][0] = 1.0 - (yy + zz); m[1][0] = xy - wz;
+  m[2][0] = xz + wy; m[3][0] = 0.0;
+	
+  m[0][1] = xy + wz; m[1][1] = 1.0 - (xx + zz);
+  m[2][1] = yz - wx; m[3][1] = 0.0;
+  
+  m[0][2] = xz - wy; m[1][2] = yz + wx;
+  m[2][2] = 1.0 - (xx + yy); m[3][2] = 0.0;
+  
+  m[0][3] = 0; m[1][3] = 0;
+  m[2][3] = 0; m[3][3] = 1;
+}
+
+/**
+   \brief performs a smooth move.
+   \param from from where
+   \param to to where
+   \param t the time this transformation should take
+   \param res The approximation-density
+*/
+void Quaternion::quatSlerp(const Quaternion* from, const Quaternion* to, float t, Quaternion* res)
+{
+  float tol[4];
+  double omega, cosom, sinom, scale0, scale1;
+  DELTA = 0.2;
+
+  cosom = from->v.x * to->v.x + from->v.y * to->v.y + from->v.z * to->v.z + from->w * to->w;
+
+  if( cosom < 0.0 ) 
+    { 
+      cosom = -cosom; 
+      tol[0] = -to->v.x;
+      tol[1] = -to->v.y;
+      tol[2] = -to->v.z;
+      tol[3] = -to->w;
+    }
+  else
+    {
+      tol[0] = to->v.x;
+      tol[1] = to->v.y;
+      tol[2] = to->v.z;
+      tol[3] = to->w;
+    }
+  
+  //if( (1.0 - cosom) > DELTA )
+  //{
+      omega = acos(cosom);
+      sinom = sin(omega);
+      scale0 = sin((1.0 - t) * omega) / sinom;
+      scale1 = sin(t * omega) / sinom;
+      //}
+      /*
+  else
+    {
+      scale0 = 1.0 - t;
+      scale1 = t;
+    }
+      */
+  res->v.x = scale0 * from->v.x + scale1 * tol[0];
+  res->v.y = scale0 * from->v.y + scale1 * tol[1];
+  res->v.z = scale0 * from->v.z + scale1 * tol[2];
+  res->w = scale0 * from->w + scale1 * tol[3];
+}
+
+
+/**
+   \brief convert a rotational 4x4 glMatrix into a Quaternion
+   \param m: a 4x4 matrix in glMatrix order
+*/
+Quaternion::Quaternion (float m[4][4])
+{
+	
+  float  tr, s, q[4];
+  int    i, j, k;
+
+  int nxt[3] = {1, 2, 0};
+
+  tr = m[0][0] + m[1][1] + m[2][2];
+
+  	// check the diagonal
+  if (tr > 0.0) 
+  {
+    s = sqrt (tr + 1.0);
+    w = s / 2.0;
+    s = 0.5 / s;
+    v.x = (m[1][2] - m[2][1]) * s;
+    v.y = (m[2][0] - m[0][2]) * s;
+    v.z = (m[0][1] - m[1][0]) * s;
+	} 
+	else 
+	{
+ 		// diagonal is negative
+  	i = 0;
+  	if (m[1][1] > m[0][0]) i = 1;
+    if (m[2][2] > m[i][i]) i = 2;
+    j = nxt[i];
+    k = nxt[j];
+
+    s = sqrt ((m[i][i] - (m[j][j] + m[k][k])) + 1.0);
+      
+    q[i] = s * 0.5;
+            
+    if (s != 0.0) s = 0.5 / s;
+	
+	  q[3] = (m[j][k] - m[k][j]) * s;
+    q[j] = (m[i][j] + m[j][i]) * s;
+    q[k] = (m[i][k] + m[k][i]) * s;
+
+  	v.x = q[0];
+  	v.y = q[1];
+  	v.z = q[2];
+  	w = q[3];
+  }
+}
+
+/**
+   \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);
+}
+
+
+
+#endif /* _QUATERNION_H */
Index: orxonox/branches/levelloader/src/lib/math/vector.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/math/vector.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/math/vector.cc	(revision 3746)
@@ -65,5 +65,5 @@
 float Vector::operator* (const Vector& v) const
 {
-  return x*v.x+y*v.y+z*v.z;
+  return x * v.x + y * v.y+ z * v.z;
 }
 
Index: orxonox/branches/levelloader/src/lib/math/vector_new.h
===================================================================
--- orxonox/branches/levelloader/src/lib/math/vector_new.h	(revision 3746)
+++ orxonox/branches/levelloader/src/lib/math/vector_new.h	(revision 3746)
@@ -0,0 +1,265 @@
+/*! 
+    \file vector.h
+    \brief A basic 3D math framework
+    
+    Contains classes to handle vectors, lines, rotations and planes
+*/ 
+
+#ifndef _VECTOR_H
+#define _VECTOR_H
+
+#include <math.h>
+//! PI the circle-constant
+#define PI 3.14159265359f  /* this is not nice... make a math_def file or something */ 
+
+//! 3D Vector
+/**
+	Class to handle 3D Vectors
+*/
+class Vector {
+
+  public:
+ 
+  float x; //!< The x Coordinate of the Vector.
+  float y; //!< The y Coordinate of the Vector.
+  float z; //!< The z Coordinate of the Vector.
+
+  Vector (float x, float y, float z) : x(x), y(y), z(z) {}  //!< assignment constructor
+  Vector () : x(0), y(0), z(0) {}
+  ~Vector () {}
+
+  Vector operator+ (const Vector& v) const;
+  Vector operator- (const Vector& v) const;
+  float operator* (const Vector& v) const;
+  Vector operator* (float f) const;
+  Vector operator/ (float f) const;
+  inline float dot (const Vector& v) const;
+  Vector cross (const Vector& v) const;
+  void scale(const Vector& v);
+  float len() const;
+  void normalize();
+  Vector* getNormalized();
+  Vector abs();
+
+  void debug();
+};
+
+//float angleDeg (const Vector& v1, const Vector& v2);
+//float angleRad (const Vector& v1, const Vector& v2);
+
+
+/**
+   \brief add two vectors
+   \param v: the other vector
+   \return the sum of both vectors
+*/
+Vector Vector::operator+ (const Vector& v) const
+{
+  Vector r;
+
+  r.x = x + v.x;
+  r.y = y + v.y;
+  r.z = z + v.z;
+  
+  return r;
+}
+
+/**
+   \brief subtract a vector from another
+   \param v: the other vector
+   \return the difference between the vectors
+*/
+Vector Vector::operator- (const Vector& v) const
+{
+  Vector r;
+  
+  r.x = x - v.x;
+  r.y = y - v.y;
+  r.z = z - v.z;
+  
+  return r;
+}
+
+/**
+   \brief calculate the dot product of two vectors
+   \param v: the other vector
+   \return the dot product of the vectors
+*/
+float Vector::operator* (const Vector& v) const
+{
+  return x * v.x + y * v.y + z * v.z;
+}
+
+/**
+   \brief multiply a vector with a float
+   \param f: the factor
+   \return the vector multipied by f
+*/
+Vector Vector::operator* (float f) const
+{  
+  Vector r;
+  
+  r.x = x * f;
+  r.y = y * f;
+  r.z = z * f;
+  
+  return r;
+}
+
+/**
+   \brief divide a vector with a float
+   \param f: the divisor
+   \return the vector divided by f   
+*/
+Vector Vector::operator/ (float f) const
+{
+  Vector r;
+  
+  if( f == 0.0)
+  {
+    // Prevent divide by zero
+    return Vector (0,0,0);
+  }
+  
+  r.x = x / f;
+  r.y = y / f;
+  r.z = z / f;
+  
+  return r;
+}
+
+/**
+   \brief calculate the dot product of two vectors
+   \param v: the other vector
+   \return the dot product of the vectors
+*/
+inline float Vector::dot (const Vector& v) const
+{
+  return x*v.x+y*v.y+z*v.z;
+}
+
+/**
+  \brief calculate the cross product of two vectors
+  \param v: the other vector
+	\return the cross product of the vectors
+*/
+Vector Vector::cross (const Vector& v) const
+{
+  Vector r;
+  
+  r.x = y * v.z - z * v.y;
+  r.y = z * v.x - x * v.z;
+  r.z = x * v.y - y * v.x;
+  
+  return r;
+}
+  
+/**
+   \brief normalizes the vector to lenght 1.0
+*/
+void Vector::normalize ()
+{
+  float l = len();
+  
+  if( l == 0.0)
+  {
+    // Prevent divide by zero
+    return;
+  }
+  
+  x = x / l;
+  y = y / l;
+  z = z / l;
+}
+
+
+/**
+   \brief returns the voctor normalized to length 1.0
+*/
+
+Vector* Vector::getNormalized()
+{
+  float l = len();
+  if(l != 1.0)
+    {
+      return this;
+    }
+  else if(l == 0.0)
+    {
+      return 0;
+    }
+  
+  Vector *normalizedVector = new Vector(x / l, y /l, z / l);
+  return normalizedVector;
+}
+
+/**
+   \brief scales this Vector with Vector v.
+   \param v the vector to scale this vector with
+*/
+void Vector::scale(const Vector& v)
+{
+  x *= v.x;
+  y *= v.y;
+  z *= v.z;
+}
+
+ 
+/**
+   \brief calculates the lenght of the vector
+   \return the lenght of the vector
+*/
+float Vector::len () const
+{
+  return sqrt (x*x+y*y+z*z);
+}
+
+
+/**
+   \brief Vector is looking in the positive direction on all axes after this
+*/
+Vector Vector::abs() 
+{
+  Vector v(fabs(x), fabs(y), fabs(z));
+  return v;
+}
+
+/**
+   \brief calculate the angle between two vectors in radiances
+   \param v1: a vector
+   \param v2: another vector
+   \return the angle between the vectors in radians
+*/
+float angleRad (const Vector& v1, const Vector& v2)
+{
+  return acos( v1 * v2 / (v1.len() * v2.len()));
+}
+
+
+/**
+   \brief calculate the angle between two vectors in degrees
+   \param v1: a vector
+   \param v2: another vector
+   \return the angle between the vectors in degrees
+*/
+float angleDeg (const Vector& v1, const Vector& v2)
+{
+  float f;
+  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");
+}
+
+
+#endif /* _VECTOR_H */
Index: orxonox/branches/levelloader/src/lib/util/list.h
===================================================================
--- orxonox/branches/levelloader/src/lib/util/list.h	(revision 3606)
+++ orxonox/branches/levelloader/src/lib/util/list.h	(revision 3746)
@@ -46,35 +46,60 @@
 };
 
-class Iterator
-{
-
+
+
+template<class T> struct listElement
+{
+  listElement* prev;
+  T* curr;
+  listElement* next;
+};
+
+template<class T> class tIterator
+{
  public:
-  bool hasNext();
-  WorldEntity* next();
+  tIterator(listElement<T>* startElement);
+  ~tIterator();
+  
+  T* nextElement();
 
  private:
-
-};
+  listElement<T>* currentEl;
+  listElement<T>* tmpEl;
+};
+
+
+template<class T>
+inline tIterator<T>::tIterator (listElement<T>* startElement) 
+{
+  this->currentEl = startElement;
+  this->tmpEl = NULL;
+}
+
+
+template<class T>
+tIterator<T>::~tIterator ()
+{
+  this->currentEl = NULL;
+}
+
+
+template<class T>
+inline T* tIterator<T>::nextElement ()
+{
+  if( this->currentEl == NULL)
+    return NULL;
+
+  this->tmpEl = this->currentEl;
+  this->currentEl = this->currentEl->next;
+  return this->tmpEl->curr;
+}
+
 
 
 template<class T> class tList 
 {
- private:
-  struct listElement
-  {
-    listElement* prev;
-    T* curr;
-    listElement* next;
-  };
-
-  Uint32 size;
-  listElement* first;
-  listElement* last;
-  listElement* currentEl;
-  
  public:
   tList ();
   ~tList ();
-  
 
   void add(T* entity);
@@ -85,8 +110,15 @@
   int getSize();
   T* enumerate();
+  tIterator<T>* getIterator();
   T* nextElement();
   T* nextElement(T* toEntity);
   T* toArray();
   void debug();
+
+ private:
+  Uint32 size;
+  listElement<T>* first;
+  listElement<T>* last;
+  listElement<T>* currentEl;
 };
 
@@ -106,5 +138,5 @@
   while(this->currentEl != NULL)
     {
-      listElement* le = this->currentEl->next;
+      listElement<T>* le = this->currentEl->next;
       //delete this->currentEl->curr;
       delete this->currentEl;
@@ -118,8 +150,8 @@
 
 template<class T>
-void tList<T>::add(T* entity)
+inline void tList<T>::add(T* entity)
 {
   if( entity == NULL) return;
-  listElement* el = new listElement;
+  listElement<T>* el = new listElement<T>;
   el->prev = this->last;
   el->curr = entity;
@@ -135,9 +167,9 @@
 
 template<class T>
-void tList<T>::remove(T* entity)
+inline void tList<T>::remove(T* entity)
 {
   if( entity == NULL) return;
   this->currentEl = this->first;
-  listElement* te;
+  listElement<T>* te;
   while( this->currentEl != NULL)
     {
@@ -150,7 +182,8 @@
 	  else this->currentEl->next->prev = this->currentEl->prev;
 
-	  te = this->currentEl->next;  // for what am i doing this?
+	  //te = this->currentEl->next;  // for what am i doing this?
 	  delete this->currentEl;
-	  this->currentEl = te;
+	  //this->currentEl = te;
+	  this->currentEl = NULL;
 	  this->size--;
 	  return;
@@ -167,5 +200,5 @@
   while(this->currentEl != NULL)
     {
-      listElement* le = this->currentEl->next;
+      listElement<T>* le = this->currentEl->next;
       //delete this->currentEl->curr;
       delete this->currentEl;
@@ -203,5 +236,5 @@
 {
   //if( this->last == this->first == NULL) return NULL;
-  if(this->size == 0) return NULL;
+  if( this->size == 0) return NULL;
   this->currentEl = this->first;
   return this->currentEl->curr;
@@ -210,10 +243,18 @@
 
 template<class T>
+inline tIterator<T>* tList<T>::getIterator()
+{
+  tIterator<T>* iterator = new tIterator<T>(this->first);
+  return iterator;
+}
+
+
+template<class T>
 T* tList<T>::nextElement()
 {
   // if( this->last == this->first == NULL) return NULL;
-  if(this->size == 0) return NULL;
+  if( this->size == 0) return NULL;
   this->currentEl = this->currentEl->next;
-  if(this->currentEl == NULL) return NULL;
+  if( this->currentEl == NULL) return NULL;
   return this->currentEl->curr;
 }
Index: orxonox/branches/levelloader/src/lib/util/resource_manager.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/util/resource_manager.cc	(revision 3746)
+++ orxonox/branches/levelloader/src/lib/util/resource_manager.cc	(revision 3746)
@@ -0,0 +1,499 @@
+/* 
+   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: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
+
+#include "resource_manager.h"
+
+// different resource Types
+#include "objModel.h"
+#include "primitive_model.h"
+#include "texture.h"
+
+#include "list.h"
+
+// File Handling Includes
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+using namespace std;
+
+/**
+   \brief standard constructor
+*/
+ResourceManager::ResourceManager () 
+{
+   this->setClassName ("ResourceManager");
+   this->dataDir = "./";
+   this->imageDirs = new tList<char>();
+   this->resourceList = new tList<Resource>();
+}
+
+/**
+   \returns the Instance to this ResourceManager
+*/
+ResourceManager* ResourceManager::getInstance(void)
+{
+  if (!ResourceManager::singletonRef)
+    ResourceManager::singletonRef = new ResourceManager();
+  return ResourceManager::singletonRef;
+}
+
+//! Singleton Reference to the ResourceManager
+ResourceManager* ResourceManager::singletonRef = NULL;
+
+/**
+   \brief standard destructor
+*/
+ResourceManager::~ResourceManager (void) 
+{
+  // deleting the Resources-List
+  this->unloadAllByPriority(RP_GAME);
+  delete this->resourceList;
+  // deleting the Directorie Lists
+  tIterator<char>* tmpIt = imageDirs->getIterator();
+  char* tmpDir = tmpIt->nextElement();
+  while(tmpDir)
+    {
+      delete []tmpDir;
+      tmpDir = tmpIt->nextElement();
+    }
+  delete tmpIt;
+
+  delete this->imageDirs;
+
+  ResourceManager::singletonRef = NULL;
+}
+
+/**
+   \brief sets the data main directory
+   \param dataDir the DataDirectory.
+*/
+bool ResourceManager::setDataDir(char* dataDir)
+{
+  if (isDir(dataDir))
+    {
+      this->dataDir = new char[strlen(dataDir)+1];
+      strcpy(this->dataDir, dataDir);
+    }
+  else
+    {
+      PRINTF(1)("%s is not a Directory, and can not be the Data Directory\n", dataDir);
+    }
+}
+
+/**
+   \brief adds a new Path for Images
+   \param imageDir The path to insert
+   \returns true, if the Path was well and injected (or already existent within the list)
+   false otherwise
+*/
+bool ResourceManager::addImageDir(char* imageDir)
+{
+  // check if the param is a Directory
+  if (isDir(imageDir))
+    {
+      // check if the Directory has been added before
+      tIterator<char>* tmpImageDirs = imageDirs->getIterator();
+      char* tmpDir = tmpImageDirs->nextElement();
+      while(tmpDir)
+	{
+	  if (!strcmp(tmpDir, imageDir))
+	    {
+	      PRINTF(4)("Path %s already loaded\n", imageDir);
+	      delete tmpImageDirs;
+	      return true;
+	    }
+	  tmpDir = tmpImageDirs->nextElement();
+	}
+      delete tmpImageDirs;
+
+      // adding the directory to the List
+      tmpDir  = new char[strlen(imageDir)+1];
+      strcpy(tmpDir, imageDir);
+      this->imageDirs->add(tmpDir);
+      return true;
+    }
+  else
+    {
+      PRINTF(1)("%s is not a Directory, and can not be added to the Paths of Images\n", dataDir);
+      return false;
+    }
+}
+
+/**
+   \brief loads resources
+   \param fileName The fileName of the resource to load
+   \param prio The ResourcePriority of this resource (will only be increased)
+   \returns a pointer to a desired Resource.
+*/
+void* ResourceManager::load(const char* fileName, ResourcePriority prio)
+{
+  ResourceType tmpType;
+  if (!strncmp(fileName+(strlen(fileName)-4), ".obj", 4))
+    tmpType = OBJ;
+  else if (!strncmp(fileName+(strlen(fileName)-4), ".wav", 4))
+    tmpType = WAV;
+  else if (!strncmp(fileName+(strlen(fileName)-4), ".mp3", 4))
+    tmpType = MP3;
+  else if (!strncmp(fileName+(strlen(fileName)-4), ".ogg", 4))
+    tmpType = OGG;
+  else if (!strcmp(fileName, "cube") ||
+           !strcmp(fileName, "sphere") ||
+	   !strcmp(fileName, "plane") ||
+           !strcmp(fileName, "cylinder") ||
+           !strcmp(fileName, "cone"))
+    tmpType = PRIM;
+  else 
+    tmpType = IMAGE;
+
+  return this->load(fileName, tmpType, prio);
+}
+
+/**
+   \brief loads resources
+   \param fileName The fileName of the resource to load
+   \param type The Type of Resource to load (\see ResourceType)
+   \param prio The ResourcePriority of this resource (will only be increased)
+   \returns a pointer to a desired Resource.
+*/
+void* ResourceManager::load(const char* fileName, ResourceType type, ResourcePriority prio)
+{
+  // searching if the resource was loaded before.
+  Resource* tmpResource = this->locateResourceByName(fileName);
+  if (tmpResource) // if the resource was not loaded before.
+    {
+      PRINTF(4)("not loading cached resource %s\n", tmpResource->name);
+      tmpResource->count++;
+      if(tmpResource->prio < prio)
+	tmpResource->prio = prio;
+    }
+  else
+    {
+      char* tmpDir;
+      // Setting up the new Resource
+      tmpResource = new Resource;
+      tmpResource->count = 1;
+      tmpResource->type = type;
+      tmpResource->prio = prio;
+      tmpResource->name = new char[strlen(fileName)+1];
+      strcpy(tmpResource->name, fileName);
+
+      // creating the full name. (directoryName + FileName)
+      char* fullName = new char[strlen(dataDir)+strlen(fileName)+1];
+      sprintf(fullName, "%s%s", this->dataDir, fileName);
+      
+      // Checking for the type of resource \see ResourceType
+      switch(type)
+	{
+	case OBJ:
+	  if(isFile(fullName))
+	    tmpResource->pointer = new OBJModel(fullName);
+	  else
+	    {
+	      PRINTF(2)("Sorry, %s does not exist. Loading a cube-Model instead\n", fullName);
+	      tmpResource->pointer = ResourceManager::load("cube", PRIM);
+	    }
+	  break;
+	case PRIM:
+	  if (!strcmp(tmpResource->name, "cube"))
+	    tmpResource->pointer = new PrimitiveModel(CUBE);
+	  else if (!strcmp(tmpResource->name, "sphere"))
+	    tmpResource->pointer = new PrimitiveModel(SPHERE);
+	  else if (!strcmp(tmpResource->name, "plane"))
+	    tmpResource->pointer = new PrimitiveModel(PLANE);
+	  else if (!strcmp(tmpResource->name, "cylinder"))
+	    tmpResource->pointer = new PrimitiveModel(CYLINDER);
+	  else if (!strcmp(tmpResource->name, "cone"))
+	    tmpResource->pointer = new PrimitiveModel(CONE);
+	  break;
+	case IMAGE:
+	  if(isFile(fullName))
+	    {
+	      PRINTF(4)("Image %s resides to %s\n", fileName, fullName);
+	      tmpResource->pointer = new Texture(fullName);
+	    }
+	  else
+	    {
+	      tIterator<char>* iterator = imageDirs->getIterator();
+	      tmpDir = iterator->nextElement();
+	      //tmpDir = imageDirs->enumerate();
+	      while(tmpDir)
+		{
+		  char* imgName = new char[strlen(tmpDir)+strlen(fileName)+1];
+		  sprintf(imgName, "%s%s", tmpDir, fileName);
+		  if(isFile(imgName))
+		    {
+		      PRINTF(4)("Image %s resides to %s\n", fileName, imgName);
+		      tmpResource->pointer = new Texture(imgName);
+		      delete []imgName;
+		      break;
+		    }
+		  delete []imgName;
+		  tmpDir = iterator->nextElement();
+		}
+	      delete iterator;
+	    }
+	  if(!tmpResource)
+	     PRINTF(2)("!!Image %s not Found!!\n", fileName);
+	  break;
+	default:
+	  tmpResource->pointer = NULL;
+	  PRINTF(1)("No type found for %s.\n   !!This should not happen unless the Type is not supported yet.!!\n", tmpResource->name);
+	  break;
+	}
+      this->resourceList->add(tmpResource);
+      delete []fullName;
+    }
+
+  return tmpResource->pointer;
+}
+
+/**
+   \brief unloads a Resource
+   \param pointer The pointer to free
+   \returns true if successful (pointer found, and deleted), false otherwise
+   
+*/
+bool ResourceManager::unload(void* pointer, ResourcePriority prio)
+{
+  // if pointer is existent. and only one resource of this type exists.
+  Resource* tmpResource = this->locateResourceByPointer(pointer);
+  if (!tmpResource)
+    {
+      PRINTF(2)("Resource not Found %p\n", pointer);
+      return false;
+    }
+  else
+    unload(tmpResource, prio);
+}
+
+bool ResourceManager::unload(Resource* resource, ResourcePriority prio)
+{
+  if (resource->count > 0)
+    resource->count--;
+  if (resource->prio <= prio)
+    {
+      if (resource->count <= 0)
+	{
+	  // deleting the Resource
+	  switch(resource->type)
+	    {
+	    case OBJ:
+	    case PRIM:
+	      delete (Model*)resource->pointer;
+	      break;
+	    case IMAGE:
+	      delete (Texture*)resource->pointer;
+	      break;
+	    default:
+	      PRINTF(1)("NOT YET IMPLEMENTED !!FIX FIX!!\n");
+	      return false;
+	      break;
+	    }
+	  // deleting the List Entry:
+	  PRINTF(4)("Resource %s safely removed.\n", resource->name);
+	  delete []resource->name;
+	  this->resourceList->remove(resource);
+	}
+      else
+	PRINTF(4)("Resource %s not removed, because there are still %d References to it.\n", resource->name, resource->count);
+    }
+  else
+    PRINTF(4)("not deleting resource %s because DeleteLevel to high\n", resource->name);
+  return true;
+}
+
+
+/**
+   \brief unloads all alocated Memory of Resources with a pririty lower than prio
+   \param prio The priority to delete
+*/
+bool ResourceManager::unloadAllByPriority(ResourcePriority prio)
+{
+  tIterator<Resource>* iterator = resourceList->getIterator();
+  Resource* enumRes = iterator->nextElement();
+  while (enumRes)
+    {
+      if (enumRes->prio <= prio)
+	if (enumRes->count == 0)
+	  unload(enumRes, prio);
+	else
+	  PRINTF(2)("unable to unload %s because there are still %d references to it\n",
+		   enumRes->name, enumRes->count);
+      //enumRes = resourceList->nextElement();
+      enumRes = iterator->nextElement();
+    }
+  delete iterator;
+}
+
+/**
+   \brief Searches for a Resource by Name
+   \param fileName The name to look for
+   \returns a Pointer to the Resource if found, NULL otherwise.
+*/
+Resource* ResourceManager::locateResourceByName(const char* fileName)
+{
+  //  Resource* enumRes = resourceList->enumerate();
+  tIterator<Resource>* iterator = resourceList->getIterator();
+  Resource* enumRes = iterator->nextElement();
+  while (enumRes)
+    {
+      if (!strcmp(fileName, enumRes->name))
+	{
+	  delete iterator;
+	  return enumRes;
+	}
+      enumRes = iterator->nextElement();
+    }
+  delete iterator;
+  return NULL;
+}
+
+/**
+   \brief Searches for a Resource by Pointer
+   \param pointer the Pointer to search for
+   \returns a Pointer to the Resource if found, NULL otherwise.
+*/
+Resource* ResourceManager::locateResourceByPointer(const void* pointer)
+{
+  //  Resource* enumRes = resourceList->enumerate();
+  tIterator<Resource>* iterator = resourceList->getIterator();
+  Resource* enumRes = iterator->nextElement();
+  while (enumRes)
+    {
+      if (pointer == enumRes->pointer)
+	{
+	  delete iterator;
+	  return enumRes;
+	}
+      enumRes = iterator->nextElement();
+    }
+  delete iterator;
+  return NULL;
+}
+
+/**
+   \brief Checks if it is a Directory
+   \param directoryName the Directory to check for
+   \returns true if it is a directory/symlink false otherwise
+   \todo implement for win32 usage too
+   \bug does return false by default on win32
+*/
+bool ResourceManager::isDir(const char* directoryName)
+{
+	#ifdef __WIN32__
+		return false;
+	#elif
+  struct stat status;
+  stat(directoryName, &status);
+  if (status.st_mode & (S_IFDIR | S_IFLNK))
+    return true;
+  else
+    return false;
+  #endif
+}
+
+/**
+   \brief Checks if the file is either a Regular file or a Symlink
+   \param fileName the File to check for
+   \returns true if it is a regular file/symlink, false otherwise
+   \todo implement fo win32 usage too
+   \bug does return false by default on win32
+*/
+bool ResourceManager::isFile(const char* fileName)
+{
+	#ifdef __WIN32__
+		return false;
+	#elif
+  struct stat status;
+  stat(fileName, &status);
+  if (status.st_mode & (S_IFREG | S_IFLNK))
+    return true;
+  else
+    return false;
+  #endif
+}
+
+/**
+   \brief outputs debug information about the ResourceManager
+*/
+void ResourceManager::debug(void)
+{
+  PRINT(0)("=RM===================================\n");
+  PRINT(0)("= RESOURCE-MANAGER DEBUG INFORMATION =\n");
+  PRINT(0)("======================================\n");
+  // if it is not initialized
+  PRINT(0)(" Reference is: %p\n", ResourceManager::singletonRef);
+  PRINT(0)(" Data-Directory is: %s\n", this->dataDir);
+  PRINT(0)(" List of Image-Directories: ");
+  tIterator<char>* tmpIt = imageDirs->getIterator();
+  char* tmpDir = tmpIt->nextElement();
+  while(tmpDir)
+    {
+      PRINT(0)("%s ",tmpDir);
+      tmpDir = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  PRINT(0)("\n");
+
+  PRINT(0)("List of all stored Resources:\n");
+  tIterator<Resource>* iterator = resourceList->getIterator();
+  Resource* enumRes = iterator->nextElement();
+  while (enumRes)
+    {
+      PRINT(0)("-----------------------------------------\n");
+      PRINT(0)("Name: %s; References: %d; Type:", enumRes->name, enumRes->count);
+      switch (enumRes->type)
+	{
+	case OBJ:
+	  PRINT(0)("ObjectModel\n");
+	  break;
+	case PRIM:
+	  PRINT(0)("PrimitiveModel\n");
+	  break;
+	case IMAGE:
+	  PRINT(0)("ImageFile (Texture)\n");
+	  break;
+	default:
+	  PRINT(0)("SoundFile\n");
+	  break;
+	}
+      PRINT(0)("gets deleted at ");
+      switch(enumRes->prio)
+	{
+	default:
+	case RP_NO:
+	  PRINT(0)("first posibility (0)\n");
+	  break;
+	case RP_LEVEL:
+	  PRINT(0)("the end of the Level (1)\n");
+	  break;
+	case RP_CAMPAIGN:
+	  PRINT(0)("the end of the campaign (2)\n");
+	  break;
+	case RP_GAME:
+	  PRINT(0)("when leaving the game (3)\n");
+	  break;
+	}
+      enumRes = iterator->nextElement();
+    }
+  delete iterator;
+
+
+
+  PRINT(0)("==================================RM==\n");
+}
Index: orxonox/branches/levelloader/src/lib/util/resource_manager.h
===================================================================
--- orxonox/branches/levelloader/src/lib/util/resource_manager.h	(revision 3746)
+++ orxonox/branches/levelloader/src/lib/util/resource_manager.h	(revision 3746)
@@ -0,0 +1,84 @@
+/*! 
+    \file resource_manager.h
+    \brief The Resource Manager checks if a file/resource is loaded.
+
+    If a file/resource was already loaded the resourceManager will 
+    return a void pointer to the desired resource.
+    Otherwise it will instruct the coresponding resource-loader to load,
+    and receive a pointer to it.
+*/
+
+#ifndef _RESOURCE_MANAGER_H
+#define _RESOURCE_MANAGER_H
+
+#include "base_object.h"
+
+// FORWARD DEFINITION \\
+//template<class T> class tList;
+#include "list.h"                //! \todo do this by forward definition (ask Patrick)
+
+//! An eumerator for different fileTypes the resourceManager supports \todo WAV, MP3, OGG support
+enum ResourceType {OBJ, PRIM, WAV, MP3, OGG, IMAGE};
+//! An enumerator for different UNLOAD-types. 
+/**
+   RP_NO: will be unloaded on request
+   RP_LEVEL: will be unloaded at the end of a Level
+   RP_CAMPAIGN: will be unloaded at the end of a Campaign
+   RP_GAME: will be unloaded at the end of the whole Game (when closing orxonox)
+*/
+enum ResourcePriority {RP_NO = 0, RP_LEVEL = 1, RP_CAMPAIGN = 2, RP_GAME = 3};
+
+//! A Struct that keeps track about A resource its name its Type, and so on
+struct Resource
+{
+  void* pointer;             //!< Pointer to the Resource.
+  
+  char* name;                //!< Name of the Resource.
+  ResourceType type;         //!< ResourceType of this Resource.
+  ResourcePriority prio;     //!< The Priority of this resource. (This will only be increased)
+  int count;                 //!< How many times this Resource has been loaded.
+};
+
+
+//! The ResourceManager is a class, that decides if a file/resource should be loaded
+/**
+   If a file/resource was already loaded the resourceManager will 
+   return a void pointer to the desired resource.
+   Otherwise it will instruct the corresponding resource-loader to load,
+   and receive the pointer to it.
+
+   It does it by looking, if a desired file has already been loaded.
+*/
+class ResourceManager : public BaseObject 
+{
+ public:
+  static ResourceManager* getInstance();
+  virtual ~ResourceManager();
+
+  bool setDataDir(char* dataDir);
+  bool addImageDir(char* imageDir);
+  void* load(const char* fileName, ResourcePriority prio = RP_NO);
+  void* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO);
+  bool unload(void* pointer, ResourcePriority prio = RP_NO);
+  bool unload(Resource* resource, ResourcePriority = RP_NO);
+  bool unloadAllByPriority(ResourcePriority prio);
+  void debug(void);
+
+ private:
+  ResourceManager();
+  static ResourceManager* singletonRef;
+
+  tList<Resource>* resourceList;       //!< The List of Resources, that has already been loaded.
+  char* dataDir;                       //!< The Data Directory, where all relevant Data is stored.
+  tList<char>* imageDirs;              //!< A list of directories in which images are stored.
+
+
+  Resource* locateResourceByName(const char* fileName);
+  Resource* locateResourceByPointer(const void* pointer);
+  
+  bool isDir(const char* directory);
+  bool isFile(const char* directory);
+
+};
+
+#endif /* _RESOURCE_MANAGER_H */
Index: orxonox/branches/levelloader/src/message_structures.h
===================================================================
--- orxonox/branches/levelloader/src/message_structures.h	(revision 3606)
+++ orxonox/branches/levelloader/src/message_structures.h	(revision 3746)
@@ -6,4 +6,6 @@
 #ifndef _MESSAGE_STRUCTURES_H
 #define _MESSAGE_STRUCTURES_H
+
+#include "stdincl.h"
 
 #define CMD_LENGHT 16
Index: orxonox/branches/levelloader/src/orxonox.cc
===================================================================
--- orxonox/branches/levelloader/src/orxonox.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/orxonox.cc	(revision 3746)
@@ -22,14 +22,19 @@
    main-programmer: Patrick Boenzli
    co-programmer: Christian Meyer
+   co-programmer: Benjamin Grauer: injected ResourceManager/GraphicsEngine
 */
 
 #include "orxonox.h"
+
 #include "world.h"
-#include "camera.h"
 #include "data_tank.h"
 #include "command_node.h"
 #include "game_loader.h"
+#include "graphics_engine.h"
+#include "resource_manager.h"
+#include "debug.h"
+
 #include <string.h>
-int verbose = 4;
+int verbose = 3;
 
 using namespace std;
@@ -51,6 +56,7 @@
   if( world != NULL) delete world;
   if( localinput != NULL) delete world;
-  if( localcamera != NULL) delete localcamera;
   if( resources != NULL) delete resources;
+  delete GraphicsEngine::getInstance(); // deleting the Graphics
+  delete ResourceManager::getInstance(); // deletes the Resource Manager
 }
 
@@ -110,66 +116,8 @@
 int Orxonox::initVideo() 
 {
-  printf("> Initializing video\n");
-  if (SDL_Init(SDL_INIT_VIDEO) == -1)
-    {
-      printf ("could not initialize SDL Video\n");
-      return -1;
-    }
-  // Set video mode
-  // TO DO: parse arguments for settings
-  //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
-  //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
-  //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
-  //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
-  
-
-  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
-  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);    
-  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0);  
-  SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
-  SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
-  SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
-  SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
-
-
-
-  int bpp = 16;
-  int width = 640;
-  int height = 480;
-  //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/
-  //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;
-
-  Uint32 videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE;
-
-  /* query SDL for information about our video hardware */
-  const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
-  
-  if( videoInfo == NULL)
-    {
-      printf ("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError()); 
-      SDL_Quit ();
-    }
-  if( videoInfo->hw_available)
-    videoFlags |= SDL_HWSURFACE;
-  else 
-    videoFlags |= SDL_SWSURFACE;
-  /*
-  if(VideoInfo -> blit_hw)                            
-    VideoFlags |= SDL_HWACCEL;
-  */
-  
-  if((this->screen = SDL_SetVideoMode (width, height, bpp, videoFlags)) == NULL)
-  {
-    printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, videoFlags, SDL_GetError());
-    SDL_Quit();
-    return -1;
-  }
-  
-  // Set window labeling
-  SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
-  
-  // TO DO: Create a cool icon and use it here
-  // SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);  
-
+  PRINTF(3)("> Initializing video\n");
+  
+  GraphicsEngine::getInstance();
+  
   return 0;
 }
@@ -215,5 +163,8 @@
 int Orxonox::initResources() 
 {
-  printf("Not yet implemented\n");
+  //  printf("Not yet implemented\n");
+  PRINT(3)("initializing ResourceManager\n");
+  resourceManager = ResourceManager::getInstance();
+  resourceManager->setDataDir("../data/");
   return 0;
 }
@@ -270,4 +221,11 @@
 {
   // Handle special events such as reshape, quit, focus changes
+  switch (event->type)
+    {
+    case SDL_VIDEORESIZE:
+      GraphicsEngine* tmpGEngine = GraphicsEngine::getInstance();
+      tmpGEngine->resolutionChanged(&event->resize);
+      break;
+    }
 }
  
@@ -291,15 +249,4 @@
 }
 
-
-/**
-   \brief retrieve a pointer to the local Camera
-   \return a pointer to localcamera
-*/
-Camera* Orxonox::getCamera()
-{
-  return localcamera;
-}
-
-
 /**
    \brief retrieve a pointer to the local CommandNode
@@ -329,4 +276,6 @@
 }
 
+
+
 /**
    \brief main function
@@ -336,4 +285,41 @@
 int main(int argc, char** argv) 
 {  
+  
+  /* reading arguments 
+     
+     currently supported arguments are:
+     <no args>                   ::    just starts orxonox
+     --benchmark                 ::    start the benchmark without starting orxonox
+     
+     this is a preselection: it matches to one of the start* functions, the
+     finetuning is made in those functions.
+  */
+
+
+  int i;
+  for(i = 0; i < argc; ++i)
+    {
+      if(! strcmp( "--help", argv[i])) return startHelp();
+      else if(! strcmp( "--benchmark", argv[i])) return startBenchmarks();
+    }
+
+  PRINTF(2)("Orxonox does not understand the arguments");
+  return startOrxonox(argc, argv);
+}
+
+
+
+int startHelp()
+{
+  printf("orxonox: starts the orxonox game - rules\n");
+  printf("usage: orxonox [arg]\n\n");
+  printf("valid options:\n");
+  printf(" --benchmark\tstarts the orxonox benchmark\n");
+  printf(" --help \tshows this menu\n");
+}
+
+
+int startOrxonox(int argc, char** argv)
+{
   printf(">>> Starting Orxonox <<<\n");
   Orxonox *orx = Orxonox::getInstance();
@@ -347,6 +333,442 @@
   orx->start();
   
-  //delete orx;
-  
-  return 0;
-}
+  delete orx;
+  
+}
+
+
+#include "list.h"
+#include "world_entity.h"
+#include "vector.h"
+#include "player.h"
+#include "base_object.h"
+
+#ifdef __WIN32__
+#elif
+#include <asm/msr.h>
+#include <linux/timex.h>
+#endif
+
+
+#define LIST_MAX 1000
+#define VECTOR_MAX 1000000
+#define ITERATIONS 10000
+
+
+int startBenchmarks()
+{
+	#ifndef __WIN32__
+  printf("===========================================================\n");
+  printf("=                      BENCHMARKS                         =\n");
+  printf("===========================================================\n");
+  printf(" the author is not paying any attention to cacheing effects\n");
+  printf(" of the CPU.\n\n");
+  printf("[title]\t\t\t\t\t     [cycles]\t[loops]\n\n");
+  //  printf("------------------------------------------------------------\n\n");
+
+  // first measure the time overhead:
+  unsigned long ini, end, dt, tmp;
+  rdtscl(ini); rdtscl(end);
+  dt = end - ini;
+
+  int type = -1; 
+  /* type   -1 == all 
+     type    0 == framework
+     type    1 == vector
+     type    2 == quaternion
+     type    3 == lists
+  */
+  if(type == 0 || type == -1)
+    {
+      /* framework test*/
+      
+      printf("Generating Objects:\t\t\t\t\t%i\n", ITERATIONS);
+      /* ************WorldEntity class test************** */
+      WorldEntity* w = NULL;
+      int i = 0;
+      unsigned long mittel = 0;
+      
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  WorldEntity* w = new WorldEntity();
+	  
+	  rdtscl(end);
+	  delete w;
+	  mittel += (end - ini - dt);
+	}
+      float mi = mittel / (float)ITERATIONS;
+      printf(" Generate a WorldEntity object:\t\t%11.2f\n", mi);
+      
+      /*
+	mittel = 0;
+	for(i = 0; i < ITERATIONS; ++i)
+	{
+	rdtscl(ini);
+	
+	WorldEntity* w = new Primitive(P_SPHERE);
+	
+	rdtscl(end);
+	delete w;
+	mittel += (end - ini - dt);
+	}
+	mi = mittel / (float)ITERATIONS;
+	printf(" Generate a Primitive  object:\t\t%11.2f\n", mi);
+      */
+
+      mittel = 0;
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  Vector* v = new Vector();
+	  
+	  rdtscl(end);
+	  delete v;
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)ITERATIONS;
+      printf(" Generate a Vector object:\t\t%11.2f\n", mi);
+
+
+     mittel = 0;
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  Quaternion* q = new Quaternion();
+	  
+	  rdtscl(end);
+	  delete q;
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)ITERATIONS;
+      printf(" Generate a Quaternion object:\t\t%11.2f\n", mi);
+
+
+
+
+      printf("\nCalling function inline &| virtual, \t\t\t%i\n", ITERATIONS);
+      mittel = 0;
+      w = new WorldEntity();
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  w->tick(0.0f);
+
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	  }
+      //delete w;
+      mi = mittel / (float)ITERATIONS;
+      printf(" Virt funct tick() of WE: \t\t%11.2f\n", mi);
+
+
+      mittel = 0;
+      WorldEntity wo;
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  wo.tick(0.0f);
+	   
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	  }
+      //delete w;
+      mi = mittel / (float)ITERATIONS;
+      printf(" Inl virt funct tick() of WE v2: \t%11.2f\n", mi);
+
+      
+      mittel = 0;
+      BaseObject* bo = new BaseObject();
+      for(i = 0; i < ITERATIONS; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  bo->isFinalized();
+	   
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	  }
+      //delete w;
+      mi = mittel / (float)ITERATIONS;
+      printf(" Inl funct BaseObject::isFinazlized(): \t%11.2f\n", mi);
+
+      
+      tList<WorldEntity>* list = new tList<WorldEntity>();
+
+      
+      /* ************Primitvie class test************** */
+      list = new tList<WorldEntity>();
+ 
+      
+      /*
+	mittel = 0;
+	w = new Primitive(P_SPHERE);
+	for(i = 0; i < ITERATIONS; ++i)
+	{
+	rdtscl(ini);
+	
+	w->tick(0.0f);
+	
+	rdtscl(end);
+	mittel += (end - ini - dt);
+	}
+	mi = mittel / (float)ITERATIONS;
+	printf(" Call function tick() of Prim:\t\t%11.2f\n", mi);
+      */
+      
+    }
+  
+  if(type == 1 || type == -1)
+    {
+      printf("\nDoing some simple vector operations: \t\t\t%i\n", VECTOR_MAX);
+      /* vector test */
+      Vector* a = new Vector(1.3, 5.3, 4.1);
+      Vector* b = new Vector(0.4, 2.5, 6.2);
+      Vector* c = new Vector();
+      
+      unsigned long mittel, ini, end;
+      float mi;
+      int i = 0;
+      // addition
+      mittel = 0;
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  *c = *a + *b;
+	   
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" Addition of two vectors:\t\t%11.2f\n", mi);
+      
+      // multiplikation
+
+      mittel = 0;
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  *c = a->cross( *b);
+	   
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" CrossMult of two vectors:\t\t%11.2f\n", mi);
+
+    }
+  if( type == 2 || type == -1)
+    {
+      /* quaternion test */
+      printf("\nDoing some simple quaternion operations: \t\t%i\n", VECTOR_MAX);
+      /* vector test */
+      Quaternion* a = new Quaternion();
+      Quaternion* b = new Quaternion();
+      Quaternion* c = new Quaternion();
+      
+      unsigned long mittel, ini, end;
+      float mi;
+      int i = 0;
+      // quaternion generieren mit spez konstruktor
+      mittel = 0;
+      Vector* qa = new Vector(4.6, 9.3, 0.4);
+      Vector* qb = new Vector(3.5, 6.1, 4.3);
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  Quaternion* qu = new Quaternion(*qa, *qb);
+	  
+	  rdtscl(end);
+	  delete qu;
+	  mittel += (end - ini - dt);
+	}
+      delete a;
+      delete b;
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" Gen. quatern. betw. two vectors:\t%11.2f\n", mi);
+      
+      
+      // multiplication
+      mittel = 0;
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  *c = *a * *b;
+	  
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" Multiplying two quat.(=rot): a * b\t%11.2f\n", mi);
+      
+      
+      
+      // rotating a vector by a quaternion
+      mittel = 0;
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  *qa = a->apply(*qb);
+	  
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" Rot a vec by a quat: q->apply(v)\t%11.2f\n", mi);
+      
+      
+      
+      // generate rotation matrix
+      mittel = 0;
+      float matrix[4][4];
+      for(i = 0; i < VECTOR_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  a->matrix(matrix);
+	  
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)VECTOR_MAX;
+      printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi);
+    }
+  if( type == 3 || type == -1)
+    {
+      /* list tests*/
+      printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX);
+      tList<char>* list = new tList<char>();
+      char* name;
+      
+      printf(" Adding[1..10] elements to list, found:\n");
+      list->add("1");
+      list->add("2");
+      list->add("3");
+      list->add("4");
+      list->add("5");
+      list->add("6");
+      list->add("7");
+      list->add("8");
+      list->add("9");
+      list->add("10");
+      
+      /*give list out */
+      tIterator<char>* iterator = list->getIterator();
+      name = iterator->nextElement();
+      printf("  List Elements: \t\t");
+      while( name != NULL)
+	{
+	  printf("%s,", name);
+	  name = iterator->nextElement();
+	}
+      delete iterator;
+      printf("\n");
+      
+      
+      /*removing some elements from the list*/
+      printf(" Removing elements [2,3,6,8,10], adding [11] now found:\n");
+      list->remove("2");
+      list->remove("3");
+      list->remove("6");
+      list->remove("8");
+      list->remove("10");
+      list->add("11");
+      /*give list out */
+      iterator = list->getIterator();
+      name = iterator->nextElement();
+      printf("  List Elements: \t\t");
+      while( name != NULL)
+	{
+	  printf("%s,", name);
+	  name = iterator->nextElement();
+	}
+      delete iterator;
+      printf("\n");
+      
+      delete list;
+      printf("\nChecking list performance:\t\t\t\t%i\n", LIST_MAX);
+      
+      tList<int>* plist = new tList<int>();
+      unsigned long mittel, ini, end;
+      float mi;
+      int i = 0;
+      mittel = 0;
+      for(i = 0; i < LIST_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  plist->add(&i);
+	  
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)LIST_MAX;
+      printf(" Adding reference to list:\t\t%11.2f\n", mi);
+      
+      mittel = 0;
+      for(i = 0; i < LIST_MAX; ++i)
+	{
+	  rdtscl(ini);
+	  
+	  plist->remove(&i);
+	  
+	  rdtscl(end);
+	  mittel += (end - ini - dt);
+	}
+      mi = mittel / (float)LIST_MAX;
+      printf(" Removing 1st reference from list:\t%11.2f\n", mi);
+      
+
+      printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX);
+      list = new tList<char>();
+      printf(" Adding[1..10] elements to list, found:\n");
+      list->add("1");
+      list->add("2");
+      list->add("3");
+      list->add("4");
+      list->add("5");
+      list->add("6");
+      list->add("7");
+      list->add("8");
+      list->add("9");
+      list->add("10");
+      
+      /*give list out */
+      iterator = list->getIterator();
+      name = iterator->nextElement();
+      printf("  List Elements: \t\t");
+      while( name != NULL)
+	{
+	  printf("%s,", name);
+	  name = iterator->nextElement();
+	}
+      delete iterator;
+      printf("\n");
+      
+      
+      int c = 0;
+      printf(" Going trough list with nextElement(el) func: ");
+      name = list->firstElement();
+      while(c < 20)
+	{
+	  printf("%s,", name);
+	  name = list->nextElement(name);
+	  c++;
+	}
+      printf("\n");
+      
+
+      
+    }
+  #endif
+}
Index: orxonox/branches/levelloader/src/orxonox.conf
===================================================================
--- orxonox/branches/levelloader/src/orxonox.conf	(revision 3606)
+++ orxonox/branches/levelloader/src/orxonox.conf	(revision 3746)
@@ -13,3 +13,8 @@
 x=up_world
 z=down_world
-
+1=view0
+2=view1
+3=view2
+4=view3
+5=view4
+5=view5
Index: orxonox/branches/levelloader/src/orxonox.h
===================================================================
--- orxonox/branches/levelloader/src/orxonox.h	(revision 3606)
+++ orxonox/branches/levelloader/src/orxonox.h	(revision 3746)
@@ -7,5 +7,6 @@
 #define _ORXONOX_H
 
-#include "stdincl.h"
+#include "comincl.h"
+#include "glincl.h"
 
 class CommandNode;
@@ -15,4 +16,5 @@
 class Camera;
 class GameLoader;
+class ResourceManager;
 
 //! Orxonox core singleton class
@@ -24,5 +26,4 @@
   static Orxonox* singletonRef;
   Orxonox ();
-  virtual ~Orxonox ();
 
   char configfilename[256];   //!< Filename of the configuration-file.
@@ -30,7 +31,7 @@
   DataTank* resources;        //!< DataContainer
   CommandNode* localinput;    //!< Command Handler
-  Camera* localcamera;        //!< The current Camera
   SDL_Surface* screen;        //!< The current Screen
   GameLoader* gameLoader;     //!< The gameLoader
+  ResourceManager* resourceManager; //!< The ResourceManager
   
   bool bQuitOrxonox;          //!< If Orxonox should Quit
@@ -57,4 +58,6 @@
  public:
   static Orxonox* getInstance ();
+  virtual ~Orxonox ();
+
   void start();
   void quitGame();
@@ -66,5 +69,4 @@
   
   CommandNode* getLocalInput();
-  Camera* getCamera();
   World* getWorld();
   SDL_Surface* getScreen ();
@@ -73,4 +75,8 @@
 };
 
+int startHelp(void);
+int startOrxonox(int argc, char** argv);
+int startBenchmarks(void);
+
 #endif /* _ORXONOX_H */
 
Index: orxonox/branches/levelloader/src/proto/proto_class.cc
===================================================================
--- orxonox/branches/levelloader/src/proto/proto_class.cc	(revision 3746)
+++ orxonox/branches/levelloader/src/proto/proto_class.cc	(revision 3746)
@@ -0,0 +1,53 @@
+
+
+/* 
+   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: ...
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+#include "proto_class.h"
+
+#include "stdincl.h" // maybe
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+   \todo this constructor is not jet implemented - do it
+*/
+ProtoClass::ProtoClass () 
+{
+   this->setClassName ("ProtoClass");
+}
+
+
+/**
+   \brief standard deconstructor
+
+*/
+ProtoClass::~ProtoClass () 
+{
+  // delete what has to be deleted here
+}
+
+/**
+   \brief nonsense - delete this method
+   \param realy nothing to give
+   \returns true or false - probably nothing?
+
+   this is just to show the doxygen abilities (this for example is an extension for a long comment)
+*/
+bool ProtoClass::doNonSense (int nothing) {}
Index: orxonox/branches/levelloader/src/proto/proto_class.h
===================================================================
--- orxonox/branches/levelloader/src/proto/proto_class.h	(revision 3746)
+++ orxonox/branches/levelloader/src/proto/proto_class.h	(revision 3746)
@@ -0,0 +1,39 @@
+/*! 
+    \file proto_class.h
+    \brief Definition of the proto class template, used quickly start work
+    \todo Example: this shows how to use simply add a Marker that here has to be done something.
+
+    The Protoclass exists, to help you quikly getting the run for how to develop in orxonox.
+    It is an example for the CODING-CONVENTION, and a starting-point for every class.
+*/
+
+#ifndef _PROTO_CLASS_H
+#define _PROTO_CLASS_H
+
+#include "what realy has to be included"
+#include "base_object.h"
+
+// FORWARD DEFINITION \\
+class someClassWeNeed;
+
+
+/*class Test;*/ /* forward definition of class Test (without including it here!)*/
+
+//! A default class that aids you to start creating a new class
+/**
+   here can be some longer description of this class
+*/
+class ProtoClass : public BaseObject {
+
+ public:
+  ProtoClass();
+  virtual ~ProtoClass();
+
+  bool doNonSense (int nothing);
+
+ private:
+  int nonSense;  //!< doxygen tag here like this for all the variables - delete this variable if you use this
+
+};
+
+#endif /* _PROTO_CLASS_H */
Index: orxonox/branches/levelloader/src/proto/proto_singleton.cc
===================================================================
--- orxonox/branches/levelloader/src/proto/proto_singleton.cc	(revision 3746)
+++ orxonox/branches/levelloader/src/proto/proto_singleton.cc	(revision 3746)
@@ -0,0 +1,55 @@
+/* 
+   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: ...
+   co-programmer: ...
+*/
+
+//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+#include "proto_singleton.h"
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+*/
+ProtoSingleton::ProtoSingleton () 
+{
+   this->setClassName ("ProtoSingleton");
+
+}
+
+/**
+   \brief the singleton reference to this class
+*/
+ProtoSingleton* ProtoSingleton::singletonRef = NULL;
+
+/**
+   \returns a Pointer to this Class
+*/
+ProtoSingleton* ProtoSingleton::getInstance(void)
+{
+  if (!ProtoSingleton::singletonRef)
+    ProtoSingleton::singletonRef = new ProtoSingleton();
+  return ProtoSingleton::singletonRef;
+}
+
+/**
+   \brief standard deconstructor
+
+*/
+ProtoSingleton::~ProtoSingleton () 
+{
+  ProtoSingleton::singletonRef = NULL;
+
+}
Index: orxonox/branches/levelloader/src/proto/proto_singleton.h
===================================================================
--- orxonox/branches/levelloader/src/proto/proto_singleton.h	(revision 3746)
+++ orxonox/branches/levelloader/src/proto/proto_singleton.h	(revision 3746)
@@ -0,0 +1,27 @@
+/*! 
+    \file proto_singleton.h
+    \brief Definition of the proto class template, used quickly start work
+    
+    a simple file to copy and create a singleton-class from
+*/
+
+#ifndef _PROTO_SINGLETON_H
+#define _PROTO_SINGLETON_H
+
+#include "base_object.h"
+
+// FORWARD DEFINITION \\
+
+//! A default singleton class.
+class ProtoSingleton : public BaseObject {
+
+ public:
+  static ProtoSingleton* getInstance(void);
+  virtual ~ProtoSingleton(void);
+
+ private:
+  ProtoSingleton(void);
+  static ProtoSingleton* singletonRef;
+};
+
+#endif /* _PROTO_SINGLETON_H */
Index: orxonox/branches/levelloader/src/proto_class.cc
===================================================================
--- orxonox/branches/levelloader/src/proto_class.cc	(revision 3606)
+++ 	(revision )
@@ -1,53 +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: ...
-   co-programmer: ...
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
-
-#include "proto_class.h"
-
-#include "stdincl.h" // maybe
-
-using namespace std;
-
-
-/**
-   \brief standard constructor
-   \todo this constructor is not jet implemented - do it
-*/
-ProtoClass::ProtoClass () 
-{
-   this->setClassName ("ProtoClass");
-}
-
-
-/**
-   \brief standard deconstructor
-
-*/
-ProtoClass::~ProtoClass () 
-{
-  // delete what has to be deleted here
-}
-
-/**
-   \brief nonsense - delete this method
-   \param realy nothing to give
-   \returns true or false - probably nothing?
-
-   this is just to show the doxygen abilities (this for example is an extension for a long comment)
-*/
-bool ProtoClass::doNonSense (int nothing) {}
Index: orxonox/branches/levelloader/src/proto_class.h
===================================================================
--- orxonox/branches/levelloader/src/proto_class.h	(revision 3606)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*! 
-    \file proto_class.h
-    \brief Definition of the proto class template, used quickly start work
-    \todo Example: this shows how to use simply add a Marker that here has to be done something.
-
-    The Protoclass exists, to help you quikly getting the run for how to develop in orxonox.
-    It is an example for the CODING-CONVENTION, and a starting-point for every class.
-*/
-
-#ifndef _PROTO_CLASS_H
-#define _PROTO_CLASS_H
-
-#include "what realy has to be included"
-#include "base_object.h"
-
-// FORWARD DEFINITION \\
-class someClassWeNeed;
-
-
-/*class Test;*/ /* forward definition of class Test (without including it here!)*/
-
-//! A default class that aids you to start creating a new class
-/**
-   here can be some longer description of this class
-*/
-class ProtoClass : public BaseObject {
-
- public:
-  ProtoClass();
-  virtual ~ProtoClass();
-
-  bool doNonSense (int nothing);
-
- private:
-  int nonSense;  //!< doxygen tag here like this for all the variables - delete this variable if you use this
-
-};
-
-#endif /* _PROTO_CLASS_H */
Index: orxonox/branches/levelloader/src/simple_animation.cc
===================================================================
--- orxonox/branches/levelloader/src/simple_animation.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/simple_animation.cc	(revision 3746)
@@ -1,2 +1,3 @@
+
 
 
@@ -19,87 +20,39 @@
 #include "simple_animation.h"
 #include "stdincl.h"
-#include "p_node.h"
+#include "vector.h"
+#include "world_entity.h"
 
 using namespace std;
 
+
+
+SimpleAnimation* SimpleAnimation::singletonRef = 0;
+/**
+   \brief gets the singleton instance
+   \returns singleton instance
+*/
+SimpleAnimation* SimpleAnimation::getInstance()
+{
+  if( singletonRef == NULL)
+    singletonRef = new SimpleAnimation();
+  return singletonRef;
+}
+
 /**
    \brief standard constructor
-   \param the point of the object
-   \param and the orientation of it
-   \param at this time
-*/
-KeyFrame::KeyFrame(Vector* point, Quaternion* orientation, float time)
-{
-  this->setRelCoor(point);
-  this->setRelDir(orientation);
-  this->time = time;
-}
-
-
-/**
-   \brief standard constructor
-   \param the point of the object
-   \param and the orientation of it
-   \param at this time
-   \param function of the velocity of the movement 
-*/
-KeyFrame::KeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)
-{
-  this->setRelCoor(point);
-  this->setRelDir(orientation);
-  this->time = time;
-  this->mode = mode;
-}
-
-
-/**
-   \brief standard deconstructor
-*/
-KeyFrame::~KeyFrame()
-{
-}
-
-
-/**
-   \brief sets the important properties of a Keyframe
-   \param the point of the object
-   \param and the orientation of it
-   \param at this time
-*/
-void KeyFrame::set(Vector* point, Quaternion* orientation, float time)
-{
-  this->setRelCoor(point);
-  this->setRelDir(orientation);
-  this->time = time;
-}
-
-
-/**
-   \brief sets the important properties of a Keyframe
-   \param the point of the object
-   \param and the orientation of it
-   \param at this time
-   \param function of the velocity of the movement 
-*/
-void KeyFrame::set(Vector* point, Quaternion* orientation, float time, movementMode mode)
-{
-  this->setRelCoor(point);
-  this->setRelDir(orientation);
-  this->time = time;
-  this->mode = mode;
-}
-
-
-
-/**
-   \brief standard constructor
-*/
-SimpleAnimation::SimpleAnimation (PNode* parent) 
+*/
+SimpleAnimation::SimpleAnimation () 
 {
    this->setClassName ("SimpleAnimation");
    this->frames = new tList<KeyFrame>();
+   this->animators = new tList<Animation>();
    this->localTime = 0;
-   this->bPause = false;
-   this->parent = parent;
+   this->bRunning = false;
+   this->currentFrame = NULL;
+   this->lastFrame = NULL;
+
+   this->tmpVect = new Vector();
+   this->lastPosition = new Vector();
+   this->deltaT = 0.2;
 }
 
@@ -111,11 +64,71 @@
 SimpleAnimation::~SimpleAnimation () 
 {
-  KeyFrame* frame = this->frames->enumerate(); 
+  tIterator<KeyFrame>* iterator = this->frames->getIterator();
+  KeyFrame* frame = iterator->nextElement(); 
   while( frame != NULL) 
     { 
       delete frame;
-      frame = frames->nextElement();
-    }
+      frame = iterator->nextElement();
+    }
+  delete iterator;
   delete this->frames;
+}
+
+
+/**
+   \brief this determines the start of an Animator Describtion
+
+   this can then be followed by different commands like addKeyFrame(..) etc. and
+   will be closed with AnimatiorEnd()
+*/
+void SimpleAnimation::animatorBegin()
+{
+  this->bDescriptive = true;
+}
+
+
+/**
+   \brief this determines the end of an Animator Describtion
+
+   this can then be followed by different commands like addKeyFrame(..) etc. and
+   will be closed with AnimatiorEnd()
+*/
+void SimpleAnimation::animatorEnd()
+{
+  this->workingObject = NULL;
+  this->bDescriptive = false;
+}
+
+
+/*
+  Vector* lastPosition;
+  Vector* tmpVect;
+  tList<KeyFrame>* frames;
+  animationMode animMode;
+  movementMode movMode;
+  bool bRunning;
+  float deltaT;
+*/
+
+/**
+   \brief select an object to work on by using this function
+   \param object wo work on
+*/
+void SimpleAnimation::selectObject(WorldEntity* entity)
+{
+  Animation* anim = getAnimationFromWorldEntity(entity);
+  if( anim == NULL)
+    {
+      printf("SimpleAnimation::selectObject() - object not found, creating one\n");
+      anim = new Animation;
+      anim->object = entity;
+      anim->lastPosition = new Vector();
+      anim->tmpVect = new Vector();
+      frames = new tList<KeyFrame>();
+      bRunning = false;
+      deltaT = 0.0;
+      this->animators->add(anim);
+    }
+  this->workingAnimator = anim;
 }
 
@@ -125,10 +138,20 @@
    \brief adds a keyframe with properties
    \param the point of the object
-   \param and the orientation of it
+   \param and the direction of it
    \param at this time
 */
-void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time)
-{
-  KeyFrame* frame = new KeyFrame(point, orientation, time);
+void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time)
+{
+  if( !this->bDescriptive)
+    {
+      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
+      return;
+    }
+  KeyFrame* frame = new KeyFrame;
+  frame->position = point;
+  frame->direction = direction;
+  frame->time = time;
+  frame->mode = DEFAULT_ANIMATION_MODE;
+  frame->object = this->workingObject;
   this->frames->add(frame);
 }
@@ -138,11 +161,21 @@
    \brief adds a keyframe with properties
    \param the point of the object
-   \param and the orientation of it
+   \param and the direction of it
    \param at this time
    \param function of the velocity of the movement 
 */
-void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)
-{
-  KeyFrame* frame = new KeyFrame(point, orientation, time, mode);
+void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode)
+{
+  if( !this->bDescriptive)
+    {
+      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
+      return;
+    }
+  KeyFrame* frame = new KeyFrame;
+  frame->position = point;
+  frame->direction = direction;
+  frame->time = time;
+  frame->mode = mode;
+  frame->object = this->workingObject;
   this->frames->add(frame);
 }
@@ -154,4 +187,10 @@
 void SimpleAnimation::addKeyFrame(KeyFrame* frame)
 {
+  if( !this->bDescriptive)
+    {
+      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
+      return;
+    }
+  frame->object = this->workingObject;
   this->frames->add(frame);
 }
@@ -163,16 +202,20 @@
 void SimpleAnimation::reset()
 {
-  KeyFrame* frame = this->frames->enumerate(); 
+  tIterator<KeyFrame>* iterator = this->frames->getIterator();
+  KeyFrame* frame = iterator->nextElement(); 
   while( frame != NULL) 
     { 
       delete frame;
-      frame = frames->nextElement();
-    }
+      frame = iterator->nextElement();
+    }
+  delete iterator;
   delete this->frames;
 
   this->frames = new tList<KeyFrame>();
   this->localTime = 0;
-  this->bPause = false;
-
+  this->bRunning = false;
+
+  this->currentFrame = NULL;
+  this->lastFrame = NULL;
 }
 
@@ -181,5 +224,16 @@
 */
 void SimpleAnimation::start()
-{}
+{
+  if( this->bRunning)
+    {
+      PRINTF(2)("SimpleAnimatin is already running. You are trying to start it again.\n");
+    return;
+    }
+  
+  this->localTime = 0;
+  this->lastFrame = this->frames->firstElement();
+  this->currentFrame = this->frames->nextElement(this->currentFrame);
+  this->bRunning = true;
+}
 
 
@@ -188,5 +242,7 @@
 */
 void SimpleAnimation::stop()
-{}
+{
+  this->bRunning = false;
+}
 
 /**
@@ -196,5 +252,7 @@
 {
   this->localTime = 0;
-  this->bPause = false;
+  this->lastFrame = this->frames->firstElement();
+  this->currentFrame = this->frames->nextElement(this->currentFrame);
+  this->bRunning = true;
 }
 
@@ -204,5 +262,5 @@
 void SimpleAnimation::pause()
 {
-  this->bPause = true;
+  this->bRunning = false;
 }
 
@@ -212,5 +270,5 @@
 void SimpleAnimation::resume()
 {
-  this->bPause = false;
+  this->bRunning = true;
 }
 
@@ -221,9 +279,85 @@
 void SimpleAnimation::tick(float time)
 {
-  if(!this->bPause)
-    {
-
-
-
-    }
-}
+  this->localTime += time;
+  tIterator<Animation>* iterator = this->animators->getIterator();
+  Animation* anim = iterator->nextElement();
+  while( anim != NULL)
+    {
+      if( anim->bRunning)
+	{
+	  
+	  
+	  /* first get the current frame via time-stamps */ 
+	  while( this->localTime > anim->currentFrame->time)
+	    {
+	      printf("SimpleAnimation::tick(...) - changing Frame\n");
+	      
+	      //this->currentFrame->object->setRelCoor(*this->currentFrame->position);
+	      *anim->lastPosition = *anim->currentFrame->position;
+	      
+	      anim->lastFrame = anim->currentFrame;
+	      anim->currentFrame = anim->frames->nextElement(anim->currentFrame);
+	      anim->movMode = anim->currentFrame->mode;
+	      if( anim->movMode == NEG_EXP)
+		{
+		  *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position;
+		  anim->deltaT = 1/anim->currentFrame->time * logf(1.0 + 600.0/anim->tmpVect->len());
+		}
+	    }
+	  
+	  /* now animate it */
+	  switch( anim->movMode)
+	    {
+	    case LINEAR:
+	      
+	      *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position;
+	      *anim->tmpVect = *anim->tmpVect * this->localTime / anim->currentFrame->time;
+	      anim->currentFrame->object->setRelCoor(*anim->lastFrame->position + *anim->tmpVect);
+	      *anim->lastPosition = *anim->tmpVect;
+	      break;
+	    case EXP:
+	      
+	      break;
+	    case NEG_EXP:
+	      *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position;
+	      *anim->tmpVect = *anim->tmpVect * (1 - exp(- this->localTime * anim->deltaT));     
+	      anim->currentFrame->object->setRelCoor(*anim->lastFrame->position + *anim->tmpVect);
+	      *anim->lastPosition = *anim->tmpVect;
+	      break;
+	    case SIN:
+	      *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position;
+	      *anim->tmpVect = *anim->tmpVect * 0.5*(1 - cos(M_PI * this->localTime / anim->currentFrame->time));     
+	      anim->currentFrame->object->setRelCoor(*anim->lastFrame->position + *anim->tmpVect);
+	      *anim->lastPosition = *anim->tmpVect;
+	      break;
+	    case COS:
+	      
+	      break;
+	    case QUADRATIC:
+	      *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position;
+	      *anim->tmpVect = *anim->tmpVect * 1/3 * ldexpf(this->localTime, 3);
+	      break;
+	    default:
+	      break;
+	    }
+	}
+      anim = iterator->nextElement();
+    }
+  delete anim;
+}
+
+
+
+Animation* SimpleAnimation::getAnimationFromWorldEntity(WorldEntity* entity)
+{
+  tIterator<Animation>* iterator = this->animators->getIterator();
+  Animation* anim = iterator->nextElement();
+  while( anim != NULL)
+    {
+      if( anim->object == entity)
+	return anim;
+      anim = iterator->nextElement();
+    }
+  delete iterator;
+  return NULL;
+}
Index: orxonox/branches/levelloader/src/simple_animation.h
===================================================================
--- orxonox/branches/levelloader/src/simple_animation.h	(revision 3606)
+++ orxonox/branches/levelloader/src/simple_animation.h	(revision 3746)
@@ -12,29 +12,45 @@
 
 #include "base_object.h"
-#include "p_node.h"
 #include "list.h"
 
 
-typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS};
+class Vector;
+class Quaternion;
+class WorldEntity;
+class PNode;
+
+typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS, QUADRATIC};
+typedef enum animationMode{SINGLE=0, LOOP};
+#define DEFAULT_ANIMATION_MODE LINEAR
 
 
-//! KeyFrame Class
+//! KeyFrame Struct
 /**
-   This represents one point with orientation of the animation
+   This represents one point with direction of the animation
 */
-class KeyFrame : public PNode {
- public:
-  KeyFrame(Vector* point, Quaternion* orientation, float time);
-  KeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode); 
-  virtual ~KeyFrame();
-
-  void set(Vector* point, Quaternion* orientation, float time);
-  void set(Vector* point, Quaternion* orientation, float time, movementMode mode);
-  
- private:
+typedef struct KeyFrame {
+  Vector* position;
+  Quaternion* direction;
+  WorldEntity* object;
   float time;
   movementMode mode;
 };
 
+//! Animation Struct
+/**
+   This represents an animation for a object
+*/
+typedef struct Animation {
+  WorldEntity* object;
+  KeyFrame* currentFrame;
+  KeyFrame* lastFrame;
+  Vector* lastPosition;
+  Vector* tmpVect;
+  tList<KeyFrame>* frames;
+  animationMode animMode;
+  movementMode movMode;
+  bool bRunning;
+  float deltaT;
+};
 
 //! Animation Class
@@ -45,11 +61,14 @@
   
  public:
-  SimpleAnimation(PNode* parent);
-  virtual ~SimpleAnimation();
+  static SimpleAnimation* getInstance();
 
-  void addKeyFrame(Vector* point, Quaternion* orientation, float time);
-  void addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode);
+  void animatorBegin();
+  void animatorEnd();
+  void selectObject(WorldEntity* entity);
+  void addKeyFrame(Vector* point, Quaternion* direction, float time);
+  void addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode);
   void addKeyFrame(KeyFrame* frame);
   void reset();
+
 
   void start();
@@ -62,9 +81,25 @@
 
  private:
-  bool bPause;                     //<! is set, when there is a pause
-  tList<KeyFrame>* frames;        //<! where keyframes are stored in
+  SimpleAnimation();
+  virtual ~SimpleAnimation();
+
+  static SimpleAnimation* singletonRef;
+  bool bDescriptive;               //<! is true, when AnimatorBegin() was executed but no AnimatorEnd() yet: in describtive mode: pass commands
+  bool bRunning;                   //<! is set, when the animation is running
+  tList<KeyFrame>* frames;         //<! where keyframes are stored in
+  tList<Animation>* animators;      //<! a list of animation's
+  KeyFrame* currentFrame;          //<! the frame that is been played now
+  KeyFrame* lastFrame;
+  Vector* lastPosition;
+  movementMode mode;               //<! this is an enum of the mode, how the speed is distributed
   float localTime;
   PNode* parent;
   
+  Vector* tmpVect;                 //<! this is the temporary vector save place - 
+  WorldEntity* workingObject;      //<! this is a pointer to the current working object that has been selected via selectObject()
+  Animation* workingAnimator;       //<! the animator with which you are currently working
+  float deltaT;                    //<! this is a time constant for the movement
+
+  Animation* getAnimationFromWorldEntity(WorldEntity* entity);
 
 };
Index: orxonox/branches/levelloader/src/story_entities/campaign.cc
===================================================================
--- orxonox/branches/levelloader/src/story_entities/campaign.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/story_entities/campaign.cc	(revision 3746)
@@ -18,10 +18,14 @@
 
 #include "campaign.h"
+
+#include "story_entity.h"
+
 #include "world.h"
 #include "camera.h"
-#include "story_entity.h"
 #include "factory.h"
 #include "game_loader.h"
 
+#include "list.h"
+
 using namespace std;
 
@@ -30,7 +34,8 @@
 Campaign::Campaign () 
 {
-  this->entities = new ListTemplate<StoryEntity>();
+  this->entities = new tList<StoryEntity>();
   this->isInit = false;
 }
+
 
 Campaign::~Campaign () {}
@@ -47,5 +52,5 @@
 	GameLoader* loader = GameLoader::getInstance();
 	
-  this->entities = new ListTemplate<StoryEntity>();
+  this->entities = new tList<StoryEntity>();
   this->isInit = false;
   
@@ -106,4 +111,5 @@
     {
       se->displayLoadScreen();
+      se->preLoad();
       se->load();
       se->init();
@@ -232,5 +238,7 @@
   if( storyID == WORLD_ID_GAMEEND)
     return NULL;
-  ListTemplate<StoryEntity>* l;
+
+  /*
+  tList<StoryEntity>* l;
   StoryEntity* entity = NULL;
   l = this->entities->getNext();  
@@ -239,4 +247,5 @@
       entity = l->getObject();
       l = l->getNext();
+
       int id = entity->getStoryID();
       //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id);
@@ -246,5 +255,25 @@
 	  return entity;
 	}
-    }
+
+    }
+  */
+
+
+
+  StoryEntity* entity = this->entities->enumerate();
+  while( entity != NULL) 
+    { 
+      int id = entity->getStoryID();
+      //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id);
+      if(id == storyID)
+	{
+	  //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n");
+	  return entity;
+	}
+      entity = this->entities->nextElement();
+    }
+
+
+
   return NULL;
 }
Index: orxonox/branches/levelloader/src/story_entities/campaign.h
===================================================================
--- orxonox/branches/levelloader/src/story_entities/campaign.h	(revision 3606)
+++ orxonox/branches/levelloader/src/story_entities/campaign.h	(revision 3746)
@@ -8,4 +8,5 @@
 
 class World;
+template<class T> class tList;
 
 class Campaign : public StoryEntity {
@@ -34,5 +35,6 @@
 
  private:
-  ListTemplate<StoryEntity>* entities;
+  //ListTemplate<StoryEntity>* entities;
+  tList<StoryEntity>* entities;
   bool running;
 
Index: orxonox/branches/levelloader/src/story_entities/story_entity.cc
===================================================================
--- orxonox/branches/levelloader/src/story_entities/story_entity.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/story_entities/story_entity.cc	(revision 3746)
@@ -72,4 +72,24 @@
 
 
+/**
+   \brief stuff that will have to be initialized before load
+
+   this gives all storyentities the possibility to init stuff before the
+   load function, where all the stuff is been made ready for start
+*/
+ErrorMessage StoryEntity::preLoad()
+{}
+
+/** 
+    \brief loads the current entity
+
+    this is here to enable you loading maps into the entities. for all other actions you
+    should take the init() function.
+    load() is exec before init()
+*/
+ErrorMessage StoryEntity::load()
+{}
+
+
 /** 
     \brief initialize the entity before use. 
@@ -78,17 +98,9 @@
     After execution of this function, the Entity is ready to be played/executed, 
     this shifts the initialisation work before the execution - very important...
+    init() is exec shortly before start()
 */
 ErrorMessage StoryEntity::init()
 {}
 
-
-/** 
-    \brief loads the current entity
-
-    this is here to enable you loading maps into the entities. for all other actions you
-    should take the init() function.
-*/
-ErrorMessage StoryEntity::load()
-{}
 
 /** 
Index: orxonox/branches/levelloader/src/story_entities/story_entity.h
===================================================================
--- orxonox/branches/levelloader/src/story_entities/story_entity.h	(revision 3606)
+++ orxonox/branches/levelloader/src/story_entities/story_entity.h	(revision 3746)
@@ -8,7 +8,9 @@
 #define _STORY_ENTITY_H
 
-#include "stdincl.h"
+#include "base_object.h"
 
 #include "story_def.h"
+#include "error.h"
+
 
 //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc...
@@ -23,4 +25,5 @@
   bool isPaused; //! is true if the entity is paused
 
+  virtual ErrorMessage preLoad();
   virtual ErrorMessage load();
   virtual ErrorMessage init();
Index: orxonox/branches/levelloader/src/story_entities/world.cc
===================================================================
--- orxonox/branches/levelloader/src/story_entities/world.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/story_entities/world.cc	(revision 3746)
@@ -18,18 +18,27 @@
 
 #include "world.h"
-#include "world_entity.h"
-#include "track_manager.h"
-#include "player.h"
-#include "command_node.h"
-#include "camera.h"
-#include "environment.h"
-#include "primitive.h"
+
+#include "orxonox.h"
+
 #include "p_node.h"
 #include "null_parent.h"
 #include "helper_parent.h"
+#include "track_node.h"
+#include "world_entity.h"
+#include "player.h"
+#include "camera.h"
+#include "environment.h"
+#include "skysphere.h"
+#include "terrain.h"
+#include "light.h"
+
+#include "track_manager.h"
+#include "garbage_collector.h"
+#include "simple_animation.h"
+
+#include "command_node.h"
 #include "glmenu_imagescreen.h"
-#include "skysphere.h"
-#include "light.h"
 #include "fontset.h"
+#include "list.h"
 #include "factory.h"
 #include "game_loader.h"
@@ -37,7 +46,75 @@
 #include "terrain.h"
 
+
+
 using namespace std;
 
 CREATE_FACTORY(World);
+
+WorldInterface* WorldInterface::singletonRef = 0;
+
+
+/**
+   \brief private constructor because of singleton
+*/
+WorldInterface::WorldInterface()
+{
+  this->worldIsInitialized = false;
+  this->worldReference = NULL;
+}
+
+/**
+   \brief public deconstructor
+*/
+WorldInterface::~WorldInterface()
+{
+  this->singletonRef = NULL;
+  this->worldIsInitialized = false;
+  this->worldReference = NULL;
+}
+
+/**
+   \brief gets the singleton instance
+   \returns singleton instance
+*/
+WorldInterface* WorldInterface::getInstance()
+{
+  if( singletonRef == NULL)
+    singletonRef = new WorldInterface();
+  return singletonRef;
+}
+
+
+/**
+   \brief initializes the interface
+   \param reference to the world
+
+   if the worldinterface is not initilizes, there wont be any 
+   useable interface
+*/
+void WorldInterface::init(World* world)
+{
+  this->worldReference = world;
+  if( world != NULL)
+    {
+      this->worldIsInitialized = true;
+      PRINTF(3)("WorldInterface up and running\n");
+    }
+}
+
+
+/**
+   \brief gets the entity list from the world
+   \return entity list
+*/
+tList<WorldEntity>* WorldInterface::getEntityList()
+{
+  if( this->worldIsInitialized)
+    return this->worldReference->getEntities();
+  PRINT(1)("Someone tried to use the WorldInterface before it has been initizlized! this can result in SEGFAULTs!\n");
+  return NULL;
+}
+
+
 
 World::World( TiXmlElement* root)
@@ -110,4 +187,10 @@
   cn->reset();
 
+  ResourceManager::getInstance()->debug();
+  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
+  ResourceManager::getInstance()->debug();
+
+  delete WorldInterface::getInstance();
+
   delete this->nullParent;
   delete this->entities;
@@ -116,8 +199,17 @@
   if( this->worldName) delete this->worldName;
   if( this->path) delete this->path;
-}
-
-/**
-   \brief initializes a new World
+
+  //delete garbagecollecor
+  //delete animator
+}
+
+/**
+   \brief initializes the world. 
+
+   set all stuff here that is world generic and does not use to much memory
+   because the real init() function StoryEntity::init() will be called
+   shortly before start of the game.  
+   since all worlds are initiated/referenced before they will be started.
+   NO LEVEL LOADING HERE - NEVER!
 */
 void World::init(char* name, int worldID)
@@ -128,8 +220,20 @@
   this->debugWorldNr = worldID;
   this->entities = new tList<WorldEntity>();
-
-  // Enable default GL stuff
-  glEnable(GL_DEPTH_TEST);
-
+}
+
+
+/**
+   \brief this is executed before load
+
+   since the load function sometimes needs data, that has been init before
+   the load and after the proceeding storyentity has finished
+*/
+ErrorMessage World::preLoad()
+{
+  /* init the world interface */
+  WorldInterface* wi = WorldInterface::getInstance();
+  wi->init(this);
+  this->garbageCollector = GarbageCollector::getInstance();
+  this->simpleAnimation = SimpleAnimation::getInstance();
 }
 
@@ -153,4 +257,5 @@
 	// load the campaign document
 	if( !XMLDoc->LoadFile())
+      this->glmis->step();
 
 	{
@@ -257,7 +362,7 @@
     
     	// bind camera
-    this->localCamera = new Camera(this);
+    this->localCamera = new Camera();
     this->localCamera->setName ("camera");
-    this->localCamera->bind (localPlayer);
+    //this->localCamera->bind (localPlayer);
     this->localPlayer->addChild (this->localCamera);
 
@@ -267,4 +372,17 @@
       /*monitor progress*/
   //  this->glmis->step();
+
+      // LIGHT initialisation
+      lightMan = LightManager::getInstance();
+      lightMan->setAmbientColor(.1,.1,.1);
+      lightMan->addLight();
+      //      lightMan->setAttenuation(1.0, .01, 0.0);
+      //      lightMan->setDiffuseColor(1,1,1);
+      //  lightMan->addLight(1);
+      //  lightMan->setPosition(20, 10, -20);
+      //  lightMan->setDiffuseColor(0,0,0);
+      lightMan->debug();
+	    lightMan->setPosition(-5.0, 10.0, -40.0);
+
 
 	    // Create SkySphere
@@ -274,8 +392,15 @@
 	    this->skySphere->setMode(PNODE_MOVEMENT);
 
-	    /*monitor progress*/
-	  //  this->glmis->step();
-	  
-	  //  trackManager->setBindSlave(env);
+
+	    //	    trackManager->setBindSlave(env);
+	    PNode* tn = trackManager->getTrackNode();
+	    tn->addChild(this->localPlayer);
+
+	    //localCamera->setParent(TrackNode::getInstance());
+	    tn->addChild(this->localCamera);
+	    //	    localCamera->lookAt(tn);
+	    this->localPlayer->setMode(PNODE_ALL);
+	    //Vector* cameraOffset = new Vector (0, 5, -10);
+	    //trackManager->condition(2, LEFTRIGHT, this->localPlayer);
 
   // initialize debug coord system
@@ -290,9 +415,12 @@
   terrain->setRelCoor(new Vector(0,-10,0));
   this->spawn(terrain);
-
-}
-
-/**
-   \brief initializes a new World
+}
+
+
+/**
+   \brief initializes a new World shortly before start
+
+   this is the function, that will be loaded shortly before the world is 
+   started
 */
 ErrorMessage World::init()
@@ -302,5 +430,4 @@
   cn->addToWorld(this);
   cn->enable(true);
-
 PRINTF0("> Done Loading world: '%s'\n", getPath());
 }
@@ -363,5 +490,5 @@
   this->glmis = GLMenuImageScreen::getInstance();
   this->glmis->init();
-  this->glmis->setMaximum(10);
+  this->glmis->setMaximum(8);
   this->glmis->draw();
  
@@ -378,6 +505,26 @@
   PRINTF(3)("World::releaseLoadScreen - start\n"); 
   this->glmis->setValue(this->glmis->getMaximum());
-  SDL_Delay(500);
+  //SDL_Delay(500);
   PRINTF(3)("World::releaseLoadScreen - end\n"); 
+}
+
+
+/**
+   \brief gets the list of entities from the world
+   \returns entity list
+*/
+tList<WorldEntity>* World::getEntities()
+{
+  return this->entities;
+}
+
+
+/**
+   \brief this returns the current game time
+   \returns elapsed game time
+*/
+double World::getGameTime()
+{
+  return this->gameTime;
 }
 
@@ -435,10 +582,14 @@
   glLoadIdentity();
 
-  entity = this->entities->enumerate();
+  //entity = this->entities->enumerate();
+  tIterator<WorldEntity>* iterator = this->entities->getIterator();
+  entity = iterator->nextElement();
   while( entity != NULL ) 
     { 
       if( entity->bDraw ) entity->draw();
-      entity = this->entities->nextElement();
-    } 
+      //entity = this->entities->nextElement();
+      entity = iterator->nextElement();
+    }
+  delete iterator;
   
   glCallList (objectList);
@@ -477,5 +628,5 @@
   p4->debug ();
   
-  p1->update ();
+  p1->update (0);
 
   printf ("World::debug() - update\n");
@@ -486,5 +637,5 @@
 
   p2->shiftCoor (new Vector(-1, -1, -1));
-  p1->update ();
+  p1->update (0);
 
   p1->debug ();
@@ -496,5 +647,5 @@
 
 
- p1->update ();
+ p1->update (0);
 
   p1->debug ();
@@ -593,7 +744,7 @@
   if(!this->bPause)
     {
-      Uint32 dt = currentFrame - this->lastFrame;
+      this->dt = currentFrame - this->lastFrame;
       
-      if(dt > 0)
+      if( this->dt > 0)
 	{
 	  float fps = 1000/dt;
@@ -607,24 +758,29 @@
 	  PRINTF(2)("fps = 1000 - frame rate is adjusted\n");
 	  SDL_Delay(10);
-	  dt = 10;
+	  this->dt = 10;
 	}
       //this->timeSlice (dt);
       
       /* function to let all entities tick (iterate through list) */
-      WorldEntity* entity;
-      float seconds = dt / 1000.0;  
-      assert( this->nullParent != NULL); 
-      entity = entities->enumerate(); 
+      float seconds = this->dt / 1000.0;      
+      this->gameTime += seconds;
+      //entity = entities->enumerate(); 
+      tIterator<WorldEntity>* iterator = this->entities->getIterator();
+      WorldEntity* entity = iterator->nextElement();
       while( entity != NULL) 
 	{ 
 	  entity->tick (seconds);
-	  entity = entities->nextElement();
-	}
+	  entity = iterator->nextElement();
+	}
+      delete iterator;
+      //skySphere->updatePosition(localCamera->absCoordinate);
+      
       /* update tick the rest */
+      this->trackManager->tick(this->dt);
       assert( this->localCamera != NULL); 
       assert( this->trackManager != NULL); 
-      this->localCamera->tick(dt);
-
-      this->trackManager->tick(dt);
+      this->localCamera->tick(this->dt);
+      this->garbageCollector->tick(seconds);
+      this->simpleAnimation->tick(seconds);
     }
   this->lastFrame = currentFrame;
@@ -640,5 +796,6 @@
 void World::update()
 {
-  this->nullParent->update ();
+  this->garbageCollector->update();
+  this->nullParent->update (dt);
 }
 
@@ -728,4 +885,11 @@
 bool World::command(Command* cmd)
 {
+  if( !strcmp( cmd->cmd, "view0")) this->localCamera->setViewMode(VIEW_NORMAL);
+  else if( !strcmp( cmd->cmd, "view1")) this->localCamera->setViewMode(VIEW_BEHIND);
+  else if( !strcmp( cmd->cmd, "view2")) this->localCamera->setViewMode(VIEW_FRONT);
+  else if( !strcmp( cmd->cmd, "view3")) this->localCamera->setViewMode(VIEW_LEFT);
+  else if( !strcmp( cmd->cmd, "view4")) this->localCamera->setViewMode(VIEW_RIGHT);
+  else if( !strcmp( cmd->cmd, "view5")) this->localCamera->setViewMode(VIEW_TOP);
+  
   return false;
 }
Index: orxonox/branches/levelloader/src/story_entities/world.h
===================================================================
--- orxonox/branches/levelloader/src/story_entities/world.h	(revision 3606)
+++ orxonox/branches/levelloader/src/story_entities/world.h	(revision 3746)
@@ -8,10 +8,12 @@
 
 #include "stdincl.h"
-
+#include "comincl.h"
 #include "story_entity.h"
 #include "p_node.h"
 
+
+class World;
+class WorldEntity;
 class TrackManager;
-class WorldEntity;
 class Camera;
 class PNode;
@@ -21,5 +23,27 @@
 class FontSet;
 class Terrain;
+class GarbageCollector;
+class SimpleAnimation;
 
+//! The game world Interface
+/**
+   this is a singleton interface, that enables world_entities to access the
+   world. for those objects, there is no easier way than over this interface!
+*/
+class WorldInterface : BaseObject {
+
+ public:
+  ~WorldInterface();
+  static WorldInterface* getInstance();
+  void init(World* world);
+  tList<WorldEntity>* getEntityList();
+
+ private:
+  WorldInterface();
+  static WorldInterface* singletonRef;    //!< singleton reference to this object
+  bool worldIsInitialized;                //!< true if the world has been initialized
+  World* worldReference;                  //!< this is a reference to the running world
+
+};
 
 //! The game world
@@ -39,6 +63,8 @@
   virtual ~World ();
 
+  double getGameTime();
 
   /* classes from story-entity */
+  virtual ErrorMessage preLoad();
   virtual ErrorMessage load ();
   virtual ErrorMessage init ();
@@ -55,4 +81,6 @@
   bool command (Command* cmd);
 
+  tList<WorldEntity>* getEntities();
+
   /* interface to world */
   void spawn (WorldEntity* entity);
@@ -68,11 +96,13 @@
   void init(char* name, int worldID);
 
-  Uint32 lastFrame;             //!< last time of frame
-  bool bQuitOrxonox;            //!< quit this application
-  bool bQuitCurrentGame;        //!< quit only the current game and return to menu
-  bool bPause;                  //!< pause mode
+  Uint32 lastFrame;                   //!< last time of frame
+  Uint32 dt;                          //!< time needed to calculate this frame
+  double gameTime;                    //!< this is where the game time is saved
+  bool bQuitOrxonox;                  //!< quit this application
+  bool bQuitCurrentGame;              //!< quit only the current game and return to menu
+  bool bPause;                        //!< pause mode
 
-  FontSet* testFont;            //!< A test Font. \todo fix this, so it is for real.
-  GLMenuImageScreen* glmis;     //!< The Level-Loader Display
+  FontSet* testFont;                  //!< A test Font. \todo fix this, so it is for real.
+  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
 
   char* worldName;              //!< The name of this World
@@ -80,14 +110,18 @@
   int debugWorldNr;             //!< The Debug Nr. needed, if something goes wrong
 
-  PNode* nullParent;            //!< The zero-point, that everything has as its parent.
-  TrackManager* trackManager;   //!< The reference of the TrackManager that handles the course through the Level.
-  Camera* localCamera;          //!< The current Camera
-  Skysphere* skySphere;         //!< The Environmental Heaven of orxonox \todo insert this to environment insted
-  LightManager* lightMan;       //!< The Lights of the Level
-  Terrain* terrain;             //!< The Terrain of the World.
+  PNode* nullParent;                  //!< The zero-point, that everything has as its parent.
+  TrackManager* trackManager;         //!< The reference of the TrackManager that handles the course through the Level.
+  Camera* localCamera;                //!< The current Camera
+  Skysphere* skySphere;               //!< The Environmental Heaven of orxonox \todo insert this to environment insted
+  LightManager* lightMan;             //!< The Lights of the Level
+  Terrain* terrain;                   //!< The Terrain of the World.
 
-  GLuint objectList;            //!< temporary: \todo this will be ereased soon
-  tList<WorldEntity>* entities;//!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
-  WorldEntity* localPlayer;     //!< The Player, you fly through the level.
+  GLuint objectList;                  //!< temporary: \todo this will be ereased soon
+  tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
+  WorldEntity* localPlayer;           //!< The Player, you fly through the level.
+
+  GarbageCollector* garbageCollector; //!< reference to the garbage  collector
+
+  SimpleAnimation* simpleAnimation;   //!< reference to the SimpleAnimation object
  
   /* function for main-loop */
Index: orxonox/branches/levelloader/src/subprojects/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/subprojects/Makefile.in	(revision 3606)
+++ orxonox/branches/levelloader/src/subprojects/Makefile.in	(revision 3746)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.8.2 from Makefile.am.
 # @configure_input@
 
@@ -177,7 +177,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/subprojects/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/subprojects/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  src/subprojects/Makefile
+	  $(AUTOMAKE) --gnu  src/subprojects/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -272,14 +272,12 @@
 	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; \
@@ -291,9 +289,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
Index: orxonox/branches/levelloader/src/subprojects/testmain/Makefile.in
===================================================================
--- orxonox/branches/levelloader/src/subprojects/testmain/Makefile.in	(revision 3606)
+++ orxonox/branches/levelloader/src/subprojects/testmain/Makefile.in	(revision 3746)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.8.2 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)
@@ -197,7 +197,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/subprojects/testmain/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/subprojects/testmain/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  src/subprojects/testmain/Makefile
+	  $(AUTOMAKE) --gnu  src/subprojects/testmain/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -219,5 +219,5 @@
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	$(mkdir_p) $(DESTDIR)$(bindir)
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
@@ -225,6 +225,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
@@ -234,6 +234,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
 
@@ -289,9 +289,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
@@ -348,7 +346,5 @@
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
-	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
-	done
+	$(mkdir_p) $(DESTDIR)$(bindir)
 install: install-am
 install-exec: install-exec-am
Index: orxonox/branches/levelloader/src/track_manager.cc
===================================================================
--- orxonox/branches/levelloader/src/track_manager.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/track_manager.cc	(revision 3746)
@@ -18,8 +18,14 @@
 #include "track_manager.h"
 
+#include "base_object.h"
 #include "p_node.h"
 #include "substring.h"
 
 #include "track_node.h"
+#include "stdincl.h"
+#include "list.h"
+#include "debug.h"
+
+
 
 #include <stdarg.h>
@@ -67,10 +73,12 @@
   if ((!this->isJoined &&this->childCount > 0) || (this->isJoined && this->mainJoin))
     {
-      TrackElement* enumElem = children->enumerate();
+      tIterator<TrackElement>* iterator = this->children->getIterator();
+      TrackElement* enumElem = iterator->nextElement();
       while (enumElem)
 	{
 	  delete enumElem;
-	  enumElem = children->nextElement();
-	}
+	  enumElem = iterator->nextElement();
+	}
+      delete iterator;
       delete this->children;
     }
@@ -92,5 +100,6 @@
   if (this->childCount > 0)
     {
-      TrackElement* enumElem = this->children->enumerate();
+      tIterator<TrackElement>* iterator = this->children->getIterator();
+      TrackElement* enumElem = iterator->nextElement();
       TrackElement* tmpElem;
       while (enumElem)
@@ -98,6 +107,7 @@
 	  if ((tmpElem = enumElem->findByID(trackID)))
 	    return tmpElem;
-	  enumElem = this->children->nextElement();
-	}
+	  enumElem = iterator->nextElement();
+	}
+      delete iterator;
     }
   else 
@@ -145,11 +155,13 @@
   else
     {
-      TrackElement* enumElem = this->children->enumerate();
+      tIterator<TrackElement>* iterator = this->children->getIterator();
+      TrackElement* enumElem = iterator->nextElement();
       while (enumElem)
 	{
 	  if(!enumElem->backLoopCheck(trackElem))
 	    return false;
-	  enumElem = this->children->nextElement();
-	}
+	  enumElem = iterator->nextElement();
+	}
+      delete iterator;
       
       return true;
@@ -287,5 +299,5 @@
   PNode* tmpNode = (PNode*)node;
 
-  if (tmpNode->getRelCoor().z < 0)
+  if (tmpNode->getRelCoor()->z < 0)
     return 0;
   else 
@@ -308,5 +320,5 @@
   PNode* tmpNode = (PNode*)node;
 
-  Vector nodeRelCoord = tmpNode->getRelCoor();
+  Vector nodeRelCoord = *tmpNode->getRelCoor();
   float minDist = 100000000;
   int childNumber = 0;
@@ -910,5 +922,4 @@
 void TrackManager::drawGraph(float dt) const
 {
-
   for (int i = 1; i <= trackElemCount; i++)
     {
@@ -922,5 +933,5 @@
 	    glVertex3f(tmpVector.x, tmpVector.y, tmpVector.z);
 	  }
-  glEnd();
+      glEnd();
     }
 }
Index: orxonox/branches/levelloader/src/track_manager.h
===================================================================
--- orxonox/branches/levelloader/src/track_manager.h	(revision 3606)
+++ orxonox/branches/levelloader/src/track_manager.h	(revision 3746)
@@ -12,10 +12,10 @@
 #define _TRACK_MANAGER_H
 
-#include "stdincl.h"
 #include "curve.h"
 #include "substring.h"
+#include "base_object.h"
 
 class PNode;
-class TrackNamer;
+template<class T> class tList;
 
 // Static Definitions
Index: orxonox/branches/levelloader/src/track_node.cc
===================================================================
--- orxonox/branches/levelloader/src/track_node.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/track_node.cc	(revision 3746)
@@ -46,5 +46,5 @@
   this->trackManager = TrackManager::getInstance();
   this->setMode(PNODE_ALL);
-  this->absCoordinate = *absCoordinate;
+  this->absCoordinate = absCoordinate;
 }
 
Index: orxonox/branches/levelloader/src/world_entities/environment.cc
===================================================================
--- orxonox/branches/levelloader/src/world_entities/environment.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/environment.cc	(revision 3746)
@@ -30,5 +30,6 @@
 Environment::Environment () : WorldEntity()
 {
-  this->model = new OBJModel("../data/models/fighter.obj");
+  this->model = (Model*) ResourceManager::getInstance()->load("cube", RP_LEVEL);
+  //  this->model = new OBJModel("../data/models/fighter.obj");
 }
 
@@ -54,9 +55,9 @@
 	string = grabParameter( root, "model");
 	if( string != NULL)
-		this->model = new OBJModel( string);
+  	this->model = (Model*) ResourceManager::getInstance()->load( string, RP_LEVEL);
 	else
 	{
 		PRINTF0("Environment is missing a proper 'model'\n");
-		this->model = new OBJModel( "../data/models/reaplow.obj");
+  	this->model = (Model*) ResourceManager::getInstance()->load( "cube", RP_LEVEL);
 	}
 	if( this->model == NULL)
Index: orxonox/branches/levelloader/src/world_entities/player.cc
===================================================================
--- orxonox/branches/levelloader/src/world_entities/player.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/player.cc	(revision 3746)
@@ -20,10 +20,13 @@
 #include "player.h"
 
+#include "track_manager.h"
+#include "objModel.h"
+#include "resource_manager.h"
+#include "weapon.h"
+#include "test_gun.h"
+#include "world.h"
+
+#include "list.h"
 #include "stdincl.h"
-//#include "collision.h"
-#include "objModel.h"
-#include "list.h"
-#include "weapon.h"
-#include "track_manager.h"
 
 using namespace std;
@@ -35,15 +38,23 @@
    \param isFree if the player is free
 */
-Player::Player(bool isFree) : WorldEntity(isFree)
-{
-  this->model = new OBJModel("../data/models/reaplow.obj");
+Player::Player() : WorldEntity()
+{
   this->weapons = new tList<Weapon>();
   this->activeWeapon = NULL;
-
+  /*
+    this is the debug player - actualy we would have to make a new
+     class derivated from Player for each player. for now, we just use
+     the player.cc for debug also
+  */
+  this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
   travelSpeed = 15.0;
-  velocity = Vector();
+  velocity = new Vector();
   bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
   bFire = false;
   acceleration = 10.0;
+  //weapons:
+  Weapon* wp = new TestGun(this, new Vector(-1.1, 0.0, 2.6), new Quaternion());
+  this->weapons->add(wp);
+  this->activeWeapon = wp;  
 }
 
@@ -53,13 +64,9 @@
 Player::~Player ()
 {
-  Weapon* w = this->weapons->enumerate(); 
-  while( w != NULL) 
-    { 
-      delete w;
-      w = this->weapons->nextElement();
-    }
+  /* do not delete the weapons, they are contained in the pnode tree
+     and will be deleted there.
+     this only frees the memory allocated to save the list.
+  */
   delete this->weapons;
-  
-  //delete this->velocity;
 }
 
@@ -94,9 +101,9 @@
 	string = grabParameter( root, "model");
 	if( string != NULL)
-		this->model = new OBJModel( string);
+  	this->model = (Model*)ResourceManager::getInstance()->load(string, OBJ, RP_CAMPAIGN);
 	else
 	{
 		PRINTF0("Player is missing a proper 'model'\n");
-		this->model = new OBJModel( "../data/models/reaplow.obj");
+  	this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
 	}
 	if( this->model == NULL)
@@ -104,4 +111,21 @@
 		PRINTF0("Player model '%s' could not be loaded\n", string);
 	}
+	
+	this->weapons = new tList<Weapon>();
+  this->activeWeapon = NULL;
+  /*
+    this is the debug player - actualy we would have to make a new
+     class derivated from Player for each player. for now, we just use
+     the player.cc for debug also
+  */
+  travelSpeed = 15.0;
+  velocity = new Vector();
+  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
+  bFire = false;
+  acceleration = 10.0;
+  //weapons:
+  Weapon* wp = new TestGun(this, new Vector(-1.1, 0.0, 2.6), new Quaternion());
+  this->weapons->add(wp);
+  this->activeWeapon = wp; 
 }
 
@@ -192,8 +216,10 @@
 void Player::tick (float time)
 {
+  /* link tick to weapon */
+  this->activeWeapon->tick(time);
   // player controlled movement
-  this->move (time);
+  this->move(time);
   // weapon system manipulation
-  this->fire();
+  this->weapon();
 }
 
@@ -214,11 +240,11 @@
   //orthDirection = orthDirection.cross (direction);
 
-  if( this->bUp && this->getRelCoor().x < 20)
+  if( this->bUp && this->getRelCoor()->x < 20)
     accel = accel+(direction*acceleration);
-  if( this->bDown && this->getRelCoor().x > -5)
+  if( this->bDown && this->getRelCoor()->x > -5)
     accel = accel-(direction*acceleration);
-  if( this->bLeft &&  TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2)
+  if( this->bLeft &&  TrackManager::getInstance()->getWidth() > -this->getRelCoor()->z*2)
     accel = accel - (orthDirection*acceleration); 
-  if( this->bRight &&  TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
+  if( this->bRight &&  TrackManager::getInstance()->getWidth() > this->getRelCoor()->z*2)
     accel = accel + (orthDirection*acceleration);
   if( this->bAscend )
@@ -233,15 +259,18 @@
    \brief weapon manipulation by the player
 */
-void Player::fire()
-{
-  if(this->bFire)
+void Player::weapon()
+{
+  if( this->bFire)
     {
       if(this->activeWeapon != NULL)
 	this->activeWeapon->fire();
     }
-  if(this->bWeaponChange)
+  if( this->bWeaponChange && this->weapons->getSize() > 1)
     {
-      Weapon* w = this->weapons->enumerate(); 
+      PRINTF(1)("changing the weapon of the player: deactivate old, activate new\n");
+      this->activeWeapon->deactivate();
+      //this->weapons->enumerate();  FIX: strang weapon change...
       this->activeWeapon = this->weapons->nextElement(this->activeWeapon);
+      this->activeWeapon->activate();
     }
 }
Index: orxonox/branches/levelloader/src/world_entities/player.h
===================================================================
--- orxonox/branches/levelloader/src/world_entities/player.h	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/player.h	(revision 3746)
@@ -10,6 +10,7 @@
 
 template<class T> class tList;
-class OBJModel;
 class Weapon;
+class Vector;
+class World;
 
 //! Basic controllable WorldEntity
@@ -19,5 +20,5 @@
   
  public:
-  Player(bool isFree = false);
+  Player();
   Player(TiXmlElement* root);
   virtual ~Player();
@@ -48,11 +49,12 @@
   tList<Weapon>* weapons;//!< a list of weapon
   Weapon* activeWeapon;  //!< the weapon that is currenty activated
+  World* myWorld;        //!< reference to the world object
 
-  Vector velocity;       //!< the velocity of the player.
+  Vector* velocity;       //!< the velocity of the player.
   float travelSpeed;     //!< the current speed of the player (to make soft movement)
   float acceleration;    //!< the acceleration of the player.
   
   void move(float time);
-  void fire(void);
+  void weapon(void);
   
 };
Index: orxonox/branches/levelloader/src/world_entities/primitive.cc
===================================================================
--- orxonox/branches/levelloader/src/world_entities/primitive.cc	(revision 3606)
+++ 	(revision )
@@ -1,99 +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: Patrick Boenzli
-   co-programmer: 
-*/
-
-
-#include "primitive.h"
-#include "stdincl.h"
-#include "world_entity.h"
-#include "vector.h"
-#include "objModel.h"
-
-using namespace std;
-
-
-
-/**
-   \brief standard constructor
-*/
-Primitive::Primitive (PRIMITIVE_FORM form) : WorldEntity()
-{
-  //this->model = new OBJModel("../data/models/fighter.obj");
-  //this->model = new OBJModel("");
-  this->object = gluNewQuadric();
-  
-  gluQuadricTexture(this->object, GL_TRUE);
-
-  this->material = new Material("Sphere");
-  this->material->setDiffuseMap("../data/pictures/load_screen.jpg");
-  this->material->setIllum(3);
-  this->material->setSpecular(1, 1, 1);
-}
-
-
-/**
-   \brief standard deconstructor
-*/
-Primitive::~Primitive () 
-{
-  delete this->material;
-  free(this->object);
-}
-
-/**
-   \brief called, when the object gets hit
-   \param other object, that hits it
-   \param location of impact
-*/
-void Primitive::hit (WorldEntity* weapon, Vector* loc) {}
-
-
-/**
-   \brief object collides
-*/
-void Primitive::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
-
-
-/**
-   \brief tick singal put everything here, that is timedependent
-   \param time in sec
-*/
-void Primitive::tick (float time) 
-{
-  //  Vector v(0.0, 0.0, 1.0);
-  //  Quaternion q(10.0, v);
-  //  this->setRelDir(&(this->relDirection * q));
-}
-
-/**
-   \brief drawing function of the object
-*/
-void Primitive::draw () 
-{
-  glMatrixMode(GL_MODELVIEW);
-  glPushMatrix();
-
-  float matrix[4][4];
-  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
-  //rotate
-  //this->getAbsDir().matrix (matrix);
-  //glMultMatrixf((float*)matrix);
-  this->material->select();
-  gluSphere(this->object, 2, 20, 20);
-
-  glPopMatrix();
-}
-
Index: orxonox/branches/levelloader/src/world_entities/primitive.h
===================================================================
--- orxonox/branches/levelloader/src/world_entities/primitive.h	(revision 3606)
+++ 	(revision )
@@ -1,27 +1,0 @@
-#ifndef _PRIMITIVE_H
-#define _PRIMITIVE_H
-
-#include "world_entity.h"
-
-typedef enum PRIMITIVE_FORM {PSPHERE = 0, PCUBE, PSQUARE};
-
-class Primitive : public WorldEntity 
-{
-  friend class World;
-
- public:
-  Primitive (PRIMITIVE_FORM form);
-  virtual ~Primitive ();
-
-  virtual void tick (float time);
-  virtual void hit (WorldEntity* weapon, Vector* loc);
-  virtual void collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags);
-  virtual void draw ();
-
- private:
-  GLUquadricObj *object; //!< the object to be rendered
-  Material *material;    //!< A Material for the SkySphere.
-
-};
-
-#endif /* _PRIMITIVE_H */
Index: orxonox/branches/levelloader/src/world_entities/projectile.cc
===================================================================
--- orxonox/branches/levelloader/src/world_entities/projectile.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/projectile.cc	(revision 3746)
@@ -18,8 +18,10 @@
 
 #include "projectile.h"
-#include "stdincl.h"
+
 #include "world_entity.h"
+#include "weapon.h"
+#include "null_parent.h"
+#include "model.h"
 #include "vector.h"
-#include "objModel.h"
 
 using namespace std;
@@ -29,7 +31,12 @@
    \brief standard constructor
 */
-Projectile::Projectile () : WorldEntity()
+Projectile::Projectile (Weapon* weapon) : WorldEntity()
 {
-  this->model = new OBJModel("");
+  this->model = (Model*)ResourceManager::getInstance()->load("sphere", PRIM, RP_LEVEL);
+  this->weapon = weapon;
+  this->flightDirection = NULL;
+  this->currentLifeTime = 0.0f;
+  this->ttl = 0.75f; /* sec */
+  this->speed = 2.0f;
 }
 
@@ -40,7 +47,49 @@
 Projectile::~Projectile () 
 {
-
+  /* 
+     do not delete the test projectModel, since it is pnode 
+     and will be cleaned out by world 
+  */
+  //delete this->projectileModel;
 }
 
+
+/**
+   \brief this sets the flight direction of the projectile
+   \param directin in which to flight
+
+   this function will calculate a vector out of this to be used in the
+   tick function
+*/
+void Projectile::setFlightDirection(Quaternion flightDirection)
+{
+  if( this->flightDirection == NULL)
+    this->flightDirection = new Vector();
+  Vector v(1, 0, 0);
+  *this->flightDirection = flightDirection.apply(v);
+  this->flightDirection->normalize();
+}
+
+
+/**
+   \brief this sets the time to life of the projectile
+   \param ttl in second
+
+   after this life time, the projectile will garbage collect itself
+*/
+void Projectile::setTTL(float ttl)
+{
+  this->ttl = ttl;
+}
+
+
+/**
+   \brief sets the speed of the projectile
+*/
+void Projectile::setSpeed(float speed)
+{
+  this->speed = speed * 3; /* fix speed settings */
+  PRINTF(4)("Projectile::setting speed to: %f\n", this->speed);
+}
 
 /**
@@ -49,5 +98,18 @@
 */
 void Projectile::tick (float time) 
-{}
+{
+  Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.7);
+  this->shiftCoor(v);
+
+  this->currentLifeTime += time;
+  if( this->ttl < this->currentLifeTime)
+    {
+      PRINTF(5)("FINALIZE==========================\n");
+      PRINTF(5)("current life time is: %f/%f\n", this->currentLifeTime, this->ttl);
+      PRINTF(5)("FINALIZE===========================\n");
+      this->finalize();
+      this->currentLifeTime = 0.0f;
+    }
+}
 
 /**
Index: orxonox/branches/levelloader/src/world_entities/projectile.h
===================================================================
--- orxonox/branches/levelloader/src/world_entities/projectile.h	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/projectile.h	(revision 3746)
@@ -2,4 +2,18 @@
     \projectile.h
     \brief a projectile, that is been shooted by a weapon
+
+    You can use this class to make some shoots, but this isn't the real idea. If you want to just test, if the
+    shooting funcions work, use the Projectile class. But if you want to implement your own shoots its 
+    different:<br>
+    Make a new class and derive it from Projectile. To have a weapon work well, reimplement the functions
+    - void tick()
+    - void draw()
+    - void hit() (only if you have working collision detection)
+    When you have implemented these functions you have just to add the projectiles to your weapon. You ll want 
+    to make this by looking into the function 
+    - Weapon::fire()
+    there you just change the line:
+    Projectile* pj = new Projectile();    TO     Projectile* pj = new MyOwnProjectileClass();
+    and schwups it works... :)
 */
 
@@ -9,4 +23,6 @@
 #include "world_entity.h"
 
+class Vector;
+class Weapon;
 
 class Projectile : public WorldEntity 
@@ -15,6 +31,10 @@
 
  public:
-  Projectile ();
+  Projectile (Weapon* weapon);
   virtual ~Projectile ();
+
+  void setFlightDirection(Quaternion flightDirection);
+  void setSpeed(float speed);
+  void setTTL(float ttl);
 
   virtual void hit (WorldEntity* weapon, Vector* loc);
@@ -24,7 +44,12 @@
   virtual void draw ();
 
- private:
+ protected:
   //physical attriutes like: force, speed, acceleration etc.
-
+  float speed;                         //!< this is the speed of the projectile
+  float currentLifeTime;               //!< this is the time, the projectile exists in this world (incremented by tick)
+  float ttl;                           //!< time to life, after this time, the projectile will garbage collect itself
+  Vector* flightDirection;             //!< direction in which the shoot flights
+  Weapon* weapon;                      //!< weapon the shoot belongs to
+  
 };
 
Index: orxonox/branches/levelloader/src/world_entities/skysphere.cc
===================================================================
--- orxonox/branches/levelloader/src/world_entities/skysphere.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/skysphere.cc	(revision 3746)
@@ -26,9 +26,12 @@
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
 
-#include "material.h"
+
 #include "skysphere.h"
 #include "stdincl.h"
+
+#include "material.h"
 #include "vector.h"
-#include "world_entity.h"
+//#include "world_entity.h"
+
 
 using namespace std;
@@ -100,7 +103,6 @@
   glPushMatrix();
   glMatrixMode(GL_MODELVIEW);
-  glTranslatef(this->absCoordinate.x,
-	       this->absCoordinate.y,
-	       this->absCoordinate.z);
+  Vector r = this->getAbsCoor();
+  glTranslatef(r.x, r.y, r.z);
 
   //glRotatef(-30, 1, 0, 0);
Index: orxonox/branches/levelloader/src/world_entities/skysphere.h
===================================================================
--- orxonox/branches/levelloader/src/world_entities/skysphere.h	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/skysphere.h	(revision 3746)
@@ -14,5 +14,4 @@
 
 /* INCLUDES */
-#include "p_node.h"
 #include "world_entity.h"
 
Index: orxonox/branches/levelloader/src/world_entities/terrain.cc
===================================================================
--- orxonox/branches/levelloader/src/world_entities/terrain.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/terrain.cc	(revision 3746)
@@ -16,5 +16,7 @@
 
 #include "terrain.h"
-
+#include "stdincl.h"
+#include "model.h"
+#include "vector.h"
 #include "glincl.h"
 
@@ -43,5 +45,5 @@
   if (strstr(fileName, ".obj") || strstr(fileName, ".OBJ"))
     {
-      this->model = (OBJModel*)new OBJModel(fileName);
+      this->model = (Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_LEVEL);
     }
   else
Index: orxonox/branches/levelloader/src/world_entities/test_bullet.cc
===================================================================
--- orxonox/branches/levelloader/src/world_entities/test_bullet.cc	(revision 3746)
+++ orxonox/branches/levelloader/src/world_entities/test_bullet.cc	(revision 3746)
@@ -0,0 +1,100 @@
+
+
+/* 
+   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: Patrick Boenzli
+   co-programmer: 
+*/
+
+
+#include "test_bullet.h"
+
+#include "world_entity.h"
+#include "weapon.h"
+#include "null_parent.h"
+#include "model.h"
+#include "vector.h"
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+*/
+TestBullet::TestBullet (Weapon* weapon) : Projectile(weapon)
+{}
+
+
+/**
+   \brief standard deconstructor
+*/
+TestBullet::~TestBullet () 
+{
+  /* 
+     do not delete the test projectModel, since it is pnode 
+     and will be cleaned out by world 
+  */
+  //delete this->projectileModel;
+}
+
+
+
+/**
+   \brief signal tick, time dependent things will be handled here
+   \param time since last tick
+*/
+void TestBullet::tick (float time) 
+{
+  Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.7);
+  this->shiftCoor(v);
+
+  this->currentLifeTime += time;
+  if( this->ttl < this->currentLifeTime)
+    {
+      PRINTF(5)("FINALIZE==========================\n");
+      PRINTF(5)("current life time is: %f/%f\n", this->currentLifeTime, this->ttl);
+      PRINTF(5)("FINALIZE===========================\n");
+      this->finalize();
+      this->currentLifeTime = 0.0f;
+    }
+}
+
+/**
+   \brief the projectile gets hit by another entity
+   \param the other entity
+   \param place where it is hit
+*/
+void TestBullet::hit (WorldEntity* entity, Vector* place) 
+{}
+
+
+/**
+   \brief the function gets called, when the projectile is destroyed
+*/
+void TestBullet::destroy () 
+{}
+
+
+void TestBullet::draw () 
+{
+  glMatrixMode(GL_MODELVIEW);
+  glPushMatrix();
+
+  float matrix[4][4];  
+  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
+  this->getAbsDir().matrix (matrix);
+  glMultMatrixf((float*)matrix);  
+  this->model->draw();
+
+  glPopMatrix();
+}
+
Index: orxonox/branches/levelloader/src/world_entities/test_bullet.h
===================================================================
--- orxonox/branches/levelloader/src/world_entities/test_bullet.h	(revision 3746)
+++ orxonox/branches/levelloader/src/world_entities/test_bullet.h	(revision 3746)
@@ -0,0 +1,30 @@
+/*! 
+    \projectile.h
+    \brief a projectile, that is been shooted by a weapon
+*/
+
+#ifndef _TEST_BULLET_H
+#define _TEST_BULLET_H
+
+#include "projectile.h"
+
+class Vector;
+class Weapon;
+
+class TestBullet : public Projectile 
+{
+  friend class World;
+
+ public:
+  TestBullet (Weapon* weapon);
+  virtual ~TestBullet ();
+
+  virtual void hit (WorldEntity* weapon, Vector* loc);
+  virtual void destroy ();
+
+  virtual void tick (float time);
+  virtual void draw ();
+  
+};
+
+#endif /* _TEST_BULLET_H */
Index: orxonox/branches/levelloader/src/world_entities/test_gun.cc
===================================================================
--- orxonox/branches/levelloader/src/world_entities/test_gun.cc	(revision 3746)
+++ orxonox/branches/levelloader/src/world_entities/test_gun.cc	(revision 3746)
@@ -0,0 +1,149 @@
+
+
+/* 
+   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: Patrick Boenzli
+   co-programmer: 
+
+
+   \todo: direction in which the projectile flights
+   \todo: a target to set/hit
+*/
+
+
+#include "test_gun.h"
+
+#include "stdincl.h"
+#include "world_entity.h"
+#include "model.h"
+#include "test_bullet.h"
+
+#include "vector.h"
+#include "list.h"
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+
+   creates a new weapon
+*/
+TestGun::TestGun (PNode* parent, Vector* coordinate, Quaternion* direction) 
+  :  Weapon (parent, coordinate, direction) 
+{
+  this->idleTime = 0.2f;
+}
+
+
+/**
+   \brief standard deconstructor
+*/
+TestGun::~TestGun () 
+{
+  // model will be deleted from WorldEntity-destructor
+}
+
+
+/**
+   \brief this activates the weapon
+
+   This is needed, since there can be more than one weapon on a ship. the 
+   activation can be connected with an animation. for example the weapon is 
+   been armed out. 
+*/
+void TestGun::activate()
+{}
+
+
+/**
+   \brief this deactivates the weapon
+
+   This is needed, since there can be more than one weapon on a ship. the 
+   activation can be connected with an animation. for example the weapon is 
+   been armed out.
+*/
+void TestGun::deactivate()
+{}
+
+
+/**
+   \brief fires the weapon
+   
+   this is called from the player.cc, when fire-button is been pushed
+*/
+void TestGun::fire()
+{
+  if( this->localTime < this->idleTime)
+    {
+      this->weaponIdle();
+      return;
+    }
+  Projectile* pj = new TestBullet(this);
+
+  pj->setAbsCoor(this->getAbsCoor());
+  pj->setAbsDir(this->getAbsDir());
+
+  pj->setFlightDirection(this->getAbsDir());
+  pj->setSpeed(this->getSpeed());
+
+  this->worldEntities->add(pj);
+  this->localTime = 0;
+}
+
+
+/**
+   \brief is called, when the weapon gets hit (=collide with something)
+   \param from which entity it is been hit
+   \param where it is been hit
+
+   this may not be used, since it would make the game relay complicated when one
+   can destroy the weapons of enemies or vice versa.
+*/
+void TestGun::hit (WorldEntity* entity, Vector* position) 
+{}
+
+
+/**
+   \brief is called, when the weapon is destroyed
+
+   this is in conjunction with the hit function, so when a weapon is able to get
+   hit, it can also be destoryed.
+*/
+void TestGun::destroy () 
+{}
+
+
+/**
+   \brief tick signal for time dependent/driven stuff
+*/
+void TestGun::tick (float time) 
+{
+  this->localTime += time;
+  //this->debug();
+  //printf("TEST_GUN: this speed is: %f\n", this->getSpeed());
+}
+
+
+/**
+   \brief is called, when there is no fire button pressed
+*/
+void TestGun::weaponIdle()
+{}
+
+
+/**
+   \brief this will draw the weapon
+*/
+void TestGun::draw () 
+{}
+
Index: orxonox/branches/levelloader/src/world_entities/test_gun.h
===================================================================
--- orxonox/branches/levelloader/src/world_entities/test_gun.h	(revision 3746)
+++ orxonox/branches/levelloader/src/world_entities/test_gun.h	(revision 3746)
@@ -0,0 +1,54 @@
+/*! 
+    \file weapon.h
+    \brief a weapon that a player can use
+
+    A Player has a list of weapons, that can be choosen to shoot projectiles
+    (projectiles.{cc,h}) at ennemies. These weapons can be shooted sequentially
+    or (if able) combined. Therefore you can choose the weapon mode = choose
+    a weapon.
+
+    A weapon is characterized by:
+     o firing-rate: the initial firing rate of a weapon (1/s = Herz)
+     o slowdown-factor: this is a factor d: exp(-d*x), d is element of all positive R. it determines how fast the firing-rate will slow down. if no slowdown: d=0, the bigger d is, the faster the weapon will slow down!
+     o energy-consumption: this determines the energy that has to be used to produce this projectile = costs per projectile
+    
+    Furthermore there are some other attributes, that will help to represent a firing
+    weapon in this world:
+     o sound file/ressource: this is a pointer to the sound-file/ressource. however it may be represented
+     o shooting animation
+     
+*/
+
+
+#ifndef _TEST_GUN_H
+#define _TEST_GUN_H
+
+#include "weapon.h"
+
+class Projectile;
+class Vector;
+class Quaternion;
+
+
+class TestGun : public Weapon
+{
+  friend class World;
+
+ public:
+  TestGun (PNode* parent, Vector* coordinate, Quaternion* direction);
+  virtual ~TestGun ();
+
+  virtual void activate(void);
+  virtual void deactivate(void);
+
+  virtual void fire(void);
+  virtual void hit (WorldEntity* weapon, Vector* loc);
+  virtual void destroy(void);
+  
+  virtual void tick(float time);
+  virtual void weaponIdle(void);
+  virtual void draw(void);
+
+};
+
+#endif /* _TEST_GUN_H */
Index: orxonox/branches/levelloader/src/world_entities/weapon.cc
===================================================================
--- orxonox/branches/levelloader/src/world_entities/weapon.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/weapon.cc	(revision 3746)
@@ -21,6 +21,8 @@
 #include "world_entity.h"
 #include "vector.h"
-#include "objModel.h"
+#include "model.h"
 #include "projectile.h"
+#include "list.h"
+#include "world.h"
 
 using namespace std;
@@ -32,6 +34,13 @@
    creates a new weapon
 */
-Weapon::Weapon () : WorldEntity()
-{}
+Weapon::Weapon (PNode* parent, Vector* coordinate, Quaternion* direction) 
+  : WorldEntity()
+{
+  parent->addChild(this, PNODE_ROTATE_AND_MOVE);
+  this->setRelCoor(coordinate);
+  this->setRelDir(direction);
+  WorldInterface* wi = WorldInterface::getInstance();
+  this->worldEntities = wi->getEntityList();
+}
 
 
@@ -145,5 +154,7 @@
 */
 void Weapon::setWeaponIdleTime(float time)
-{}
+{
+  this->idleTime = time;
+}
 
 /**
@@ -155,5 +166,7 @@
 */
 float Weapon::getWeaponIdleTime(void)
-{}
+{
+  return this->idleTime;
+}
 
 /**
@@ -165,5 +178,7 @@
 */
 bool Weapon::hasWeaponIdleTimeElapsed(void)
-{}
+{
+  return (this->localTime>this->idleTime)?true:false;
+}
 
 
Index: orxonox/branches/levelloader/src/world_entities/weapon.h
===================================================================
--- orxonox/branches/levelloader/src/world_entities/weapon.h	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/weapon.h	(revision 3746)
@@ -43,5 +43,5 @@
 
  public:
-  Weapon ();
+  Weapon (PNode* parent, Vector* coordinate, Quaternion* direction);
   virtual ~Weapon ();
   
@@ -57,9 +57,9 @@
   bool isActive(void);
 
-  virtual void setWeaponIdleTime(float time);
-  virtual float getWeaponIdleTime(void);
-  virtual bool hasWeaponIdleTimeElapsed(void);
+  void setWeaponIdleTime(float time);
+  float getWeaponIdleTime(void);
+  bool hasWeaponIdleTimeElapsed(void);
 
-  virtual void fire(void);
+  virtual void fire(void) = 0;
   virtual void hit (WorldEntity* weapon, Vector* loc);
   virtual void destroy(void);
@@ -69,12 +69,14 @@
   virtual void draw(void);
 
+ protected:
+  tList<WorldEntity>* worldEntities;
+  float localTime;
+  float idleTime;
+  float slowDownFactor;
 
  private:
   bool enabled;
-  float localTime;
-  float slowDownFactor;
   Projectile* projectile;
   //WeaponSound sound;
-
 };
 
Index: orxonox/branches/levelloader/src/world_entities/world_entity.cc
===================================================================
--- orxonox/branches/levelloader/src/world_entities/world_entity.cc	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/world_entity.cc	(revision 3746)
@@ -19,5 +19,8 @@
 
 #include "world_entity.h"
-#include "stdincl.h"
+#include "objModel.h"
+#include "list.h"
+
+//#include "stdincl.h"
 //#include "collision.h"
 
@@ -48,5 +51,6 @@
 {
   // if( collisioncluster != NULL) delete collisioncluster;
-  delete this->model;
+  if (this->model)
+    ResourceManager::getInstance()->unload(this->model);
 }
 
@@ -167,5 +171,5 @@
    Handle all stuff that should update with time inside this method (movement, animation, etc.)
 */
-void WorldEntity::tick(float time) 
+inline void WorldEntity::tick(float time) 
 {
 }
@@ -177,5 +181,5 @@
    This is a central function of an entity: call it to let the entity painted to the screen. Just override this function with whatever you want to be drawn.
 */
-void WorldEntity::draw() 
+inline void WorldEntity::draw() 
 {}
 
Index: orxonox/branches/levelloader/src/world_entities/world_entity.h
===================================================================
--- orxonox/branches/levelloader/src/world_entities/world_entity.h	(revision 3606)
+++ orxonox/branches/levelloader/src/world_entities/world_entity.h	(revision 3746)
@@ -7,10 +7,12 @@
 #define _WORLD_ENTITY_H
 
-#include "stdincl.h"
 #include "p_node.h"
-#include "objModel.h"
+#include "comincl.h"
+#include "resource_manager.h"
+
 
 //class CollisionCluster;
 class CharacterAttributes;
+class Model;
 
 
@@ -48,5 +50,5 @@
   
  protected:
-  OBJModel* model;                  //!< The model that should be loaded for this entity.
+  Model* model;                  //!< The model that should be loaded for this entity.
   CharacterAttributes* charAttr;      //!< the character attributes of a world_entity
   
