Index: orxonox/branches/physics/src/Makefile.am
===================================================================
--- orxonox/branches/physics/src/Makefile.am	(revision 3866)
+++ orxonox/branches/physics/src/Makefile.am	(revision 3953)
@@ -17,4 +17,7 @@
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/glmenu
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/ai
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/animation
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/common
 
 
@@ -30,10 +33,10 @@
 		 command_node.cc \
 		 keynames.cc \
-		 camera.cc \
+		 world_entities/camera.cc \
 		 track_manager.cc \
 		 track_node.cc \
-		 animation.cc \
-		 animation3d.cc \
-		 animation_player.cc \
+		 util/animation/animation.cc \
+		 util/animation/animation3d.cc \
+		 util/animation/animation_player.cc \
 		 garbage_collector.cc \
 		 story_entities/story_entity.cc \
@@ -69,6 +72,6 @@
 		 lib/lang/base_object.cc \
 		 lib/util/ini_parser.cc \
-		 lib/util/list.cc \
-		 lib/util/resource_manager.cc \
+		 util/common/list.cc \
+		 util/resource_manager.cc \
 		 lib/math/vector.cc \
 		 lib/math/curve.cc \
@@ -79,5 +82,5 @@
 		 track_manager.h \
                  ability.h \
-		 camera.h \
+		 world_entities/camera.h \
 		 keynames.h \
 		 command_node.h \
@@ -85,8 +88,8 @@
 		 track_manager.h \
 		 track_node.h \
-		 animation.h \
-		 t_animation.h \
-		 animation3d.h \
-		 animation_player.h \
+		 util/animation/animation.h \
+		 util/animation/t_animation.h \
+		 util/animation/animation3d.h \
+		 util/animation/animation_player.h \
 		 garbage_collector.h \
 		 story_entities/story_entity.h \
@@ -125,7 +128,7 @@
 		 lib/lang/base_entity.h \
 		 lib/lang/base_object.h \
-		 lib/util/list.h \
-		 lib/util/list_template.h \
-		 lib/util/resource_manager.h \
+		 util/common/list.h \
+		 util/common/list_template.h \
+		 util/resource_manager.h \
 		 lib/util/ini_parser.h \
 		 lib/math/vector.h \
Index: orxonox/branches/physics/src/Makefile.in
===================================================================
--- orxonox/branches/physics/src/Makefile.in	(revision 3866)
+++ orxonox/branches/physics/src/Makefile.in	(revision 3953)
@@ -237,5 +237,5 @@
 target_vendor = @target_vendor@
 MAINSRCDIR = .
-AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -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_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -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 -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common
 AM_LDFLAGS = $(MWINDOWS)
 orxonox_SOURCES = orxonox.cc \
@@ -243,10 +243,10 @@
 		 command_node.cc \
 		 keynames.cc \
-		 camera.cc \
+		 world_entities/camera.cc \
 		 track_manager.cc \
 		 track_node.cc \
-		 animation.cc \
-		 animation3d.cc \
-		 animation_player.cc \
+		 util/animation/animation.cc \
+		 util/animation/animation3d.cc \
+		 util/animation/animation_player.cc \
 		 garbage_collector.cc \
 		 story_entities/story_entity.cc \
@@ -282,6 +282,6 @@
 		 lib/lang/base_object.cc \
 		 lib/util/ini_parser.cc \
-		 lib/util/list.cc \
-		 lib/util/resource_manager.cc \
+		 util/common/list.cc \
+		 util/resource_manager.cc \
 		 lib/math/vector.cc \
 		 lib/math/curve.cc \
@@ -292,5 +292,5 @@
 		 track_manager.h \
                  ability.h \
-		 camera.h \
+		 world_entities/camera.h \
 		 keynames.h \
 		 command_node.h \
@@ -298,8 +298,8 @@
 		 track_manager.h \
 		 track_node.h \
-		 animation.h \
-		 t_animation.h \
-		 animation3d.h \
-		 animation_player.h \
+		 util/animation/animation.h \
+		 util/animation/t_animation.h \
+		 util/animation/animation3d.h \
+		 util/animation/animation_player.h \
 		 garbage_collector.h \
 		 story_entities/story_entity.h \
@@ -338,7 +338,7 @@
 		 lib/lang/base_entity.h \
 		 lib/lang/base_object.h \
-		 lib/util/list.h \
-		 lib/util/list_template.h \
-		 lib/util/resource_manager.h \
+		 util/common/list.h \
+		 util/common/list_template.h \
+		 util/resource_manager.h \
 		 lib/util/ini_parser.h \
 		 lib/math/vector.h \
@@ -490,4 +490,68 @@
 @am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
+camera.o: world_entities/camera.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT camera.o -MD -MP -MF "$(DEPDIR)/camera.Tpo" -c -o camera.o `test -f 'world_entities/camera.cc' || echo '$(srcdir)/'`world_entities/camera.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/camera.Tpo" "$(DEPDIR)/camera.Po"; else rm -f "$(DEPDIR)/camera.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/camera.cc' object='camera.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/camera.Po' tmpdepfile='$(DEPDIR)/camera.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 camera.o `test -f 'world_entities/camera.cc' || echo '$(srcdir)/'`world_entities/camera.cc
+
+camera.obj: world_entities/camera.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT camera.obj -MD -MP -MF "$(DEPDIR)/camera.Tpo" -c -o camera.obj `if test -f 'world_entities/camera.cc'; then $(CYGPATH_W) 'world_entities/camera.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/camera.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/camera.Tpo" "$(DEPDIR)/camera.Po"; else rm -f "$(DEPDIR)/camera.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/camera.cc' object='camera.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/camera.Po' tmpdepfile='$(DEPDIR)/camera.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 camera.obj `if test -f 'world_entities/camera.cc'; then $(CYGPATH_W) 'world_entities/camera.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/camera.cc'; fi`
+
+animation.o: util/animation/animation.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation.o -MD -MP -MF "$(DEPDIR)/animation.Tpo" -c -o animation.o `test -f 'util/animation/animation.cc' || echo '$(srcdir)/'`util/animation/animation.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/animation.Tpo" "$(DEPDIR)/animation.Po"; else rm -f "$(DEPDIR)/animation.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/animation/animation.cc' object='animation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/animation.Po' tmpdepfile='$(DEPDIR)/animation.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 animation.o `test -f 'util/animation/animation.cc' || echo '$(srcdir)/'`util/animation/animation.cc
+
+animation.obj: util/animation/animation.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation.obj -MD -MP -MF "$(DEPDIR)/animation.Tpo" -c -o animation.obj `if test -f 'util/animation/animation.cc'; then $(CYGPATH_W) 'util/animation/animation.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/animation.Tpo" "$(DEPDIR)/animation.Po"; else rm -f "$(DEPDIR)/animation.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/animation/animation.cc' object='animation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/animation.Po' tmpdepfile='$(DEPDIR)/animation.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 animation.obj `if test -f 'util/animation/animation.cc'; then $(CYGPATH_W) 'util/animation/animation.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation.cc'; fi`
+
+animation3d.o: util/animation/animation3d.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation3d.o -MD -MP -MF "$(DEPDIR)/animation3d.Tpo" -c -o animation3d.o `test -f 'util/animation/animation3d.cc' || echo '$(srcdir)/'`util/animation/animation3d.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/animation3d.Tpo" "$(DEPDIR)/animation3d.Po"; else rm -f "$(DEPDIR)/animation3d.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/animation/animation3d.cc' object='animation3d.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/animation3d.Po' tmpdepfile='$(DEPDIR)/animation3d.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 animation3d.o `test -f 'util/animation/animation3d.cc' || echo '$(srcdir)/'`util/animation/animation3d.cc
+
+animation3d.obj: util/animation/animation3d.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation3d.obj -MD -MP -MF "$(DEPDIR)/animation3d.Tpo" -c -o animation3d.obj `if test -f 'util/animation/animation3d.cc'; then $(CYGPATH_W) 'util/animation/animation3d.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation3d.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/animation3d.Tpo" "$(DEPDIR)/animation3d.Po"; else rm -f "$(DEPDIR)/animation3d.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/animation/animation3d.cc' object='animation3d.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/animation3d.Po' tmpdepfile='$(DEPDIR)/animation3d.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 animation3d.obj `if test -f 'util/animation/animation3d.cc'; then $(CYGPATH_W) 'util/animation/animation3d.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation3d.cc'; fi`
+
+animation_player.o: util/animation/animation_player.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_player.o -MD -MP -MF "$(DEPDIR)/animation_player.Tpo" -c -o animation_player.o `test -f 'util/animation/animation_player.cc' || echo '$(srcdir)/'`util/animation/animation_player.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/animation_player.Tpo" "$(DEPDIR)/animation_player.Po"; else rm -f "$(DEPDIR)/animation_player.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/animation/animation_player.cc' object='animation_player.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/animation_player.Po' tmpdepfile='$(DEPDIR)/animation_player.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 animation_player.o `test -f 'util/animation/animation_player.cc' || echo '$(srcdir)/'`util/animation/animation_player.cc
+
+animation_player.obj: util/animation/animation_player.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_player.obj -MD -MP -MF "$(DEPDIR)/animation_player.Tpo" -c -o animation_player.obj `if test -f 'util/animation/animation_player.cc'; then $(CYGPATH_W) 'util/animation/animation_player.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation_player.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/animation_player.Tpo" "$(DEPDIR)/animation_player.Po"; else rm -f "$(DEPDIR)/animation_player.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/animation/animation_player.cc' object='animation_player.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/animation_player.Po' tmpdepfile='$(DEPDIR)/animation_player.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 animation_player.obj `if test -f 'util/animation/animation_player.cc'; then $(CYGPATH_W) 'util/animation/animation_player.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation_player.cc'; fi`
+
 story_entity.o: story_entities/story_entity.cc
 @am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT story_entity.o -MD -MP -MF "$(DEPDIR)/story_entity.Tpo" -c -o story_entity.o `test -f 'story_entities/story_entity.cc' || echo '$(srcdir)/'`story_entities/story_entity.cc; \
@@ -1002,35 +1066,35 @@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ini_parser.obj `if test -f 'lib/util/ini_parser.cc'; then $(CYGPATH_W) 'lib/util/ini_parser.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/ini_parser.cc'; fi`
 
-list.o: lib/util/list.cc
-@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.o -MD -MP -MF "$(DEPDIR)/list.Tpo" -c -o list.o `test -f 'lib/util/list.cc' || echo '$(srcdir)/'`lib/util/list.cc; \
+list.o: util/common/list.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.o -MD -MP -MF "$(DEPDIR)/list.Tpo" -c -o list.o `test -f 'util/common/list.cc' || echo '$(srcdir)/'`util/common/list.cc; \
 @am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/list.Tpo" "$(DEPDIR)/list.Po"; else rm -f "$(DEPDIR)/list.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='lib/util/list.cc' object='list.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/common/list.cc' object='list.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/list.Po' tmpdepfile='$(DEPDIR)/list.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 list.o `test -f 'lib/util/list.cc' || echo '$(srcdir)/'`lib/util/list.cc
-
-list.obj: lib/util/list.cc
-@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.obj -MD -MP -MF "$(DEPDIR)/list.Tpo" -c -o list.obj `if test -f 'lib/util/list.cc'; then $(CYGPATH_W) 'lib/util/list.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/list.cc'; fi`; \
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.o `test -f 'util/common/list.cc' || echo '$(srcdir)/'`util/common/list.cc
+
+list.obj: util/common/list.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.obj -MD -MP -MF "$(DEPDIR)/list.Tpo" -c -o list.obj `if test -f 'util/common/list.cc'; then $(CYGPATH_W) 'util/common/list.cc'; else $(CYGPATH_W) '$(srcdir)/util/common/list.cc'; fi`; \
 @am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/list.Tpo" "$(DEPDIR)/list.Po"; else rm -f "$(DEPDIR)/list.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='lib/util/list.cc' object='list.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/common/list.cc' object='list.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/list.Po' tmpdepfile='$(DEPDIR)/list.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 list.obj `if test -f 'lib/util/list.cc'; then $(CYGPATH_W) 'lib/util/list.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/list.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_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.obj `if test -f 'util/common/list.cc'; then $(CYGPATH_W) 'util/common/list.cc'; else $(CYGPATH_W) '$(srcdir)/util/common/list.cc'; fi`
+
+resource_manager.o: 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 'util/resource_manager.cc' || echo '$(srcdir)/'`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@	source='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_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.o `test -f 'util/resource_manager.cc' || echo '$(srcdir)/'`util/resource_manager.cc
+
+resource_manager.obj: 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 'util/resource_manager.cc'; then $(CYGPATH_W) 'util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/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@	source='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`
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.obj `if test -f 'util/resource_manager.cc'; then $(CYGPATH_W) 'util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/util/resource_manager.cc'; fi`
 
 vector.o: lib/math/vector.cc
@@ -1204,5 +1268,5 @@
 
 distdir: $(DISTFILES)
-	$(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/network $(distdir)/proto $(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/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/util $(distdir)/util/animation $(distdir)/util/common $(distdir)/world_entities
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
Index: orxonox/branches/physics/src/animation.cc
===================================================================
--- orxonox/branches/physics/src/animation.cc	(revision 3866)
+++ 	(revision )
@@ -1,130 +1,0 @@
-/* 
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Benjamin Grauer
-   co-programmer: ...
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ANIM
-
-#include "animation.h"
-#include "debug.h"
-#include "animation_player.h"
-
-/**
-   \brief creates a new Animation
-   
-   This also adds the Animation automatically to the AnimationPlayer's list
-*/
-Animation::Animation(void)
-{  
-  // initialize a beginning KeyFrame, that will be deleted afterwards
-  this->bHasKeys = false;
-  this->bHandled = true;
-  this->bDelete = false;
-  this->baseObject = NULL;
-
-  // setting default values
-  this->localTime = 0.0;
-  this->bRunning = true;
-
-  AnimationPlayer::getInstance()->addAnimation(this);
-}
-
-/**
-   \brief destructs the Animation
-   
-   this also takes the animation out of the AnimationPlayer's list (if it is there)
-*/
-Animation::~Animation(void)
-{
-  this->doNotHandle();
-}
-
-/**
-   \brief tells the AnimationPlayer, that we do not wish to  handle this animation
-   automatically.
-   
-   This means that it will not be ticked, and not be deleted with the AnimationPlayer
-*/
-void Animation::doNotHandle(void)
-{
-  if (this->bHandled)
-    AnimationPlayer::getInstance()->removeAnimation(this);
-}
-
-/**
-   \brief Sets the infinitymode
-   \param postInfinity How the Animation should advance after the last Keyframe
-*/
-void Animation::setInfinity(ANIM_INFINITY postInfinity)
-{
-  this->postInfinity = postInfinity;
-}
-
-/**
-   \brief handles the Animation if it gets out of boundraries eg. if animation is finished.
-*/
-void Animation::handleInfinity(void)
-{
-  switch (this->postInfinity)
-    {
-    case ANIM_INF_CONSTANT:
-      this->localTime = 0.0;
-      this->bRunning = false;
-      break;
-    case ANIM_INF_REPLAY:
-      this->replay();
-      break;
-    case ANIM_INF_REWIND:
-      this->stop();
-      break;
-    case ANIM_INF_DELETE: // this will possibly never be made
-      this->bDelete = true;
-      break;
-    }
-}
-
-/**
-   \brief plays the animation back from the current Time forward
-*/
-void Animation::play()
-{
-  this->bRunning = true;
-}
-
-/**
-   \brief Stops the animation. eg. pause(); rewind();
-*/
-void Animation::stop()
-{
-  this->rewind();
-  this->bRunning = true;
-  this->tick(0.0);
-  this->bRunning = false;
-}
-
-/**
-   \brief Pauses the animation. Stays at the current Time
-*/
-void Animation::pause()
-{
-  this->bRunning = false;
-}
-
-/**
-   \brief replays the animation, eg. rewind();play();
-*/
-void Animation::replay()
-{
-  this->rewind();
-  this->bRunning = true;
-}
Index: orxonox/branches/physics/src/animation.h
===================================================================
--- orxonox/branches/physics/src/animation.h	(revision 3866)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/*! 
-    \file animation.h
-    A Subclass for all animations in orxonox
-*/
-
-#ifndef _ANIMATION_H
-#define _ANIMATION_H
-
-#include "list.h"
-#include "base_object.h"
-#include "confincl.h"  // must be here to determin the DEBUG-level
-
-// FORWARD DEFINITION
-
-//! An enumerator of Functions to describe the flow of the Animation
-/**
-   \todo check with Patrick it of
-
-   description in speed to the next keyframe:
-   ANIM_CONSTANT: 0, infinity.
-   ANIM_LINEAR: equal
-   ANIM_SINE: fast, slow, fast
-   ANIM_COSINE: slow, fast, slow
-   ANIM_EXP: fast, slow
-   ANIM_NEG_EXP: slow fast
-   ANIM_RANDOM: eratic
-   
-   deprecated QUADRATIC
-*/
-typedef enum ANIM_FUNCTION {ANIM_CONSTANT,
-			    ANIM_LINEAR,
-			    ANIM_SINE,
-			    ANIM_COSINE,
-			    ANIM_EXP,
-			    ANIM_NEG_EXP,
-			    ANIM_QUADRATIC,
-			    ANIM_RANDOM};
-
-//! An enumerator describing what the animation should do after the last keyframe.
-/**
-   ANIM_INF_CONSTANT stays at the end of the animation
-   ANIM_INF_REPLAY loops back to the beginning and replays the animation
-   ANIM_INF_REWIND loops back to the beginning and then stops the animation
-   ANIM_INF_DELETE deletes the animation. !! THIS IS DANGEROUS !! only do this with non-class variables
-*/
-typedef enum ANIM_INFINITY {ANIM_INF_CONSTANT,
-			    ANIM_INF_REPLAY,
-			    ANIM_INF_REWIND,
-			    ANIM_INF_DELETE};//, ANIM_INF_LINEAR, ANIM_INF_PINGPONG;
-
-//! A Superclass for describing an animation (all animations will be derived from this one)
-/** implement in subclasses:
- * 
- * De-/Constructor
- * Animation Functions
- * virtual tick
- * addKeyFrame
- * List of keyFrames
- * currentKeyFrame/nextKeyFrame
- * virtual rewind, to go to the first Keyframe. (other functions will call this one)
-*/
-class Animation
-{
- public:
-  virtual ~Animation(void);
-  void doNotHandle(void);
-
-  void setInfinity(ANIM_INFINITY postInfinity = ANIM_INF_CONSTANT);
-
-  void play(); // equals resume();
-  void stop();
-  void pause();
-  void replay();
-  //! A virtual function that should change to the first keyframe.
-  virtual void rewind() = 0;
-  /** \brief A virtual function that ticks the animation \param dt the time passed */
-  virtual void tick(float dt) = 0;
-
-  /**
-     \returns the BaseObject, this animation operates on
-  */
-  BaseObject* getBaseObject(void) const {return baseObject;}
-
-  /** \returns if the Animation should be deleted */
-  inline bool ifDelete(void) {return bDelete;}
-
- protected:
-  Animation(void);
-
-  void handleInfinity(void);
-  // variables
-  float localTime;                //!< The Time passed since the beginning of the currentKeyFrame.
-  ANIM_INFINITY postInfinity;     //!< describing what the animation should do after the last keyframe.
-
-  BaseObject* baseObject;         //!< The same as object in the derived classes, but with reference to BaseObject
-  bool bHasKeys;                  //!< If the animation has any keys at all. Needed to add the first keyframe (and delete the dummy).
-  bool bHandled;                  //!< If this Animation is handled by the AnimationPlayer.
-  bool bRunning;                  //!< If the animation is running
-  bool bDelete;                   //!< If true, the animation will be deleted through the AnimationPlayer.
-};
-
-
-/**********************TEST*******************************/
-class aTest
-{
- public:
-  aTest() { last = 0.0;}
-  ~aTest() {}
-  void littleDebug(float f) {  diff = f - last; printf("f=%f, diff=%f\n", f,diff); last = f;}
- private:
-  float diff;
-  float last;
-};
-
-//aTest::aTest() {}
-//aTest::~aTest() {}
-
-//void aTest::littleDebug(float f)
-
-/**********************TEST*******************************/
-
-
-#endif /* _ANIMATION_H */
Index: orxonox/branches/physics/src/animation3d.cc
===================================================================
--- orxonox/branches/physics/src/animation3d.cc	(revision 3866)
+++ 	(revision )
@@ -1,307 +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: Benjamin Grauer
-
-   2005-04-17: Benjamin Grauer
-          Rewritte all functions, so it will fit into the Animation-class
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ANIM
-
-#include "animation3d.h"
-
-#include "p_node.h"
-
-using namespace std;
-
-/**
-   \brief standard constructor
-*/
-Animation3D::Animation3D(PNode* object)
-{
-  this->object = object;
-
-  // create a new List
-  this->keyFrameList = new tList<KeyFrame3D>();
-  KeyFrame3D* tmpKeyFrame = new KeyFrame3D;
-  tmpKeyFrame->position = Vector();
-  tmpKeyFrame->direction = Quaternion();
-  keyFrameList->add(tmpKeyFrame);
-
-  this->currentKeyFrame = tmpKeyFrame;
-  this->nextKeyFrame = tmpKeyFrame;
-
-  this->animFunc = &Animation3D::linear;
-}
-
-/**
-   \brief standard deconstructor
-   
-   deletes all the Keyframes
-*/
-Animation3D::~Animation3D(void)
-{
-  // delete all the KeyFrames
-  tIterator<KeyFrame3D>* itKF = keyFrameList->getIterator();
-  KeyFrame3D*  enumKF = itKF->nextElement();
-  while (enumKF)
-    {
-      delete enumKF;
-      enumKF = itKF->nextElement();
-    }
-  delete itKF;
-  delete this->keyFrameList;
-}
-
-/**
-   \brief rewinds the Animation to the beginning (first KeyFrame and time == 0)
-*/
-void Animation3D::rewind(void)
-{
-  this->currentKeyFrame = keyFrameList->firstElement();
-  this->nextKeyFrame = keyFrameList->nextElement(keyFrameList->firstElement());
-  this->localTime = 0.0;
-}
-
-/**
-   \brief Appends a new Keyframe
-   \param position The position of the new Keyframe
-   \param direction The direction of the new Keyframe.
-   \param duration The duration from the new KeyFrame to the next one
-   \param animFunc The function to animate between this keyFrame and the next one
-*/
-void Animation3D::addKeyFrame(Vector position, Quaternion direction, float duration, ANIM_FUNCTION animFunc)
-{
-  // some small check
-  if (duration <= 0.0)
-    duration = 1.0;
-
-  KeyFrame3D* tmpKeyFrame;
-    
-  if (bHasKeys)
-    {
-      tmpKeyFrame = new KeyFrame3D;
-      if (this->currentKeyFrame == this->nextKeyFrame)
-	this->nextKeyFrame = tmpKeyFrame;
-      this->keyFrameList->add(tmpKeyFrame);
-
-    }
-  else
-    {
-      tmpKeyFrame = this->keyFrameList->firstElement();
-      bHasKeys = true;
-      this->setAnimFunc(animFunc);
-    }
-
-  tmpKeyFrame->position = position;
-  tmpKeyFrame->direction = direction;
-  tmpKeyFrame->duration = duration;
-  tmpKeyFrame->animFunc = animFunc;
-
-}
-
-/**
-   \brief ticks the Animation
-   \param dt how much time to tick
-*/
-void Animation3D::tick(float dt)
-{
-  if (this->bRunning)
-    { 
-      this->localTime += dt;
-      if (localTime >= this->currentKeyFrame->duration)
-	{
-	  // switching to the next Key-Frame
-	  this->localTime -= this->currentKeyFrame->duration;
-	  this->currentKeyFrame = this->nextKeyFrame;
-	  // checking, if we should still Play the animation
-	  if (this->currentKeyFrame == this->keyFrameList->lastElement())
-	    this->handleInfinity();
-	  this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
-	  this->setAnimFunc(this->currentKeyFrame->animFunc);	  
-	  
-	  if( this->currentKeyFrame->animFunc == ANIM_NEG_EXP)
-	    {
-	      this->tmpVect = this->nextKeyFrame->position - this->currentKeyFrame->position;
-	      this->deltaT = 1/this->currentKeyFrame->duration * logf(1.0 + 600.0/this->tmpVect.len());
-	    }
-	}
-
-      /* now animate it */
-      (this->*animFunc)(this->localTime);
-      /*
-      switch( this->movMode)
-	{
-	case LINEAR:
-	  *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
-	  *this->tmpVect = *this->tmpVect * this->localTime / this->currentFrame->time;
-	  this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect);
-	  *this->lastPosition = *this->tmpVect;
-	  break;
-	case EXP:
-	      
-	  break;
-	case NEG_EXP:
-	  *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
-	  *this->tmpVect = *this->tmpVect * (1 - expf(- this->localTime * this->deltaT));     
-	  this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect);
-	  *this->lastPosition = *this->tmpVect;
-	  break;
-	case SIN:
-	  *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
-	  *this->tmpVect = *this->tmpVect * 0.5*(1 - cos(M_PI * this->localTime / this->currentFrame->time));     
-	  this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect);
-	  *this->lastPosition = *this->tmpVect;
-	  break;
-	case COS:
-	      
-	  break;
-	case QUADRATIC:
-	  *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
-	  *this->tmpVect = *this->tmpVect * 1/3 * ldexpf(this->localTime, 3);
-	  break;
-	default:
-	  break;
-	}
-      */
-    }
-}
-
-
-/**
-   \brief Sets The kind of Animation between this keyframe and the next one
-   \param animFunc The Type of Animation to set
-*/
-void Animation3D::setAnimFunc(ANIM_FUNCTION animFunc)
-{
-  switch (animFunc)
-    {
-    default:
-    case ANIM_CONSTANT:
-      this->animFunc = &Animation3D::constant;
-      break;
-    case ANIM_LINEAR:
-      this->animFunc = &Animation3D::linear;
-      break;
-    case ANIM_SINE:
-      this->animFunc = &Animation3D::sine;
-      break;
-    case ANIM_COSINE:
-      this->animFunc = &Animation3D::cosine;
-      break;
-    case ANIM_EXP:
-      this->animFunc = &Animation3D::exp;
-      break;
-    case ANIM_NEG_EXP:
-      this->animFunc = &Animation3D::negExp;
-      break;
-    case ANIM_QUADRATIC:
-      this->animFunc = &Animation3D::quadratic;
-      break;
-    case ANIM_RANDOM:
-      this->animFunc = &Animation3D::random;
-      break;
-    }
-}
-
-/**
-   \brief stays at the value of the currentKeyFrame
-   \param timePassed The time passed since this Keyframe began
-*/
-void Animation3D::constant(float timePassed) const
-{
-  this->object->setRelCoor(this->currentKeyFrame->position);
-
-  /*
-    this->tmpVect = this->nextKeyFrame->position - this->currentKeyFrame->position;
-    this->tmpVect = this->tmpVect * this->localTime / this->currentKeyFrame->duration;
-    this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect);
-    this->lastPosition = this->tmpVect;
-  */
-}
-
-/**
-   \brief linear interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-
-   \todo implement also do this for direction
-*/
-void Animation3D::linear(float timePassed) const
-{
-  this->object->setRelCoor(this->currentKeyFrame->position +
-			  (this->nextKeyFrame->position - this->currentKeyFrame->position) * 
-			  (timePassed/this->currentKeyFrame->duration));
-}
-
-/**
-   \brief a Sinusodial Interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-
-   \todo implement
-*/
-void Animation3D::sine(float timePassed) const
-{
-  this->linear(timePassed);
-}
-
-/**
-   \brief a cosine interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-
-   \todo implement
-*/
-void Animation3D::cosine(float timePassed) const
-{
-  this->linear(timePassed);
-}
-
-/**
-   \brief an exponential interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-*/
-void Animation3D::exp(float timePassed) const
-{
-  this->linear(timePassed);
-}
-
-/**
-   \brief a negative exponential interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-
-   \todo implement
-*/
-void Animation3D::negExp(float timePassed) const
-{
-  this->linear(timePassed);
-}
-
-/**
-   \brief a quadratic interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-
-   \todo implement
-*/
-void Animation3D::quadratic(float timePassed) const
-{
-  this->linear(timePassed);
-}
-
-/**
-   \brief some random animation (fluctuating)
-   \param timePassed The time passed since this Keyframe began
-*/
-void Animation3D::random(float timePassed) const
-{
-  this->object->setRelCoor(this->currentKeyFrame->position * (float)rand()/(float)RAND_MAX);
-  this->object->setRelDir(this->currentKeyFrame->direction * (float)rand()/(float)RAND_MAX);
-}
Index: orxonox/branches/physics/src/animation3d.h
===================================================================
--- orxonox/branches/physics/src/animation3d.h	(revision 3866)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*! 
-    \file animation3d.h
-*/
-
-
-#include "animation.h"
-
-#include "vector.h"
-class PNode;
-
-//! KeyFrame3D Struct
-/**
-   This represents one point with direction of the animation
-*/
-typedef struct KeyFrame3D {
-  float duration;                   //!< The duration of this KeyFrame
-  Vector position;                  //!< The position of this KeyFrame
-  Quaternion direction;             //!< The direction of this KeyFrame
-  ANIM_FUNCTION animFunc;           //!< with whitch function to iterate to the next KeyFrame3D
-};
-
-//! Animation Struct
-/**
-   This represents an animation for a object
-*/
-class Animation3D : public Animation
-{
- public:
-  Animation3D(PNode* object);
-  virtual ~Animation3D(void);
-    
-  virtual void rewind(void);
-
-  void addKeyFrame(Vector position, Quaternion direction, float time, ANIM_FUNCTION animFunc = ANIM_LINEAR);
-  //  void addKeyFrame(KeyFrame3D* frame);
-
-  virtual void tick(float dt);
-
- private:
-  // animation functions
-  void setAnimFunc(ANIM_FUNCTION animFunc);
-  void constant(float timePassed) const;
-  void linear(float timePassed) const;
-  void sine(float timePassed) const;
-  void cosine(float timePassed) const;
-  void exp(float timePassed) const;
-  void negExp(float timePassed) const;
-  void quadratic(float timePassed) const;
-  void random(float timePassed) const;
-  //  ANIM_FUNCTION animFunc;
-  void (Animation3D::*animFunc)(float) const;      //!< A Function for the AnimationType
-
-  KeyFrame3D* currentKeyFrame;                     //!< The current KeyFrame
-  KeyFrame3D* nextKeyFrame;                        //!< The KeyFrame we iterate to
-  tList<KeyFrame3D>* keyFrameList;                 //!< The KeyFrameList
-
-  // more class-local description
-  PNode* object;                                   //!< The Object from which to Animate something
-  Vector lastPosition;   //!< ??
-  Vector tmpVect;        //!< what for??
-  float deltaT;          //!< ??
-};
Index: orxonox/branches/physics/src/animation_player.cc
===================================================================
--- orxonox/branches/physics/src/animation_player.cc	(revision 3866)
+++ 	(revision )
@@ -1,192 +1,0 @@
-/* 
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Benjamin Grauer
-   co-programmer: ...
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ANIM
-
-#include "animation_player.h"
-
-#include "compiler.h"
-
-using namespace std;
-
-
-/**
-   \brief standard constructor
-*/
-AnimationPlayer::AnimationPlayer () 
-{
-   this->setClassName ("AnimationPlayer");
-
-   this->animationList = new tList<Animation>();
-   this->play();
-}
-
-/**
-   \brief the singleton reference to this class
-*/
-AnimationPlayer* AnimationPlayer::singletonRef = NULL;
-
-/**
-   \returns a Pointer to this Class
-*/
-AnimationPlayer* AnimationPlayer::getInstance(void)
-{
-  if (!AnimationPlayer::singletonRef)
-    AnimationPlayer::singletonRef = new AnimationPlayer();
-  return AnimationPlayer::singletonRef;
-}
-
-/**
-   \brief standard deconstructor
-
-   !! DANGER !! when unloading the AnimationPlayer no other Function
-   should reference any Animations, from the animationList because it 
-   automatically deletes them. 
-   This usually happens when unloading a World.
-*/
-AnimationPlayer::~AnimationPlayer () 
-{
-  // deleting the Animation List AND all the elements of the List
-  this->flush();
-  delete this->animationList;
-
-  AnimationPlayer::singletonRef = NULL;
-}
-
-/**
-   \brief adds an Animation to the AnimationList.
-   \param animation the Animation to handle
-
-   when adding a Animation the Animation will too be deleted when
-   the AnimationPlayer gets deleted. Consider not adding it, or 
-   unadding it with animation->notHandled();
-*/
-void AnimationPlayer::addAnimation(Animation* animation)
-{
-  this->animationList->add(animation);
-}
-
-/**
-   \brief removes an Animation from the Animation List, WITHOUT deleting it.
-   \param animation the Anmination to remove from the List
-*/
-void AnimationPlayer::removeAnimation(Animation* animation)
-{
-  this->animationList->remove(animation);
-}
-
-/**
-   \brief empties the list AND deletes all the Animations
-*/ 
-void AnimationPlayer::flush(void)
-{
-  // deleting the Animation List AND all the elements of the List
-  tIterator<Animation>* animIt = this->animationList->getIterator();
-  Animation* anim = animIt->nextElement();
-  while( anim != NULL)
-    {
-      delete anim;
-      this->animationList->remove(anim);
-      anim = animIt->nextElement();
-    }
-  delete animIt;
-
-  delete this->animationList;
-  this->animationList = new tList<Animation>();
-}
-
-/**
-   \brief Ticks all the animations in animationList 
-   \param timePassed the time passed since the last tick.
-*/
-void AnimationPlayer::tick(float timePassed)
-{
-  if (this->bRunning)
-    {
-      // iterate through all the animations and tick them.
-      tIterator<Animation>* animIt = this->animationList->getIterator();
-      Animation* anim = animIt->nextElement();
-      while( anim != NULL)
-	{
-	  anim->tick(timePassed);
-	  if(unlikely(anim->ifDelete()))
-	  {
-	    this->animationList->remove(anim);
-	    delete anim;
-	  }
-	  anim = animIt->nextElement();
-	}
-      delete animIt;
-    }
-}
-/**
-   \brief starts playing the AnimationPlayer
-*/
-void AnimationPlayer::play(void)
-{
-  this->bRunning = true;
-}
-
-/**
-   \brief pauses playing of the AnimationPlayer
-*/
-void AnimationPlayer::pause(void)
-{
-  this->bRunning = false;
-}
-
-
-Animation* AnimationPlayer::getObjectFromBaseObject(const BaseObject* baseObject) const
-{
-  tIterator<Animation>* animIt = this->animationList->getIterator();
-  Animation* anim = animIt->nextElement();
-  while( anim != NULL)
-    {
-      if(anim->getBaseObject() == baseObject)
-	{
-	  delete animIt;
-	  return anim;
-	}
-      anim = animIt->nextElement();
-    }
-  delete animIt;
-
-}
-
-
-
-/**
-   \brief Outputs some nice debug-information
-*/
-void AnimationPlayer::debug(void)
-{
-  PRINT(0)("+------------------------------------+\n");
-  PRINT(0)("+ ANIMATION PLAYER DEBUG INFORMATION +\n");
-  PRINT(0)("+------------------------------------+\n");
-  PRINT(0)("| Reference: %p\n", this);
-  PRINT(0)("| CountOfAnims %d\n", this->animationList->getSize());
-  PRINT(0)("-Animation Information---------------+\n");
-  // Per ANIMATION DEBUG
-  tIterator<Animation>* animIt = this->animationList->getIterator();
-  Animation* anim = animIt->nextElement();
-  while( anim != NULL)
-    {
-      //      anim->debug();
-      anim = animIt->nextElement();
-    }
-  delete animIt;
-
-  PRINT(0)("+--------------------------------AP--+\n");
-}
Index: orxonox/branches/physics/src/animation_player.h
===================================================================
--- orxonox/branches/physics/src/animation_player.h	(revision 3866)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*! 
-    \file animation_player.h
-*/
-
-#ifndef _ANIMATION_PLAYER_H
-#define _ANIMATION_PLAYER_H
-
-#include "base_object.h"
-#include "animation.h"
-
-/* FORWARD DEFINITION */
-
-//! A AnimationPlayer, that handles the animation of all the Animations in the scene.
-/**
-   <b>AnimationPlayer usage:</b> \n
-
-   <b>Initialisation</b>: AnimationPlayer::getInstance() does the trick this is 
-   usually done when initializing a world \n
-   <b>Adding Animations</b>: create an Animation the following Way:
-   \li Anim* animation = new Anim(); // also use any other Subclass of Animation to initialize this
-   \li set some parameters: also see the specific classes for more info
-   \n
-   if you do not want a specific Animation to be handled by the AnimationPlayer, you have to 
-   unload it explicitely with animation->doNotHandle();
-   \n
-   eveything else will be done by the AnimationPlayer itself.\n
-*/
-class AnimationPlayer : public BaseObject {
-
- public:
-  static AnimationPlayer* getInstance(void);
-  virtual ~AnimationPlayer(void);
-
-  // animation handling
-  void addAnimation(Animation* animation);
-  void removeAnimation(Animation* animation);
-  void flush(void);
-
-  // time functions
-  void tick(float timePassed);
-  void play(void);
-  void pause(void);
-
-  Animation* getObjectFromBaseObject(const BaseObject* baseObject) const;
-
-  void debug(void);
-
- private:
-  /* singleton */
-  AnimationPlayer(void);
-  static AnimationPlayer* singletonRef;
-
-  /* class specific */
-  tList<Animation>* animationList;         //!< A List of Animations to be handled.
-  bool bRunning;                           //!< If the AnimationPlayer is running.
-};
-
-
-#endif /* _ANIMATION_PLAYER_H */
Index: orxonox/branches/physics/src/camera.cc
===================================================================
--- orxonox/branches/physics/src/camera.cc	(revision 3866)
+++ 	(revision )
@@ -1,199 +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: Christian Meyer
-   co-programmer: ...
-*/
-
-#include "camera.h"
-
-#include "world.h"
-#include "world_entity.h"
-#include "vector.h"
-
-using namespace std;
-
-////////////
-// CAMERA //
-////////////
-
-/**
-   \brief creates a Camera
-*/
-Camera::Camera(void)
-{
-  this->setClassName("Camera");
-  this->target = new CameraTarget();
-
-  this->setFovy(90);
-  this->setAspectRatio(1.2f);
-  this->setClipRegion(.1, 2000);
-
-  this->setViewMode(VIEW_NORMAL);
-}
-
-/**
-   \brief default destructor
-*/
-Camera::~Camera(void)
-{
-}
-
-/**
-   \brief focuses the Camera onto a Target
-   \param target the new PNode the Camera should look at.
-*/
-void Camera::lookAt(PNode* target)
-{
-  this->target->setParent(target);
-}
-
-/**
-   \returns The PNode of the Target (from there you can get position and so on
-*/
-PNode* Camera::getTarget(void)
-{
-  return (PNode*)this->target;
-}
-
-
-/**
-   \brief sets a new AspectRatio
-   \param aspectRatio the new aspect ratio to set (width / height)
-*/
-void Camera::setAspectRatio(float aspectRatio)
-{
-  this->aspectRatio = aspectRatio;
-}
-
-/**
-   \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;
-}
-
-/**
-  \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;
-}
-
-void Camera::setViewMode(ViewMode mode)
-{
-  switch (mode)
-    {
-    default:
-    case VIEW_NORMAL:
-      this->toFovy = 60.0;
-      this->toRelCoor = Vector(-10, 5, 0);
-      break;
-    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);
-    }
-}
-
-
-/**
-   \brief initialize rendering perspective according to this camera
-   
-   This is called immediately before the rendering cycle starts, it sets all global
-   rendering options as well as the GL_PROJECTION matrix according to the camera.
-*/
-void Camera::apply ()
-{
-  // switching to Projection Matrix
-  glMatrixMode (GL_PROJECTION);
-  glLoadIdentity ();
-
-  // setting up the perspective
-  gluPerspective(this->fovy,
-		 this->aspectRatio,
-		 this->nearClip,
-		 this->farClip);
-
-  // 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);
-
-  // switching back to Modeling Matrix
-  glMatrixMode (GL_MODELVIEW);
-}
-
-
-
-///////////////////
-// CAMERA-TARGET //
-///////////////////
-
-
-CameraTarget::CameraTarget()
-{
-  this->setClassName("CameraTarget");
-  this->setMode(PNODE_MOVEMENT);
-}
-
-CameraTarget::~CameraTarget()
-{
-
-}
Index: orxonox/branches/physics/src/camera.h
===================================================================
--- orxonox/branches/physics/src/camera.h	(revision 3866)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*! 
-    \file camera.h
-    \brief Viewpoint controlling class definitions
-*/ 
-
-#ifndef _CAMERA_H
-#define _CAMERA_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.
-*/
-class Camera : public PNode 
-{
- private:
-  CameraTarget* target;            //!< The Target of the Camera (where this Camera Looks at)
-
-  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.
-
-  Vector toRelCoor;
-  float toFovy;
-  
- public:
-  Camera(void);
-  virtual ~Camera(void);
-
-  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/physics/src/defs/debug.h
===================================================================
--- orxonox/branches/physics/src/defs/debug.h	(revision 3866)
+++ orxonox/branches/physics/src/defs/debug.h	(revision 3953)
@@ -68,7 +68,8 @@
 #define DEBUG_MODULE_LIGHT              0
 #define DEBUG_MODULE_PLAYER             1
+#define DEBUG_MODULE_WEAPON             3
 #define DEBUG_MODULE_MATH               0
-#define DEBUG_MODULE_FONT               4
-#define DEBUG_MODULE_ANIM               3
+#define DEBUG_MODULE_FONT               1
+#define DEBUG_MODULE_ANIM               1
 
 #define DEBUG_MODULE_NULL_PARENT        0
Index: orxonox/branches/physics/src/lib/graphics/importer/Makefile.am
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/Makefile.am	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/importer/Makefile.am	(revision 3953)
@@ -4,7 +4,9 @@
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/story_entities
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/coord
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/data
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/importer
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/lang
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/util
@@ -15,4 +17,7 @@
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/glmenu
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/ai
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/animation
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/common
 
 
@@ -34,5 +39,8 @@
 		  $(MAINSRCDIR)/lib/lang/base_object.cc \
 		  $(MAINSRCDIR)/lib/math/vector.cc \
-		  $(MAINSRCDIR)/lib/util/resource_manager.cc
+		  $(MAINSRCDIR)/util/resource_manager.cc \
+		  $(MAINSRCDIR)/lib/graphics/text_engine.cc \
+		  $(MAINSRCDIR)/lib/coord/p_node.cc \
+		  $(MAINSRCDIR)/lib/coord/null_parent.cc
 
 noinst_HEADERS= framework.h \
Index: orxonox/branches/physics/src/lib/graphics/importer/Makefile.in
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/Makefile.in	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/importer/Makefile.in	(revision 3953)
@@ -57,5 +57,6 @@
 	array.$(OBJEXT) material.$(OBJEXT) texture.$(OBJEXT) \
 	graphics_engine.$(OBJEXT) base_object.$(OBJEXT) \
-	vector.$(OBJEXT) resource_manager.$(OBJEXT)
+	vector.$(OBJEXT) resource_manager.$(OBJEXT) \
+	text_engine.$(OBJEXT) p_node.$(OBJEXT) null_parent.$(OBJEXT)
 importer_OBJECTS = $(am_importer_OBJECTS)
 importer_LDADD = $(LDADD)
@@ -68,9 +69,10 @@
 @AMDEP_TRUE@	./$(DEPDIR)/graphics_engine.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/material.Po ./$(DEPDIR)/model.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/objModel.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/null_parent.Po ./$(DEPDIR)/objModel.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/p_node.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
+@AMDEP_TRUE@	./$(DEPDIR)/text_engine.Po ./$(DEPDIR)/texture.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/vector.Po ./$(DEPDIR)/windowHandler.Po
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
@@ -194,5 +196,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/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_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -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 -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common
 AM_LDFLAGS = $(MWINDOWS)
 importer_SOURCES = framework.cc \
@@ -207,5 +209,8 @@
 		  $(MAINSRCDIR)/lib/lang/base_object.cc \
 		  $(MAINSRCDIR)/lib/math/vector.cc \
-		  $(MAINSRCDIR)/lib/util/resource_manager.cc
+		  $(MAINSRCDIR)/util/resource_manager.cc \
+		  $(MAINSRCDIR)/lib/graphics/text_engine.cc \
+		  $(MAINSRCDIR)/lib/coord/p_node.cc \
+		  $(MAINSRCDIR)/lib/coord/null_parent.cc
 
 noinst_HEADERS = framework.h \
@@ -290,7 +295,10 @@
 @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)/null_parent.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objModel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.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)/text_engine.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@
@@ -361,19 +369,67 @@
 @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; \
+resource_manager.o: $(MAINSRCDIR)/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)/util/resource_manager.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/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@	source='$(MAINSRCDIR)/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_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.o `test -f '$(MAINSRCDIR)/util/resource_manager.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/util/resource_manager.cc
+
+resource_manager.obj: $(MAINSRCDIR)/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)/util/resource_manager.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/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@	source='$(MAINSRCDIR)/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`
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.obj `if test -f '$(MAINSRCDIR)/util/resource_manager.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/util/resource_manager.cc'; fi`
+
+text_engine.o: $(MAINSRCDIR)/lib/graphics/text_engine.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT text_engine.o -MD -MP -MF "$(DEPDIR)/text_engine.Tpo" -c -o text_engine.o `test -f '$(MAINSRCDIR)/lib/graphics/text_engine.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/graphics/text_engine.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/text_engine.Tpo" "$(DEPDIR)/text_engine.Po"; else rm -f "$(DEPDIR)/text_engine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/graphics/text_engine.cc' object='text_engine.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/text_engine.Po' tmpdepfile='$(DEPDIR)/text_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 text_engine.o `test -f '$(MAINSRCDIR)/lib/graphics/text_engine.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/graphics/text_engine.cc
+
+text_engine.obj: $(MAINSRCDIR)/lib/graphics/text_engine.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT text_engine.obj -MD -MP -MF "$(DEPDIR)/text_engine.Tpo" -c -o text_engine.obj `if test -f '$(MAINSRCDIR)/lib/graphics/text_engine.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/graphics/text_engine.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/graphics/text_engine.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/text_engine.Tpo" "$(DEPDIR)/text_engine.Po"; else rm -f "$(DEPDIR)/text_engine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/graphics/text_engine.cc' object='text_engine.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/text_engine.Po' tmpdepfile='$(DEPDIR)/text_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 text_engine.obj `if test -f '$(MAINSRCDIR)/lib/graphics/text_engine.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/graphics/text_engine.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/graphics/text_engine.cc'; fi`
+
+p_node.o: $(MAINSRCDIR)/lib/coord/p_node.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT p_node.o -MD -MP -MF "$(DEPDIR)/p_node.Tpo" -c -o p_node.o `test -f '$(MAINSRCDIR)/lib/coord/p_node.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/coord/p_node.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/p_node.Tpo" "$(DEPDIR)/p_node.Po"; else rm -f "$(DEPDIR)/p_node.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/coord/p_node.cc' object='p_node.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/p_node.Po' tmpdepfile='$(DEPDIR)/p_node.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 p_node.o `test -f '$(MAINSRCDIR)/lib/coord/p_node.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/coord/p_node.cc
+
+p_node.obj: $(MAINSRCDIR)/lib/coord/p_node.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT p_node.obj -MD -MP -MF "$(DEPDIR)/p_node.Tpo" -c -o p_node.obj `if test -f '$(MAINSRCDIR)/lib/coord/p_node.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/coord/p_node.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/coord/p_node.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/p_node.Tpo" "$(DEPDIR)/p_node.Po"; else rm -f "$(DEPDIR)/p_node.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/coord/p_node.cc' object='p_node.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/p_node.Po' tmpdepfile='$(DEPDIR)/p_node.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 p_node.obj `if test -f '$(MAINSRCDIR)/lib/coord/p_node.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/coord/p_node.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/coord/p_node.cc'; fi`
+
+null_parent.o: $(MAINSRCDIR)/lib/coord/null_parent.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT null_parent.o -MD -MP -MF "$(DEPDIR)/null_parent.Tpo" -c -o null_parent.o `test -f '$(MAINSRCDIR)/lib/coord/null_parent.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/coord/null_parent.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/null_parent.Tpo" "$(DEPDIR)/null_parent.Po"; else rm -f "$(DEPDIR)/null_parent.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/coord/null_parent.cc' object='null_parent.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/null_parent.Po' tmpdepfile='$(DEPDIR)/null_parent.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 null_parent.o `test -f '$(MAINSRCDIR)/lib/coord/null_parent.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/coord/null_parent.cc
+
+null_parent.obj: $(MAINSRCDIR)/lib/coord/null_parent.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT null_parent.obj -MD -MP -MF "$(DEPDIR)/null_parent.Tpo" -c -o null_parent.obj `if test -f '$(MAINSRCDIR)/lib/coord/null_parent.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/coord/null_parent.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/coord/null_parent.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/null_parent.Tpo" "$(DEPDIR)/null_parent.Po"; else rm -f "$(DEPDIR)/null_parent.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/lib/coord/null_parent.cc' object='null_parent.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/null_parent.Po' tmpdepfile='$(DEPDIR)/null_parent.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 null_parent.obj `if test -f '$(MAINSRCDIR)/lib/coord/null_parent.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/coord/null_parent.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/coord/null_parent.cc'; fi`
 uninstall-info-am:
 
Index: orxonox/branches/physics/src/lib/graphics/importer/material.cc
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/material.cc	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/importer/material.cc	(revision 3953)
@@ -34,9 +34,8 @@
    \param mtlName Name of the Material to be added to the Material List
 */
-Material::Material (char* mtlName)
+Material::Material (const char* mtlName)
 {
    PRINTF(4)("initializing new Material.\n");
-  this->nextMat = NULL;
-  this->name ="";
+  this->name = NULL;
   this->setIllum(3);
   this->setDiffuse(0,0,0);
@@ -55,8 +54,5 @@
   this->specularTextureSet = false;
 
-  if (mtlName)
-    this->setName (mtlName);
-  else
-    this->setName("");
+  this->setName(mtlName);
 }
 
@@ -71,47 +67,4 @@
   if (this->diffuseTexture)
     ResourceManager::getInstance()->unload(this->diffuseTexture);
-  if (this->nextMat)
-    delete this->nextMat;
-}
-
-/**
-   \brief adds a new Material to the List.
-   this Function will append a new Material to the end of a Material List.
-   \param mtlName The name of the Material to be added.
-*/
-Material* Material::addMaterial(char* mtlName)
-{
-  PRINTF(4)("adding Material %s.\n", mtlName);
-   Material* tmpMat = this;
-  while (tmpMat->nextMat != NULL)
-    {
-      tmpMat = tmpMat->nextMat;
-    }
-  tmpMat->nextMat = new Material(mtlName);
-  return tmpMat->nextMat;
-  
-}
-
-/**
-   \brief Search for a Material called mtlName
-   \param mtlName the Name of the Material to search for
-   \returns Material named mtlName if it is found. NULL otherwise.
-*/
-Material* Material::search(char* mtlName)
-{
-  PRINTF(5)("Searching for material %s", mtlName);
-  Material* searcher = this;
-  while (searcher != NULL)
-    {
-      PRINT(5)(".");
-      if (!strcmp (searcher->getName(), mtlName))
-	{
-	  PRINT(5)("found.\n");
-	  return searcher;
-	}
-      searcher = searcher->nextMat;
-    }
-  PRINT(2)("material %s not found\n", mtlName);
-  return NULL;
 }
 
@@ -168,9 +121,18 @@
    \param mtlName the Name of the Material to be set.
 */ 
-void Material::setName (char* mtlName)
-{
-  PRINTF(4)("setting Material Name to %s.\n", this->name);
-  this->name = new char [strlen(mtlName)+1];
-  strcpy(this->name, mtlName);
+void Material::setName (const char* mtlName)
+{
+  if (this->name)
+    delete this->name;
+  if (mtlName)
+    {
+      this->name = new char [strlen(mtlName)+1];
+      strcpy(this->name, mtlName);
+    }
+  else
+    {
+      this->name = new char[2];
+      strcpy(this->name, "");
+    }
 }
 
Index: orxonox/branches/physics/src/lib/graphics/importer/material.h
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/material.h	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/importer/material.h	(revision 3953)
@@ -14,4 +14,8 @@
 #endif /* HAVE_CONFIG_H */
 
+#ifndef NULL
+#define NULL 0
+#endif
+
 // FORWARD DEFINITIONS //
 class Texture;
@@ -22,12 +26,10 @@
 {
  public:
-  Material (char* mtlName = "");
-  Material* addMaterial(char* mtlName);
+  Material (const char* mtlName = NULL);
   ~Material ();
 
-  Material* search(char* mtlName);
   bool select (void);
 
-  void setName (char* mtlName);
+  void setName (const char* mtlName);
   char* getName (void);
   void setIllum (int illum);
@@ -70,7 +72,4 @@
   bool specularTextureSet;//!< Chekcs if the specular texture is Set.
 
-  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
-
-
 };
 #endif
Index: orxonox/branches/physics/src/lib/graphics/importer/model.cc
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/model.cc	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/importer/model.cc	(revision 3953)
@@ -23,160 +23,21 @@
 #include "array.h"
 #include "vector.h"
+#include "list.h"
 
 using namespace std;
 
-/**
-   \brief Creates a 3D-Model.
-
-   This only initializes a 3D-Model, but does not cleanup the Faces.
-*/
-Model::Model(void)
-{
-  this->initialize();
-}
-
+//////////////////
+// DE-CONSTRUCT //
+//////////////////
 /**
    \brief Creates a 3D-Model. and assigns it a Name.
 */
-Model::Model(char* modelName)
-{
-  this->initialize();
+Model::Model(const char* modelName, MODEL_TYPE type)
+{
+  PRINTF(4)("new 3D-Model is being created\n"); 
+  this->name = NULL;
   this->setName(modelName);
-}
-
-/**
-   \brief deletes an Model.
-
-   Looks if any from model allocated space is still in use, and if so deleted it.
-*/
-Model::~Model(void)
-{
-  PRINTF(4)("Deleting Model ");
-  if (this->name)
-    {
-      PRINT(4)("%s\n", this->name);
-      delete []this->name;
-    }
-  else
-      PRINT(4)("\n");
-
-  PRINTF(4)("Deleting display Lists.\n");
-  Group* walker = this->firstGroup;
-  while (walker != NULL)
-    {
-      glDeleteLists (walker->listNumber, 1);
-      Group* delWalker = walker;
-      walker = walker->next;
-      delete delWalker;
-    }
-
-  PRINTF(4)("Deleting Materials.\n");
-  if (this->material)
-    delete this->material;
-}
-
-/**
-   \brief Finalizes an Object. This can be done outside of the Class.
-*/
-void Model::finalize(void)
-{
-  this->importToGL ();
-  
-  this->cleanup();
-
-  this->finalized = true;
-}
-
-/**
-   \brief Draws the Models of all Groups.
-   It does this by just calling the Lists that must have been created earlier.
-*/
-void Model::draw (void) const
-{
-  PRINTF(4)("drawing the 3D-Models\n"); 
-  Group* walker = this->firstGroup;
-  while (walker != NULL)
-    {
-      PRINTF(5)("Drawing model %s\n", walker->name);
-      glCallList (walker->listNumber);
-      walker = walker->next;
-    }
-}
-
-/**
-   \brief Draws the Model number groupNumber
-   \param groupNumber The number of the group that will be displayed.
-
-   It does this by just calling the List that must have been created earlier.
-*/
-void Model::draw (int groupNumber) const 
-{
-  if (groupNumber >= this->groupCount)
-    {
-      PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);
-      return;
-    }
-  PRINTF(4)("drawing the requested 3D-Models if found.\n"); 
-  Group* walker = this->firstGroup;
-  int counter = 0;
-  while (walker != NULL)
-    {
-      if (counter == groupNumber)
-	{
-	  PRINTF(2)("Drawing model number %i named %s\n", counter, walker->name);
-	  glCallList (walker->listNumber);
-	  return;
-	}
-      ++counter;
-      walker = walker->next;
-    }
-  PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->name);
-  return;
-
-}
-
-/**
-   \brief Draws the Model with a specific groupName
-   \param groupName The name of the group that will be displayed.
-
-   It does this by just calling the List that must have been created earlier.
-*/
-void Model::draw (char* groupName) const
-{
-  PRINTF(4)("drawing the requested 3D-Models if found.\n"); 
-  Group* walker = this->firstGroup;
-  while (walker != NULL)
-    {
-      if (!strcmp(walker->name, groupName))
-	{
-	  PRINTF(4)("Drawing model %s\n", walker->name);
-	  glCallList (walker->listNumber);
-	  return;
-	}
-      walker = walker->next;
-    }
-  PRINTF(2)("Model Named %s in %s not Found.\n", groupName, this->name);
-  return;
-}
-
-/**
-   \returns Count of the Models in this File
-*/
-int Model::getGroupCount (void) const
-{
-  return this->groupCount;
-}
-
-/**
-    \brief initializes the Model.
-
-    This Function initializes all the needed arrays, Lists and clientStates.
-    It also defines default values.
-*/
-bool Model::initialize (void)
-{
-  PRINTF(4)("new 3D-Model is being created\n"); 
-
-  this->name = NULL;
+  this->type = type;
+
   this->finalized = false;
   // setting the start group;
@@ -187,5 +48,4 @@
   this->initGroup (this->currentGroup);
   this->scaleFactor = 1;
-  this->material = new Material();
 
   this->vertices = new Array();
@@ -193,7 +53,155 @@
   this->normals = new Array();
 
-  return true;
-}
-
+  this->materialList = new tList<Material>;
+
+  if (this->type == MODEL_VERTEX_ARRAY)
+    glEnableClientState(GL_VERTEX_ARRAY | GL_NORMAL_ARRAY | GL_TEXTURE_COORD_ARRAY);
+}
+
+/**
+   \brief deletes an Model.
+
+   Looks if any from model allocated space is still in use, and if so deleted it.
+*/
+Model::~Model(void)
+{
+  PRINTF(4)("Deleting Model ");
+  if (this->name)
+    {
+      PRINT(4)("%s\n", this->name);
+      delete []this->name;
+    }
+  else
+      PRINT(4)("\n");
+
+  PRINTF(5)("Deleting display Lists.\n");
+  Group* walker = this->firstGroup;
+  while (walker != NULL)
+    {
+      glDeleteLists (walker->listNumber, 1);
+      Group* delWalker = walker;
+      walker = walker->next;
+      delete delWalker;
+    }
+
+  // deleting Arrays
+  this->deleteArrays();
+
+  // deleting the MaterialList
+  PRINTF(5)("Deleting Materials.\n");
+  tIterator<Material>* tmpIt = this->materialList->getIterator();
+  Material* material = tmpIt->nextElement();
+  while(material)
+    {
+      delete material;
+      material = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  delete materialList;
+}
+
+/**
+   \brief Finalizes an Object. This can be done outside of the Class.
+*/
+void Model::finalize(void)
+{
+  // this creates the display List.
+  this->importToDisplayList();
+  
+
+  // deletes everything we allocated.
+  if (this->type == MODEL_DISPLAY_LIST)
+    this->deleteArrays();
+  this->cleanup();
+
+  this->finalized = true;
+}
+
+//////////
+// DRAW //
+//////////
+/**
+   \brief Draws the Models of all Groups.
+   It does this by just calling the Lists that must have been created earlier.
+*/
+void Model::draw (void) const
+{
+  PRINTF(4)("drawing the 3D-Models\n"); 
+  Group* walker = this->firstGroup;
+  while (walker != NULL)
+    {
+      PRINTF(5)("Drawing model %s\n", walker->name);
+      glCallList (walker->listNumber);
+      walker = walker->next;
+    }
+}
+
+/**
+   \brief Draws the Model number groupNumber
+   \param groupNumber The number of the group that will be displayed.
+
+   It does this by just calling the List that must have been created earlier.
+*/
+void Model::draw (int groupNumber) const 
+{
+  if (groupNumber >= this->groupCount)
+    {
+      PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);
+      return;
+    }
+  PRINTF(4)("drawing the requested 3D-Models if found.\n"); 
+  Group* walker = this->firstGroup;
+  int counter = 0;
+  while (walker != NULL)
+    {
+      if (counter == groupNumber)
+	{
+	  PRINTF(4)("Drawing model number %i named %s\n", counter, walker->name);
+	  glCallList (walker->listNumber);
+	  return;
+	}
+      ++counter;
+      walker = walker->next;
+    }
+  PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->name);
+  return;
+
+}
+
+/**
+   \brief Draws the Model with a specific groupName
+   \param groupName The name of the group that will be displayed.
+
+   It does this by just calling the List that must have been created earlier.
+*/
+void Model::draw (char* groupName) const
+{
+  PRINTF(4)("drawing the requested 3D-Models if found.\n"); 
+  Group* walker = this->firstGroup;
+  while (walker != NULL)
+    {
+      if (!strcmp(walker->name, groupName))
+	{
+	  PRINTF(4)("Drawing model %s\n", walker->name);
+	  glCallList (walker->listNumber);
+	  return;
+	}
+      walker = walker->next;
+    }
+  PRINTF(2)("Model Named %s in %s not Found.\n", groupName, this->name);
+  return;
+}
+
+/**
+   \returns Count of the Models in this File
+*/
+int Model::getGroupCount (void) const
+{
+  return this->groupCount;
+}
+
+//////////
+// INIT //
+//////////
 /**
    \brief sets a name to the Model
@@ -204,7 +212,13 @@
   if (this->name) 
     delete this->name;
-  this->name = new char[strlen(name)+1];
-  strcpy(this->name, name);
-}
+  if (name)
+    {
+      this->name = new char[strlen(name)+1];
+      strcpy(this->name, name);
+    }
+  else 
+    this->name = NULL;
+}
+
 /**
    \brief initializes a new Group model
@@ -244,11 +258,8 @@
 
 /**
-   \brief finalizes an Model.
-   This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process.
-*/
-bool Model::cleanup(void)
-{
-  PRINTF(4)("cleaning up the 3D-Model to save Memory.\n");
-
+   \brief deletes all the arrays
+*/
+bool Model::deleteArrays(void)
+{
   if (this->vertices)
     delete this->vertices;
@@ -257,5 +268,16 @@
   if (this->normals)
     delete this->normals;
-
+  this->vertices = NULL;
+  this->vTexture = NULL;
+  this->normals = NULL;
+}
+
+/**
+   \brief finalizes an Model.
+   This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process.
+*/
+bool Model::cleanup(void)
+{
+  PRINTF(4)("cleaning up the 3D-Model to save Memory.\n");
   this->cleanupGroup(this->firstGroup);
   return true; 
@@ -299,7 +321,5 @@
       delete face->next;
     }
-      
-}
-
+}
 
 /**
@@ -316,4 +336,58 @@
 }
 
+//////////
+// MESH //
+//////////
+/**
+   \brief adds a new Material to the Material List
+   \param material the Material to add
+   \returns the added material
+
+   !! beware the Material will be deleted when the Model gets deleted
+*/
+Material* Model::addMaterial(Material* material)
+{
+  this->materialList->add(material);
+  return material;
+}
+
+/**
+   \brief adds a new Material to the Material List
+   \param material the name of the Material to add
+   \returns the added material
+*/
+Material* Model::addMaterial(const char* materialName)
+{
+  
+  Material* newMat = new Material();
+  newMat->setName(materialName);
+
+  // adding material to the List of materials
+  this->materialList->add(newMat);  
+  return newMat;
+}
+
+/**
+   \brief finds a Material by its name and returns it
+   \param materialName the Name of the material to search for.
+   \returns the Material if found, NULL otherwise
+*/
+Material* Model::findMaterialByName(const char* materialName)
+{
+  tIterator<Material>* tmpIt = this->materialList->getIterator();
+  Material* material = tmpIt->nextElement();
+  while(material)
+    {
+      if (!strcmp(material->getName(), materialName))
+	{
+	  delete tmpIt;
+	  return material;
+	}
+      material = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  return NULL;
+}
+
 /**
    \brief parses a group String
@@ -323,5 +397,5 @@
    With it you should be able to import .obj-files with more than one Models inside. 
 */
-bool Model::addGroup (char* groupString)
+bool Model::addGroup (const char* groupString)
 {
   PRINTF(5)("Read Group: %s.\n", groupString);
@@ -339,5 +413,4 @@
     }
   ++this->groupCount;
-
 }
 
@@ -348,5 +421,5 @@
    If a vertex line is found this function will inject it into the vertex-Array
 */
-bool Model::addVertex (char* vertexString)
+bool Model::addVertex (const char* vertexString)
 {
   float subbuffer1;
@@ -366,5 +439,5 @@
    
 */
-bool Model::addVertex(const float x, const float y, const float z)
+bool Model::addVertex(float x, float y, float z)
 {
   PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z);
@@ -374,4 +447,67 @@
 
 /**
+   \brief parses a vertexNormal-String
+   \param normalString The String that will be parsed.
+
+   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
+*/
+bool Model::addVertexNormal (const char* normalString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  float subbuffer3;
+  sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
+  PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);
+  this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3);
+  return true;
+}
+
+/**
+   \brief adds a VertexNormal.
+   \param x The x coordinate of the Normal.
+   \param y The y coordinate of the Normal.
+   \param z The z coordinate of the Normal.
+
+   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
+*/
+bool Model::addVertexNormal(float x, float y, float z)
+{
+  PRINTF(5)("found vertex-Normal %f, %f, %f\n", x, y, z);
+  this->normals->addEntry(x, y, z);
+}
+
+/**
+   \brief parses a vertexTextureCoordinate-String
+   \param vTextureString The String that will be parsed.
+
+   If a vertexTextureCoordinate line is found,
+   this function will inject it into the vertexTexture-Array
+*/
+bool Model::addVertexTexture (const char* vTextureString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2);
+  PRINTF(5)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);
+  this->vTexture->addEntry(subbuffer1);
+  this->vTexture->addEntry(subbuffer2);
+  return true;
+}
+
+/**
+   \brief adds a Texture Coordinate
+   \param u The u coordinate of the TextureCoordinate.
+   \param v The y coordinate of the TextureCoordinate.
+
+   If a TextureCoordinate line is found this function will inject it into the TextureCoordinate-Array
+*/
+bool Model::addVertexTexture(float u, float v)
+{
+  PRINTF(5)("found vertex-Texture %f, %f\n", u, v);
+  this->vTexture->addEntry(u);
+  this->vTexture->addEntry(v);
+}
+
+/**
    \brief parses a face-string
    \param faceString The String that will be parsed.
@@ -379,5 +515,5 @@
    If a face line is found this function will add it to the glList.
 */
-bool Model::addFace (char* faceString)
+bool Model::addFace (const char* faceString)
 {
   if (this->currentGroup->faceCount >0)
@@ -441,5 +577,5 @@
    \param type 0: vertex only, 1: vertex and normal, 2: vertex and Texture, 3 vertex, normal and texture
 */
-bool Model::addFace(const float faceElemCount, int type, ...)
+bool Model::addFace(int faceElemCount, VERTEX_FORMAT type, ...)
 {
    if (this->currentGroup->faceCount > 0)
@@ -472,84 +608,14 @@
 
 /**
-   \brief parses a vertexNormal-String
-   \param normalString The String that will be parsed.
-
-   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
-*/
-bool Model::addVertexNormal (char* normalString)
-{
-  float subbuffer1;
-  float subbuffer2;
-  float subbuffer3;
-  sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
-  PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);
-  this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3);
-  return true;
-}
-
-/**
-   \brief adds a VertexNormal.
-   \param x The x coordinate of the Normal.
-   \param y The y coordinate of the Normal.
-   \param z The z coordinate of the Normal.
-
-   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
-*/
-bool Model::addVertexNormal(const float x, const float y, const float z)
-{
-  PRINTF(3)("found vertex-Normal %f, %f, %f\n", x, y, z);
-  this->normals->addEntry(x, y, z);
-}
-
-/**
-   \brief parses a vertexTextureCoordinate-String
-   \param vTextureString The String that will be parsed.
-
-   If a vertexTextureCoordinate line is found,
-   this function will inject it into the vertexTexture-Array
-*/
-bool Model::addVertexTexture (char* vTextureString)
-{
-  float subbuffer1;
-  float subbuffer2;
-  sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2);
-  PRINTF(5)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);
-  this->vTexture->addEntry(subbuffer1);
-  this->vTexture->addEntry(subbuffer2);
-  return true;
-}
-
-/**
-   \brief adds a Texture Coordinate
-   \param u The u coordinate of the TextureCoordinate.
-   \param v The y coordinate of the TextureCoordinate.
-
-   If a TextureCoordinate line is found this function will inject it into the TextureCoordinate-Array
-*/
-bool Model::addVertexTexture(const float u, const float v)
-{
-  PRINTF(3)("found vertex-Texture %f, %f\n", u, v);
-  this->vTexture->addEntry(u);
-  this->vTexture->addEntry(v);
-}
-
-/**
    \brief Function that selects a material, if changed in the obj file.
    \param matString the Material that will be set.
 */
-bool Model::addUseMtl (char* matString)
-{
-  /*
-  if (!this->mtlFileName)
-    {
-      PRINTF(4)("Not using new defined material, because no mtlFile found yet\n");
-      return false;
-    }
-  */      
+bool Model::setMaterial(const char* matString)
+{
   if (this->currentGroup->faceCount > 0)
     this->currentGroup->currentFace = this->currentGroup->currentFace->next = new Face;
   this->initFace (this->currentGroup->currentFace);
   
-  this->currentGroup->currentFace->material = material->search(matString);
+  this->currentGroup->currentFace->material = this->findMaterialByName(matString);
 
   if (this->currentGroup->faceCount == 0)
@@ -561,5 +627,5 @@
    \param mtl the Material that will be set.
 */
-bool Model::addUseMtl (Material* mtl)
+bool Model::setMaterial(Material* mtl)
 {
   if (this->currentGroup->faceCount > 0)
@@ -574,9 +640,87 @@
 
 /**
+   \brief A routine that is able to create normals.
+
+   The algorithm does the following:
+   1. It calculates creates Vectors for each normale, and sets them to zero.
+   2. It then Walks through a) all the Groups b) all the Faces c) all the FaceElements
+   3. It searches for a points two neighbours per Face, takes Vecotrs to them calculates FaceNormals and adds it to the Points Normal.
+   4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array.
+*/
+bool Model::buildVertexNormals ()
+{  
+  PRINTF(4)("Normals are being calculated.\n");
+
+  Vector* normArray = new Vector [vertices->getCount()/3];
+  for (int i=0; i<vertices->getCount()/3;i++)
+    normArray[i] = Vector(.0,.0,.0);
+  
+  int firstTouch;
+  int secondTouch;
+  Vector prevV;
+  Vector nextV;
+  Vector curV;
+
+  Group* tmpGroup = firstGroup;
+  while (tmpGroup)
+    {
+      Face* tmpFace = tmpGroup->firstFace;
+      while (tmpFace)
+	{
+	  if (tmpFace->firstElem)
+	    {
+	      FaceElement* firstElem = tmpFace->firstElem;
+	      FaceElement* prevElem;
+	      FaceElement* curElem = firstElem;
+	      FaceElement* nextElem;
+	      FaceElement* lastElem;
+	      // find last Element of the Chain. !! IMPORTANT:the last Element of the Chain must point to NULL, or it will resolv into an infinity-loop.
+	      while (curElem)
+		{
+		  prevElem = curElem;
+		  curElem = curElem->next;
+		}
+	      lastElem = prevElem;
+	      
+	      curElem = firstElem;
+	      for (int j=0; j<tmpFace->vertexCount; j++)
+		{
+		  if (!(nextElem = curElem->next))
+		    nextElem = firstElem;
+		  curElem->normalNumber = curElem->vertexNumber;
+		  
+		  curV = Vector (vertices->getArray()[curElem->vertexNumber*3], vertices->getArray()[curElem->vertexNumber*3+1], vertices->getArray()[curElem->vertexNumber*3+2]);
+		  prevV = Vector (vertices->getArray()[prevElem->vertexNumber*3], vertices->getArray()[prevElem->vertexNumber*3+1], vertices->getArray()[prevElem->vertexNumber*3+2]) - curV;
+		  nextV = Vector (vertices->getArray()[nextElem->vertexNumber*3], vertices->getArray()[nextElem->vertexNumber*3+1], vertices->getArray()[nextElem->vertexNumber*3+2]) - curV;
+		  normArray[curElem->vertexNumber] = normArray[curElem->vertexNumber] + nextV.cross(prevV);
+
+		  prevElem = curElem;
+		  curElem = curElem->next;
+		}
+	    }
+	  tmpFace = tmpFace->next;
+	}
+      tmpGroup = tmpGroup->next;
+    }
+
+  for (int i=0; i<vertices->getCount()/3;i++)
+    {
+      normArray[i].normalize();
+      PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
+      
+      this->normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z);
+
+    }
+  delete []normArray; 
+}
+
+////////////
+// openGL //
+////////////
+/**
    \brief reads and includes the Faces/Materials into the openGL state Machine
 */
-bool Model::importToGL (void)
-{
-
+bool Model::importToDisplayList(void)
+{
   // finalize the Arrays
   this->vertices->finalizeArray();
@@ -667,4 +811,25 @@
 
 /**
+   \brief reads and includes the Faces/Materials into the openGL state Machine
+*/
+bool Model::importToVertexArray(void)
+{
+  // finalize the Arrays
+  this->vertices->finalizeArray();
+  this->vTexture->finalizeArray();
+  if (normals->getCount() == 0) // vertices-Array must be built for this
+    this->buildVertexNormals();
+  this->normals->finalizeArray();
+
+  this->currentGroup = this->firstGroup;
+  glVertexPointer(3, GL_FLOAT, 0, this->vertices->getArray());
+  glNormalPointer(3, 0, this->normals->getArray());
+  glTexCoordPointer(2, GL_FLOAT, 0, this->vTexture->getArray());
+
+}
+
+
+
+/**
    \brief Adds a Face-element (one vertex of a face) with all its information. 
    \param elem The FaceElement to add to the OpenGL-environment.
@@ -688,83 +853,4 @@
 
 }
-
-/**
-   \brief A routine that is able to create normals.
-
-   The algorithm does the following:
-   1. It calculates creates Vectors for each normale, and sets them to zero.
-   2. It then Walks through a) all the Groups b) all the Faces c) all the FaceElements
-   3. It searches for a points two neighbours per Face, takes Vecotrs to them calculates FaceNormals and adds it to the Points Normal.
-   4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array.
-*/
-bool Model::buildVertexNormals ()
-{
-  
-  PRINTF(4)("Normals are being calculated.\n");
-
-  Vector* normArray = new Vector [vertices->getCount()/3];
-  for (int i=0; i<vertices->getCount()/3;i++)
-    normArray[i] = Vector(.0,.0,.0);
-  
-  int firstTouch;
-  int secondTouch;
-  Vector prevV;
-  Vector nextV;
-  Vector curV;
-
-  Group* tmpGroup = firstGroup;
-  while (tmpGroup)
-    {
-      Face* tmpFace = tmpGroup->firstFace;
-      while (tmpFace)
-	{
-	  if (tmpFace->firstElem)
-	    {
-	      FaceElement* firstElem = tmpFace->firstElem;
-	      FaceElement* prevElem;
-	      FaceElement* curElem = firstElem;
-	      FaceElement* nextElem;
-	      FaceElement* lastElem;
-	      // find last Element of the Chain. !! IMPORTANT:the last Element of the Chain must point to NULL, or it will resolv into an infinity-loop.
-	      while (curElem)
-		{
-		  prevElem = curElem;
-		  curElem = curElem->next;
-		}
-	      lastElem = prevElem;
-	      
-	      curElem = firstElem;
-	      for (int j=0; j<tmpFace->vertexCount; j++)
-		{
-		  if (!(nextElem = curElem->next))
-		    nextElem = firstElem;
-		  curElem->normalNumber = curElem->vertexNumber;
-		  
-		  curV = Vector (vertices->getArray()[curElem->vertexNumber*3], vertices->getArray()[curElem->vertexNumber*3+1], vertices->getArray()[curElem->vertexNumber*3+2]);
-		  prevV = Vector (vertices->getArray()[prevElem->vertexNumber*3], vertices->getArray()[prevElem->vertexNumber*3+1], vertices->getArray()[prevElem->vertexNumber*3+2]) - curV;
-		  nextV = Vector (vertices->getArray()[nextElem->vertexNumber*3], vertices->getArray()[nextElem->vertexNumber*3+1], vertices->getArray()[nextElem->vertexNumber*3+2]) - curV;
-		  normArray[curElem->vertexNumber] = normArray[curElem->vertexNumber] + nextV.cross(prevV);
-
-		  prevElem = curElem;
-		  curElem = curElem->next;
-		}
-	    }
-	  tmpFace = tmpFace->next;
-	}
-      tmpGroup = tmpGroup->next;
-    }
-
-  for (int i=0; i<vertices->getCount()/3;i++)
-    {
-      normArray[i].normalize();
-      PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
-      
-      this->normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z);
-
-    }
-  delete []normArray; 
-  
-}
-
 
 /**
@@ -833,10 +919,10 @@
   */
 
-  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);
-
-}
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,1, 2,2,2, 4,4,3, 3,3,4);
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 3,3,5, 4,4,6, 6,6,7, 5,5,8);
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 5,5,9, 6,6,10, 8,8,11, 7,7,12);
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,7,13, 8,8,14, 2,10,15, 1,9,16);
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,2,17, 8,11,18, 6,12,19, 4,4,20);
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,13,21, 1,1,22, 3,3,23, 5,14,24);
+
+}
Index: orxonox/branches/physics/src/lib/graphics/importer/model.h
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/model.h	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/importer/model.h	(revision 3953)
@@ -8,10 +8,19 @@
 
 #include "material.h"
+#include "glincl.h"
 
 // FORWARD DEFINITION //
 class Array;
 class Vector;
+template<class T> class tList;
 
-using namespace std;
+//! an enumerator fot the different Model Types.
+/**
+   MODEL_DISPLAY_LIST means, that a DisplayList will be built out of the model. This model will be STATIC, meaning it cannot be changed after initialisation.
+   MODEL_VERTEX_ARRAY means, that a VertexArray will be built out of the model. This moel will be DYNAMIX, meaning that one can change the properties from outside of the model.
+*/
+typedef enum MODEL_TYPE {MODEL_DISPLAY_LIST,
+			 MODEL_VERTEX_ARRAY};
+
 
 // definition of different modes for setting up Faces
@@ -19,24 +28,17 @@
 #define NORMAL 1       //!< If Faces are created WITH Normals (otherwise autocalculate)
 #define TEXCOORD 2     //!< If Faces are created WITH TextureCoordinate
+//! an enumerator for VERTEX_FORMAT
+typedef enum VERTEX_FORMAT {VERTEX_ONLY = VERTEX,
+		    VERTEX_NORMAL = NORMAL,
+		    VERTEX_TEXCOORD = TEXCOORD,
+		    VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD};
 
 //! Class that handles 3D-Models. it can also read them in and display them.
 class Model
 {
- public:
-  Model(void);
-  Model(char* modelName);
-  virtual ~Model(void);
-
-  void setName(const char* name);
-  
-  void draw(void) const;
-  void draw(int groupNumber) const;
-  void draw(char* groupName) const;
-  int getGroupCount() const;
-
- protected:
-  char* name;            //!< This is the name of the Model.
-  bool finalized;        //!< Sets the Object to be finalized.
-  
+ private:
+  /////////////
+  // structs //
+  /////////////
   //! This is the placeholder of one Vertex beloning to a Face.
   struct FaceElement
@@ -64,5 +66,6 @@
     char* name;         //!< the Name of the Group. this is an identifier, that can be accessed via the draw (char* name) function.
 
-    unsigned int listNumber;//!< The number of the GL-List this Group gets.
+    GLubyte* indices;   //!< The indices of the Groups. Needed for vertex-arrays
+    GLuint listNumber;  //!< The number of the GL-List this Group gets.
     Face* firstFace;    //!< The first Face in this group.
     Face* currentFace;  //!< The current Face in this Group (the one we are currently working with.)
@@ -73,4 +76,7 @@
   };
 
+  char* name;            //!< This is the name of the Model.
+  MODEL_TYPE type;
+  bool finalized;        //!< Sets the Object to be finalized.
 
   Array* vertices;      //!< The Array that handles the Vertices.
@@ -79,15 +85,22 @@
   Array* vTexture;      //!< The Array that handles the VertexTextureCoordinates.
 
-  
   Group* firstGroup;    //!< The first of all groups.
   Group* currentGroup;  //!< The currentGroup. this is the one we will work with.
   int groupCount;       //!< The Count of Groups.
 
-  Material* material;   //!< Initial pointer to the Material. This can hold many materials, because Material can be added with Material::addMaterial(..)
-  float scaleFactor;    //!< The Factor with which the Model should be scaled. \todo maybe one wants to scale the Model after Initialisation
+  tList<Material>* materialList;
+  
 
-  bool initialize(void);
   bool initGroup(Group* group);
   bool initFace (Face* face);
+
+  bool buildVertexNormals(void);
+
+  bool importToDisplayList(void);
+  bool addGLElement(FaceElement* elem);
+
+  bool importToVertexArray(void);
+
+  bool deleteArrays(void);
   bool cleanup(void);
   bool cleanupGroup(Group* group);
@@ -95,25 +108,39 @@
   bool cleanupFaceElement(FaceElement* faceElem);
 
- public:
-  bool addGroup(char* groupString);
-  bool addVertex(char* vertexString);
-  bool addVertex(const float x, const float y, const float z);
-  bool addFace(char* faceString);
-  bool addFace(const float faceElemCount, int type, ...);
-  bool addVertexNormal(char* normalString);
-  bool addVertexNormal(const float x, const float y, const float z);
-  bool addVertexTexture(char* vTextureString);
-  bool addVertexTexture(const float u, const float v);
-  bool addUseMtl(char* mtlString);
-  bool addUseMtl(Material* mtl);
-  void finalize(void);
 
  protected:
-  bool importToGL(void);
-  bool addGLElement(FaceElement* elem);
+  float scaleFactor;    //!< The Factor with which the Model should be scaled. \todo maybe one wants to scale the Model after Initialisation
 
-  bool buildVertexNormals(void);
+  Material* findMaterialByName(const char* materialName);
 
   void cubeModel(void);
+
+ public:
+  Model(const char* modelName = NULL, MODEL_TYPE type = MODEL_DISPLAY_LIST);
+  virtual ~Model(void);
+
+  void setName(const char* name);
+  inline const char* getName() {return this->name;}
+  
+  void draw(void) const;
+  void draw(int groupNumber) const;
+  void draw(char* groupName) const;
+  int getGroupCount() const;
+
+  Material* addMaterial(Material* material);
+  Material* addMaterial(const char* materialName);
+
+  bool addGroup(const char* groupString);
+  bool addVertex(const char* vertexString);
+  bool addVertex(float x, float y, float z);
+  bool addFace(const char* faceString);
+  bool addFace(int faceElemCount, VERTEX_FORMAT type, ...);
+  bool addVertexNormal(const char* normalString);
+  bool addVertexNormal(float x, float y, float z);
+  bool addVertexTexture(const char* vTextureString);
+  bool addVertexTexture(float u, float v);
+  bool setMaterial(const char* mtlString);
+  bool setMaterial(Material* mtl);
+  void finalize(void);
 };
 
Index: orxonox/branches/physics/src/lib/graphics/importer/objModel.cc
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/objModel.cc	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/importer/objModel.cc	(revision 3953)
@@ -18,7 +18,12 @@
 #include "objModel.h"
 
-#include <fstream>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define PARSELINELENGTH 8192
 
 #include "debug.h"
+#include "compiler.h"
 
 /**
@@ -27,5 +32,5 @@
    \param scaling The factor that the model will be scaled with.
 */
-OBJModel::OBJModel(char* fileName, float scaling)
+OBJModel::OBJModel(const char* fileName, float scaling) : Model(fileName)
 {
   this->initializeOBJ();
@@ -34,7 +39,5 @@
   this->importFile (fileName);
 
-  this->importToGL ();
-
-  this->cleanup();
+  this->finalize();
 }
 
@@ -63,6 +66,4 @@
   this->objFileName = NULL;
   this->mtlFileName = NULL;
-
-  this->initialize();
 }
 
@@ -71,5 +72,5 @@
    \param fileName The file to import
 */
-bool OBJModel::importFile (char* fileName)
+bool OBJModel::importFile (const char* fileName)
 {
   PRINTF(4)("preparing to read in file: %s\n", fileName);
@@ -83,5 +84,6 @@
   char pathSplitter='/';
 #endif /* __WIN32__ */
-  char* tmpName = fileName;
+  char* tmpName;
+  strcpy(tmpName, fileName);
   if (tmpName[0] == pathSplitter)
     tmpName++;
@@ -100,6 +102,5 @@
   
   this->setName(name);
-  if (this->material)
-    this->material->addTexturePath(this->objPath);
+
   this->objFileName = new char[strlen(name)+1];
   strcpy (this->objFileName, name);
@@ -120,67 +121,62 @@
   strcat(fileName, this->objFileName);
 
-  ifstream* OBJ_FILE = new ifstream(fileName);
-  if (OBJ_FILE->fail())
-    {
-      PRINTF(1)("unable to open .OBJ file: %s\n Loading cube-Model instead.\n", fileName);
-      cubeModel();
-      OBJ_FILE->close();
-      delete []fileName;
-      delete OBJ_FILE;
+  FILE* stream;
+  if( (stream = fopen (fileName, "r")) == NULL)
+    {
+      printf("IniParser could not open %s\n", fileName);
       return false;
     }
-  PRINTF(4)("Reading from opened file %s\n", fileName);
-  char Buffer[10000];
-  while(!OBJ_FILE->eof())
-    {
-      OBJ_FILE->getline(Buffer, 10000);
-      PRINTF(5)("Read input line: %s\n", Buffer);
+
+  char buffer[PARSELINELENGTH];
+  while(fgets(buffer, PARSELINELENGTH, stream))
+    {
+      // line termiated with \0 not \n
+      if (buffer[strlen(buffer)-1] == '\n')
+	buffer[strlen(buffer)-1] = '\0';
+
+      // case vertice
+      if (!strncmp(buffer, "v ", 2))
+	{
+	  this->addVertex(buffer+2);
+	}
+
+      // case face
+      else if (!strncmp(buffer, "f ", 2))
+	{
+	  this->addFace (buffer+2);
+	}
       
-
-      // case vertice
-      if (!strncmp(Buffer, "v ", 2))
-	{
-	  this->addVertex(Buffer+2);
-	}
-
-      // case face
-      else if (!strncmp(Buffer, "f ", 2))
-	{
-	  this->addFace (Buffer+2);
-	}
-      
-      else if (!strncmp(Buffer, "mtllib ", 7))
-	{
-	  this->readMtlLib (Buffer+7);
-	}
-
-      else if (!strncmp(Buffer, "usemtl ", 7))
-	{
-	  this->addUseMtl (Buffer+7);
+      else if (!strncmp(buffer, "mtllib ", 7))
+	{
+	  this->readMtlLib (buffer+7);
+	}
+
+      else if (!strncmp(buffer, "usemtl ", 7))
+	{
+	  this->setMaterial (buffer+7);
 	}
 
       // case VertexNormal
-      else if (!strncmp(Buffer, "vn ", 3))
-	{
-	  this->addVertexNormal(Buffer+3);
+      else if (!strncmp(buffer, "vn ", 3))
+	{
+	  this->addVertexNormal(buffer+3);
 	}
       
       // case VertexTextureCoordinate
-      else if (!strncmp(Buffer, "vt ", 3))
-	{
-	  this->addVertexTexture(Buffer+3);
+      else if (!strncmp(buffer, "vt ", 3))
+	{
+	  this->addVertexTexture(buffer+3);
 	}
       // case group
-      else if (!strncmp(Buffer, "g ", 2))
-	{
-	  this->addGroup (Buffer+2);
-	}
-      else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented
-	{
-	  PRINTF(2)("smoothing groups not supportet yet. line: %s\n", Buffer);
-	}
-    }
-  OBJ_FILE->close();
-  delete OBJ_FILE;
+      else if (!strncmp(buffer, "g ", 2))
+	{
+	  this->addGroup (buffer+2);
+	}
+      else if (!strncmp(buffer, "s ", 2)) //! \todo smoothing groups have to be implemented
+	{
+	  PRINTF(2)("smoothing groups not supportet yet. line: %s\n", buffer);
+	}
+    }
+  fclose (stream);
   delete []fileName;
   return true;
@@ -196,5 +192,5 @@
 
 */
-bool OBJModel::readMtlLib (char* mtlFile)
+bool OBJModel::readMtlLib (const char* mtlFile)
 {
   this->mtlFileName = new char [strlen(mtlFile)+1];
@@ -205,87 +201,95 @@
   
 
-  PRINTF(4)("Opening mtlFile: %s\n", fileName);
-
-  ifstream* MTL_FILE = new ifstream (fileName);
-  if (MTL_FILE->fail())
-    {
-      PRINTF(2)("unable to open file: %s\n", fileName);
-      MTL_FILE->close();
-      delete []fileName;
-      delete MTL_FILE;
+  FILE* stream;
+  if( (stream = fopen (fileName, "r")) == NULL)
+    {
+      printf("IniParser could not open %s\n", fileName);
       return false;
     }
-  char Buffer[500];
-  Material* tmpMat = material;
-  while(!MTL_FILE->eof())
-    {
-      MTL_FILE->getline(Buffer, 500);
-      PRINTF(5)("found line in mtlFile: %s\n", Buffer);
+
+  char buffer[PARSELINELENGTH];
+  Material* tmpMat = NULL;
+
+  while(fgets(buffer, PARSELINELENGTH, stream))
+    {
+      PRINTF(5)("found line in mtlFile: %s\n", buffer);
+
+      // line termiated with \0 not \n
+      if (buffer[strlen(buffer)-1] == '\n')
+	buffer[strlen(buffer)-1] = '\0';
+
+      // create new Material
+      if (!strncmp(buffer, "newmtl ", 7))
+	{
+	  tmpMat = this->addMaterial(buffer+7);//tmpMat->addMaterial(buffer+7);
+	}
+      // setting a illumMode
+      else if (!strncmp(buffer, "illum ", 6))
+	{
+	  if (likely(tmpMat != NULL))
+	    tmpMat->setIllum(buffer+6);
+
+	}
+      // setting Diffuse Color
+      else if (!strncmp(buffer, "Kd ", 3))
+	{
+	  if (likely(tmpMat != NULL))
+	    tmpMat->setDiffuse(buffer+3);
+	}
+      // setting Ambient Color
+      else if (!strncmp(buffer, "Ka ", 3))
+	{
+	  if (likely(tmpMat != NULL))
+	    tmpMat->setAmbient(buffer+3);
+	}
+      // setting Specular Color
+      else if (!strncmp(buffer, "Ks ", 3))
+	{
+	  if (likely(tmpMat != NULL))
+	    tmpMat->setSpecular(buffer+3);
+	}
+      // setting The Specular Shininess
+      else if (!strncmp(buffer, "Ns ", 3))
+	{
+	  if (likely(tmpMat != NULL))
+	    tmpMat->setShininess(buffer+3);
+	}
+      // setting up transparency
+      else if (!strncmp(buffer, "d ", 2))
+	{
+	  if (likely(tmpMat != NULL))
+	    tmpMat->setTransparency(buffer+2);
+	}
+      else if (!strncmp(buffer, "Tf ", 3))
+	{
+	  if (likely(tmpMat != NULL))
+	    tmpMat->setTransparency(buffer+3);
+	}
       
-
-      // create new Material
-      if (!strncmp(Buffer, "newmtl ", 7))
-	{
-	  tmpMat = tmpMat->addMaterial(Buffer+7);
-	  //	  PRINTF(2)("%s, %p\n", tmpMat->getName(), tmpMat);
-	}
-      // setting a illumMode
-      else if (!strncmp(Buffer, "illum ", 6))
-	{
-	  tmpMat->setIllum(Buffer+6);
-
-	}
-      // setting Diffuse Color
-      else if (!strncmp(Buffer, "Kd ", 3))
-	{
-	  tmpMat->setDiffuse(Buffer+3);
-	}
-      // setting Ambient Color
-      else if (!strncmp(Buffer, "Ka ", 3))
-	{
-	  tmpMat->setAmbient(Buffer+3);
-	}
-      // setting Specular Color
-      else if (!strncmp(Buffer, "Ks ", 3))
-	{
-	  tmpMat->setSpecular(Buffer+3);
-	}
-      // setting The Specular Shininess
-      else if (!strncmp(Buffer, "Ns ", 3))
-	{
-	  tmpMat->setShininess(Buffer+3);
-	}
-      // setting up transparency
-      else if (!strncmp(Buffer, "d ", 2))
-	{
-	  tmpMat->setTransparency(Buffer+2);
-	}
-      else if (!strncmp(Buffer, "Tf ", 3))
-	{
-	  tmpMat->setTransparency(Buffer+3);
-	}
-      
-      else if (!strncmp(Buffer, "map_Kd ", 7))
-	{
-	  tmpMat->setDiffuseMap(Buffer+7);
-	}
-      else if (!strncmp(Buffer, "map_Ka ", 7))
-	{
-	  tmpMat->setAmbientMap(Buffer+7);
-	}
-      else if (!strncmp(Buffer, "map_Ks ", 7))
-	{
-	  tmpMat->setSpecularMap(Buffer+7);
-	}
-      else if (!strncmp(Buffer, "bump ", 5))
-	{
-	  tmpMat->setBump(Buffer+7);
+      else if (!strncmp(buffer, "map_Kd ", 7))
+	{
+	  if (likely(tmpMat != NULL))
+	    tmpMat->setDiffuseMap(buffer+7);
+	}
+      else if (!strncmp(buffer, "map_Ka ", 7))
+	{
+	  if (likely(tmpMat != NULL))
+	    tmpMat->setAmbientMap(buffer+7);
+	}
+      else if (!strncmp(buffer, "map_Ks ", 7))
+	{
+	  if (likely(tmpMat != NULL))
+	    tmpMat->setSpecularMap(buffer+7);
+	}
+      else if (!strncmp(buffer, "bump ", 5))
+	{
+	  if (likely(tmpMat != NULL))
+	    tmpMat->setBump(buffer+7);
 	}
      
 
     }
-  MTL_FILE->close();
+  fclose(stream);
   delete []fileName;
-  delete MTL_FILE;
   return true;
 }
Index: orxonox/branches/physics/src/lib/graphics/importer/objModel.h
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/objModel.h	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/importer/objModel.h	(revision 3953)
@@ -13,5 +13,5 @@
 {
  public:
-  OBJModel(char* fileName, float scaling = 1.0);
+  OBJModel(const char* fileName, float scaling = 1.0);
   virtual ~OBJModel();
   void initializeOBJ(void);
@@ -24,7 +24,7 @@
 
   ///// readin /////
-  bool importFile (char* fileName);
+  bool importFile (const char* fileName);
   bool readFromObjFile (void);
-  bool readMtlLib (char* matFile);
+  bool readMtlLib (const char* matFile);
 };
 
Index: orxonox/branches/physics/src/lib/graphics/importer/primitive_model.cc
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/primitive_model.cc	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/importer/primitive_model.cc	(revision 3953)
@@ -33,6 +33,4 @@
 PrimitiveModel::PrimitiveModel(PRIMITIVE type, float size, unsigned int detail)
 {
-  this->initialize();
-
   switch (type)
     {
@@ -54,7 +52,5 @@
       break;
     }
-  this->importToGL ();
-
-  this->cleanup();
+  this->finalize();
 }
 
@@ -123,13 +119,13 @@
 	    {
 	      v1 = vertexCount+1;
-	      this->addFace(3, TEXCOORD, v1, v1, v3, v3, v4, v4);
+	      this->addFace(3, VERTEX_TEXCOORD, v1, v1, v3, v3, v4, v4);
 	    }
 	  else if (j == detail)
 	    {
 	      v3 = vertexCount+2;
-	      this->addFace(3, TEXCOORD, v1, v1, v2, v2, v3, v3);
+	      this->addFace(3, VERTEX_TEXCOORD, v1, v1, v2, v2, v3, v3);
 	    }
 	  else
-	    this->addFace(4, TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4);
+	    this->addFace(4, VERTEX_TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4);
 	}
     }
@@ -163,15 +159,15 @@
       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);
+      this->addFace(4, VERTEX_ONLY, p1, p2, p3, p4);
+      this->addFace(3, VERTEX_ONLY, p4, p1, 2*detail+1);
+      this->addFace(3, VERTEX_ONLY, p2, p3, 2*detail+2);
+    }
+  // caps
+  this->addFace(4, VERTEX_ONLY, 2*detail-1, 2*detail, 2, 1);
+  this->addFace(3, VERTEX_ONLY, 1, 2*detail-1, 2*detail+1);
+  this->addFace(3, VERTEX_ONLY, 2*detail, 2, 2*detail+2);
 }
 
@@ -207,6 +203,6 @@
       else
 	v2 = i+4;
-      this->addFace(3, VERTEX, 1, v1, v2);
-      this->addFace(3, VERTEX, 2, v1, v2); 
+      this->addFace(3, VERTEX_ONLY, 1, v1, v2);
+      this->addFace(3, VERTEX_ONLY, 2, v1, v2); 
     }
 }
@@ -238,5 +234,5 @@
 	v3 = (i+1)*detail + (j+1);
 	v4 = i*detail + (j+1);
-	this->addFace(4, TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4);
+	this->addFace(4, VERTEX_TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4);
       }
 }
Index: orxonox/branches/physics/src/lib/graphics/importer/texture.cc
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/texture.cc	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/importer/texture.cc	(revision 3953)
@@ -23,22 +23,9 @@
    \brief Constructor for a Texture
 */
-Texture::Texture(void)
-{
-  this->pImage = new Image;
-  this->pImage->data = NULL;
-  this->map = NULL;
-  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);
+  if (imageName)
+    this->loadImage(imageName);
 }  
 
@@ -50,7 +37,4 @@
 Texture::~Texture(void)
 {
-  if (this->pImage->data)
-    delete []this->pImage->data;
-  delete pImage;
   if (this->texture)
     glDeleteTextures(1, &this->texture);
@@ -73,22 +57,86 @@
 /**
    \brief Loads a Texture to the openGL-environment.
-   \param pImage The Image to load to openGL
+   \param surface the Image to load to openGL
+   \returns The ID of the texture.
 */
-bool Texture::loadTexToGL (Image* pImage)
+GLuint Texture::loadTexToGL (SDL_Surface* surface)
 {
   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);
+
+      GLuint texture;
+      int w, h;
+      SDL_Surface *image;
+      SDL_Rect area;
+      Uint32 saved_flags;
+      Uint8  saved_alpha;
       
-      glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
-      glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);	
+      w = surface->w;
+      h = surface->h;
+      
+      image = SDL_CreateRGBSurface(SDL_SWSURFACE,
+				   w, h,
+				   32,
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
+				   0x000000FF, 
+				   0x0000FF00, 
+				   0x00FF0000, 
+				   0xFF000000
+#else
+				   0xFF000000,
+				   0x00FF0000, 
+				   0x0000FF00, 
+				   0x000000FF
+#endif
+				   );
+      if ( image == NULL ) {
+	return 0;
+      }
+      
+      /* Save the alpha blending attributes */
+      saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK);
+      saved_alpha = surface->format->alpha;
+      if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
+	SDL_SetAlpha(surface, 0, 0);
+      }
+      
+      /* Copy the surface into the GL texture image */
+      area.x = 0;
+      area.y = 0;
+      area.w = surface->w;
+      area.h = surface->h;
+      SDL_BlitSurface(surface, &area, image, &area);
+      
+      /* Restore the alpha blending attributes */
+      if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
+	SDL_SetAlpha(surface, saved_flags | SDL_OPENGL, saved_alpha);
+      }
+      
+      /* Create an OpenGL texture for the image */
+      glGenTextures(1, &texture);
+      glBindTexture(GL_TEXTURE_2D, texture);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+      /*      glTexImage2D(GL_TEXTURE_2D,
+		   0,
+		   GL_RGBA,
+		   w, h,
+		   0,
+		   GL_RGBA,
+		   GL_UNSIGNED_BYTE,
+		   image->pixels);
+      */
+      gluBuild2DMipmaps(GL_TEXTURE_2D,
+			3,
+			w,
+			h,
+			GL_RGBA,
+			GL_UNSIGNED_BYTE,
+			image->pixels);
+
+      SDL_FreeSurface(image); /* No longer needed */
+      
+      return texture;
     }
 }
@@ -104,38 +152,31 @@
       if (imageName)
 	{
-	  this->map=IMG_Load(imageName);
-	  if(!map)
+	  SDL_Surface* tmpSurf;
+	  if (this->texture)
+	    glDeleteTextures(1, &this->texture);
+	  // load the new Image to memory
+	  tmpSurf = IMG_Load(imageName);
+	  if(!tmpSurf)
 	    {
 	      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;
-	      SDL_SetAlpha(this->map, 0, 0);
-	    }
 
-	  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]);
+	  GLubyte* pixels = (GLubyte*)tmpSurf->pixels;
 	  
-	  this->loadTexToGL (this->pImage);
-	  SDL_FreeSurface(map);
-	  pImage->data = NULL;
+	  /* this swaps the Mapping so lowel left will be upper left */
+	  for( int i = 0 ; i < (tmpSurf->h / 2) ; ++i )
+	    for( int j = 0 ; j < tmpSurf->w * tmpSurf->format->BytesPerPixel; j += tmpSurf->format->BytesPerPixel )
+	      for(int k = 0; k < tmpSurf->format->BytesPerPixel; ++k)
+		swap( pixels[(i * tmpSurf->w * tmpSurf->format->BytesPerPixel) + j + k],
+		      pixels[ ( (tmpSurf->h - i - 1) * tmpSurf->w *  tmpSurf->format->BytesPerPixel) + j + k]);
+
+	  PRINTF(3)("loading Image %s\n", imageName);
+	  if (tmpSurf)
+	    this->texture = loadTexToGL(tmpSurf);
+
+	  
+	  SDL_FreeSurface(tmpSurf);
+	  return true;
 	}
       else
Index: orxonox/branches/physics/src/lib/graphics/importer/texture.h
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/texture.h	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/importer/texture.h	(revision 3953)
@@ -20,27 +20,14 @@
 {
  private:
-  //! Struct to handle Infos about an Image
-  struct Image
-  {
-    int rowSpan;    //!< The count of the rows this Image has.
-    GLuint width;   //!< The width of the Image.
-    GLuint height;  //!< The height of the Image.
-    GLuint bpp;     //!< BytesPerPixel
-    GLenum format;  //!< The Format of the PixelData
-    GLuint type;    //!< Type of the Image.
-    GLubyte *data;  //!< The Image Data comes here! DANGER: uncompressed data.
-  };
-  Image* pImage;    //!< The data of an Image
   GLuint texture;   //!< The Texture-ID of opengl from this Texture.
-  SDL_Surface* map; //!< The map SDL initializes for this element.
   char* searchTextureInPaths(const char* texName) const;
   void swap(unsigned char &a, unsigned char &b);
  public:
-  Texture(void);
-  Texture(const char* imageName);
+  Texture(const char* imageName = NULL);
   ~Texture(void);
+
   /** \returns The textureID of this texture.  */
   inline GLuint getTexture(void) {return this->texture;} 
-  bool loadTexToGL (Image* pImage);
+  GLuint loadTexToGL (SDL_Surface* surface);
 
   bool loadImage(const char* imageName);
Index: orxonox/branches/physics/src/lib/graphics/text_engine.cc
===================================================================
--- orxonox/branches/physics/src/lib/graphics/text_engine.cc	(revision 3866)
+++ orxonox/branches/physics/src/lib/graphics/text_engine.cc	(revision 3953)
@@ -36,5 +36,5 @@
 #include "vector.h"
 #include "debug.h"
-
+#include "list.h"
 
 ////////////
Index: orxonox/branches/physics/src/lib/util/list.cc
===================================================================
--- orxonox/branches/physics/src/lib/util/list.cc	(revision 3866)
+++ 	(revision )
@@ -1,148 +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 "list.h"
-#include "world_entity.h"
-
-using namespace std;
-
-
-
-List::List () 
-{
-  this->first = NULL;
-  this->last = NULL;
-  this->size = 0;
-}
-
-List::~List () 
-{}
-
-
-void List::add(WorldEntity* entity)
-{
-  printf("List::add() \n");
-  listElement* el = new listElement;
-  el->prev = this->last;
-  el->curr = entity;
-  el->next = NULL;
-
-  this->last = el;
-
-  if(this->size == 0) this->first = el;
-  else el->prev->next = el;
-  this->size++;
-}
-
-
-void List::remove(WorldEntity* entity)
-{
-  this->currentEl = this->first;
-  listElement* te;
-  while( this->currentEl != NULL)
-    {
-      if( this->currentEl->curr == entity)
-	{
-	  printf("List::remove() - object found\n");
-	  
-	  if( this->currentEl->prev  == NULL ) this->first = this->currentEl->next;
-	  else this->currentEl->prev->next = this->currentEl->next;
-
-	  if( this->currentEl->next == NULL) this->last = this->currentEl->prev;
-	  else this->currentEl->next->prev = this->currentEl->prev;
-
-	  te = this->currentEl->next;
-	  delete this->currentEl;
-	  this->currentEl = te;
-	  return;
-	}
-      this->currentEl = this->currentEl->next;
-    }
-}
-
-
-void List::destroy()
-{
-  printf("List::clear() - clearing all world objects, releasing mem\n");
-  this->currentEl = this->first;
-  listElement* le = NULL;
-  while(this->currentEl != NULL)
-    {
-      le = this->currentEl->next;
-      delete this->currentEl->curr;
-      delete this->currentEl;
-      this->currentEl = le;
-    }
-  this->first = NULL;
-  this->last = NULL;
-  this->size = 0;
-}
-
-
-WorldEntity* List::firstElement()
-{
-  return this->first->curr;
-}
-
-
-bool List::isEmpty()
-{
-  return (this->size==0)?true:false;
-}
-
-
-int List::getSize()
-{
-  return this->size;
-}
-
-
-WorldEntity* List::enumerate()
-{
-  if(this->size == 0) return NULL;
-  this->currentEl = this->first;
-  return this->currentEl->curr;
-}
-
-
-WorldEntity* List::nextElement()
-{
-  if(this->size == 0) return NULL;
-  this->currentEl = this->currentEl->next;
-  if(this->currentEl == NULL) return NULL;
-  return this->currentEl->curr;
-}
-
-
-WorldEntity* List::toArray()
-{}
-
-
-void List::debug()
-{
-  int counter = 1;
-  this->currentEl = this->first;
-  printf("List:debug() =====================\n");
-  while(this->currentEl != NULL)
-    {
-      printf("element: nr %d/%d\n", counter, size);
-      this->currentEl = this->currentEl->next;
-      counter++;
-    }
-  printf("List:debug()END =====================\n");
-}
Index: orxonox/branches/physics/src/lib/util/list.h
===================================================================
--- orxonox/branches/physics/src/lib/util/list.h	(revision 3866)
+++ 	(revision )
@@ -1,297 +1,0 @@
-
-#ifndef _LIST_H
-#define _LIST_H
-
-#include "compiler.h"
-#ifndef NULL
-#define NULL 0
-#endif
-
-//! An enum to list all the modes available when adding an object to a List
-//enum ADDMODE {LIST_ADD_FIRST, LIST_ADD_LAST};
-//! An enum to list the two searching directions available when removing an object from a List
-//enum FINDMODE {LIST_FIND_BW, LIST_FIND_FW};
-
-
-
-class WorldEntity;
-
-class List {
-
- public:
-  List ();
-  ~List ();
-
-  void add(WorldEntity* entity);
-  void remove(WorldEntity* entity);
-  void destroy();
-  WorldEntity* firstElement();
-  bool isEmpty();
-  int getSize();
-  WorldEntity* enumerate();
-  WorldEntity* nextElement();
-  WorldEntity* toArray();
-  void debug();
-
- private:
-  struct listElement
-  {
-    listElement* prev;
-    WorldEntity* curr;
-    listElement* next;
-  };
-  unsigned int size;
-  listElement* first;
-  listElement* last;
-  listElement* currentEl;
-
-
-};
-
-
-
-template<class T> struct listElement
-{
-  listElement* prev;
-  T* curr;
-  listElement* next;
-};
-
-template<class T> class tIterator
-{
- public:
-  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>
-inline 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 
-{
- public:
-  tList ();
-  ~tList ();
-
-  void add(T* entity);
-  void remove(T* entity);
-  void destroy();
-  T* firstElement();
-  T* lastElement();
-  bool isEmpty();
-  int getSize();
-  //T* enumerate();
-  tIterator<T>* getIterator();
-  T* nextElement();
-  T* nextElement(T* toEntity);
-  T* toArray();
-  void debug();
-
- private:
-  unsigned int size;
-  listElement<T>* first;
-  listElement<T>* last;
-  listElement<T>* currentEl;
-};
-
-
-template<class T>
-inline tList<T>::tList () 
-{
-  this->first = NULL;
-  this->last = NULL;
-  this->size = 0;
-}
-
-template<class T>
-inline tList<T>::~tList () 
-{
-  this->currentEl = this->first;
-  while(this->currentEl != NULL)
-    {
-      listElement<T>* le = this->currentEl->next;
-      //delete this->currentEl->curr;
-      delete this->currentEl;
-      this->currentEl = le;
-    }
-  this->first = NULL;
-  this->last = NULL;
-  this->size = 0;
-}
-
-
-template<class T>
-inline void tList<T>::add(T* entity)
-{
-  if( unlikely(entity == NULL)) return;
-  listElement<T>* el = new listElement<T>;
-  el->prev = this->last;
-  el->curr = entity;
-  el->next = NULL;
-
-  this->last = el;
-
-  if( unlikely(el->prev == NULL)) this->first = el; /* if first element */
-  else el->prev->next = el;
-  this->size++;
-}
-
-
-template<class T>
-inline void tList<T>::remove(T* entity)
-{
-  this->currentEl = this->first;
-  listElement<T>* te;
-  while( this->currentEl != NULL)
-    {
-      if( unlikely(this->currentEl->curr == entity))
-	{ 
-	  if( unlikely(this->currentEl->prev  == NULL)) this->first = this->currentEl->next;
-	  else this->currentEl->prev->next = this->currentEl->next;
-
-	  if( unlikely(this->currentEl->next == NULL)) this->last = this->currentEl->prev;
-	  else this->currentEl->next->prev = this->currentEl->prev;
-
-	  delete this->currentEl;
-	  this->size--;
-	  return;
-	}
-      this->currentEl = this->currentEl->next;
-    }
-}
-
-
-template<class T>
-inline void tList<T>::destroy()
-{
-  this->currentEl = this->first;
-  while(this->currentEl != NULL)
-    {
-      listElement<T>* le = this->currentEl->next;
-      //delete this->currentEl->curr;
-      delete this->currentEl;
-      this->currentEl = le;
-    }
-  this->first = NULL;
-  this->last = NULL;
-  this->size = 0;
-}
-
-
-template<class T>
-inline T* tList<T>::firstElement()
-{
-  return this->first->curr;
-}
-
-
-template<class T>
-inline T* tList<T>::lastElement()
-{
-  return this->last->curr;
-}
-
-
-template<class T>
-inline bool tList<T>::isEmpty()
-{
-  return (this->size==0)?true:false;
-}
-
-
-template<class T>
-inline int tList<T>::getSize()
-{
-  return this->size;
-}
-
-
-/* deprecated */
-/*
-template<class T>
-T* tList<T>::enumerate()
-{
-  //if( this->last == this->first == NULL) return NULL;
-  if( this->size == 0) return NULL;
-  this->currentEl = this->first;
-  return this->currentEl->curr;
-}
-*/
-
-template<class T>
-inline tIterator<T>* tList<T>::getIterator()
-{
-  tIterator<T>* iterator = new tIterator<T>(this->first);
-  return iterator;
-}
-
-
-/* deprecated */
-template<class T>
-T* tList<T>::nextElement()
-{
-  // if( this->last == this->first == NULL) return NULL;
-  if( this->size == 0) return NULL;
-  this->currentEl = this->currentEl->next;
-  if( this->currentEl == NULL) return NULL;
-  return this->currentEl->curr;
-}
-
-
-/**
-   \brief this returns the next element after toEntity or the first if toEntity is last
-*/
-template<class T>
-inline T* tList<T>::nextElement(T* toEntity)
-{
-  //if( this->last == this->first == NULL) return NULL;
-  if(this->size == 0) return NULL;
-  if( toEntity == NULL) return this->first->curr;
-  if( toEntity == this->last->curr ) return this->first->curr;
-  this->currentEl = this->first;
-  while(this->currentEl->curr != toEntity && this->currentEl->next != NULL)
-    {
-      this->currentEl = this->currentEl->next;
-    }
-  if(this->currentEl == NULL) return NULL;
-  return this->currentEl->next->curr;
-}
-
-
-template<class T>
-T* tList<T>::toArray()
-{}
-
-#endif /* _LIST_H */
Index: orxonox/branches/physics/src/lib/util/list_template.h
===================================================================
--- orxonox/branches/physics/src/lib/util/list_template.h	(revision 3866)
+++ 	(revision )
@@ -1,308 +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: Christian Meyer
-
-   ADDONS/FIXES:
-  
-   Patrick Boenzli     :          Implemented getSize() function
-*/
-
-
-/*!
-  \file list.h
-  \brief Contains a template for a doubly linked list
-*/
-
-#ifndef _LIST_TEMPLATE_H
-#define _LIST_TEMPLATE_H
-
-#include "stdincl.h"
-
-//! An enum to list all the modes available when adding an object to a List
-enum ADDMODE {LIST_ADD_NEXT, LIST_ADD_PREV, LIST_ADD_FIRST, LIST_ADD_LAST};
-//! An enum to list the two searching directions available when removing an object from a List
-enum FINDMODE {LIST_FIND_BW, LIST_FIND_FW};
-
-//! A generic doubly linked list
-template<class T> class ListTemplate 
-{
-  T* object;
-  ListTemplate<T>* next;
-  ListTemplate<T>* prev;
-  bool bReference;
-  int size;
-  
- public:
-  ListTemplate (T* obj, ListTemplate<T>* n, ListTemplate<T>* p, bool bRef);
-  ~ListTemplate ();
-  
-  int add(T* obj, ADDMODE mode, bool bRef);
-  T* getObject();
-  ListTemplate<T>* getNext();
-  ListTemplate<T>* getPrevious();
-  ListTemplate<T>* getLast();
-  ListTemplate<T>* getFirst();
-  void setNext(ListTemplate<T>* ptr);
-  void setPrev(ListTemplate<T>* ptr);
-  int remove (T* obj, FINDMODE mode);
-  int getSize();
-  void destroy();
-};
-
-
-/**
-  \brief Standard constructor
-  
-  Call this without any parameters to generate a new ListTemplate which can be filled with content.
-  DO NOT create a ListTemplate element that contains an object on your own, you'll lose the data
-  contained in that object and will have trouble removing the list from your memory.
-*/
-template<class T>
-ListTemplate<T>::ListTemplate (T* obj = NULL, ListTemplate<T>* n = NULL, ListTemplate<T>* p = NULL, bool bRef = false)
-{
-  object = obj;
-  next = n;
-  prev = p;
-  bReference = bRef;
-  if(obj != NULL)
-    ++size;
-}
-
-/**
-  \brief Standard destructor
-  
-  Call this on the initially generated base ListTemplate element to remove the whole ListTemplate from the memory.
-  You can safely do this to any ListTemplate element you want without messing up the rest of the ListTemplate, but keep in mind
-  that the contained object will be deleted as well when bRef had been set to false.
-*/
-template<class T>
-ListTemplate<T>::~ListTemplate ()
-{
-  if (object == NULL) // deleted foot node => disband the list
-  {
-    while( next != NULL)
-    {
-      delete next;
-    }
-    while( prev != NULL)
-    {
-      delete prev;
-    }
-  }
-  else
-  {
-    if (prev != NULL) prev->setNext (next);
-    if (next != NULL) next->setPrev (prev);
-    if (!bReference) delete object;
-  }
-}
- 
-/**
-  \brief Add an object to the ListTemplate
-  \param obj: A pointer to an allocated object
-  \param mode: A Value of ADDMODE (default: LIST_ADD_NEXT)
-  \param bRef: Sets whether the element is serving as a storage point or a simple listing (default: false)
-  \return 0 if the operation succeded, -1 if the element could not be added
-  
-  This adds a new ListTemplate element to the chain. The mode parameter can be used to specify
-  the location where the element should be added. LIST_ADD_NEXT will add the new element directly
-  after the base element. LIST_ADD_PREV will add the new element directly before the base element.
-  LIST_ADD_FIRST will add the element at the beginning of the ListTemplate whereas LIST_ADD_LAST will add
-  it to the end of the chain. If the bRef parameter is set to true, the object pointer will not be deleted
-  when the element containing that object is deleted, thus the ListTemplate can be used for temporary listings as
-  well as permanent data storage.
-*/
-template<class T> 
-int ListTemplate<T>::add (T* obj, ADDMODE mode = LIST_ADD_NEXT, bool bRef = false)
-{
-  ListTemplate<T>* p;
-  if( obj == NULL) return -1;
-  switch (mode)
-  {
-    case LIST_ADD_NEXT:
-      p = new ListTemplate<T>( obj, next, this, bRef);
-      if( next != NULL) next->setPrev (p);
-      next = p;
-      break;
-    case LIST_ADD_PREV:
-      p = new ListTemplate<T>( obj, this, prev, bRef);
-      if( prev != NULL) prev->setNext (p);
-      prev = p;
-      break;
-    case LIST_ADD_FIRST:
-      if (prev == NULL) prev = new ListTemplate<T> (obj, this, NULL, bRef);
-      else return prev->add (obj, mode, bRef);
-      break;
-    case LIST_ADD_LAST:
-      if (next == NULL) next = new ListTemplate<T> (obj, NULL, this, bRef);
-      else return next->add (obj, mode, bRef);
-      break;
-    default:
-        return -1;
-      break;
-  }
-  ++size;
-  return 0;
-}
-
-/**
-  \brief Get the next element of the ListTemplate
-  \return The ListTemplate element after the current ListTemplate element
-*/
-template<class T>
-ListTemplate<T>* ListTemplate<T>::getNext ()
-{
-  return next;
-}
- 
-/**
-  \brief Get the previous element of the ListTemplate
-  \return The ListTemplate element before the current ListTemplate element
-*/
-template<class T>
-ListTemplate<T>* ListTemplate<T>::getPrevious ()
-{
-  return prev;
-}
-
-/**
-  \brief Get the last element of the ListTemplate
-  \return The last ListTemplate element
-*/
-template<class T>
-ListTemplate<T>* ListTemplate<T>::getLast ()
-{
-  if (next == NULL) return this;
-  else return next->getLast();
-}
-
-/**
-  \brief Get the first element of the ListTemplate
-  \return The first ListTemplate element
-*/
-template<class T>
-ListTemplate<T>* ListTemplate<T>::getFirst ()
-{
-  if (prev == NULL) return this;
-  else return prev->getFirst();
-}
-
-/**
-  \brief Removes a certain element from the ListTemplate
-  \param obj: A pointer to the object that should be removed
-  \param mode: A value of FINDMODE
-  \return 0 if the element was found and removed, -1 if the element was not found
-  
-  This searches the part of the ListTemplate specified with mode for the object in question.
-  When the object is found it is deleted and the ListTemplate element is removed from the chain.
-  If mode is LIST_FIND_FW all elements AFTER the base element are searched, if mode is
-  LIST_FIND_BW all elements BEFORE the base element are searched. Note that the object
-  contained within the ListTemplate element is NOT deleted when bRef was set to true.
-*/
-template<class T>
-int ListTemplate<T>::remove (T* obj, FINDMODE mode = LIST_FIND_FW)
-{
-  if (obj == NULL) return -1;
-  else
-  {
-    switch (mode)
-    {
-      case LIST_FIND_BW:
-        if (prev == NULL) return -1;
-        else
-        {
-          if( prev->getObject() == obj)
-          {
-            delete prev;
-          }
-          else
-          {
-            return prev->remove( obj, mode);
-          }
-        }
-        break;
-      case LIST_FIND_FW:
-        if (next == NULL) return -1;
-        else
-        {
-          if( next->getObject() == obj)
-          {
-            delete next;
-          }
-          else
-          {
-            return next->remove( obj, mode);
-          }
-        }
-        break;
-      default:
-        return -1;
-    }
-  }
-  --size;
-  return 0;
-}
-
-/**
-  \brief Set the next element of a ListTemplate element
-  \param ptr: A pointer to the new next element
-    
-  Sets the next element of a ListTemplate element... Better not touch this, it can really mess up a ListTemplate.
-*/
-template<class T>
-void ListTemplate<T>::setNext (ListTemplate<T>* ptr)
-{
-  next = ptr;
-}
-
-/**
-  \brief Set the prev element of a ListTemplate element
-  \param ptr: A pointer to the new previous element
-    
-  Sets the previous element of a ListTemplate element... Better not touch this, it can really mess up a ListTemplate.
-*/
-template<class T>
-void ListTemplate<T>::setPrev (ListTemplate<T>* ptr)
-{
-  prev = ptr;
-}
-
-/**
-  \brief Get the pointer to the object the element is containing
-  \return The contained object (will be NULL if called on the base element).
-*/
-template<class T>
-T* ListTemplate<T>::getObject()
-{
-  return object;
-}
-
-
-/**
-  \brief Returns the current size of the ListTemplate
-  \return Size of ListTemplate
-*/
-template<class T>
-int ListTemplate<T>::getSize()
-{
-  return this->size;
-}
-
-
-template<class T>
-void ListTemplate<T>::destroy()
-{
-  /* \todo at the moment - doing nothing. should delete everything */
-}
-
-#endif /* _LIST_TENMPLATE_H */
-
Index: orxonox/branches/physics/src/lib/util/resource_manager.cc
===================================================================
--- orxonox/branches/physics/src/lib/util/resource_manager.cc	(revision 3866)
+++ 	(revision )
@@ -1,591 +1,0 @@
-/* 
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Benjamin Grauer
-   co-programmer: 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 "text_engine.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, void* param1, void* param2, void* param3)
-{
-  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 if (!strncmp(fileName+(strlen(fileName)-4), ".ttf", 4))
-    tmpType = TTF;
-  else 
-    tmpType = IMAGE;
-
-  return this->load(fileName, tmpType, prio, param1, param2, param3);
-}
-
-/**
-   \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, void* param1, void* param2, void* param3)
-{
-  // searching if the resource was loaded before.
-  Resource* tmpResource = this->locateResourceByInfo(fileName, type, param1, param2,param3);
-  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 (param1)
-	    tmpResource->modelSize = *(float*)param1;
-	  else
-	    tmpResource->modelSize = 1.0;
-
-	  if(isFile(fullName))
-	    tmpResource->pointer = new OBJModel(fullName, tmpResource->modelSize);
-	  else
-	    {
-	      PRINTF(2)("Sorry, %s does not exist. Loading a cube-Model instead\n", fullName);
-	      tmpResource->pointer = ResourceManager::load("cube", PRIM, prio, &tmpResource->modelSize);
-	    }
-	  break;
-	case PRIM:
-	  if (param1)
-	    tmpResource->modelSize = *(float*)param1;
-	  else
-	    tmpResource->modelSize = 1.0;
-
-	  if (!strcmp(tmpResource->name, "cube"))
-	    tmpResource->pointer = new PrimitiveModel(CUBE, tmpResource->modelSize);
-	  else if (!strcmp(tmpResource->name, "sphere"))
-	    tmpResource->pointer = new PrimitiveModel(SPHERE, tmpResource->modelSize);
-	  else if (!strcmp(tmpResource->name, "plane"))
-	    tmpResource->pointer = new PrimitiveModel(PLANE, tmpResource->modelSize);
-	  else if (!strcmp(tmpResource->name, "cylinder"))
-	    tmpResource->pointer = new PrimitiveModel(CYLINDER, tmpResource->modelSize);
-	  else if (!strcmp(tmpResource->name, "cone"))
-	    tmpResource->pointer = new PrimitiveModel(CONE, tmpResource->modelSize);
-	  break;
-	case TTF:
-	    if (param1)
-	      tmpResource->ttfSize = *(int*)param1;
-	    else
-	      tmpResource->ttfSize = FONT_DEFAULT_SIZE;
-	    if (param2)
-	      {
-		Vector* tmpVec = (Vector*)param2;
-		tmpResource->ttfColorR = (int)tmpVec->x;
-		tmpResource->ttfColorG = (int)tmpVec->y;
-		tmpResource->ttfColorB = (int)tmpVec->z;
-	      }
-	    else
-	      {
-		tmpResource->ttfColorR = FONT_DEFAULT_COLOR_R;
-		tmpResource->ttfColorG = FONT_DEFAULT_COLOR_G;
-		tmpResource->ttfColorB = FONT_DEFAULT_COLOR_B;
-	      }
-	    
-	  if(isFile(fullName))
-	    tmpResource->pointer = new Font(fullName,
-					    tmpResource->ttfSize,
-					    tmpResource->ttfColorR,
-					    tmpResource->ttfColorG,
-					    tmpResource->ttfColorB);
-	  else
-	    PRINTF(2)("Sorry, %s does not exist. Not loading Font\n", fullName);
-	  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;
-    }
-  if (tmpResource->pointer)
-    return tmpResource->pointer;
-  else 
-    {
-      PRINTF(2)("Resource %s could not be loaded\n", fileName);
-      delete tmpResource;
-      return NULL;
-    }
-}
-
-/**
-   \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;
-	    case TTF:
-	      delete (Font*)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 some information
-   \param fileName The name to look for
-   \returns a Pointer to the Resource if found, NULL otherwise.
-*/
-Resource* ResourceManager::locateResourceByInfo(const char* fileName, ResourceType type, void* param1, void* param2, void* param3)
-{
-  //  Resource* enumRes = resourceList->enumerate();
-  tIterator<Resource>* iterator = resourceList->getIterator();
-  Resource* enumRes = iterator->nextElement();
-  while (enumRes)
-    {
-      if (enumRes->type == type && !strcmp(fileName, enumRes->name))
-	{
-	  bool match = false;
-	  bool subMatch = false;
-	  switch (type)
-	    {
-	    case PRIM:
-	    case OBJ:
-	      if (!param1)
-		{
-		  if (enumRes->modelSize == 1.0)
-		    match = true;
-		}
-	      else if (enumRes->modelSize == *(float*)param1)
-		match = true;
-	      break;
-	    case TTF:
-	      if (!param1)
-		{
-		  if (enumRes->ttfSize == FONT_DEFAULT_SIZE)
-		    subMatch = true;
-		}
-	      else if (enumRes->modelSize =- *(int*)param1)
-		subMatch = true;
-	      if(subMatch)
-		{
-		  Vector* tmpVec = (Vector*)param2;
-		  if (!param2)
-		    {
-		      if(enumRes->ttfColorR == FONT_DEFAULT_COLOR_R &&
-			 enumRes->ttfColorG == FONT_DEFAULT_COLOR_G &&
-			 enumRes->ttfColorB == FONT_DEFAULT_COLOR_B )
-			match = true;
-		    }
-		  else if (enumRes->ttfColorR == (int)tmpVec->x &&
-			   enumRes->ttfColorG == (int)tmpVec->y &&
-			   enumRes->ttfColorB == (int)tmpVec->z )
-		    match = true;
-		}
-
-	      break;
-	    default:
-	      match = true;
-	      break;
-	    }
-	  if (match)
-	    {
-	      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
-*/
-bool ResourceManager::isDir(const char* directoryName)
-{
-  struct stat status;
-  stat(directoryName, &status);
-  if (status.st_mode & (S_IFDIR 
-#ifndef __WIN32__
-			| S_IFLNK
-#endif
-			))
-    return true;
-  else
-    return false;
-}
-
-/**
-   \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
-*/
-bool ResourceManager::isFile(const char* fileName)
-{
-  struct stat status;
-  stat(fileName, &status);
-  if (status.st_mode & (S_IFREG 
-#ifndef __WIN32__
-			| S_IFLNK
-#endif
-			))
-    return true;
-  else
-    return false;
-}
-
-/**
-   \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/physics/src/lib/util/resource_manager.h
===================================================================
--- orxonox/branches/physics/src/lib/util/resource_manager.h	(revision 3866)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*! 
-    \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, TTF, 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.
-  int count;                 //!< How many times this Resource has been loaded.
-  
-  char* name;                //!< Name of the Resource.
-  ResourceType type;         //!< ResourceType of this Resource.
-  ResourcePriority prio;     //!< The Priority of this resource. (This will only be increased)
-
-  // more specific
-  float modelSize;
-  unsigned int ttfSize;
-  unsigned char ttfColorR;
-  unsigned char ttfColorG;
-  unsigned char ttfColorB;
-};
-
-
-//! 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.
-
-   \todo loading also dependant by parameters.
-*/
-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* param1 = NULL, void* param2 = NULL, void* param3 = NULL);
-  void* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO,
-	     void* param1 = NULL, void* param2 = NULL, void* param3 = NULL);
-  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* locateResourceByInfo(const char* fileName, ResourceType type, void* param1, void* param2, void* param3);
-  Resource* locateResourceByPointer(const void* pointer);
-  
-  bool isDir(const char* directory);
-  bool isFile(const char* directory);
-
-};
-
-#endif /* _RESOURCE_MANAGER_H */
Index: orxonox/branches/physics/src/simple_animation.cc
===================================================================
--- orxonox/branches/physics/src/simple_animation.cc	(revision 3866)
+++ 	(revision )
@@ -1,392 +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: Benjamin Grauer
-
-   2005-04-17: Benjamin Grauer
-          Rewritte all functions, so it will fit into the Animation-class
-*/
-
-
-#include "simple_animation.h"
-
-
-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
-*/
-SimpleAnimation::SimpleAnimation () 
-{
-   this->setClassName ("SimpleAnimation");
-   this->frames = new tList<KeyFrame3D>();
-   this->animators = new tList<Animation3D>();
-   this->localTime = 0;
-   this->bRunning = false;
-   this->currentFrame = NULL;
-   this->lastFrame = NULL;
-
-   this->tmpVect = new Vector();
-   this->lastPosition = new Vector();
-   this->deltaT = 0.2;
-}
-
-
-/**
-   \brief standard deconstructor
-
-*/
-SimpleAnimation::~SimpleAnimation () 
-{
-  tIterator<KeyFrame3D>* iterator = this->frames->getIterator();
-  KeyFrame3D* frame = iterator->nextElement(); 
-  while( frame != NULL) 
-    { 
-      delete frame;
-      frame = iterator->nextElement();
-    }
-  delete iterator;
-  delete this->frames;
-  singletonRef = NULL;
-}
-
-
-/**
-   \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->workingAnimator = NULL;
-  this->bDescriptive = false;
-}
-
-
-/*
-  Vector* lastPosition;
-  Vector* tmpVect;
-  tList<KeyFrame3D>* 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(PNode* entity)
-{
-  Animation3D* anim = getAnimationFromPNode(entity);
-  if( anim == NULL)
-    {
-      anim = new Animation3D;
-      anim->object = entity;
-      anim->lastPosition = new Vector();
-      anim->tmpVect = new Vector();
-      anim->frames = new tList<KeyFrame3D>();
-      anim->animMode = LOOP;
-      anim->bRunning = false;
-      deltaT = 0.0;
-      this->animators->add(anim);
-    }
-  this->workingAnimator = anim;
-}
-
-
-
-/**
-   \brief adds a keyframe with properties
-   \param the point of the object
-   \param and the direction of it
-   \param at this time
-*/
-void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time)
-{
-  if( !this->bDescriptive || this->workingAnimator == NULL)
-    {
-      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
-      return;
-    }
-  KeyFrame3D* frame = new KeyFrame3D;
-  frame->position = point;
-  frame->direction = direction;
-  frame->time = time;
-  frame->mode = DEFAULT_ANIMATION_MODE;
-  frame->object = this->workingAnimator->object;
-  this->workingAnimator->frames->add(frame);
-}
-
-
-/**
-   \brief adds a keyframe with properties
-   \param the point of the object
-   \param and the direction of it
-   \param at this time
-   \param function of the velocity of the movement 
-*/
-void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode)
-{
-  if( !this->bDescriptive || this->workingAnimator == NULL)
-    {
-      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
-      return;
-    }
-  KeyFrame3D* frame = new KeyFrame3D;
-  frame->position = point;
-  frame->direction = direction;
-  frame->time = time;
-  frame->mode = mode;
-  frame->object = this->workingAnimator->object;
-  this->workingAnimator->frames->add(frame);
-}
-
-/**
-   \brief adds a already defined keyframe
-   \param the keyframe to add
-*/
-void SimpleAnimation::addKeyFrame(KeyFrame3D* frame)
-{
-  if( !this->bDescriptive || this->workingAnimator == NULL)
-    {
-      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
-      return;
-    }
-  frame->object = this->workingAnimator->object;
-  this->workingAnimator->frames->add(frame);
-}
-
-
-void SimpleAnimation::setAnimationMode(animationMode mode)
-{
-  if( !this->bDescriptive || this->workingAnimator == NULL)
-    {
-      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
-      return;
-    }
-  this->workingAnimator->animMode = mode;
-}
-
-/**
-   \brief clear the list of keyframes, deleting all keyframes included
-*/
-void SimpleAnimation::reset()
-{
-  /*
-  tIterator<KeyFrame3D>* iterator = this->frames->getIterator();
-  KeyFrame3D* frame = iterator->nextElement(); 
-  while( frame != NULL) 
-    { 
-      delete frame;
-      frame = iterator->nextElement();
-    }
-  delete iterator;
-  delete this->frames;
-
-  this->frames = new tList<KeyFrame3D>();
-  this->localTime = 0;
-  this->bRunning = false;
-
-  this->currentFrame = NULL;
-  this->lastFrame = NULL;
-  */
-}
-
-/**
-   \brief starts the animation, therefore listens to tick signals
-*/
-void SimpleAnimation::start()
-{
-  if( this->bRunning)
-    {
-      PRINTF(2)("SimpleAnimatin is already running. You are trying to start it again.\n");
-    return;
-    }
-  
-  if( this->workingAnimator == NULL)
-    {
-      PRINTF(1)("You have no target selected to start: either do this with start(target) or by prev selecting it\n");
-      return;
-    }
-  this->workingAnimator->localTime = 0.0;
-  this->workingAnimator->bRunning = true;
-  this->workingAnimator->currentFrame = this->workingAnimator->frames->firstElement();
-  this->workingAnimator->lastFrame = this->workingAnimator->frames->nextElement(this->workingAnimator->currentFrame);
-
-  /*
-  tIterator<Animation>* iterator = this->animators->getIterator();
-  Animation* anim = iterator->nextElement();
-  while( anim != NULL)
-    {
-      printf("SimpleAnimation::start() - initializing an animaion\n");
-      anim->currentFrame = anim->frames->firstElement();
-      anim->lastFrame = anim->frames->nextElement(anim->currentFrame);
-      anim = iterator->nextElement();
-    }
-  */
-}
-
-
-/**
-   \brief stops the animation, immune to tick signals
-*/
-void SimpleAnimation::stop()
-{
-  this->bRunning = false;
-}
-
-/**
-   \brief stops and then starts the animation from begining
-*/
-void SimpleAnimation::restart()
-{
-  this->localTime = 0;
-  //this->lastFrame = this->frames->firstElement();
-  //this->currentFrame = this->frames->nextElement(this->currentFrame);
-  this->bRunning = true;
-}
-
-/**
-   \brief pauses the animation until resumed
-*/
-void SimpleAnimation::pause()
-{
-  this->bRunning = false;
-}
-
-/**
-   \brief resumes a pause, if not paused, no effect
-*/
-void SimpleAnimation::resume()
-{
-  this->bRunning = true;
-}
-
-
-/**
-   \brief heart beat, next animation step
-*/
-void SimpleAnimation::tick(float time)
-{
-  tIterator<Animation3D>* iterator = this->animators->getIterator();
-  Animation3D* anim = iterator->nextElement();
-  while( anim != NULL)
-    {
-      if( anim->bRunning)
-	{ 
-	  anim->localTime += time;
-	  /* first get the current frame via time-stamps */ 
-	  while( anim->localTime > anim->currentFrame->time)
-	    {
-	      PRINTF(4)("SimpleAnimation::tick(...) - changing Frame\n");
-	      
-	      anim->localTime -= anim->currentFrame->time;
-	      //this->currentFrame->object->setRelCoor(*this->currentFrame->position);
-	      *anim->lastPosition = *anim->currentFrame->position;
-	      
-	      anim->lastFrame = anim->currentFrame;
-	      anim->currentFrame = anim->frames->nextElement(anim->currentFrame);
-	      if( anim->currentFrame == anim->frames->firstElement() && anim->animMode == SINGLE)
-		{
-		  anim->bRunning = false;
-		  return;
-		}
-	      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 * anim->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 - expf(- anim->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 * anim->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(anim->localTime, 3);
-	      break;
-	    default:
-	      break;
-	    }
-	}
-      anim = iterator->nextElement();
-    }
-  delete anim;
-}
-
-
-
-Animation3D* SimpleAnimation::getAnimationFromPNode(PNode* entity)
-{
-  tIterator<Animation3D>* iterator = this->animators->getIterator();
-  Animation3D* anim = iterator->nextElement();
-  while( anim != NULL)
-    {
-      if( anim->object == entity)
-	return anim;
-      anim = iterator->nextElement();
-    }
-  delete iterator;
-  return NULL;
-}
Index: orxonox/branches/physics/src/simple_animation.h
===================================================================
--- orxonox/branches/physics/src/simple_animation.h	(revision 3866)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*! 
-    \file simple_animation.h
-    \brief A class to interpolate the movement of an object following descrete points in room and time
-    \todo implement it
-
-    This class has been done to animate some movement, works best for short 
-    distances.
-*/
-
-#ifndef _SIMPLE_ANIMATION_H
-#define _SIMPLE_ANIMATION_H
-
-#include "base_object.h"
-#include "list.h"
-#include "animation.h"
-
-
-class Vector;
-class Quaternion;
-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 Struct
-/**
-   This represents one point with direction of the animation
-*/
-typedef struct KeyFrame3D {
-  Vector* position;
-  Quaternion* direction;
-  PNode* object;
-  float time;
-  movementMode mode;
-};
-
-//! Animation Struct
-/**
-   This represents an animation for a object
-*/
-class Animation3D : public Animation
-{
- public:
-  Animation3D(void);
-  virtual ~Animation3D(void);
-    
-  virtual void rewind(void);
-
-  void addKeyFrame(Vector* point, Quaternion* direction, float time, ANIM_FUNCTION animFunc = ANIM_LINEAR);
-  void addKeyFrame(KeyFrame3D* frame);
-
-  virtual void tick(float timePassed);
-
-  // animation functions
-  void setAnimFunc(ANIM_FUNCTION animFunc);
-
- private:
-  float constant(float timePassed) const;
-  float linear(float timePassed) const;
-  float sine(float timePassed) const;
-  float cosine(float timePassed) const;
-  float exp(float timePassed) const;
-  float negExp(float timePassed) const;
-  float quadratic(float timePassed) const;
-  float random(float timePassed) const;
-  //  ANIM_FUNCTION animFunc;
-  KeyFrame3D* currentKeyFrame;
-  KeyFrame3D* nextKeyFrame;
-  tList<KeyFrame3D>* keyFrameList;
-  float (Animation3D::*animFunc)(float) const;
-
-  // private
-  PNode* object;
-  Vector* lastPosition;
-  Vector* tmpVect;
-  float deltaT;
-  float localTime;
-
-  tList<KeyFrame3D>* frames;
-  KeyFrame3D* currentFrame;
-  KeyFrame3D* lastFrame;
-
-  bool bRunning;
-
-  animationMode animMode;
-  movementMode movMode;
-};
-
-//! Animation Class
-/**
-   Helps you making some small animation
-*/
-class SimpleAnimation : public BaseObject {
- public:
-  static SimpleAnimation* getInstance();
-  virtual ~SimpleAnimation();
-
-  void animatorBegin();
-  void animatorEnd();
-  void selectObject(PNode* entity);
-  void addKeyFrame(Vector* point, Quaternion* direction, float time);
-  void addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode);
-  void addKeyFrame(KeyFrame3D* frame);
-  void setAnimationMode(animationMode mode);
-  void reset();
-
-
-  void start();
-  void stop();
-  void restart();
-  void pause();
-  void resume();
-
-  void tick(float time);
-
- private:
-  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<KeyFrame3D>* frames;         //<! where keyframes are stored in
-  tList<Animation3D>* animators;      //<! a list of animation's
-  KeyFrame3D* currentFrame;          //<! the frame that is been played now
-  KeyFrame3D* 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 - 
-  PNode* workingObject;      //<! this is a pointer to the current working object that has been selected via selectObject()
-  Animation3D* workingAnimator;       //<! the animator with which you are currently working
-  float deltaT;                    //<! this is a time constant for the movement
-
-  Animation3D* getAnimationFromPNode(PNode* entity);
-
-};
-
-#endif /* _SIMPLE_ANIMATION_H */
Index: orxonox/branches/physics/src/story_entities/world.cc
===================================================================
--- orxonox/branches/physics/src/story_entities/world.cc	(revision 3866)
+++ orxonox/branches/physics/src/story_entities/world.cc	(revision 3953)
@@ -367,5 +367,4 @@
 	    trackManager->condition(2, LEFTRIGHT, this->localPlayer);
 	    this->glmis->step();
-
 	    break;
 	  }
Index: orxonox/branches/physics/src/t_animation.h
===================================================================
--- orxonox/branches/physics/src/t_animation.h	(revision 3866)
+++ 	(revision )
@@ -1,346 +1,0 @@
-/*
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Benjamin Grauer
-   co-programmer: ...
-*/
-
-/*! 
-    \file t_animation.h
-*/
-
-#ifndef _T_ANIMATION_H
-#define _T_ANIMATION_H
-
-
-#include "animation.h"
-
-#define DELTA_X 0.05  //!< the percentag of the distance that doesnt have to be done by neg_exp (asymptotical) ~ maschinendelta
-
-//! A Struct for Keyframes that simply hold a float
-typedef struct KeyFrameF
-{
-  float duration;             //!< duration of this keyframe
-  float value;                //!< value of this keyframe
-  ANIM_FUNCTION animFunc;     //!< with whitch function to iterate to the next KeyFrameF
-};
-
-
-//! A Class to handle some animation for single floated values.
-template<class T> class tAnimation : public Animation
-{
- public:
-  tAnimation(T* object = NULL, void (T::*funcToAnim)(float) = NULL);
-  virtual ~tAnimation();
-
-  void setFuncToAnim(T* object, void (T::*funcToAnim)(float));
-
-  void addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc = ANIM_LINEAR);
-
-  virtual void rewind();
-  virtual void tick(float dt);
-
- private:
-  // animation functions
-  void setAnimFunc(ANIM_FUNCTION animFunc);
-  float constant(float timePassed) const;
-  float linear(float timePassed) const;
-  float sine(float timePassed) const;
-  float cosine(float timePassed) const;
-  float exp(float timePassed) const;
-  float negExp(float timePassed) const;
-  float quadratic(float timePassed) const;
-  float random(float timePassed) const;
-
-
-  //  ANIM_FUNCTION animFunc;
-  float (tAnimation<T>::*animFunc)(float) const;  //!< A Function for the AnimationType
-
-  KeyFrameF* currentKeyFrame;                     //!< The current KeyFrame
-  KeyFrameF* nextKeyFrame;                        //!< The KeyFrame we iterate to
-  tList<KeyFrameF>* keyFrameList;                 //!< The KeyFrameList
-
-  T* object;                                      //!< The Object from which to Animate something
-  void (T::*funcToAnim)(float);                   //!< The function to Animate
-
-  float expFactor;                                //!< some factors
-};
-
-
-
-/**
-   \brief standard constructor
-*/
-template<class T>
-tAnimation<T>::tAnimation (T* object, void (T::*funcToAnim)(float)) 
-{
-  // create a new List
-  this->keyFrameList = new tList<KeyFrameF>();
-  KeyFrameF* tmpKeyFrame = new KeyFrameF;
-  tmpKeyFrame->value = 0.0;
-  tmpKeyFrame->duration = 1.0;
-  keyFrameList->add(tmpKeyFrame);
-
-  this->currentKeyFrame = tmpKeyFrame;
-  this->nextKeyFrame = tmpKeyFrame;
-
-  this->animFunc = &tAnimation<T>::linear;
-
-  this->setFuncToAnim(object, funcToAnim);
-}
-
-
-/**
-   \brief standard deconstructor
-   
-   deletes all the Keyframes
-*/
-template<class T>
-tAnimation<T>::~tAnimation () 
-{
-  // delete all the KeyFrames
-  tIterator<KeyFrameF>* itKF = keyFrameList->getIterator();
-  KeyFrameF*  enumKF = itKF->nextElement();
-  while (enumKF)
-    {
-      delete enumKF;
-      enumKF = itKF->nextElement();
-    }
-  delete itKF;
-  delete this->keyFrameList;
-}
-
-/**
-   \brief rewinds the Animation to the beginning (first KeyFrame and time == 0)
-*/
-template<class T>
-void tAnimation<T>::rewind(void)
-{
-  this->currentKeyFrame = keyFrameList->firstElement();
-  this->nextKeyFrame = keyFrameList->nextElement(keyFrameList->firstElement());
-  this->localTime = 0.0;
-}
-
-/**
-   \brief sets the Function we want to animate
-   \param object from what object do we want to animate
-   \param funcToAnim which function
-*/
-template<class T>
-void tAnimation<T>::setFuncToAnim(T* object, void (T::*funcToAnim)(float))
-{
-  this->baseObject = this->object = object;
-  this->funcToAnim = funcToAnim;
-}
-
-/**
-   \brief Appends a new Keyframe
-   \param value the value of the new KeyFrame
-   \param duration The duration from the new KeyFrame to the next one
-   \param animFunc The function to animate between this keyFrame and the next one
-*/
-template<class T>
-void tAnimation<T>::addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc)
-{
-  // some small check
-  if (duration <= 0.0)
-    duration = 1.0;
-
-  KeyFrameF* tmpKeyFrame;
-    
-  if (bHasKeys)
-    {
-      tmpKeyFrame = new KeyFrameF;
-      if (this->currentKeyFrame == this->nextKeyFrame)
-	this->nextKeyFrame = tmpKeyFrame;
-      this->keyFrameList->add(tmpKeyFrame);
-
-    }
-  else
-    {
-      tmpKeyFrame = this->keyFrameList->firstElement();
-      bHasKeys = true;
-      this->setAnimFunc(animFunc);
-    }
-  tmpKeyFrame->value = value;
-  tmpKeyFrame->duration = duration;
-  tmpKeyFrame->animFunc = animFunc;
-}
-
-/**
-   \brief ticks the Animation
-   \param dt how much time to tick
-*/
-template<class T>
-void tAnimation<T>::tick(float dt)
-{
-  if (this->bRunning)
-    {
-      this->localTime += dt;
-      if (localTime >= this->currentKeyFrame->duration)
-	{
-	  // switching to the next Key-Frame
-	  this->localTime -= this->currentKeyFrame->duration;
-
-	  this->currentKeyFrame = this->nextKeyFrame;
-	  // checking, if we should still Play the animation
-	  if (this->currentKeyFrame == this->keyFrameList->lastElement())
-	    this->handleInfinity();
-	  this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
-	  printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value);
-	  this->setAnimFunc(this->currentKeyFrame->animFunc);	  
-	}
-      
-      (this->object->*(funcToAnim))((this->*animFunc)(this->localTime));
-    }
-}
-
-/**
-   \brief Sets The kind of Animation between this keyframe and the next one
-   \param animFunc The Type of Animation to set
-*/
-template<class T>
-void tAnimation<T>::setAnimFunc(ANIM_FUNCTION animFunc)
-{
-  switch (animFunc)
-    {
-    default:
-    case ANIM_CONSTANT:
-      this->animFunc = &tAnimation<T>::constant;
-      break;
-    case ANIM_LINEAR:
-      this->animFunc = &tAnimation<T>::linear;
-      break;
-    case ANIM_SINE:
-      this->animFunc = &tAnimation<T>::sine;
-      break;
-    case ANIM_COSINE:
-      this->animFunc = &tAnimation<T>::cosine;
-      break;
-    case ANIM_EXP:
-      this->animFunc = &tAnimation<T>::exp;
-      break;
-    case ANIM_NEG_EXP:
-      {
-	this->animFunc = &tAnimation<T>::negExp;
-	float d = fabs(this->currentKeyFrame->value - this->nextKeyFrame->value);
-	expFactor =  - 1.0 / this->currentKeyFrame->duration * logf(DELTA_X);
-	break;
-      }
-    case ANIM_QUADRATIC:
-      this->animFunc = &tAnimation<T>::quadratic;
-      break;
-    case ANIM_RANDOM:
-      this->animFunc = &tAnimation<T>::random;
-      break;
-    }
-}
-
-
-// animation functions
-/**
-   \brief stays at the value of the currentKeyFrame
-   \param timePassed The time passed since this Keyframe began
-*/
-template<class T>
-float tAnimation<T>::constant(float timePassed) const
-{
-  return this->currentKeyFrame->value;
-}
-
-/**
-   \brief linear interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-*/
-template<class T>
-float tAnimation<T>::linear(float timePassed) const 
-{
-  return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value) 
-    * (timePassed / this->currentKeyFrame->duration);
-  //  PRINTF(0)("value is %f, %p %p\n", val, this->currentKeyFrame, this->nextKeyFrame);
-  //  return val;
-}
-
-/**
-   \brief a Sinusodial Interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-*/
-template<class T>
-float tAnimation<T>::sine(float timePassed) const
-{
-  float d = this->currentKeyFrame->value - this->nextKeyFrame->value;
-  float e = 0.5 * d * (1 - cos(M_PI * timePassed / this->currentKeyFrame->duration));
-  return this->currentKeyFrame->value - e;
-  /*
-  return his->currentKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value)
-    * sin(timePassed / this->currentKeyFrame->duration * M_PI);
-  */
-}
-
-/**
-   \brief a cosine interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-*/
-template<class T>
-float tAnimation<T>::cosine(float timePassed) const
-{
-  float d = this->currentKeyFrame->value - this->nextKeyFrame->value;
-  float e = 0.5 * d * (sin(M_PI * timePassed / this->currentKeyFrame->duration));
-  if( timePassed > 0.5*this->currentKeyFrame->duration) e = (d - e);
-  return this->currentKeyFrame->value - e;
-  /*
-  return this->currentKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value)
-    * cos(timePassed / this->currentKeyFrame->duration * M_PI);
-  */
-}
-
-/**
-   \brief an exponential interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-*/
-template<class T>
-float tAnimation<T>::exp(float timePassed) const
-{
-}
-
-/**
-   \brief a negative exponential interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-*/
-template<class T>
-float tAnimation<T>::negExp(float timePassed) const
-{
-  float d = this->currentKeyFrame->value - this->nextKeyFrame->value;
-  float e = d * (1.0 - expf(- timePassed * expFactor));
-  return  this->currentKeyFrame->value - e;
-}
-
-/**
-   \brief a quadratic interpolation between this keyframe and the next one
-   \param timePassed The time passed since this Keyframe began
-*/
-template<class T>
-float tAnimation<T>::quadratic(float timePassed) const
-{
-  this->linear(timePassed);
-}
-
-/**
-   \brief some random animation (fluctuating)
-   \param timePassed The time passed since this Keyframe began
-*/
-template<class T>
-float tAnimation<T>::random(float timePassed) const
-{
-  return this->currentKeyFrame->value * (float)rand()/(float)RAND_MAX;
-}
-
-#endif /* _T_ANIMATION_H */
Index: orxonox/branches/physics/src/track_manager.cc
===================================================================
--- orxonox/branches/physics/src/track_manager.cc	(revision 3866)
+++ orxonox/branches/physics/src/track_manager.cc	(revision 3953)
@@ -111,6 +111,5 @@
     }
   // if not found
-  else 
-    return NULL;
+  return NULL;
 }
 
@@ -141,6 +140,5 @@
     }
   // if not found
-  else 
-    return NULL;
+  return NULL;
 }
 
@@ -762,4 +760,5 @@
 {
   TrackElement* tmpTrackElem;
+  TrackElement* tmpJoinElem;
   for (int i = 0; i < count; i++)
     if (!this->firstTrackElem->findByID(trackIDs[i]))
@@ -793,8 +792,10 @@
   for (int i = 0; i < count; i++)
     {
-      TrackElement* tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]);
-      if (tmpJoinElem->childCount == 0
-	  && tmpJoinElem->endTime > tmpLatestTime)
-	tmpLatestTime = tmpJoinElem->endTime;
+      if(tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]))
+	{
+	  if (tmpJoinElem->childCount == 0
+	      && tmpJoinElem->endTime > tmpLatestTime)
+	    tmpLatestTime = tmpJoinElem->endTime;
+	}
     }
   // time the main Join.
@@ -804,22 +805,24 @@
   for (int i = 1; i < count; i++)
     {
-      TrackElement* tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]);
-      if (tmpJoinElem->childCount > 0)
-	printf("!!This Curve has children, and as such will not be joined!!\n You can try joining other childless TrackElements to this one!");
-      else
-	{
-	  this->addPoint(tmpc2Point, tmpJoinElem);
-	  this->addPoint(tmpTangentPoint, tmpJoinElem);
-	  this->addPoint(tmpEndPoint, tmpJoinElem);
-	  // time all other Joins
-	  tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime;
-	  
-	  //Copying Joint-Info
-	  tmpJoinElem->children = firstJoint->children;
-	  tmpJoinElem->childCount = firstJoint->childCount;
-	  tmpJoinElem->isSavePoint = firstJoint->isSavePoint;
-	  tmpJoinElem->isFork = firstJoint->isFork;
-
-	  tmpJoinElem->isJoined = true;
+      if( tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]))
+	{
+	  if (tmpJoinElem->childCount > 0)
+	    printf("!!This Curve has children, and as such will not be joined!!\n You can try joining other childless TrackElements to this one!");
+	  else
+	    {
+	      this->addPoint(tmpc2Point, tmpJoinElem);
+	      this->addPoint(tmpTangentPoint, tmpJoinElem);
+	      this->addPoint(tmpEndPoint, tmpJoinElem);
+	      // time all other Joins
+	      tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime;
+	      
+	      //Copying Joint-Info
+	      tmpJoinElem->children = firstJoint->children;
+	      tmpJoinElem->childCount = firstJoint->childCount;
+	      tmpJoinElem->isSavePoint = firstJoint->isSavePoint;
+	      tmpJoinElem->isFork = firstJoint->isFork;
+	      
+	      tmpJoinElem->isJoined = true;
+	    }
 	}
     }
Index: orxonox/branches/physics/src/util/animation/animation.cc
===================================================================
--- orxonox/branches/physics/src/util/animation/animation.cc	(revision 3953)
+++ orxonox/branches/physics/src/util/animation/animation.cc	(revision 3953)
@@ -0,0 +1,130 @@
+/* 
+   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_ANIM
+
+#include "animation.h"
+#include "debug.h"
+#include "animation_player.h"
+
+/**
+   \brief creates a new Animation
+   
+   This also adds the Animation automatically to the AnimationPlayer's list
+*/
+Animation::Animation(void)
+{  
+  // initialize a beginning KeyFrame, that will be deleted afterwards
+  this->keyFrameCount = 0;
+  this->bHandled = true;
+  this->bDelete = false;
+  this->baseObject = NULL;
+
+  // setting default values
+  this->localTime = 0.0;
+  this->bRunning = true;
+
+  AnimationPlayer::getInstance()->addAnimation(this);
+}
+
+/**
+   \brief destructs the Animation
+   
+   this also takes the animation out of the AnimationPlayer's list (if it is there)
+*/
+Animation::~Animation(void)
+{
+  this->doNotHandle();
+}
+
+/**
+   \brief tells the AnimationPlayer, that we do not wish to  handle this animation
+   automatically.
+   
+   This means that it will not be ticked, and not be deleted with the AnimationPlayer
+*/
+void Animation::doNotHandle(void)
+{
+  if (this->bHandled)
+    AnimationPlayer::getInstance()->removeAnimation(this);
+}
+
+/**
+   \brief Sets the infinitymode
+   \param postInfinity How the Animation should advance after the last Keyframe
+*/
+void Animation::setInfinity(ANIM_INFINITY postInfinity)
+{
+  this->postInfinity = postInfinity;
+}
+
+/**
+   \brief handles the Animation if it gets out of boundraries eg. if animation is finished.
+*/
+void Animation::handleInfinity(void)
+{
+  switch (this->postInfinity)
+    {
+    case ANIM_INF_CONSTANT:
+      this->localTime = 0.0;
+      this->bRunning = false;
+      break;
+    case ANIM_INF_REPLAY:
+      this->replay();
+      break;
+    case ANIM_INF_REWIND:
+      this->stop();
+      break;
+    case ANIM_INF_DELETE: // this will possibly never be made
+      this->bDelete = true;
+      break;
+    }
+}
+
+/**
+   \brief plays the animation back from the current Time forward
+*/
+void Animation::play()
+{
+  this->bRunning = true;
+}
+
+/**
+   \brief Stops the animation. eg. pause(); rewind();
+*/
+void Animation::stop()
+{
+  this->rewind();
+  this->bRunning = true;
+  this->tick(0.0);
+  this->bRunning = false;
+}
+
+/**
+   \brief Pauses the animation. Stays at the current Time
+*/
+void Animation::pause()
+{
+  this->bRunning = false;
+}
+
+/**
+   \brief replays the animation, eg. rewind();play();
+*/
+void Animation::replay()
+{
+  this->rewind();
+  this->bRunning = true;
+}
Index: orxonox/branches/physics/src/util/animation/animation.h
===================================================================
--- orxonox/branches/physics/src/util/animation/animation.h	(revision 3953)
+++ orxonox/branches/physics/src/util/animation/animation.h	(revision 3953)
@@ -0,0 +1,123 @@
+/*! 
+    \file animation.h
+    A Subclass for all animations in orxonox
+*/
+
+#ifndef _ANIMATION_H
+#define _ANIMATION_H
+
+#include "list.h"
+#include "base_object.h"
+#include "confincl.h"  // must be here to determin the DEBUG-level
+
+// FORWARD DEFINITION
+
+//! An enumerator of Functions to describe the flow of the Animation
+/**
+   \todo check with Patrick it of
+
+   description in speed to the next keyframe:
+   ANIM_CONSTANT: 0, infinity.
+   ANIM_LINEAR: equal
+   ANIM_SINE: fast, slow, fast
+   ANIM_COSINE: slow, fast, slow
+   ANIM_EXP: slow, fast
+   ANIM_NEG_EXP: fast, slow
+   ANIM_RANDOM: eratic
+   
+   deprecated QUADRATIC
+*/
+typedef enum ANIM_FUNCTION {ANIM_CONSTANT,
+			    ANIM_LINEAR,
+			    ANIM_SINE,
+			    ANIM_COSINE,
+			    ANIM_EXP,
+			    ANIM_NEG_EXP,
+			    ANIM_QUADRATIC,
+			    ANIM_RANDOM};
+
+//! An enumerator describing what the animation should do after the last keyframe.
+/**
+   ANIM_INF_CONSTANT stays at the end of the animation
+   ANIM_INF_REPLAY loops back to the beginning and replays the animation
+   ANIM_INF_REWIND loops back to the beginning and then stops the animation
+   ANIM_INF_DELETE deletes the animation. !! THIS IS DANGEROUS !! only do this with non-class variables
+*/
+typedef enum ANIM_INFINITY {ANIM_INF_CONSTANT,
+			    ANIM_INF_REPLAY,
+			    ANIM_INF_REWIND,
+			    ANIM_INF_DELETE};//, ANIM_INF_LINEAR, ANIM_INF_PINGPONG;
+
+//! A Superclass for describing an animation (all animations will be derived from this one)
+/** implement in subclasses:
+ * 
+ * De-/Constructor
+ * Animation Functions
+ * virtual tick
+ * addKeyFrame
+ * List of keyFrames
+ * currentKeyFrame/nextKeyFrame
+ * virtual rewind, to go to the first Keyframe. (other functions will call this one)
+*/
+class Animation
+{
+ public:
+  virtual ~Animation(void);
+  void doNotHandle(void);
+
+  void setInfinity(ANIM_INFINITY postInfinity = ANIM_INF_CONSTANT);
+
+  void play(); // equals resume();
+  void stop();
+  void pause();
+  void replay();
+  //! A virtual function that should change to the first keyframe.
+  virtual void rewind() = 0;
+  /** \brief A virtual function that ticks the animation \param dt the time passed */
+  virtual void tick(float dt) = 0;
+
+  /**
+     \returns the BaseObject, this animation operates on
+  */
+  BaseObject* getBaseObject(void) const {return baseObject;}
+
+  /** \returns if the Animation should be deleted */
+  inline bool ifDelete(void) {return bDelete;}
+
+ protected:
+  Animation(void);
+
+  void handleInfinity(void);
+  // variables
+  float localTime;                //!< The Time passed since the beginning of the currentKeyFrame.
+  ANIM_INFINITY postInfinity;     //!< describing what the animation should do after the last keyframe.
+
+  BaseObject* baseObject;         //!< The same as object in the derived classes, but with reference to BaseObject
+  unsigned int keyFrameCount;     //!< The Count of KeyFrames.
+  bool bHandled;                  //!< If this Animation is handled by the AnimationPlayer.
+  bool bRunning;                  //!< If the animation is running
+  bool bDelete;                   //!< If true, the animation will be deleted through the AnimationPlayer.
+};
+
+
+/**********************TEST*******************************/
+class aTest
+{
+ public:
+  aTest() { last = 0.0;}
+  ~aTest() {}
+  void littleDebug(float f) {  diff = f - last; printf("f=%f, diff=%f\n", f,diff); last = f;}
+ private:
+  float diff;
+  float last;
+};
+
+//aTest::aTest() {}
+//aTest::~aTest() {}
+
+//void aTest::littleDebug(float f)
+
+/**********************TEST*******************************/
+
+
+#endif /* _ANIMATION_H */
Index: orxonox/branches/physics/src/util/animation/animation3d.cc
===================================================================
--- orxonox/branches/physics/src/util/animation/animation3d.cc	(revision 3953)
+++ orxonox/branches/physics/src/util/animation/animation3d.cc	(revision 3953)
@@ -0,0 +1,310 @@
+/*
+   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: Benjamin Grauer
+
+   2005-04-17: Benjamin Grauer
+          Rewritte all functions, so it will fit into the Animation-class
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ANIM
+
+#include "animation3d.h"
+
+#include "p_node.h"
+
+using namespace std;
+
+/**
+   \brief standard constructor
+*/
+Animation3D::Animation3D(PNode* object)
+{
+  this->object = object;
+
+  // create a new List
+  this->keyFrameList = new tList<KeyFrame3D>();
+  KeyFrame3D* tmpKeyFrame = new KeyFrame3D;
+  tmpKeyFrame->position = Vector();
+  tmpKeyFrame->direction = Quaternion();
+  keyFrameList->add(tmpKeyFrame);
+
+  this->currentKeyFrame = tmpKeyFrame;
+  this->nextKeyFrame = tmpKeyFrame;
+
+  this->animFunc = &Animation3D::linear;
+}
+
+/**
+   \brief standard deconstructor
+   
+   deletes all the Keyframes
+*/
+Animation3D::~Animation3D(void)
+{
+  // delete all the KeyFrames
+  tIterator<KeyFrame3D>* itKF = keyFrameList->getIterator();
+  KeyFrame3D*  enumKF = itKF->nextElement();
+  while (enumKF)
+    {
+      delete enumKF;
+      enumKF = itKF->nextElement();
+    }
+  delete itKF;
+  delete this->keyFrameList;
+}
+
+/**
+   \brief rewinds the Animation to the beginning (first KeyFrame and time == 0)
+*/
+void Animation3D::rewind(void)
+{
+  this->currentKeyFrame = keyFrameList->firstElement();
+  this->nextKeyFrame = keyFrameList->nextElement(keyFrameList->firstElement());
+  this->localTime = 0.0;
+  this->setAnimFunc(this->currentKeyFrame->animFunc);
+}
+
+/**
+   \brief Appends a new Keyframe
+   \param position The position of the new Keyframe
+   \param direction The direction of the new Keyframe.
+   \param duration The duration from the new KeyFrame to the next one
+   \param animFunc The function to animate between this keyFrame and the next one
+*/
+void Animation3D::addKeyFrame(Vector position, Quaternion direction, float duration, ANIM_FUNCTION animFunc)
+{
+  // some small check
+  if (duration <= 0.0)
+    duration = 1.0;
+
+  KeyFrame3D* tmpKeyFrame;
+    
+  // when adding the first frame
+  if (this->keyFrameCount == 0)
+    {
+      tmpKeyFrame = this->keyFrameList->firstElement();
+      this->setAnimFunc(animFunc);
+    }
+  else
+    {
+      tmpKeyFrame = new KeyFrame3D;
+      // when adding the second frame
+      if (this->currentKeyFrame == this->nextKeyFrame)
+	this->nextKeyFrame = tmpKeyFrame;
+      this->keyFrameList->add(tmpKeyFrame);
+    }
+
+  tmpKeyFrame->position = position;
+  tmpKeyFrame->direction = direction;
+  tmpKeyFrame->duration = duration;
+  tmpKeyFrame->animFunc = animFunc;
+  this->keyFrameCount++;
+}
+
+/**
+   \brief ticks the Animation
+   \param dt how much time to tick
+*/
+void Animation3D::tick(float dt)
+{
+  if (this->bRunning)
+    { 
+      this->localTime += dt;
+      if (localTime >= this->currentKeyFrame->duration)
+	{
+	  // switching to the next Key-Frame
+	  this->localTime -= this->currentKeyFrame->duration;
+	  this->currentKeyFrame = this->nextKeyFrame;
+	  // checking, if we should still Play the animation
+	  if (this->currentKeyFrame == this->keyFrameList->lastElement())
+	    this->handleInfinity();
+	  this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
+	  this->setAnimFunc(this->currentKeyFrame->animFunc);	  
+	  
+	  if( this->currentKeyFrame->animFunc == ANIM_NEG_EXP)
+	    {
+	      this->tmpVect = this->nextKeyFrame->position - this->currentKeyFrame->position;
+	      this->deltaT = 1/this->currentKeyFrame->duration * logf(1.0 + 600.0/this->tmpVect.len());
+	    }
+	}
+
+      /* now animate it */
+      (this->*animFunc)(this->localTime);
+      /*
+      switch( this->movMode)
+	{
+	case LINEAR:
+	  *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
+	  *this->tmpVect = *this->tmpVect * this->localTime / this->currentFrame->time;
+	  this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect);
+	  *this->lastPosition = *this->tmpVect;
+	  break;
+	case EXP:
+	      
+	  break;
+	case NEG_EXP:
+	  *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
+	  *this->tmpVect = *this->tmpVect * (1 - expf(- this->localTime * this->deltaT));     
+	  this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect);
+	  *this->lastPosition = *this->tmpVect;
+	  break;
+	case SIN:
+	  *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
+	  *this->tmpVect = *this->tmpVect * 0.5*(1 - cos(M_PI * this->localTime / this->currentFrame->time));     
+	  this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect);
+	  *this->lastPosition = *this->tmpVect;
+	  break;
+	case COS:
+	      
+	  break;
+	case QUADRATIC:
+	  *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
+	  *this->tmpVect = *this->tmpVect * 1/3 * ldexpf(this->localTime, 3);
+	  break;
+	default:
+	  break;
+	}
+      */
+    }
+}
+
+
+/**
+   \brief Sets The kind of Animation between this keyframe and the next one
+   \param animFunc The Type of Animation to set
+*/
+void Animation3D::setAnimFunc(ANIM_FUNCTION animFunc)
+{
+  switch (animFunc)
+    {
+    default:
+    case ANIM_CONSTANT:
+      this->animFunc = &Animation3D::constant;
+      break;
+    case ANIM_LINEAR:
+      this->animFunc = &Animation3D::linear;
+      break;
+    case ANIM_SINE:
+      this->animFunc = &Animation3D::sine;
+      break;
+    case ANIM_COSINE:
+      this->animFunc = &Animation3D::cosine;
+      break;
+    case ANIM_EXP:
+      this->animFunc = &Animation3D::exp;
+      break;
+    case ANIM_NEG_EXP:
+      this->animFunc = &Animation3D::negExp;
+      break;
+    case ANIM_QUADRATIC:
+      this->animFunc = &Animation3D::quadratic;
+      break;
+    case ANIM_RANDOM:
+      this->animFunc = &Animation3D::random;
+      break;
+    }
+}
+
+/**
+   \brief stays at the value of the currentKeyFrame
+   \param timePassed The time passed since this Keyframe began
+*/
+void Animation3D::constant(float timePassed) const
+{
+  this->object->setRelCoor(this->currentKeyFrame->position);
+
+  /*
+    this->tmpVect = this->nextKeyFrame->position - this->currentKeyFrame->position;
+    this->tmpVect = this->tmpVect * this->localTime / this->currentKeyFrame->duration;
+    this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect);
+    this->lastPosition = this->tmpVect;
+  */
+}
+
+/**
+   \brief linear interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+
+   \todo implement also do this for direction
+*/
+void Animation3D::linear(float timePassed) const
+{
+  this->object->setRelCoor(this->currentKeyFrame->position +
+			  (this->nextKeyFrame->position - this->currentKeyFrame->position) * 
+			  (timePassed/this->currentKeyFrame->duration));
+}
+
+/**
+   \brief a Sinusodial Interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+
+   \todo implement
+*/
+void Animation3D::sine(float timePassed) const
+{
+  this->linear(timePassed);
+}
+
+/**
+   \brief a cosine interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+
+   \todo implement
+*/
+void Animation3D::cosine(float timePassed) const
+{
+  this->linear(timePassed);
+}
+
+/**
+   \brief an exponential interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+*/
+void Animation3D::exp(float timePassed) const
+{
+  this->linear(timePassed);
+}
+
+/**
+   \brief a negative exponential interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+
+   \todo implement
+*/
+void Animation3D::negExp(float timePassed) const
+{
+  this->linear(timePassed);
+}
+
+/**
+   \brief a quadratic interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+
+   \todo implement
+*/
+void Animation3D::quadratic(float timePassed) const
+{
+  this->linear(timePassed);
+}
+
+/**
+   \brief some random animation (fluctuating)
+   \param timePassed The time passed since this Keyframe began
+*/
+void Animation3D::random(float timePassed) const
+{
+  this->object->setRelCoor(this->currentKeyFrame->position + 
+			   (this->nextKeyFrame->position - this->currentKeyFrame->position) * (float)rand()/(float)RAND_MAX);
+  this->object->setRelDir(this->currentKeyFrame->direction +
+			  (this->nextKeyFrame->direction - this->currentKeyFrame->direction)* (float)rand()/(float)RAND_MAX);
+}
Index: orxonox/branches/physics/src/util/animation/animation3d.h
===================================================================
--- orxonox/branches/physics/src/util/animation/animation3d.h	(revision 3953)
+++ orxonox/branches/physics/src/util/animation/animation3d.h	(revision 3953)
@@ -0,0 +1,62 @@
+/*! 
+    \file animation3d.h
+*/
+
+
+#include "animation.h"
+
+#include "vector.h"
+class PNode;
+
+//! KeyFrame3D Struct
+/**
+   This represents one point with direction of the animation
+*/
+typedef struct KeyFrame3D {
+  float duration;                   //!< The duration of this KeyFrame
+  Vector position;                  //!< The position of this KeyFrame
+  Quaternion direction;             //!< The direction of this KeyFrame
+  ANIM_FUNCTION animFunc;           //!< with whitch function to iterate to the next KeyFrame3D
+};
+
+//! Animation Struct
+/**
+   This represents an animation for a object
+*/
+class Animation3D : public Animation
+{
+ public:
+  Animation3D(PNode* object);
+  virtual ~Animation3D(void);
+    
+  virtual void rewind(void);
+
+  void addKeyFrame(Vector position, Quaternion direction, float time, ANIM_FUNCTION animFunc = ANIM_LINEAR);
+  //  void addKeyFrame(KeyFrame3D* frame);
+
+  virtual void tick(float dt);
+
+ private:
+  // animation functions
+  void setAnimFunc(ANIM_FUNCTION animFunc);
+  void constant(float timePassed) const;
+  void linear(float timePassed) const;
+  void sine(float timePassed) const;
+  void cosine(float timePassed) const;
+  void exp(float timePassed) const;
+  void negExp(float timePassed) const;
+  void quadratic(float timePassed) const;
+  void random(float timePassed) const;
+  //  ANIM_FUNCTION animFunc;
+  void (Animation3D::*animFunc)(float) const;      //!< A Function for the AnimationType
+
+  KeyFrame3D* currentKeyFrame;                     //!< The current KeyFrame
+  KeyFrame3D* nextKeyFrame;                        //!< The KeyFrame we iterate to
+  tList<KeyFrame3D>* keyFrameList;                 //!< The KeyFrameList
+
+  // more class-local description
+  PNode* object;                                   //!< The Object from which to Animate something
+  Vector lastPosition;   //!< ??
+  Vector tmpVect;        //!< what for??
+  float deltaT;          //!< ??
+};
Index: orxonox/branches/physics/src/util/animation/animation_player.cc
===================================================================
--- orxonox/branches/physics/src/util/animation/animation_player.cc	(revision 3953)
+++ orxonox/branches/physics/src/util/animation/animation_player.cc	(revision 3953)
@@ -0,0 +1,192 @@
+/* 
+   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_ANIM
+
+#include "animation_player.h"
+
+#include "compiler.h"
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+*/
+AnimationPlayer::AnimationPlayer () 
+{
+   this->setClassName ("AnimationPlayer");
+
+   this->animationList = new tList<Animation>();
+   this->play();
+}
+
+/**
+   \brief the singleton reference to this class
+*/
+AnimationPlayer* AnimationPlayer::singletonRef = NULL;
+
+/**
+   \returns a Pointer to this Class
+*/
+AnimationPlayer* AnimationPlayer::getInstance(void)
+{
+  if (!AnimationPlayer::singletonRef)
+    AnimationPlayer::singletonRef = new AnimationPlayer();
+  return AnimationPlayer::singletonRef;
+}
+
+/**
+   \brief standard deconstructor
+
+   !! DANGER !! when unloading the AnimationPlayer no other Function
+   should reference any Animations, from the animationList because it 
+   automatically deletes them. 
+   This usually happens when unloading a World.
+*/
+AnimationPlayer::~AnimationPlayer () 
+{
+  // deleting the Animation List AND all the elements of the List
+  this->flush();
+  delete this->animationList;
+
+  AnimationPlayer::singletonRef = NULL;
+}
+
+/**
+   \brief adds an Animation to the AnimationList.
+   \param animation the Animation to handle
+
+   when adding a Animation the Animation will too be deleted when
+   the AnimationPlayer gets deleted. Consider not adding it, or 
+   unadding it with animation->notHandled();
+*/
+void AnimationPlayer::addAnimation(Animation* animation)
+{
+  this->animationList->add(animation);
+}
+
+/**
+   \brief removes an Animation from the Animation List, WITHOUT deleting it.
+   \param animation the Anmination to remove from the List
+*/
+void AnimationPlayer::removeAnimation(Animation* animation)
+{
+  this->animationList->remove(animation);
+}
+
+/**
+   \brief empties the list AND deletes all the Animations
+*/ 
+void AnimationPlayer::flush(void)
+{
+  // deleting the Animation List AND all the elements of the List
+  tIterator<Animation>* animIt = this->animationList->getIterator();
+  Animation* anim = animIt->nextElement();
+  while( anim != NULL)
+    {
+      delete anim;
+      this->animationList->remove(anim);
+      anim = animIt->nextElement();
+    }
+  delete animIt;
+
+  delete this->animationList;
+  this->animationList = new tList<Animation>();
+}
+
+/**
+   \brief Ticks all the animations in animationList 
+   \param timePassed the time passed since the last tick.
+*/
+void AnimationPlayer::tick(float timePassed)
+{
+  if (this->bRunning)
+    {
+      // iterate through all the animations and tick them.
+      tIterator<Animation>* animIt = this->animationList->getIterator();
+      Animation* anim = animIt->nextElement();
+      while( anim != NULL)
+	{
+	  anim->tick(timePassed);
+	  if(unlikely(anim->ifDelete()))
+	  {
+	    this->animationList->remove(anim);
+	    delete anim;
+	  }
+	  anim = animIt->nextElement();
+	}
+      delete animIt;
+    }
+}
+/**
+   \brief starts playing the AnimationPlayer
+*/
+void AnimationPlayer::play(void)
+{
+  this->bRunning = true;
+}
+
+/**
+   \brief pauses playing of the AnimationPlayer
+*/
+void AnimationPlayer::pause(void)
+{
+  this->bRunning = false;
+}
+
+
+Animation* AnimationPlayer::getObjectFromBaseObject(const BaseObject* baseObject) const
+{
+  tIterator<Animation>* animIt = this->animationList->getIterator();
+  Animation* anim = animIt->nextElement();
+  while( anim != NULL)
+    {
+      if(anim->getBaseObject() == baseObject)
+	{
+	  delete animIt;
+	  return anim;
+	}
+      anim = animIt->nextElement();
+    }
+  delete animIt;
+
+}
+
+
+
+/**
+   \brief Outputs some nice debug-information
+*/
+void AnimationPlayer::debug(void)
+{
+  PRINT(0)("+------------------------------------+\n");
+  PRINT(0)("+ ANIMATION PLAYER DEBUG INFORMATION +\n");
+  PRINT(0)("+------------------------------------+\n");
+  PRINT(0)("| Reference: %p\n", this);
+  PRINT(0)("| CountOfAnims %d\n", this->animationList->getSize());
+  PRINT(0)("-Animation Information---------------+\n");
+  // Per ANIMATION DEBUG
+  tIterator<Animation>* animIt = this->animationList->getIterator();
+  Animation* anim = animIt->nextElement();
+  while( anim != NULL)
+    {
+      //      anim->debug();
+      anim = animIt->nextElement();
+    }
+  delete animIt;
+
+  PRINT(0)("+--------------------------------AP--+\n");
+}
Index: orxonox/branches/physics/src/util/animation/animation_player.h
===================================================================
--- orxonox/branches/physics/src/util/animation/animation_player.h	(revision 3953)
+++ orxonox/branches/physics/src/util/animation/animation_player.h	(revision 3953)
@@ -0,0 +1,59 @@
+/*! 
+    \file animation_player.h
+*/
+
+#ifndef _ANIMATION_PLAYER_H
+#define _ANIMATION_PLAYER_H
+
+#include "base_object.h"
+#include "animation.h"
+
+/* FORWARD DEFINITION */
+
+//! A AnimationPlayer, that handles the animation of all the Animations in the scene.
+/**
+   <b>AnimationPlayer usage:</b> \n
+
+   <b>Initialisation</b>: AnimationPlayer::getInstance() does the trick this is 
+   usually done when initializing a world \n
+   <b>Adding Animations</b>: create an Animation the following Way:
+   \li Anim* animation = new Anim(); // also use any other Subclass of Animation to initialize this
+   \li set some parameters: also see the specific classes for more info
+   \n
+   if you do not want a specific Animation to be handled by the AnimationPlayer, you have to 
+   unload it explicitely with animation->doNotHandle();
+   \n
+   eveything else will be done by the AnimationPlayer itself.\n
+*/
+class AnimationPlayer : public BaseObject {
+
+ public:
+  static AnimationPlayer* getInstance(void);
+  virtual ~AnimationPlayer(void);
+
+  // animation handling
+  void addAnimation(Animation* animation);
+  void removeAnimation(Animation* animation);
+  void flush(void);
+
+  // time functions
+  void tick(float timePassed);
+  void play(void);
+  void pause(void);
+
+  Animation* getObjectFromBaseObject(const BaseObject* baseObject) const;
+
+  void debug(void);
+
+ private:
+  /* singleton */
+  AnimationPlayer(void);
+  static AnimationPlayer* singletonRef;
+
+  /* class specific */
+  tList<Animation>* animationList;         //!< A List of Animations to be handled.
+  bool bRunning;                           //!< If the AnimationPlayer is running.
+};
+
+
+#endif /* _ANIMATION_PLAYER_H */
Index: orxonox/branches/physics/src/util/animation/t_animation.h
===================================================================
--- orxonox/branches/physics/src/util/animation/t_animation.h	(revision 3953)
+++ orxonox/branches/physics/src/util/animation/t_animation.h	(revision 3953)
@@ -0,0 +1,349 @@
+/*
+   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: ...
+*/
+
+/*! 
+    \file t_animation.h
+*/
+
+#ifndef _T_ANIMATION_H
+#define _T_ANIMATION_H
+
+#include "animation.h"
+
+#define DELTA_X 0.05  //!< the percentag of the distance that doesnt have to be done by neg_exp (asymptotical) ~ maschinendelta
+
+//! A Struct for Keyframes that simply hold a float
+typedef struct KeyFrameF
+{
+  float duration;             //!< duration of this keyframe
+  float value;                //!< value of this keyframe
+  ANIM_FUNCTION animFunc;     //!< with whitch function to iterate to the next KeyFrameF
+};
+
+
+//! A Class to handle some animation for single floated values.
+template<class T> class tAnimation : public Animation
+{
+ public:
+  tAnimation(T* object = NULL, void (T::*funcToAnim)(float) = NULL);
+  virtual ~tAnimation();
+
+  void setFuncToAnim(T* object, void (T::*funcToAnim)(float));
+
+  void addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc = ANIM_LINEAR);
+
+  virtual void rewind();
+  virtual void tick(float dt);
+
+ private:
+  // animation functions
+  void setAnimFunc(ANIM_FUNCTION animFunc);
+  float constant(float timePassed) const;
+  float linear(float timePassed) const;
+  float sine(float timePassed) const;
+  float cosine(float timePassed) const;
+  float exp(float timePassed) const;
+  float negExp(float timePassed) const;
+  float quadratic(float timePassed) const;
+  float random(float timePassed) const;
+
+
+  //  ANIM_FUNCTION animFunc;
+  float (tAnimation<T>::*animFunc)(float) const;  //!< A Function for the AnimationType
+
+  KeyFrameF* currentKeyFrame;                     //!< The current KeyFrame
+  KeyFrameF* nextKeyFrame;                        //!< The KeyFrame we iterate to
+  tList<KeyFrameF>* keyFrameList;                 //!< The KeyFrameList
+
+  T* object;                                      //!< The Object from which to Animate something
+  void (T::*funcToAnim)(float);                   //!< The function to Animate
+
+  float expFactor;                                //!< some factors
+};
+
+
+
+/**
+   \brief standard constructor
+*/
+template<class T>
+tAnimation<T>::tAnimation (T* object, void (T::*funcToAnim)(float)) 
+{
+  // create a new List
+  this->keyFrameList = new tList<KeyFrameF>();
+  KeyFrameF* tmpKeyFrame = new KeyFrameF;
+  tmpKeyFrame->value = 0.0;
+  tmpKeyFrame->duration = 1.0;
+  keyFrameList->add(tmpKeyFrame);
+
+  this->currentKeyFrame = tmpKeyFrame;
+  this->nextKeyFrame = tmpKeyFrame;
+
+  this->animFunc = &tAnimation<T>::linear;
+
+  this->setFuncToAnim(object, funcToAnim);
+}
+
+
+/**
+   \brief standard deconstructor
+   
+   deletes all the Keyframes
+*/
+template<class T>
+tAnimation<T>::~tAnimation () 
+{
+  // delete all the KeyFrames
+  tIterator<KeyFrameF>* itKF = keyFrameList->getIterator();
+  KeyFrameF*  enumKF = itKF->nextElement();
+  while (enumKF)
+    {
+      delete enumKF;
+      enumKF = itKF->nextElement();
+    }
+  delete itKF;
+  delete this->keyFrameList;
+}
+
+/**
+   \brief rewinds the Animation to the beginning (first KeyFrame and time == 0)
+*/
+template<class T>
+void tAnimation<T>::rewind(void)
+{
+  this->currentKeyFrame = keyFrameList->firstElement();
+  this->nextKeyFrame = keyFrameList->nextElement(keyFrameList->firstElement());
+  this->localTime = 0.0;
+  this->setAnimFunc(this->currentKeyFrame->animFunc);
+}
+
+/**
+   \brief sets the Function we want to animate
+   \param object from what object do we want to animate
+   \param funcToAnim which function
+*/
+template<class T>
+void tAnimation<T>::setFuncToAnim(T* object, void (T::*funcToAnim)(float))
+{
+  this->baseObject = this->object = object;
+  this->funcToAnim = funcToAnim;
+}
+
+/**
+   \brief Appends a new Keyframe
+   \param value the value of the new KeyFrame
+   \param duration The duration from the new KeyFrame to the next one
+   \param animFunc The function to animate between this keyFrame and the next one
+*/
+template<class T>
+void tAnimation<T>::addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc)
+{
+  // some small check
+  if (duration <= 0.0)
+    duration = 1.0;
+
+  KeyFrameF* tmpKeyFrame;
+    
+  // when adding the first frame
+  if (this->keyFrameCount == 0)
+    {
+      tmpKeyFrame = this->keyFrameList->firstElement();
+      this->setAnimFunc(animFunc);
+    }
+  else
+    {
+      tmpKeyFrame = new KeyFrameF;
+      // when adding the second frame
+      if (this->currentKeyFrame == this->nextKeyFrame)
+	this->nextKeyFrame = tmpKeyFrame;
+      this->keyFrameList->add(tmpKeyFrame);
+    }
+
+  tmpKeyFrame->value = value;
+  tmpKeyFrame->duration = duration;
+  tmpKeyFrame->animFunc = animFunc;
+  this->keyFrameCount++;
+}
+
+/**
+   \brief ticks the Animation
+   \param dt how much time to tick
+*/
+template<class T>
+void tAnimation<T>::tick(float dt)
+{
+  if (this->bRunning)
+    {
+      this->localTime += dt;
+      if (localTime >= this->currentKeyFrame->duration)
+	{
+	  // switching to the next Key-Frame
+	  this->localTime -= this->currentKeyFrame->duration;
+
+	  this->currentKeyFrame = this->nextKeyFrame;
+	  // checking, if we should still Play the animation
+	  if (this->currentKeyFrame == this->keyFrameList->lastElement())
+	    this->handleInfinity();
+	  this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
+
+	  printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value);
+	  this->setAnimFunc(this->currentKeyFrame->animFunc);	  
+	}
+      
+      (this->object->*(funcToAnim))((this->*animFunc)(this->localTime));
+    }
+}
+
+/**
+   \brief Sets The kind of Animation between this keyframe and the next one
+   \param animFunc The Type of Animation to set
+*/
+template<class T>
+void tAnimation<T>::setAnimFunc(ANIM_FUNCTION animFunc)
+{
+  switch (animFunc)
+    {
+    default:
+    case ANIM_CONSTANT:
+      this->animFunc = &tAnimation<T>::constant;
+      break;
+    case ANIM_LINEAR:
+      this->animFunc = &tAnimation<T>::linear;
+      break;
+    case ANIM_SINE:
+      this->animFunc = &tAnimation<T>::sine;
+      break;
+    case ANIM_COSINE:
+      this->animFunc = &tAnimation<T>::cosine;
+      break;
+    case ANIM_EXP:
+      this->animFunc = &tAnimation<T>::exp;
+      break;
+    case ANIM_NEG_EXP:
+      {
+	this->animFunc = &tAnimation<T>::negExp;
+	float d = fabs(this->currentKeyFrame->value - this->nextKeyFrame->value);
+	expFactor =  - 1.0 / this->currentKeyFrame->duration * logf(DELTA_X);
+	break;
+      }
+    case ANIM_QUADRATIC:
+      this->animFunc = &tAnimation<T>::quadratic;
+      break;
+    case ANIM_RANDOM:
+      this->animFunc = &tAnimation<T>::random;
+      break;
+    }
+}
+
+
+// animation functions
+/**
+   \brief stays at the value of the currentKeyFrame
+   \param timePassed The time passed since this Keyframe began
+*/
+template<class T>
+float tAnimation<T>::constant(float timePassed) const
+{
+  return this->currentKeyFrame->value;
+}
+
+/**
+   \brief linear interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+*/
+template<class T>
+float tAnimation<T>::linear(float timePassed) const 
+{
+  return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value)
+    * (timePassed / this->currentKeyFrame->duration);
+}
+
+/**
+   \brief a Sinusodial Interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+*/
+template<class T>
+float tAnimation<T>::sine(float timePassed) const
+{
+  if (timePassed * 2.0 < this->currentKeyFrame->duration)
+    return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value) 
+      * sin( M_PI * timePassed / this->currentKeyFrame->duration)/2;
+  else 
+    return this->nextKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value)
+      * sin( M_PI * (1.0 - timePassed / this->currentKeyFrame->duration))/2;
+  /*
+  printf("::%f::::%f::\n",timePassed/this->currentKeyFrame->duration,retVal);
+  return retVal;
+  */
+}
+
+/**
+   \brief a cosine interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+*/
+template<class T>
+float tAnimation<T>::cosine(float timePassed) const
+{
+  return ((this->nextKeyFrame->value + this->currentKeyFrame->value) +
+    (this->currentKeyFrame->value - this->nextKeyFrame->value) *
+    cos( M_PI * timePassed / this->currentKeyFrame->duration))/2;
+}
+
+/**
+   \brief an exponential interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+*/
+template<class T>
+float tAnimation<T>::exp(float timePassed) const
+{
+  return this->linear(timePassed);
+
+}
+
+/**
+   \brief a negative exponential interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+*/
+template<class T>
+float tAnimation<T>::negExp(float timePassed) const
+{
+  float d = this->currentKeyFrame->value - this->nextKeyFrame->value;
+  float e = d * (1.0 - expf(- timePassed * expFactor));
+  return  this->currentKeyFrame->value - e;
+}
+
+/**
+   \brief a quadratic interpolation between this keyframe and the next one
+   \param timePassed The time passed since this Keyframe began
+*/
+template<class T>
+float tAnimation<T>::quadratic(float timePassed) const
+{
+  this->linear(timePassed);
+}
+
+/**
+   \brief some random animation (fluctuating)
+   \param timePassed The time passed since this Keyframe began
+*/
+template<class T>
+float tAnimation<T>::random(float timePassed) const
+{
+  return this->currentKeyFrame->value + 
+    (this->nextKeyFrame->value - this->currentKeyFrame->value) *
+    (float)rand()/(float)RAND_MAX;
+}
+
+#endif /* _T_ANIMATION_H */
Index: orxonox/branches/physics/src/util/common/list.cc
===================================================================
--- orxonox/branches/physics/src/util/common/list.cc	(revision 3953)
+++ orxonox/branches/physics/src/util/common/list.cc	(revision 3953)
@@ -0,0 +1,148 @@
+
+
+/* 
+   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 "list.h"
+#include "world_entity.h"
+
+using namespace std;
+
+
+
+List::List () 
+{
+  this->first = NULL;
+  this->last = NULL;
+  this->size = 0;
+}
+
+List::~List () 
+{}
+
+
+void List::add(WorldEntity* entity)
+{
+  printf("List::add() \n");
+  listElement* el = new listElement;
+  el->prev = this->last;
+  el->curr = entity;
+  el->next = NULL;
+
+  this->last = el;
+
+  if(this->size == 0) this->first = el;
+  else el->prev->next = el;
+  this->size++;
+}
+
+
+void List::remove(WorldEntity* entity)
+{
+  this->currentEl = this->first;
+  listElement* te;
+  while( this->currentEl != NULL)
+    {
+      if( this->currentEl->curr == entity)
+	{
+	  printf("List::remove() - object found\n");
+	  
+	  if( this->currentEl->prev  == NULL ) this->first = this->currentEl->next;
+	  else this->currentEl->prev->next = this->currentEl->next;
+
+	  if( this->currentEl->next == NULL) this->last = this->currentEl->prev;
+	  else this->currentEl->next->prev = this->currentEl->prev;
+
+	  te = this->currentEl->next;
+	  delete this->currentEl;
+	  this->currentEl = te;
+	  return;
+	}
+      this->currentEl = this->currentEl->next;
+    }
+}
+
+
+void List::destroy()
+{
+  printf("List::clear() - clearing all world objects, releasing mem\n");
+  this->currentEl = this->first;
+  listElement* le = NULL;
+  while(this->currentEl != NULL)
+    {
+      le = this->currentEl->next;
+      delete this->currentEl->curr;
+      delete this->currentEl;
+      this->currentEl = le;
+    }
+  this->first = NULL;
+  this->last = NULL;
+  this->size = 0;
+}
+
+
+WorldEntity* List::firstElement()
+{
+  return this->first->curr;
+}
+
+
+bool List::isEmpty()
+{
+  return (this->size==0)?true:false;
+}
+
+
+int List::getSize()
+{
+  return this->size;
+}
+
+
+WorldEntity* List::enumerate()
+{
+  if(this->size == 0) return NULL;
+  this->currentEl = this->first;
+  return this->currentEl->curr;
+}
+
+
+WorldEntity* List::nextElement()
+{
+  if(this->size == 0) return NULL;
+  this->currentEl = this->currentEl->next;
+  if(this->currentEl == NULL) return NULL;
+  return this->currentEl->curr;
+}
+
+
+WorldEntity* List::toArray()
+{}
+
+
+void List::debug()
+{
+  int counter = 1;
+  this->currentEl = this->first;
+  printf("List:debug() =====================\n");
+  while(this->currentEl != NULL)
+    {
+      printf("element: nr %d/%d\n", counter, size);
+      this->currentEl = this->currentEl->next;
+      counter++;
+    }
+  printf("List:debug()END =====================\n");
+}
Index: orxonox/branches/physics/src/util/common/list.h
===================================================================
--- orxonox/branches/physics/src/util/common/list.h	(revision 3953)
+++ orxonox/branches/physics/src/util/common/list.h	(revision 3953)
@@ -0,0 +1,297 @@
+
+#ifndef _LIST_H
+#define _LIST_H
+
+#include "compiler.h"
+#ifndef NULL
+#define NULL 0
+#endif
+
+//! An enum to list all the modes available when adding an object to a List
+//enum ADDMODE {LIST_ADD_FIRST, LIST_ADD_LAST};
+//! An enum to list the two searching directions available when removing an object from a List
+//enum FINDMODE {LIST_FIND_BW, LIST_FIND_FW};
+
+
+
+class WorldEntity;
+
+class List {
+
+ public:
+  List ();
+  ~List ();
+
+  void add(WorldEntity* entity);
+  void remove(WorldEntity* entity);
+  void destroy();
+  WorldEntity* firstElement();
+  bool isEmpty();
+  int getSize();
+  WorldEntity* enumerate();
+  WorldEntity* nextElement();
+  WorldEntity* toArray();
+  void debug();
+
+ private:
+  struct listElement
+  {
+    listElement* prev;
+    WorldEntity* curr;
+    listElement* next;
+  };
+  unsigned int size;
+  listElement* first;
+  listElement* last;
+  listElement* currentEl;
+
+
+};
+
+
+
+template<class T> struct listElement
+{
+  listElement* prev;
+  T* curr;
+  listElement* next;
+};
+
+template<class T> class tIterator
+{
+ public:
+  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>
+inline 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 
+{
+ public:
+  tList ();
+  ~tList ();
+
+  void add(T* entity);
+  void remove(T* entity);
+  void destroy();
+  T* firstElement();
+  T* lastElement();
+  bool isEmpty();
+  int getSize();
+  //T* enumerate();
+  tIterator<T>* getIterator();
+  T* nextElement();
+  T* nextElement(T* toEntity);
+  T* toArray();
+  void debug();
+
+ private:
+  unsigned int size;
+  listElement<T>* first;
+  listElement<T>* last;
+  listElement<T>* currentEl;
+};
+
+
+template<class T>
+inline tList<T>::tList () 
+{
+  this->first = NULL;
+  this->last = NULL;
+  this->size = 0;
+}
+
+template<class T>
+inline tList<T>::~tList () 
+{
+  this->currentEl = this->first;
+  while(this->currentEl != NULL)
+    {
+      listElement<T>* le = this->currentEl->next;
+      //delete this->currentEl->curr;
+      delete this->currentEl;
+      this->currentEl = le;
+    }
+  this->first = NULL;
+  this->last = NULL;
+  this->size = 0;
+}
+
+
+template<class T>
+inline void tList<T>::add(T* entity)
+{
+  if( unlikely(entity == NULL)) return;
+  listElement<T>* el = new listElement<T>;
+  el->prev = this->last;
+  el->curr = entity;
+  el->next = NULL;
+
+  this->last = el;
+
+  if( unlikely(el->prev == NULL)) this->first = el; /* if first element */
+  else el->prev->next = el;
+  this->size++;
+}
+
+
+template<class T>
+inline void tList<T>::remove(T* entity)
+{
+  this->currentEl = this->first;
+  listElement<T>* te;
+  while( this->currentEl != NULL)
+    {
+      if( unlikely(this->currentEl->curr == entity))
+	{ 
+	  if( unlikely(this->currentEl->prev  == NULL)) this->first = this->currentEl->next;
+	  else this->currentEl->prev->next = this->currentEl->next;
+
+	  if( unlikely(this->currentEl->next == NULL)) this->last = this->currentEl->prev;
+	  else this->currentEl->next->prev = this->currentEl->prev;
+
+	  delete this->currentEl;
+	  this->size--;
+	  return;
+	}
+      this->currentEl = this->currentEl->next;
+    }
+}
+
+
+template<class T>
+inline void tList<T>::destroy()
+{
+  this->currentEl = this->first;
+  while(this->currentEl != NULL)
+    {
+      listElement<T>* le = this->currentEl->next;
+      //delete this->currentEl->curr;
+      delete this->currentEl;
+      this->currentEl = le;
+    }
+  this->first = NULL;
+  this->last = NULL;
+  this->size = 0;
+}
+
+
+template<class T>
+inline T* tList<T>::firstElement()
+{
+  return this->first->curr;
+}
+
+
+template<class T>
+inline T* tList<T>::lastElement()
+{
+  return this->last->curr;
+}
+
+
+template<class T>
+inline bool tList<T>::isEmpty()
+{
+  return (this->size==0)?true:false;
+}
+
+
+template<class T>
+inline int tList<T>::getSize()
+{
+  return this->size;
+}
+
+
+/* deprecated */
+/*
+template<class T>
+T* tList<T>::enumerate()
+{
+  //if( this->last == this->first == NULL) return NULL;
+  if( this->size == 0) return NULL;
+  this->currentEl = this->first;
+  return this->currentEl->curr;
+}
+*/
+
+template<class T>
+inline tIterator<T>* tList<T>::getIterator()
+{
+  tIterator<T>* iterator = new tIterator<T>(this->first);
+  return iterator;
+}
+
+
+/* deprecated */
+template<class T>
+T* tList<T>::nextElement()
+{
+  // if( this->last == this->first == NULL) return NULL;
+  if( this->size == 0) return NULL;
+  this->currentEl = this->currentEl->next;
+  if( this->currentEl == NULL) return NULL;
+  return this->currentEl->curr;
+}
+
+
+/**
+   \brief this returns the next element after toEntity or the first if toEntity is last
+*/
+template<class T>
+inline T* tList<T>::nextElement(T* toEntity)
+{
+  //if( this->last == this->first == NULL) return NULL;
+  if(this->size == 0) return NULL;
+  if( toEntity == NULL) return this->first->curr;
+  if( toEntity == this->last->curr ) return this->first->curr;
+  this->currentEl = this->first;
+  while(this->currentEl->curr != toEntity && this->currentEl->next != NULL)
+    {
+      this->currentEl = this->currentEl->next;
+    }
+  if(this->currentEl == NULL) return NULL;
+  return this->currentEl->next->curr;
+}
+
+
+template<class T>
+T* tList<T>::toArray()
+{}
+
+#endif /* _LIST_H */
Index: orxonox/branches/physics/src/util/common/list_template.h
===================================================================
--- orxonox/branches/physics/src/util/common/list_template.h	(revision 3953)
+++ orxonox/branches/physics/src/util/common/list_template.h	(revision 3953)
@@ -0,0 +1,308 @@
+/* 
+   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: Christian Meyer
+
+   ADDONS/FIXES:
+  
+   Patrick Boenzli     :          Implemented getSize() function
+*/
+
+
+/*!
+  \file list.h
+  \brief Contains a template for a doubly linked list
+*/
+
+#ifndef _LIST_TEMPLATE_H
+#define _LIST_TEMPLATE_H
+
+#include "stdincl.h"
+
+//! An enum to list all the modes available when adding an object to a List
+enum ADDMODE {LIST_ADD_NEXT, LIST_ADD_PREV, LIST_ADD_FIRST, LIST_ADD_LAST};
+//! An enum to list the two searching directions available when removing an object from a List
+enum FINDMODE {LIST_FIND_BW, LIST_FIND_FW};
+
+//! A generic doubly linked list
+template<class T> class ListTemplate 
+{
+  T* object;
+  ListTemplate<T>* next;
+  ListTemplate<T>* prev;
+  bool bReference;
+  int size;
+  
+ public:
+  ListTemplate (T* obj, ListTemplate<T>* n, ListTemplate<T>* p, bool bRef);
+  ~ListTemplate ();
+  
+  int add(T* obj, ADDMODE mode, bool bRef);
+  T* getObject();
+  ListTemplate<T>* getNext();
+  ListTemplate<T>* getPrevious();
+  ListTemplate<T>* getLast();
+  ListTemplate<T>* getFirst();
+  void setNext(ListTemplate<T>* ptr);
+  void setPrev(ListTemplate<T>* ptr);
+  int remove (T* obj, FINDMODE mode);
+  int getSize();
+  void destroy();
+};
+
+
+/**
+  \brief Standard constructor
+  
+  Call this without any parameters to generate a new ListTemplate which can be filled with content.
+  DO NOT create a ListTemplate element that contains an object on your own, you'll lose the data
+  contained in that object and will have trouble removing the list from your memory.
+*/
+template<class T>
+ListTemplate<T>::ListTemplate (T* obj = NULL, ListTemplate<T>* n = NULL, ListTemplate<T>* p = NULL, bool bRef = false)
+{
+  object = obj;
+  next = n;
+  prev = p;
+  bReference = bRef;
+  if(obj != NULL)
+    ++size;
+}
+
+/**
+  \brief Standard destructor
+  
+  Call this on the initially generated base ListTemplate element to remove the whole ListTemplate from the memory.
+  You can safely do this to any ListTemplate element you want without messing up the rest of the ListTemplate, but keep in mind
+  that the contained object will be deleted as well when bRef had been set to false.
+*/
+template<class T>
+ListTemplate<T>::~ListTemplate ()
+{
+  if (object == NULL) // deleted foot node => disband the list
+  {
+    while( next != NULL)
+    {
+      delete next;
+    }
+    while( prev != NULL)
+    {
+      delete prev;
+    }
+  }
+  else
+  {
+    if (prev != NULL) prev->setNext (next);
+    if (next != NULL) next->setPrev (prev);
+    if (!bReference) delete object;
+  }
+}
+ 
+/**
+  \brief Add an object to the ListTemplate
+  \param obj: A pointer to an allocated object
+  \param mode: A Value of ADDMODE (default: LIST_ADD_NEXT)
+  \param bRef: Sets whether the element is serving as a storage point or a simple listing (default: false)
+  \return 0 if the operation succeded, -1 if the element could not be added
+  
+  This adds a new ListTemplate element to the chain. The mode parameter can be used to specify
+  the location where the element should be added. LIST_ADD_NEXT will add the new element directly
+  after the base element. LIST_ADD_PREV will add the new element directly before the base element.
+  LIST_ADD_FIRST will add the element at the beginning of the ListTemplate whereas LIST_ADD_LAST will add
+  it to the end of the chain. If the bRef parameter is set to true, the object pointer will not be deleted
+  when the element containing that object is deleted, thus the ListTemplate can be used for temporary listings as
+  well as permanent data storage.
+*/
+template<class T> 
+int ListTemplate<T>::add (T* obj, ADDMODE mode = LIST_ADD_NEXT, bool bRef = false)
+{
+  ListTemplate<T>* p;
+  if( obj == NULL) return -1;
+  switch (mode)
+  {
+    case LIST_ADD_NEXT:
+      p = new ListTemplate<T>( obj, next, this, bRef);
+      if( next != NULL) next->setPrev (p);
+      next = p;
+      break;
+    case LIST_ADD_PREV:
+      p = new ListTemplate<T>( obj, this, prev, bRef);
+      if( prev != NULL) prev->setNext (p);
+      prev = p;
+      break;
+    case LIST_ADD_FIRST:
+      if (prev == NULL) prev = new ListTemplate<T> (obj, this, NULL, bRef);
+      else return prev->add (obj, mode, bRef);
+      break;
+    case LIST_ADD_LAST:
+      if (next == NULL) next = new ListTemplate<T> (obj, NULL, this, bRef);
+      else return next->add (obj, mode, bRef);
+      break;
+    default:
+        return -1;
+      break;
+  }
+  ++size;
+  return 0;
+}
+
+/**
+  \brief Get the next element of the ListTemplate
+  \return The ListTemplate element after the current ListTemplate element
+*/
+template<class T>
+ListTemplate<T>* ListTemplate<T>::getNext ()
+{
+  return next;
+}
+ 
+/**
+  \brief Get the previous element of the ListTemplate
+  \return The ListTemplate element before the current ListTemplate element
+*/
+template<class T>
+ListTemplate<T>* ListTemplate<T>::getPrevious ()
+{
+  return prev;
+}
+
+/**
+  \brief Get the last element of the ListTemplate
+  \return The last ListTemplate element
+*/
+template<class T>
+ListTemplate<T>* ListTemplate<T>::getLast ()
+{
+  if (next == NULL) return this;
+  else return next->getLast();
+}
+
+/**
+  \brief Get the first element of the ListTemplate
+  \return The first ListTemplate element
+*/
+template<class T>
+ListTemplate<T>* ListTemplate<T>::getFirst ()
+{
+  if (prev == NULL) return this;
+  else return prev->getFirst();
+}
+
+/**
+  \brief Removes a certain element from the ListTemplate
+  \param obj: A pointer to the object that should be removed
+  \param mode: A value of FINDMODE
+  \return 0 if the element was found and removed, -1 if the element was not found
+  
+  This searches the part of the ListTemplate specified with mode for the object in question.
+  When the object is found it is deleted and the ListTemplate element is removed from the chain.
+  If mode is LIST_FIND_FW all elements AFTER the base element are searched, if mode is
+  LIST_FIND_BW all elements BEFORE the base element are searched. Note that the object
+  contained within the ListTemplate element is NOT deleted when bRef was set to true.
+*/
+template<class T>
+int ListTemplate<T>::remove (T* obj, FINDMODE mode = LIST_FIND_FW)
+{
+  if (obj == NULL) return -1;
+  else
+  {
+    switch (mode)
+    {
+      case LIST_FIND_BW:
+        if (prev == NULL) return -1;
+        else
+        {
+          if( prev->getObject() == obj)
+          {
+            delete prev;
+          }
+          else
+          {
+            return prev->remove( obj, mode);
+          }
+        }
+        break;
+      case LIST_FIND_FW:
+        if (next == NULL) return -1;
+        else
+        {
+          if( next->getObject() == obj)
+          {
+            delete next;
+          }
+          else
+          {
+            return next->remove( obj, mode);
+          }
+        }
+        break;
+      default:
+        return -1;
+    }
+  }
+  --size;
+  return 0;
+}
+
+/**
+  \brief Set the next element of a ListTemplate element
+  \param ptr: A pointer to the new next element
+    
+  Sets the next element of a ListTemplate element... Better not touch this, it can really mess up a ListTemplate.
+*/
+template<class T>
+void ListTemplate<T>::setNext (ListTemplate<T>* ptr)
+{
+  next = ptr;
+}
+
+/**
+  \brief Set the prev element of a ListTemplate element
+  \param ptr: A pointer to the new previous element
+    
+  Sets the previous element of a ListTemplate element... Better not touch this, it can really mess up a ListTemplate.
+*/
+template<class T>
+void ListTemplate<T>::setPrev (ListTemplate<T>* ptr)
+{
+  prev = ptr;
+}
+
+/**
+  \brief Get the pointer to the object the element is containing
+  \return The contained object (will be NULL if called on the base element).
+*/
+template<class T>
+T* ListTemplate<T>::getObject()
+{
+  return object;
+}
+
+
+/**
+  \brief Returns the current size of the ListTemplate
+  \return Size of ListTemplate
+*/
+template<class T>
+int ListTemplate<T>::getSize()
+{
+  return this->size;
+}
+
+
+template<class T>
+void ListTemplate<T>::destroy()
+{
+  /* \todo at the moment - doing nothing. should delete everything */
+}
+
+#endif /* _LIST_TENMPLATE_H */
+
Index: orxonox/branches/physics/src/util/resource_manager.cc
===================================================================
--- orxonox/branches/physics/src/util/resource_manager.cc	(revision 3953)
+++ orxonox/branches/physics/src/util/resource_manager.cc	(revision 3953)
@@ -0,0 +1,614 @@
+/* 
+   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 "text_engine.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 = NULL;
+   this->setDataDir("./");
+   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(const char* dataDir)
+{
+  if (isDir(dataDir))
+    {
+      delete this->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, leaving as %s \n", dataDir, this->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, void* param1, void* param2, void* param3)
+{
+  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 if (!strncmp(fileName+(strlen(fileName)-4), ".ttf", 4))
+    tmpType = TTF;
+  else 
+    tmpType = IMAGE;
+
+  return this->load(fileName, tmpType, prio, param1, param2, param3);
+}
+
+/**
+   \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, void* param1, void* param2, void* param3)
+{
+  // searching if the resource was loaded before.
+  Resource* tmpResource = this->locateResourceByInfo(fileName, type, param1, param2,param3);
+  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 (param1)
+	    tmpResource->modelSize = *(float*)param1;
+	  else
+	    tmpResource->modelSize = 1.0;
+
+	  if(isFile(fullName))
+	    tmpResource->pointer = new OBJModel(fullName, tmpResource->modelSize);
+	  else
+	    {
+	      PRINTF(2)("Sorry, %s does not exist. Loading a cube-Model instead\n", fullName);
+	      tmpResource->pointer = ResourceManager::load("cube", PRIM, prio, &tmpResource->modelSize);
+	    }
+	  break;
+	case PRIM:
+	  if (param1)
+	    tmpResource->modelSize = *(float*)param1;
+	  else
+	    tmpResource->modelSize = 1.0;
+
+	  if (!strcmp(tmpResource->name, "cube"))
+	    tmpResource->pointer = new PrimitiveModel(CUBE, tmpResource->modelSize);
+	  else if (!strcmp(tmpResource->name, "sphere"))
+	    tmpResource->pointer = new PrimitiveModel(SPHERE, tmpResource->modelSize);
+	  else if (!strcmp(tmpResource->name, "plane"))
+	    tmpResource->pointer = new PrimitiveModel(PLANE, tmpResource->modelSize);
+	  else if (!strcmp(tmpResource->name, "cylinder"))
+	    tmpResource->pointer = new PrimitiveModel(CYLINDER, tmpResource->modelSize);
+	  else if (!strcmp(tmpResource->name, "cone"))
+	    tmpResource->pointer = new PrimitiveModel(CONE, tmpResource->modelSize);
+	  break;
+	case TTF:
+	    if (param1)
+	      tmpResource->ttfSize = *(int*)param1;
+	    else
+	      tmpResource->ttfSize = FONT_DEFAULT_SIZE;
+	    if (param2)
+	      {
+		Vector* tmpVec = (Vector*)param2;
+		tmpResource->ttfColorR = (int)tmpVec->x;
+		tmpResource->ttfColorG = (int)tmpVec->y;
+		tmpResource->ttfColorB = (int)tmpVec->z;
+	      }
+	    else
+	      {
+		tmpResource->ttfColorR = FONT_DEFAULT_COLOR_R;
+		tmpResource->ttfColorG = FONT_DEFAULT_COLOR_G;
+		tmpResource->ttfColorB = FONT_DEFAULT_COLOR_B;
+	      }
+	    
+	  if(isFile(fullName))
+	    tmpResource->pointer = new Font(fullName,
+					    tmpResource->ttfSize,
+					    tmpResource->ttfColorR,
+					    tmpResource->ttfColorG,
+					    tmpResource->ttfColorB);
+	  else
+	    PRINTF(2)("Sorry, %s does not exist. Not loading Font\n", fullName);
+	  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;
+    }
+  if (tmpResource->pointer)
+    return tmpResource->pointer;
+  else 
+    {
+      PRINTF(2)("Resource %s could not be loaded\n", fileName);
+      delete tmpResource;
+      return NULL;
+    }
+}
+
+/**
+   \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;
+	    case TTF:
+	      delete (Font*)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 some information
+   \param fileName The name to look for
+   \returns a Pointer to the Resource if found, NULL otherwise.
+*/
+Resource* ResourceManager::locateResourceByInfo(const char* fileName, ResourceType type, void* param1, void* param2, void* param3)
+{
+  //  Resource* enumRes = resourceList->enumerate();
+  tIterator<Resource>* iterator = resourceList->getIterator();
+  Resource* enumRes = iterator->nextElement();
+  while (enumRes)
+    {
+      if (enumRes->type == type && !strcmp(fileName, enumRes->name))
+	{
+	  bool match = false;
+	  bool subMatch = false;
+	  switch (type)
+	    {
+	    case PRIM:
+	    case OBJ:
+	      if (!param1)
+		{
+		  if (enumRes->modelSize == 1.0)
+		    match = true;
+		}
+	      else if (enumRes->modelSize == *(float*)param1)
+		match = true;
+	      break;
+	    case TTF:
+	      if (!param1)
+		{
+		  if (enumRes->ttfSize == FONT_DEFAULT_SIZE)
+		    subMatch = true;
+		}
+	      else if (enumRes->modelSize =- *(int*)param1)
+		subMatch = true;
+	      if(subMatch)
+		{
+		  Vector* tmpVec = (Vector*)param2;
+		  if (!param2)
+		    {
+		      if(enumRes->ttfColorR == FONT_DEFAULT_COLOR_R &&
+			 enumRes->ttfColorG == FONT_DEFAULT_COLOR_G &&
+			 enumRes->ttfColorB == FONT_DEFAULT_COLOR_B )
+			match = true;
+		    }
+		  else if (enumRes->ttfColorR == (int)tmpVec->x &&
+			   enumRes->ttfColorG == (int)tmpVec->y &&
+			   enumRes->ttfColorB == (int)tmpVec->z )
+		    match = true;
+		}
+
+	      break;
+	    default:
+	      match = true;
+	      break;
+	    }
+	  if (match)
+	    {
+	      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
+*/
+bool ResourceManager::isDir(const char* directoryName)
+{
+  char* tmpDirName = NULL;
+  struct stat status;
+
+  // checking for the termination of the string given. If there is a "/" at the end cut it away
+  if (directoryName[strlen(directoryName)-1] == '/')
+    {
+      tmpDirName = new char[strlen(directoryName)+1];
+      strncpy(tmpDirName, directoryName, strlen(directoryName)-1);
+      tmpDirName[strlen(directoryName)-1] = '\0';
+    }
+  else
+    {
+      tmpDirName = new char[strlen(directoryName)+1];
+      strcpy(tmpDirName, directoryName);
+    }
+
+  stat(tmpDirName, &status);
+  if (status.st_mode & (S_IFDIR
+#ifndef __WIN32__
+			| S_IFLNK
+#endif
+			))
+    {
+      delete tmpDirName;
+      return true;
+    }
+  else
+    {
+      delete tmpDirName;
+      return false;
+    }
+}
+
+/**
+   \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
+*/
+bool ResourceManager::isFile(const char* fileName)
+{
+  struct stat status;
+  stat(fileName, &status);
+  if (status.st_mode & (S_IFREG 
+#ifndef __WIN32__
+			| S_IFLNK
+#endif
+			))
+    return true;
+  else
+    return false;
+}
+
+/**
+   \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/physics/src/util/resource_manager.h
===================================================================
--- orxonox/branches/physics/src/util/resource_manager.h	(revision 3953)
+++ orxonox/branches/physics/src/util/resource_manager.h	(revision 3953)
@@ -0,0 +1,94 @@
+/*! 
+    \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;
+
+//! An eumerator for different fileTypes the resourceManager supports \todo WAV, MP3, OGG support
+enum ResourceType {OBJ, PRIM, WAV, MP3, OGG, TTF, 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.
+  int count;                 //!< How many times this Resource has been loaded.
+  
+  char* name;                //!< Name of the Resource.
+  ResourceType type;         //!< ResourceType of this Resource.
+  ResourcePriority prio;     //!< The Priority of this resource. (This will only be increased)
+
+  // more specific
+  float modelSize;
+  unsigned int ttfSize;
+  unsigned char ttfColorR;
+  unsigned char ttfColorG;
+  unsigned char ttfColorB;
+};
+
+
+//! 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.
+
+   \todo loading also dependant by parameters.
+*/
+class ResourceManager : public BaseObject 
+{
+ public:
+  static ResourceManager* getInstance();
+  virtual ~ResourceManager();
+
+  bool setDataDir(const char* dataDir);
+  bool addImageDir(char* imageDir);
+  void* load(const char* fileName, ResourcePriority prio = RP_NO,
+	     void* param1 = NULL, void* param2 = NULL, void* param3 = NULL);
+  void* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO,
+	     void* param1 = NULL, void* param2 = NULL, void* param3 = NULL);
+  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* locateResourceByInfo(const char* fileName, ResourceType type, void* param1, void* param2, void* param3);
+  Resource* locateResourceByPointer(const void* pointer);
+  
+  bool isDir(const char* directory);
+  bool isFile(const char* directory);
+
+};
+
+#endif /* _RESOURCE_MANAGER_H */
Index: orxonox/branches/physics/src/world_entities/camera.cc
===================================================================
--- orxonox/branches/physics/src/world_entities/camera.cc	(revision 3953)
+++ orxonox/branches/physics/src/world_entities/camera.cc	(revision 3953)
@@ -0,0 +1,199 @@
+
+
+/* 
+   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: Christian Meyer
+   co-programmer: ...
+*/
+
+#include "camera.h"
+
+#include "world.h"
+#include "world_entity.h"
+#include "vector.h"
+
+using namespace std;
+
+////////////
+// CAMERA //
+////////////
+
+/**
+   \brief creates a Camera
+*/
+Camera::Camera(void)
+{
+  this->setClassName("Camera");
+  this->target = new CameraTarget();
+
+  this->setFovy(90);
+  this->setAspectRatio(1.2f);
+  this->setClipRegion(.1, 2000);
+
+  this->setViewMode(VIEW_NORMAL);
+}
+
+/**
+   \brief default destructor
+*/
+Camera::~Camera(void)
+{
+}
+
+/**
+   \brief focuses the Camera onto a Target
+   \param target the new PNode the Camera should look at.
+*/
+void Camera::lookAt(PNode* target)
+{
+  this->target->setParent(target);
+}
+
+/**
+   \returns The PNode of the Target (from there you can get position and so on
+*/
+PNode* Camera::getTarget(void)
+{
+  return (PNode*)this->target;
+}
+
+
+/**
+   \brief sets a new AspectRatio
+   \param aspectRatio the new aspect ratio to set (width / height)
+*/
+void Camera::setAspectRatio(float aspectRatio)
+{
+  this->aspectRatio = aspectRatio;
+}
+
+/**
+   \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;
+}
+
+/**
+  \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;
+}
+
+void Camera::setViewMode(ViewMode mode)
+{
+  switch (mode)
+    {
+    default:
+    case VIEW_NORMAL:
+      this->toFovy = 60.0;
+      this->toRelCoor = Vector(-10, 5, 0);
+      break;
+    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);
+    }
+}
+
+
+/**
+   \brief initialize rendering perspective according to this camera
+   
+   This is called immediately before the rendering cycle starts, it sets all global
+   rendering options as well as the GL_PROJECTION matrix according to the camera.
+*/
+void Camera::apply ()
+{
+  // switching to Projection Matrix
+  glMatrixMode (GL_PROJECTION);
+  glLoadIdentity ();
+
+  // setting up the perspective
+  gluPerspective(this->fovy,
+		 this->aspectRatio,
+		 this->nearClip,
+		 this->farClip);
+
+  // 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);
+
+  // switching back to Modeling Matrix
+  glMatrixMode (GL_MODELVIEW);
+}
+
+
+
+///////////////////
+// CAMERA-TARGET //
+///////////////////
+
+
+CameraTarget::CameraTarget()
+{
+  this->setClassName("CameraTarget");
+  this->setMode(PNODE_MOVEMENT);
+}
+
+CameraTarget::~CameraTarget()
+{
+
+}
Index: orxonox/branches/physics/src/world_entities/camera.h
===================================================================
--- orxonox/branches/physics/src/world_entities/camera.h	(revision 3953)
+++ orxonox/branches/physics/src/world_entities/camera.h	(revision 3953)
@@ -0,0 +1,63 @@
+/*! 
+    \file camera.h
+    \brief Viewpoint controlling class definitions
+*/ 
+
+#ifndef _CAMERA_H
+#define _CAMERA_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.
+*/
+class Camera : public PNode 
+{
+ private:
+  CameraTarget* target;            //!< The Target of the Camera (where this Camera Looks at)
+
+  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.
+
+  Vector toRelCoor;
+  float toFovy;
+  
+ public:
+  Camera(void);
+  virtual ~Camera(void);
+
+  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/physics/src/world_entities/player.cc
===================================================================
--- orxonox/branches/physics/src/world_entities/player.cc	(revision 3866)
+++ orxonox/branches/physics/src/world_entities/player.cc	(revision 3953)
@@ -38,6 +38,4 @@
 Player::Player() : WorldEntity()
 {
-  this->weapons = new tList<Weapon>();
-  this->activeWeapon = NULL;
   /*
     this is the debug player - actualy we would have to make a new
@@ -46,16 +44,20 @@
   */
   this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
-  //this->model = (Model*)ResourceManager::getInstance()->load("models/weapon_packet.obj", OBJ, RP_CAMPAIGN);
   travelSpeed = 15.0;
   velocity = new Vector();
   bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
   bFire = false;
+  this->bWeaponChange = false;
   acceleration = 10.0;
   //weapons:
-  Weapon* wpRight = new TestGun(this, new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0);
-  Weapon* wpLeft = new TestGun(this, new Vector(-2.6, 0.1, -3.0), new Quaternion(), 1);
-  this->weapons->add(wpRight);
-  this->activeWeapon = wpRight;
-  this->activeWeaponL = wpLeft;
+  this->weaponMan = new WeaponManager();
+  Weapon* wpRight = new TestGun(this,Vector(-2.6, 0.1, 3.0), Quaternion(), 0);
+  Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1);
+  
+  this->weaponMan->addWeapon(wpRight, W_CONFIG0);
+  this->weaponMan->addWeapon(wpLeft, W_CONFIG1);
+  this->weaponMan->addWeapon(wpRight, W_CONFIG2);
+  this->weaponMan->addWeapon(wpLeft, W_CONFIG2);
+
 }
 
@@ -69,5 +71,5 @@
      this only frees the memory allocated to save the list.
   */
-  delete this->weapons;
+  delete this->weaponMan;
 }
 
@@ -79,5 +81,5 @@
 void Player::addWeapon(Weapon* weapon)
 {
-  this->weapons->add(weapon);
+  this->weaponMan->addWeapon(weapon);
 }
 
@@ -89,5 +91,5 @@
 void Player::removeWeapon(Weapon* weapon)
 {
-  this->weapons->remove(weapon);
+  this->weaponMan->removeWeapon(weapon);
 }
 
@@ -151,6 +153,5 @@
   glPopMatrix();
 
-  this->activeWeapon->draw();
-  this->activeWeaponL->draw();
+  this->weaponMan->draw();
 }
 
@@ -163,6 +164,7 @@
 {
   /* link tick to weapon */
-  this->activeWeapon->tick(time);
-  this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE
+  //this->activeWeapon->tick(time);
+  //this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE
+  this->weaponMan->tick(time);
   // player controlled movement
   this->move(time);
@@ -180,5 +182,4 @@
   Vector accel(0.0, 0.0, 0.0);
   /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
-  
   /* calculate the direction in which the craft is heading  */
   Vector direction (1.0, 0.0, 0.0);
@@ -210,16 +211,10 @@
   if( this->bFire)
     {
-      //if(this->activeWeapon != NULL)
-      this->activeWeapon->fire();
-      //FIX THIS FIX FIIIIIIIIIIIX
-      this->activeWeaponL->fire();
+      this->weaponMan->fire();
     }
-  if( this->bWeaponChange && this->weapons->getSize() > 1)
+  if( this->bWeaponChange)
     {
-      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();
+      this->weaponMan->nextWeaponConf();
+      this->bWeaponChange = false;
     }
 }
@@ -240,4 +235,4 @@
   if( !strcmp( cmd->cmd, "right")) this->bRight = !cmd->bUp;
   if( !strcmp( cmd->cmd, "fire")) this->bFire = !cmd->bUp;
-  if( !strcmp( cmd->cmd, "mode")) this->bWeaponChange = !cmd->bUp;
-}
+  if( !strcmp( cmd->cmd, "mode")) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange;
+}
Index: orxonox/branches/physics/src/world_entities/player.h
===================================================================
--- orxonox/branches/physics/src/world_entities/player.h	(revision 3866)
+++ orxonox/branches/physics/src/world_entities/player.h	(revision 3953)
@@ -11,4 +11,5 @@
 template<class T> class tList;
 class Weapon;
+class WeaponManager;
 class Vector;
 class World;
@@ -49,4 +50,5 @@
   Weapon* activeWeapon;  //!< the weapon that is currenty activated
   Weapon* activeWeaponL;  //temporary -- FIX THIS
+  WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
 
   World* myWorld;        //!< reference to the world object
Index: orxonox/branches/physics/src/world_entities/skybox.cc
===================================================================
--- orxonox/branches/physics/src/world_entities/skybox.cc	(revision 3866)
+++ orxonox/branches/physics/src/world_entities/skybox.cc	(revision 3953)
@@ -187,16 +187,16 @@
   model->addVertexNormal (-1.0, 0.0, 0.0);
 
-  model->addUseMtl(material[0]);
-  model->addFace (4, 3, 3,2,4, 4,3,4, 6,4,4, 5,1,4); // top
-  model->addUseMtl(material[1]);
-  model->addFace (4, 3, 7,4,2, 8,1,2, 2,2,2, 1,3,2); // bottom
-  model->addUseMtl(material[2]);
-  model->addFace (4, 3, 1,1,3, 2,2,3, 4,3,3, 3,4,3); // left
-  model->addUseMtl(material[3]);
-  model->addFace (4, 3, 5,3,1, 6,4,1, 8,1,1, 7,2,1); // right
-  model->addUseMtl(material[4]);
-  model->addFace (4, 3, 2,1,6, 8,2,6, 6,3,6, 4,4,6); // front
-  model->addUseMtl(material[5]);
-  model->addFace (4, 3, 7,1,5, 1,2,5, 3,3,5, 5,4,5); // back
+  model->setMaterial(material[0]);
+  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 3,2,4, 4,3,4, 6,4,4, 5,1,4); // top
+  model->setMaterial(material[1]);
+  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,4,2, 8,1,2, 2,2,2, 1,3,2); // bottom
+  model->setMaterial(material[2]);
+  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,3, 2,2,3, 4,3,3, 3,4,3); // left
+  model->setMaterial(material[3]);
+  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 5,3,1, 6,4,1, 8,1,1, 7,2,1); // right
+  model->setMaterial(material[4]);
+  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,6, 8,2,6, 6,3,6, 4,4,6); // front
+  model->setMaterial(material[5]);
+  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,1,5, 1,2,5, 3,3,5, 5,4,5); // back
   
   model->finalize();
Index: orxonox/branches/physics/src/world_entities/test_gun.cc
===================================================================
--- orxonox/branches/physics/src/world_entities/test_gun.cc	(revision 3866)
+++ orxonox/branches/physics/src/world_entities/test_gun.cc	(revision 3953)
@@ -40,5 +40,5 @@
    creates a new weapon
 */
-TestGun::TestGun (PNode* parent, Vector* coordinate, Quaternion* direction, int leftRight) 
+TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight) 
   :  Weapon (parent, coordinate, direction) 
 {
@@ -47,43 +47,26 @@
   this->leftRight = leftRight;
 
-  if( this->leftRight == 0)
-    this->projOffset = new Vector(1.0, 0.0, -0.35);
-  else if( this->leftRight == 1)
-    this->projOffset = new Vector(1.0, 0.0, 0.5);
+  this->objectComponent1 = new PNode();
+  this->animation1 = new Animation3D(this->objectComponent1);
+  parent->addChild(this->objectComponent1, PNODE_ALL);
 
+  this->animation1->setInfinity(ANIM_INF_CONSTANT);
+  // ANIM_LINEAR was ANIM_NEG_EXP
+  if( this->leftRight == W_LEFT)
+    {
+      this->projectileOffset = Vector(1.0, 0.0, -0.35);
 
-  this->dummy1 = new WorldEntity(); // a world entity that is not drawed: use this for the weapon 
-  this->animation = new Animation3D(dummy1);
+      this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 
+      this->animation1->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR);
+      this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);
+    }
+  else if( this->leftRight == W_RIGHT)
+    {
+      this->projectileOffset = Vector(1.0, 0.0, 0.5);
 
-  parent->addChild(this->dummy1, PNODE_ALL);
-
-  this->animation->setInfinity(ANIM_INF_CONSTANT);
-  // ANIM_LINEAR was ANIM_NEG_EXP
-  if( this->leftRight == 0)
-    {
-      this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 
-      this->animation->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR);
-      this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);
+      this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);
+      this->animation1->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR);
+      this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);
     }
-  else if( this->leftRight == 1)
-    {
-      this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);
-      this->animation->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR);
-      this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);
-    }
-  /*
-  if( this->leftRight == 0)
-    {
-      this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.0, ANIM_NEG_EXP); 
-      this->animation->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.1, ANIM_NEG_EXP);
-      this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.5, ANIM_NEG_EXP);
-    }
-  else if( this->leftRight == 1)
-    {
-      this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.0, ANIM_NEG_EXP);
-      this->animation->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.1, ANIM_NEG_EXP);
-      this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.5, ANIM_NEG_EXP);
-    }
-  */
 }
 
@@ -127,21 +110,19 @@
 void TestGun::fire()
 {
-  if( this->localTime < this->idleTime)
+  if( !this->hasWeaponIdleTimeElapsed())
     {
       this->weaponIdle();
       return;
     }
+
   Projectile* pj = new TestBullet(this);
-
-  pj->setAbsCoor(this->getAbsCoor() + *this->projOffset);
+  pj->setAbsCoor(this->getAbsCoor() + this->projectileOffset);
   pj->setAbsDir(this->getAbsDir());
-
   pj->setFlightDirection(this->getAbsDir());
   pj->setSpeed(this->getSpeed());
-
   this->worldEntities->add(pj);
   this->localTime = 0;
   
-  this->animation->replay();
+  this->animation1->replay();
 }
 
@@ -190,44 +171,25 @@
 void TestGun::draw () 
 {
-  
-  /* draw gun body 1 */
+  /* draw gun body */
   glMatrixMode(GL_MODELVIEW);
   glPushMatrix();
   float matrix[4][4];
-  
-  if( this->leftRight == 0)
-    {
-      glTranslatef (this->getAbsCoor ().x, 
-		    this->getAbsCoor ().y, 
-		    this->getAbsCoor ().z);
-      
-      this->getAbsDir ().matrix (matrix);
-      glMultMatrixf((float*)matrix);
-      this->model->draw(1);
-    }
-  else if( this->leftRight == 1)
-    {
-      glTranslatef (this->getAbsCoor ().x, 
-		    this->getAbsCoor ().y, 
-		    this->getAbsCoor ().z);
-      
-      this->getAbsDir ().matrix (matrix);
-      glMultMatrixf((float*)matrix);
-      glScalef(1.0, 1.0, -1.0);
-      this->model->draw(1);
-    }
-
+  glTranslatef (this->getAbsCoor ().x, 
+		this->getAbsCoor ().y, 
+		this->getAbsCoor ().z);  
+  this->getAbsDir ().matrix (matrix);
+  glMultMatrixf((float*)matrix);
+  if( this->leftRight == W_RIGHT)
+    glScalef(1.0, 1.0, -1.0);
+  this->model->draw(1);
   glPopMatrix();
 
-
-  /* draw gun coil 1 */
+  /* draw objectComponent1: gun coil - animated stuff */
   glMatrixMode(GL_MODELVIEW);
   glPushMatrix();
-  
-  glTranslatef (this->dummy1->getAbsCoor ().x, 
-		this->dummy1->getAbsCoor ().y, 
-		this->dummy1->getAbsCoor ().z);
-
-  this->dummy1->getAbsDir ().matrix (matrix);
+  glTranslatef (this->objectComponent1->getAbsCoor ().x, 
+		this->objectComponent1->getAbsCoor ().y, 
+		this->objectComponent1->getAbsCoor ().z);
+  this->objectComponent1->getAbsDir ().matrix (matrix);
   glMultMatrixf((float*)matrix);
   this->model->draw(0);
Index: orxonox/branches/physics/src/world_entities/test_gun.h
===================================================================
--- orxonox/branches/physics/src/world_entities/test_gun.h	(revision 3866)
+++ orxonox/branches/physics/src/world_entities/test_gun.h	(revision 3953)
@@ -37,5 +37,5 @@
 
  public:
-  TestGun (PNode* parent, Vector* coordinate, Quaternion* direction, int leftRight);
+  TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight);
   virtual ~TestGun ();
 
@@ -51,9 +51,6 @@
   virtual void draw(void);
 
- private:
-  Animation3D* animation;
-  Vector* projOffset;
-  WorldEntity* dummy1;
-  int leftRight;   // this will become an enum
+
+
 
 };
Index: orxonox/branches/physics/src/world_entities/weapon.cc
===================================================================
--- orxonox/branches/physics/src/world_entities/weapon.cc	(revision 3866)
+++ orxonox/branches/physics/src/world_entities/weapon.cc	(revision 3953)
@@ -16,4 +16,5 @@
 */
 
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
 
 #include "weapon.h"
@@ -30,44 +31,165 @@
 
 
+/**
+   \brief this initializes the weaponManager for a given nnumber of weapon slots
+   \param number of weapon slots of the model/ship <= 8 (limitied)
+*/
 WeaponManager::WeaponManager(int nrOfSlots) 
 {
+  for(int i = 0; i < W_MAX_CONFIGS; ++i)
+    {
+      this->configs[i].bUsed = false;
+      for(int j = 0; j < W_MAX_SLOTS; ++j)
+	this->configs[i].slots[j] = NULL;
+    }
   this->nrOfSlots = nrOfSlots;
-  this->nrOfConfigs = 1;
-
-  for(int i = 0; i < W_MAX_CONFS; ++i)
-    this->configs[i] = NULL;
-  this->currentConfig = new weaponConfig;
-  this->configs[0] = this->currentConfig;
-}
+  this->currConfID = W_CONFIG0;
+}
+
 
 WeaponManager::~WeaponManager() 
 {
-
-}
-
-void WeaponManager::addWeapon(Weapon* weapon, slotID slot, configID config) 
-{
-  if(this->configs[config] == NULL)
-    PRINTF(0)("");
-  //  this->configs[(int)config]->
-}
-
-void WeaponManager::addWeaponConfig(weaponConfig* config) 
-{}
-
+  /* 
+     i dont have to delete the weapons itself, because they are 
+     worldentities and therefore in the entities list of the world.
+     world will clean them up for me
+  */
+  for(int i = 0; i < W_MAX_CONFIGS; ++i)
+    {
+      this->configs[i].bUsed = false;
+      for(int j = 0; j < W_MAX_SLOTS; ++j)
+	this->configs[i].slots[j] = NULL;
+    }
+}
+
+
+/**
+   \brief adds a weapon to the selected weaponconfiguration into the selected slot
+   \param the weapon to add
+   \param an identifier for the slot: number between 0..7 if not specified: slotID=next free slot
+   \param an identifier for the weapon configuration, number between 0..3
+
+   if you add explicitly a weapon at config:n, slot:m, the weapon placed at this location will be
+   replaced by the weapon specified. if you use the W_FREE_SLOT, the manager will look for a free
+   slot in this weaponconfiguration. if there is non, the weapon won't be added and there will be 
+   a error message.
+*/
+void WeaponManager::addWeapon(Weapon* weapon, int configID, int slotID) 
+{
+  if( slotID == W_FREE_SLOT)
+    {
+      int freeSlot = this->getNextFreeSlot( configID);
+      if( freeSlot < 0 || freeSlot >= this->nrOfSlots)
+	{
+	  PRINTF(0)("There is no free slot in this WeaponConfig to dock this weapon at! Aborting\n");
+	  return;
+	}
+      PRINTF(3)("Added new Weapon to Config:%i/Slot:%i\n", configID, freeSlot);
+      this->configs[configID].bUsed = true;
+      this->configs[configID].slots[freeSlot] = weapon;
+      return;
+    }
+  this->configs[configID].bUsed = true;
+  this->configs[configID].slots[slotID] = weapon;
+  PRINTF(3)("Added a new Weapon to the WeaponManager: config %i/ slot %i\n", configID, slotID);
+}
+
+
+void WeaponManager::removeWeapon(Weapon* weapon, int configID)
+{
+  /* empty */
+}
+
+
+/**
+   \brief changes to the next weapon configuration
+
+   if there are multiple weapon configurations defined by the manager, use this to switch between them
+   this function will deactivate the weapons first, change the config and reactivate them later
+*/
 void WeaponManager::nextWeaponConf() 
-{}
-
-void WeaponManager::prevWeaponConf() 
-{}
-
-
-void WeaponManager::selectConfig(configID config) 
-{
-  if( this->configs[(int)config] != NULL)
-    this->currentConfig = this->configs[(int)config];
-  else
-    PRINTF(0)("There is no weapon config defined with the number W_CONF%i", (int)config);
-}
+{
+  PRINTF(4)("Changing weapon configuration: from %i\n", this->currConfID);
+
+  Weapon* w;
+  for(int i = 0; i < W_MAX_SLOTS; ++i)
+    {
+      w = this->configs[this->currConfID].slots[i];
+      if( w != NULL) w->deactivate();
+    }
+  int i;
+  for(i = this->currConfID + 1; i < W_MAX_CONFIGS && !this->configs[i].bUsed; ++i);
+  if( i == W_MAX_CONFIGS) this->currConfID = W_CONFIG0;
+  else this->currConfID = i;  
+  PRINTF(4)("\tto %i\n", this->currConfID);
+
+  for(int i = 0; i < W_MAX_SLOTS; ++i)
+    {
+      w = this->configs[this->currConfID].slots[i];
+      if( w != NULL) w->activate();
+    }
+}
+
+
+
+/**
+   \brief triggers fire of all weapons in the current weaponconfig
+*/
+void WeaponManager::fire()
+{
+  Weapon* firingWeapon;
+  for(int i = 0; i < W_MAX_SLOTS; ++i)
+    {
+      firingWeapon = this->configs[this->currConfID].slots[i];
+      if( firingWeapon != NULL) firingWeapon->fire();
+    }
+}
+
+
+/**
+   \brief triggers tick of all weapons in the current weaponconfig
+   \param second passed since last tick
+*/
+void WeaponManager::tick(float sec)
+{
+  Weapon* w;
+  for(int i = 0; i < W_MAX_SLOTS; ++i)
+    {
+      w = this->configs[this->currConfID].slots[i];
+      if( w != NULL) w->tick(sec);
+    }
+}
+
+
+/**
+   \brief triggers draw of all weapons in the current weaponconfig
+*/
+void WeaponManager::draw()
+{
+  Weapon* w;
+  for(int i = 0; i < W_MAX_SLOTS; ++i)
+    {
+      w = this->configs[this->currConfID].slots[i];
+      if( w != NULL) w->draw();
+    }
+}
+
+
+/**
+   \brief private gets the next free slot in a certain weaponconfig
+   \param the selected weaponconfig
+*/
+int WeaponManager::getNextFreeSlot(int configID)
+{
+  for( int i = 0; i < W_MAX_SLOTS; ++i)
+    {
+      if( this->configs[configID].slots[i] == NULL)
+	return i;
+    }
+  return -1;
+}
+
+
+
 
 
@@ -78,12 +200,20 @@
    creates a new weapon
 */
-Weapon::Weapon (PNode* parent, Vector* coordinate, Quaternion* direction) 
+Weapon::Weapon (PNode* parent, const Vector& coordinate, const Quaternion& direction) 
   : WorldEntity()
 {
   parent->addChild(this, PNODE_ALL);
-  this->setRelCoor(*coordinate);
-  this->setRelDir(*direction);
+  this->setRelCoor(coordinate);
+  this->setRelDir(direction);
   WorldInterface* wi = WorldInterface::getInstance();
   this->worldEntities = wi->getEntityList();
+
+  this->objectComponent1 = NULL;
+  this->objectComponent2 = NULL;
+  this->objectComponent3 = NULL;
+
+  this->animation1 = NULL;
+  this->animation2 = NULL;
+  this->animation3 = NULL;
 }
 
@@ -95,4 +225,9 @@
 {
   // model will be deleted from WorldEntity-destructor
+  //this->worldEntities = NULL;
+  
+  /* dont delete objectComponentsX here, they will be killed when the pnodes are cleaned out */
+
+  /* all animations are deleted via the animation player*/
 }
 
@@ -190,48 +325,7 @@
 {}
 
-/**
-   \brief sets a weapon idle time
-   \param idle time in ms
-
-   a weapon idle time is the time spend after a shoot until the weapon can
-   shoot again
-*/
-void Weapon::setWeaponIdleTime(float time)
-{
-  this->idleTime = time;
-}
-
-/**
-   \brief gets the weapon idle time
-   \returns idle time in ms
-
-   a weapon idle time is the time spend after a shoot until the weapon can
-   shoot again
-*/
-float Weapon::getWeaponIdleTime(void)
-{
-  return this->idleTime;
-}
-
-/**
-   \brief checks if the idle time is elapsed
-   \return true if time is elapsed
-
-   a weapon idle time is the time spend after a shoot until the weapon can
-   shoot again
-*/
-bool Weapon::hasWeaponIdleTimeElapsed(void)
-{
-  return (this->localTime>this->idleTime)?true:false;
-}
-
-
-/**
-   \brief fires the weapon
-   
-   this is called from the player.cc, when fire-button is been pushed
-*/
-void Weapon::fire()
-{}
+
+
+
 
 
Index: orxonox/branches/physics/src/world_entities/weapon.h
===================================================================
--- orxonox/branches/physics/src/world_entities/weapon.h	(revision 3866)
+++ orxonox/branches/physics/src/world_entities/weapon.h	(revision 3953)
@@ -34,8 +34,9 @@
 
 #define W_MAX_SLOTS 8
-#define W_MAX_CONFS 4
+#define W_MAX_CONFIGS 4
 
 class Projectile;
 class Weapon;
+class Animation3D;
 
 typedef enum {
@@ -48,22 +49,31 @@
 } weaponSoundType;
 
+
 //! this is an identifier for the slot. there are up to 8 weapon slots -> this means there can't be more than 8 weapons at the same time
-typedef enum slotID {W_SLOT0=0, W_SLOT1, W_SLOT2, W_SLOT3, 
-		     W_SLOT4, W_SLOT5, W_SLOT6, W_SLOT7};
+#define W_SLOT0 0
+#define W_SLOT1 1
+#define W_SLOT2 2
+#define W_SLOT3 3
+#define W_SLOT4 4
+#define W_SLOT5 5
+#define W_SLOT6 6
+#define W_SLOT7 7
+#define W_FREE_SLOT 99
+
 
 //! this is an identifier for the weapon config
-typedef enum configID {W_CONFIG0=0, W_CONFIG1, 
-		       W_CONFIG2, W_CONFIG3};
+#define W_CONFIG0 0
+#define W_CONFIG1 1
+#define W_CONFIG2 2
+#define W_CONFIG3 3
+
+//! a weapon can be left or right sided
+#define W_LEFT 0
+#define W_RIGHT 1
 
 //! this is a weapon Configuration: it has up to 8 slots
 typedef struct weaponConfig {
-  Weapon* slot1;                    //<! standard right side weapon
-  Weapon* slot2;                    //<! standard left side weapon
-  Weapon* slot3;                    //<! custom
-  Weapon* slot4;                    //<! custom
-  Weapon* slot5;                    //<! custom
-  Weapon* slot6;                    //<! custom
-  Weapon* slot7;                    //<! custom
-  Weapon* slot8;                    //<! custom
+  bool bUsed;                       //<! is set to true, if this configuration is 
+  Weapon* slots[8];
 };
 
@@ -74,16 +84,18 @@
   ~WeaponManager();
   
-  void addWeapon(Weapon* weapon, slotID slot, configID config = W_CONFIG0);
-  void addWeaponConfig(weaponConfig* config);
+  void addWeapon(Weapon* weapon, int configID = W_CONFIG0, int slotID = W_FREE_SLOT);
+  void removeWeapon(Weapon* weapon, int configID = W_CONFIG0);
+  void nextWeaponConf();
 
-  void nextWeaponConf();
-  void prevWeaponConf();
-  void selectConfig(configID config);
+  void fire();
+  void tick(float sec);
+  void draw();
 
  private:
-  int nrOfConfigs;                      //<! number of configurations defined
   int nrOfSlots;                        //<! number of weapon slots a ship has
-  weaponConfig* currentConfig;          //<! the currently selected config
-  weaponConfig* configs[4];             //<! a list of four configurations
+  int currConfID;                       //<! the currently selected config
+  weaponConfig configs[4];              //<! a list of four configurations
+  
+  int getNextFreeSlot(int configID);
 };
 
@@ -93,5 +105,5 @@
 
  public:
-  Weapon (PNode* parent, Vector* coordinate, Quaternion* direction);
+  Weapon (PNode* parent, const Vector& coordinate, const Quaternion& direction);
   virtual ~Weapon ();
   
@@ -107,8 +119,35 @@
   bool isActive(void);
 
-  void setWeaponIdleTime(float time);
-  float getWeaponIdleTime(void);
-  bool hasWeaponIdleTimeElapsed(void);
 
+  /**
+     \brief sets a weapon idle time
+     \param idle time in ms
+     
+     a weapon idle time is the time spend after a shoot until the weapon can
+     shoot again
+  */
+  inline void setWeaponIdleTime(float time) { this->idleTime = time; }
+  /**
+     \brief gets the weapon idle time
+     \returns idle time in ms
+     
+     a weapon idle time is the time spend after a shoot until the weapon can
+     shoot again
+  */
+  inline float getWeaponIdleTime(void) const { return this->idleTime;}
+  /**
+     \brief checks if the idle time is elapsed
+     \return true if time is elapsed
+     
+     a weapon idle time is the time spend after a shoot until the weapon can
+   shoot again
+  */
+  inline bool hasWeaponIdleTimeElapsed(void) const { return (this->localTime>this->idleTime)?true:false; }
+
+  /**
+     \brief fires the weapon
+     
+     this is called from the player.cc, when fire-button is been pushed
+  */
   virtual void fire(void) = 0;
   virtual void hit (WorldEntity* weapon, Vector* loc);
@@ -121,11 +160,22 @@
  protected:
   tList<WorldEntity>* worldEntities;
-  float localTime;
-  float idleTime;
-  float slowDownFactor;
+  float localTime;                 //<! this is the local time. important for shooting attributes like frequency
+  float idleTime;                  //<! the time a weapon needs before it can shoot again. eg. shooting frequency or actication/deactivateion delay
+  float slowDownFactor;            //<! if the shooting frequency is a linear function of time...
+
+  PNode* objectComponent1;         //<! the gun is made of multiple parts, these PNodes represent their location and orientation
+  PNode* objectComponent2;
+  PNode* objectComponent3;
+
+  Animation3D* animation1;
+  Animation3D* animation2;
+  Animation3D* animation3;
+
+  Vector projectileOffset;
+  int leftRight;   // this will become an enum
 
  private:
-  bool enabled;
-  Projectile* projectile;
+  bool enabled;                    //<! states if the weapon is enabled or not
+  Projectile* projectile;          //<! the projectile used for this weapon
   //WeaponSound sound;
 };
