Index: orxonox/branches/dave/Makefile.am
===================================================================
--- orxonox/branches/dave/Makefile.am	(revision 2746)
+++ orxonox/branches/dave/Makefile.am	(revision 2860)
@@ -1,1 +1,1 @@
-SUBDIRS = src console gui
+SUBDIRS = src console gui importer
Index: orxonox/branches/dave/Makefile.in
===================================================================
--- orxonox/branches/dave/Makefile.in	(revision 2746)
+++ orxonox/branches/dave/Makefile.in	(revision 2860)
@@ -146,5 +146,5 @@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
-SUBDIRS = src console gui
+SUBDIRS = src console gui importer
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
Index: orxonox/branches/dave/aclocal.m4
===================================================================
--- orxonox/branches/dave/aclocal.m4	(revision 2746)
+++ orxonox/branches/dave/aclocal.m4	(revision 2860)
@@ -1,3 +1,3 @@
-# generated automatically by aclocal 1.8.2 -*- Autoconf -*-
+# generated automatically by aclocal 1.8.5 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
@@ -41,5 +41,5 @@
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-	 [AM_AUTOMAKE_VERSION([1.8.2])])
+	 [AM_AUTOMAKE_VERSION([1.8.5])])
 
 # AM_AUX_DIR_EXPAND
@@ -150,5 +150,5 @@
 fi])])
 
-# serial 6						-*- Autoconf -*-
+# serial 7						-*- Autoconf -*-
 
 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
@@ -237,5 +237,7 @@
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      : > sub/conftst$i.h
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
@@ -265,7 +267,12 @@
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
       # icc doesn't choke on unknown options, it will just issue warnings
-      # (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored.
-      if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
         am_cv_$1_dependencies_compiler_type=$depmode
         break
@@ -313,5 +320,5 @@
 # Generate code to set up dependency tracking.   -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -352,12 +359,12 @@
   # Extract the definition of DEP_FILES from the Makefile without
   # running `make'.
-  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
   test -z "$DEPDIR" && continue
   # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n -e '/^U = / s///p' < "$mf"`
+  U=`sed -n 's/^U = //p' < "$mf"`
   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
   # We invoke sed twice because it is the simplest approach to
   # changing $(DEPDIR) to its actual value in the expansion.
-  for file in `sed -n -e '
+  for file in `sed -n '
     /^DEP_FILES = .*\\\\$/ {
       s/^DEP_FILES = //
@@ -718,6 +725,14 @@
 # Do not use -m 0755 and let people choose whatever they expect by
 # setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
 AC_DEFUN([AM_PROG_MKDIR_P],
-[if mkdir -p -- . 2>/dev/null; then
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
   # Keeping the `.' argument allows $(mkdir_p) to be used without
   # argument.  Indeed, we sometimes output rules like
@@ -732,5 +747,5 @@
   # directories to create, and then abort because `.' already
   # exists.
-  for d in ./-p ./--;
+  for d in ./-p ./--version;
   do
     test -d $d && rmdir $d
Index: orxonox/branches/dave/configure
===================================================================
--- orxonox/branches/dave/configure	(revision 2746)
+++ orxonox/branches/dave/configure	(revision 2860)
@@ -1497,5 +1497,5 @@
 fi
 
-if mkdir -p -- . 2>/dev/null; then
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
   # Keeping the `.' argument allows $(mkdir_p) to be used without
   # argument.  Indeed, we sometimes output rules like
@@ -1510,5 +1510,5 @@
   # directories to create, and then abort because `.' already
   # exists.
-  for d in ./-p ./--;
+  for d in ./-p ./--version;
   do
     test -d $d && rmdir $d
@@ -2415,5 +2415,7 @@
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      : > sub/conftst$i.h
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
@@ -2443,7 +2445,12 @@
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
       # icc doesn't choke on unknown options, it will just issue warnings
-      # (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored.
-      if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
         am_cv_CXX_dependencies_compiler_type=$depmode
         break
@@ -3246,5 +3253,7 @@
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      : > sub/conftst$i.h
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
@@ -3274,7 +3283,12 @@
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
       # icc doesn't choke on unknown options, it will just issue warnings
-      # (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored.
-      if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
         am_cv_CC_dependencies_compiler_type=$depmode
         break
@@ -6367,5 +6381,5 @@
 
 
-                                        ac_config_files="$ac_config_files Makefile console/Makefile gui/Makefile src/Makefile"
+                                                  ac_config_files="$ac_config_files Makefile console/Makefile gui/Makefile src/Makefile importer/Makefile"
 
 cat >confcache <<\_ACEOF
@@ -6929,4 +6943,5 @@
   "gui/Makefile" ) CONFIG_FILES="$CONFIG_FILES gui/Makefile" ;;
   "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+  "importer/Makefile" ) CONFIG_FILES="$CONFIG_FILES importer/Makefile" ;;
   "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
   "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
@@ -7688,12 +7703,12 @@
   # Extract the definition of DEP_FILES from the Makefile without
   # running `make'.
-  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
   test -z "$DEPDIR" && continue
   # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n -e '/^U = / s///p' < "$mf"`
+  U=`sed -n 's/^U = //p' < "$mf"`
   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
   # We invoke sed twice because it is the simplest approach to
   # changing $(DEPDIR) to its actual value in the expansion.
-  for file in `sed -n -e '
+  for file in `sed -n '
     /^DEP_FILES = .*\\\\$/ {
       s/^DEP_FILES = //
Index: orxonox/branches/dave/configure.ac
===================================================================
--- orxonox/branches/dave/configure.ac	(revision 2746)
+++ orxonox/branches/dave/configure.ac	(revision 2860)
@@ -196,4 +196,5 @@
 		 console/Makefile
                  gui/Makefile
-                 src/Makefile])
+                 src/Makefile
+		 importer/Makefile])
 AC_OUTPUT
Index: orxonox/branches/dave/importer/Makefile.am
===================================================================
--- orxonox/branches/dave/importer/Makefile.am	(revision 2860)
+++ orxonox/branches/dave/importer/Makefile.am	(revision 2860)
@@ -0,0 +1,27 @@
+AM_CXXFLAGS="-I/usr/X11R6/include"
+AM_LDFLAGS="-L/usr/Mesa-6.0.1/lib  -L/usr/X11R6/lib -lXt -lX11" $(MWINDOWS)
+
+#"-O3 -pedantic -fPIC -ffast-math -I/usr/X11R6/include"
+
+
+bin_PROGRAMS=importer
+importer_SOURCES=framework.cc windowHandler.cc object.cc array.cc material.cc
+
+noinst_HEADERS=windowHandler.h object.h array.h material.h
+
+
+#  uncomment the following if bencoder requires the math library
+#orxonox_LDADD=-lm
+
+#EXTRA_DIST=orxonox.lsm.in orxonox.spec.in orxonox.texinfo
+
+#  if you write a self-test script named `chk', uncomment the
+#  following and add `chk' to the EXTRA_DIST list
+#TESTS=chk
+
+#  build and install the .info pages
+#info_TEXINFOS = orxonox.texinfo
+#orxonox_TEXINFOS = gpl.texinfo
+
+#  install the man pages
+#man_MANS=orxonox.1
Index: orxonox/branches/dave/importer/Makefile.in
===================================================================
--- orxonox/branches/dave/importer/Makefile.in	(revision 2860)
+++ orxonox/branches/dave/importer/Makefile.in	(revision 2860)
@@ -0,0 +1,428 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+SOURCES = $(importer_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = importer$(EXEEXT)
+subdir = importer
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_importer_OBJECTS = framework.$(OBJEXT) windowHandler.$(OBJEXT) \
+	object.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT)
+importer_OBJECTS = $(am_importer_OBJECTS)
+importer_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po ./$(DEPDIR)/framework.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/material.Po ./$(DEPDIR)/object.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/windowHandler.Po
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+	-o $@
+SOURCES = $(importer_SOURCES)
+DIST_SOURCES = $(importer_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSBITFIELDS = @MSBITFIELDS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AM_CXXFLAGS = "-I/usr/X11R6/include"
+AM_LDFLAGS = "-L/usr/Mesa-6.0.1/lib  -L/usr/X11R6/lib -lXt -lX11" $(MWINDOWS)
+importer_SOURCES = framework.cc windowHandler.cc object.cc array.cc material.cc
+noinst_HEADERS = windowHandler.h object.h array.h material.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  importer/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  importer/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+importer$(EXEEXT): $(importer_OBJECTS) $(importer_DEPENDENCIES) 
+	@rm -f importer$(EXEEXT)
+	$(CXXLINK) $(importer_LDFLAGS) $(importer_OBJECTS) $(importer_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/framework.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windowHandler.Po@am__quote@
+
+.cc.o:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic ctags distclean distclean-compile \
+	distclean-generic distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-binPROGRAMS \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-binPROGRAMS uninstall-info-am
+
+
+#  uncomment the following if bencoder requires the math library
+#orxonox_LDADD=-lm
+
+#EXTRA_DIST=orxonox.lsm.in orxonox.spec.in orxonox.texinfo
+
+#  if you write a self-test script named `chk', uncomment the
+#  following and add `chk' to the EXTRA_DIST list
+#TESTS=chk
+
+#  build and install the .info pages
+#info_TEXINFOS = orxonox.texinfo
+#orxonox_TEXINFOS = gpl.texinfo
+
+#  install the man pages
+#man_MANS=orxonox.1
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: orxonox/branches/dave/importer/array.cc
===================================================================
--- orxonox/branches/dave/importer/array.cc	(revision 2860)
+++ orxonox/branches/dave/importer/array.cc	(revision 2860)
@@ -0,0 +1,137 @@
+/* 
+   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: ...
+*/
+
+#include "array.h"
+
+/**
+   \brief creates a new Array
+*/
+Array::Array ()
+{
+  initializeArray ();
+}
+
+/**
+   \brief deletes an Array.
+   It does this by first deleting all the array-entries, and then delete the array[] itself
+*/
+Array::~Array()
+{
+  if (verbose >= 2)
+    printf("deleting array\n");
+  Entry* walker = firstEntry;
+  Entry* last;
+  while (walker != NULL)
+    {
+      last = walker;
+      walker = walker->next;
+      delete last;
+    }
+  if (finalized)
+    delete [] array;
+}
+
+/**
+   \brief initializes an Array
+   the Function does this by setting up a fistEntry, and setting the entryCount.
+*/
+void Array::initializeArray ()
+{
+  if (verbose >= 2)
+    printf ("crating new Array\n");
+  firstEntry = new Entry;
+  firstEntry->next =NULL;
+  currentEntry=firstEntry;
+  finalized = false;
+  entryCount = 0; //0 means one entry
+  return;
+}
+
+/**
+   \brief finalizes an array.
+   This Function creates the array, and makes it ready to be sent to the application.
+*/
+void Array::finalizeArray (void)
+{
+  if (verbose >= 3)
+    printf ("Finalizing array.\n");  
+  if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL)
+    printf ("could not allocate %i data Blocks\n", entryCount);
+  Entry* walker = firstEntry;
+  for (int i=0; i<entryCount; i++)
+    {
+      array[i] = walker->value;
+      walker = walker->next;
+    }
+  finalized = true;
+  return;
+}
+
+/**
+   \brief adds a new Entry to the Array
+   \param entry Entry to add.
+*/
+void Array::addEntry (GLfloat entry)
+{
+  if (!finalized)
+    {
+      if (verbose >= 3)
+	printf ("adding new Entry to Array: %f\n", entry);
+      
+      entryCount++;
+      currentEntry->value = entry;
+      currentEntry->next = new Entry;
+      currentEntry = currentEntry->next;
+      currentEntry->next = NULL;
+    }
+  else 
+    if (verbose >= 1)
+      printf ("adding failed, because list has been finalized\n");
+}
+
+/**
+   \brief Adds 3 entries at once (convenience)
+*/
+void Array::addEntry (GLfloat entry0, GLfloat entry1, GLfloat entry2)
+{
+  addEntry (entry0);
+  addEntry (entry1);
+  addEntry (entry2);
+}
+  
+/**
+   \brief Gives back the array !! MUST be executed AFTER finalize.
+   \returns The created array.
+*/
+GLfloat* Array::getArray ()
+{
+  return array;
+}
+
+/**
+   \returns The Count of entries in the Array
+*/
+int Array::getCount()
+{
+  return entryCount;
+}
+
+/**
+   \brief Simple debug info about the Array
+*/
+void Array::debug ()
+{
+  printf ("entryCount=%i, address=%p\n", entryCount, array);
+}
Index: orxonox/branches/dave/importer/array.h
===================================================================
--- orxonox/branches/dave/importer/array.h	(revision 2860)
+++ orxonox/branches/dave/importer/array.h	(revision 2860)
@@ -0,0 +1,49 @@
+/*!
+  \file array.h
+  \brief Contains the Array Class that handles float arrays.
+  this class creates a Array of a semi-Dynamic length.
+  beware, that after finalizing the array may not be resized again.
+*/
+
+#ifndef _ARRAY_H
+#define _ARRAY_H
+
+extern int verbose; //!< will be obsolete soon
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include <fstream>
+
+
+//! Array Class that handles dynamic-float arrays.
+class Array
+{
+ public:
+  Array ();
+  ~Array();
+
+  void initializeArray ();
+  void finalizeArray (void);
+  void addEntry (GLfloat entry);
+  void addEntry(GLfloat entry0, GLfloat entry1, GLfloat entry2);
+  
+  GLfloat* getArray ();
+  int getCount();
+  void debug(void);
+ private:
+  struct Entry
+  {
+    GLfloat value;
+    Entry* next;
+  };
+
+  GLfloat* array;
+  int entryCount;
+  bool finalized;
+  Entry* firstEntry;
+  Entry* currentEntry;
+  
+  
+};
+
+#endif
Index: orxonox/branches/dave/importer/framework.cc
===================================================================
--- orxonox/branches/dave/importer/framework.cc	(revision 2860)
+++ orxonox/branches/dave/importer/framework.cc	(revision 2860)
@@ -0,0 +1,97 @@
+#include "windowHandler.h" // Include the Whandler Basecode
+#include "object.h"
+
+int verbose = 2;
+WindowHandler wHandler;  // Create an instance of the whandler basecode class
+Object* obj;
+float rotator = 0.0;
+  GLfloat whiteLight[] = {1.0, 1.0, 0.0,1.0};
+
+void DrawGLScene()
+{
+  rotator +=.001;
+  
+  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+  glLoadIdentity(); // Reset the view
+  
+  glMatrixMode(GL_PROJECTION);
+  glLoadIdentity();	
+  gluPerspective(45.0f,500/375,0.1f,100.0f);
+  gluLookAt (5*sin(rotator),7.5,5*cos(rotator), 0,0,0, 0,1,0);
+  whiteLight[1] = .5+.5*sin(rotator*10);
+  whiteLight[2] = .5+.5*sin(rotator*10);
+
+  GLfloat lightPosition[] = {10.0*sin(rotator*10), 10, 19.0, 0.0};
+  glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
+
+  glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
+  obj->draw();
+
+  SDL_GL_SwapBuffers(); // Swap the buffers
+}
+
+
+int main(int argc, char *argv[])
+{
+  Uint8* keys; // This variable will be used in the keyboard routine
+  int done=FALSE; // We aren't done yet, are we?
+
+  // Create a new OpenGL window with the title "Cone3D Basecode" at
+  // 640x480x32, fullscreen and check for errors along the way
+  if(wHandler.CreateGLWindow("Whandler Basecode", 500, 375, 32, FALSE) == FALSE)
+  {
+    // If an error is found, display a message, kill the GL and SDL screens (if they were created) and exit
+    printf("Could not initalize OpenGL :(\n\n");
+    wHandler.KillGLWindow();
+    return 0;
+  }
+  if (argc>=3)
+    obj = new Object (argv[1], atof(argv[2]));
+  else if (argc>=2)
+    obj = new Object(argv[1]);
+  else 
+    obj = new Object();
+  
+  GLfloat lmodelAmbient[] = {.1, .1, .1, 1.0};
+  glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
+  glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight);
+  glEnable(GL_LIGHTING);
+  glEnable(GL_LIGHT0);
+  glEnable(GL_DEPTH_TEST);
+
+  // Build the font from a TGA image font.tga in the data directory
+  // Hide the mouse cursor
+  SDL_ShowCursor(0);
+
+  // This is the main loop for the entire program and it will run until done==TRUE
+  while(!done)
+  {
+    // Draw the scene
+    DrawGLScene();
+    // And poll for events
+    SDL_Event event;
+    while ( SDL_PollEvent(&event) ) {
+      switch (event.type) {
+        // If a quit event was recieved
+        case SDL_QUIT:
+          // then we're done and we'll end this program
+          done=TRUE;
+          break;
+        default:
+          break;
+      }
+    }
+
+    // Get the state of the keyboard keys
+    keys = SDL_GetKeyState(NULL);
+
+    // and check if ESCAPE has been pressed. If so then quit
+    if(keys[SDLK_ESCAPE]) done=TRUE;
+  }
+
+  // Kill the GL & SDL screens
+  delete obj;
+  wHandler.KillGLWindow();
+  // And quit
+  return 0;
+}
Index: orxonox/branches/dave/importer/material.cc
===================================================================
--- orxonox/branches/dave/importer/material.cc	(revision 2860)
+++ orxonox/branches/dave/importer/material.cc	(revision 2860)
@@ -0,0 +1,293 @@
+/* 
+   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: ...
+*/
+
+#include "material.h"
+
+/**
+   \brief creates a default Material with no Name
+   normally you call this to create a material List (for an obj-file) and then append with addMaterial()
+*/
+Material::Material()
+{
+  init();
+  
+  setName ("");
+}
+
+/**
+   \brief creates a Material.
+   \param mtlName Name of the Material to be added to the Material List
+*/
+Material::Material (char* mtlName)
+{
+  init();
+  
+  setName (mtlName);
+}
+
+/** 
+    \brief deletes a Material
+*/
+Material::~Material()
+{
+  if (verbose >= 2)
+    printf ("delete Material %s\n", name);
+  if (nextMat != NULL)
+    delete 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)
+{
+  if (verbose >=2)
+    printf ("adding Material %s\n", mtlName);
+  Material* newMat = new Material(mtlName);
+  Material* tmpMat = this;
+  while (tmpMat->nextMat != NULL)
+    {
+      tmpMat = tmpMat->nextMat;
+    }
+      tmpMat->nextMat = newMat;
+      return newMat;
+  
+}
+
+/**
+   \brief initializes a new Material with its default Values
+*/
+void Material::init(void)
+{
+  if (verbose >= 3)
+    printf ("initializing new Material\n");
+  nextMat = NULL;
+
+  setIllum(1);
+  setDiffuse(0,0,0);
+  setAmbient(0,0,0);
+  setSpecular(0,0,0);
+  setShininess(2.0);
+  setTransparency(0.0);
+  
+}
+
+/**
+   \brief Set the Name of the Material. (Important for searching)
+   \param mtlName the Name of the Material to be set.
+*/ 
+void Material::setName (char* mtlName)
+{
+  if (verbose >= 3)
+    printf("setting Material Name to %s", mtlName);
+  strcpy(name, mtlName);
+  //  printf ("adding new Material: %s, %p\n", this->getName(), this);
+
+}
+/**
+   \returns The Name of The Material
+*/
+char* Material::getName (void)
+{
+  return name;
+}
+
+/**
+   \brief Sets the Material Illumination Model. 
+   \brief illu illumination Model in int form
+*/
+void Material::setIllum (int illum)
+{
+  if (verbose >= 3)
+    printf("setting illumModel of Material %s to %i", name, illum);
+  illumModel = illum;
+  //  printf ("setting illumModel to: %i\n", illumModel);
+}
+/**
+   \brief Sets the Material Illumination Model. 
+   \brief illu illumination Model in char* form
+*/void Material::setIllum (char* illum)
+{
+  setIllum (atoi(illum));
+}
+
+/**
+   \brief Sets the Material Diffuse Color.
+   \param r Red Color Channel.
+   \param g Green Color Channel.
+   \param b Blue Color Channel.
+*/
+void Material::setDiffuse (float r, float g, float b)
+{
+  if (verbose >= 3)
+    printf ("setting Diffuse Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
+  diffuse[0] = r;
+  diffuse[1] = g;
+  diffuse[2] = b;  
+  diffuse[3] = 1.0;
+
+}
+/**
+   \brief Sets the Material Diffuse Color.
+   \param rgb The red, green, blue channel in char format (with spaces between them)
+*/
+void Material::setDiffuse (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setDiffuse (atof(r), atof(g), atof(b));
+}
+
+/**
+   \brief Sets the Material Ambient Color. 
+   \param r Red Color Channel.
+   \param g Green Color Channel.
+   \param b Blue Color Channel.
+*/
+void Material::setAmbient (float r, float g, float b)
+{
+  if (verbose >=3)
+    printf ("setting Ambient Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
+  ambient[0] = r;
+  ambient[1] = g;
+  ambient[2] = b;
+  ambient[3] = 1.0;
+}
+/**
+   \brief Sets the Material Ambient Color.
+   \param rgb The red, green, blue channel in char format (with spaces between them)
+*/
+void Material::setAmbient (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setAmbient (atof(r), atof(g), atof(b));
+}
+
+/**
+   \brief Sets the Material Specular Color. 
+   \param r Red Color Channel.
+   \param g Green Color Channel.
+   \param b Blue Color Channel.
+*/
+void Material::setSpecular (float r, float g, float b)
+{
+  if (verbose >= 3)
+    printf ("setting Specular Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
+  specular[0] = r;
+  specular[1] = g;
+  specular[2] = b;
+  specular[3] = 1.0;
+ }
+/**
+   \brief Sets the Material Specular Color.
+   \param rgb The red, green, blue channel in char format (with spaces between them)
+*/
+void Material::setSpecular (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setSpecular (atof(r), atof(g), atof(b));
+}
+
+/**
+   \brief Sets the Material Shininess.
+   \param shini stes the Shininess from float.
+*/
+void Material::setShininess (float shini)
+{
+  shininess = shini;
+}
+/**
+   \brief Sets the Material Shininess.
+   \param shini stes the Shininess from char*.
+*/
+void Material::setShininess (char* shini)
+{
+  setShininess (atof(shini));
+}
+
+/**
+   \brief Sets the Material Transparency.
+   \param trans stes the Transparency from int.
+*/
+void Material::setTransparency (float trans)
+{
+  if (verbose >= 3)
+    printf ("setting Transparency of Material %s to %f\n", name, trans);
+  transparency = trans;
+}
+/**
+   \brief Sets the Material Transparency.
+   \param trans stes the Transparency from char*.
+*/
+void Material::setTransparency (char* trans)
+{
+  char tr[20];
+  sscanf (trans, "%s", tr);
+  setTransparency (atof(tr));
+}
+
+/**
+   \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)
+{
+  if (verbose >=3)
+    printf ("Searching for material %s", mtlName);
+  Material* searcher = this;
+  while (searcher != NULL)
+    {
+      if (verbose >= 3)
+	printf (".");
+      if (!strcmp (searcher->getName(), mtlName))
+	{
+	  if (verbose >= 3)
+	    printf ("found.\n");
+	  return searcher;
+	}
+      searcher = searcher->nextMat;
+    }
+  return NULL;
+}
+
+/**
+   \brief sets the material with which the following Faces will be painted
+*/
+bool Material::select (void)
+{
+  // setting diffuse color
+  //  glColor3f (diffuse[0], diffuse[1], diffuse[2]);
+  glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse);
+
+  // setting ambient color
+  glMaterialfv(GL_FRONT, GL_AMBIENT, ambient);
+
+  // setting up Sprecular
+  glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
+
+  // setting up Shininess
+  glMaterialf(GL_FRONT, GL_SHININESS, shininess);
+  
+  // setting illumination Model 
+  if (illumModel == 1)
+    glShadeModel(GL_FLAT);
+  else if (illumModel >= 2)
+    glShadeModel(GL_SMOOTH);
+}
Index: orxonox/branches/dave/importer/material.h
===================================================================
--- orxonox/branches/dave/importer/material.h	(revision 2860)
+++ orxonox/branches/dave/importer/material.h	(revision 2860)
@@ -0,0 +1,59 @@
+/*!
+  \file material.h
+  \brief Contains the Material Class that handles Material for 3D-Objects.
+*/
+
+#ifndef _MATERIAL_H
+#define _MATERIAL_H
+
+extern int verbose; //!< will be obsolete soon.
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include <stdlib.h>
+#include <fstream>
+
+//! Class to handle Materials.
+class Material
+{
+ public:
+  Material ();
+  Material (char* mtlName);
+  Material* addMaterial(char* mtlName);
+
+  void init(void);
+  ~Material ();
+
+
+  void setName (char* mtlName);
+  char* getName (void);
+  void setIllum (int illum);
+  void setIllum (char* illum);
+  void setDiffuse (float r, float g, float b);
+  void setDiffuse (char* rgb);
+  void setAmbient (float r, float g, float b);
+  void setAmbient (char* rgb);
+  void setSpecular (float r, float g, float b);
+  void setSpecular (char* rgb);
+  void setShininess (float shini);
+  void setShininess (char* shini);
+  void setTransparency (float trans);
+  void setTransparency (char* trans);
+
+  Material* search (char* mtlName);
+
+  bool select (void);
+
+  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
+
+ private:
+  char name [50];
+  int illumModel;
+  float diffuse [4];
+  float ambient [4];
+  float specular [4];
+  float shininess;
+  float transparency;
+
+};
+#endif
Index: orxonox/branches/dave/importer/object.cc
===================================================================
--- orxonox/branches/dave/importer/object.cc	(revision 2860)
+++ orxonox/branches/dave/importer/object.cc	(revision 2860)
@@ -0,0 +1,663 @@
+/* 
+   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: ...
+*/
+
+#include "object.h"
+
+/**
+   \brief Creates a 3D-Object, but does not load any 3D-models
+   pretty useless
+*/
+Object::Object ()
+{
+
+  initialize();
+
+  BoxObject();
+
+  finalize();
+}
+
+/**
+   \brief Crates a 3D-Object and loads in a File
+   \param fileName file to parse and load (must be a .obj file)
+*/
+Object::Object(char* fileName)
+{
+  initialize();
+
+  importFile (fileName);
+
+  finalize();
+}
+
+/**
+   \brief Crates a 3D-Object, loads in a File and scales it.
+   \param fileName file to parse and load (must be a .obj file)
+   \param scaling The factor that the object will be scaled with.
+*/
+
+Object::Object(char* fileName, float scaling)
+{
+  initialize();
+  scaleFactor = scaling;
+
+  importFile (fileName);
+
+  finalize();
+}
+
+/**
+   \brief deletes an Object
+*/
+Object::~Object()
+{
+  if (verbose >= 2)
+    printf ("Deleting display List.\n");
+  Group* walker = firstGroup;
+  while (walker != NULL)
+    {
+      glDeleteLists (walker->listNumber, 1);
+      Group* lastWalker = walker;
+      walker = walker->nextGroup;
+      delete lastWalker;
+    } 
+}
+
+/** 
+    \brief initializes the Object
+    This Function initializes all the needed arrays, Lists and clientStates
+*/
+bool Object::initialize (void)
+{
+  if (verbose >=3)
+    printf("new 3D-Object is being created\n"); 
+
+  // setting the start group;
+  firstGroup = new Group;
+  currentGroup = firstGroup;
+  groupCount = 0;
+  
+  initGroup (currentGroup);
+  mtlFileName = "";
+  scaleFactor = 1;
+  material = new Material();
+
+  glEnableClientState (GL_VERTEX_ARRAY);
+  //  glEnableClientState (GL_NORMAL_ARRAY);
+  //  glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+
+
+  return true;
+}
+
+/**
+   \brief Imports a obj file and handles the the relative location
+   \param fileName The file to import
+*/
+bool Object::importFile (char* fileName)
+{
+  if (verbose >=3)
+    printf("preparing to read in file: %s\n", fileName);   
+  objFileName = fileName;
+  this->readFromObjFile (objFileName);
+  return true;
+}
+
+/**
+   \brief finalizes an Object.
+   This funcion is needed, to close the glList and all the other lists.
+*/
+bool Object::finalize(void)
+{
+  //  if (verbose >=3)
+    printf("finalizing the 3D-Object\n"); 
+  finalizeGroup (currentGroup);
+  if (material != NULL)
+    delete material;
+  return true;
+}
+
+/**
+   \brief Draws the Objects of all Groups.
+   It does this by just calling the Lists that must have been created earlier.
+*/
+void Object::draw (void)
+{
+  if (verbose >=2)
+    printf("drawing the 3D-Objects\n"); 
+  Group* walker = firstGroup;
+  while (walker != NULL)
+    {
+      if (verbose >= 3)
+	printf ("Drawing object %s\n", walker->name);
+      glCallList (walker->listNumber);
+      walker = walker->nextGroup;
+    }
+}
+
+/**
+   \brief Draws the Object number groupNumber
+   It does this by just calling the List that must have been created earlier.
+   \param groupNumber The number of the group that will be displayed.
+*/
+void Object::draw (int groupNumber)
+{
+  if (groupNumber >= groupCount)
+    {
+      if (verbose>=2)
+	printf ("You requested object number %i, but this File only contains of %i Objects.\n", groupNumber-1, groupCount);
+      return;
+    }
+  if (verbose >=2)
+    printf("drawing the requested 3D-Objects if found.\n"); 
+  Group* walker = firstGroup;
+  int counter = 0;
+  while (walker != NULL)
+    {
+      if (counter == groupNumber)
+	{
+	  if (verbose >= 2)
+	    printf ("Drawing object number %s named %s\n", counter, walker->name);
+	  glCallList (walker->listNumber);
+	  return;
+	}
+      ++counter;
+      walker = walker->nextGroup;
+    }
+  if (verbose >= 2)
+    printf("Object number %i in %s not Found.\n", groupNumber, objFileName);
+  return;
+
+}
+
+/**
+   \brief Draws the Object with a specific groupname
+   It does this by just calling the List that must have been created earlier.
+   \param groupName The name of the group that will be displayed.
+*/
+void Object::draw (char* groupName)
+{
+  if (verbose >=2)
+    printf("drawing the requested 3D-Objects if found.\n"); 
+  Group* walker = firstGroup;
+  while (walker != NULL)
+    {
+      if (!strcmp(walker->name, groupName))
+	{
+	  if (verbose >= 2)
+	    printf ("Drawing object %s\n", walker->name);
+	  glCallList (walker->listNumber);
+	  return;
+	}
+      walker = walker->nextGroup;
+    }
+  if (verbose >= 2)
+    printf("Object Named %s in %s not Found.\n", groupName, objFileName);
+  return;
+}
+
+/**
+   \returns Count of the Objects in this File
+*/
+int Object::getGroupCount (void)
+{
+  return groupCount;
+}
+
+/**
+   \brief initializes a new Group object
+*/
+bool Object::initGroup(Group* group)
+{
+  if (verbose >= 2)
+    printf("Adding new Group\n");
+  group->faceMode = -1;
+  group->name = "";
+  if ((group->listNumber = glGenLists(1)) == 0 )
+    {
+      printf ("list could not be created for this Object\n");
+      return false;
+    }
+  
+  if (groupCount == 0)
+    {
+      group->firstVertex = 0;
+      group->firstNormal = 0;
+      group->firstNormal = 0;
+    }
+  else
+    {
+      group->firstVertex = currentGroup->firstVertex + currentGroup->vertices->getCount()/3;
+      group->firstNormal = currentGroup->firstNormal + currentGroup->normals->getCount()/3;
+      group->firstVertexTexture = currentGroup->firstVertexTexture + currentGroup->vTexture->getCount()/2;
+    }
+
+  group->vertices = new Array();
+  group->normals = new Array();
+  group->vTexture = new Array();
+
+  glNewList (group->listNumber, GL_COMPILE);
+}
+
+/**
+   \brief finalizes a Group.
+*/
+bool Object::finalizeGroup(Group* group)
+{
+  glEnd();
+  glEndList();
+  
+  delete group->vertices;
+  delete group->normals;
+  delete group->vTexture;
+}
+/**
+   \brief Reads in the .obj File and sets all the Values.
+   This function does read the file, parses it for the occurence of things like vertices, faces and so on, and executes the specific tasks
+   \param fileName the File that will be parsed (.obj-file)
+*/
+bool Object::readFromObjFile (char* fileName)
+{
+  OBJ_FILE = new ifstream(fileName);
+  if (!OBJ_FILE->is_open())
+    {
+      if (verbose >=1)
+	printf ("unable to open .OBJ file: %s\n Loading Box Object instead.\n", fileName);
+      BoxObject();
+      return false;
+    }
+  objFileName = fileName;
+  char Buffer[500];
+  while(!OBJ_FILE->eof())
+    {
+      OBJ_FILE->getline(Buffer, 500);
+      if (verbose >=4)
+	printf ("Read input line: %s\n",Buffer);
+      
+
+      // case vertice
+      if (!strncmp(Buffer, "v ", 2))
+	{
+	  readVertex(Buffer+2);
+	}
+
+      // case face
+      else if (!strncmp(Buffer, "f ", 2))
+	{
+	  readFace (Buffer+2);
+	}
+      
+      else if (!strncmp(Buffer, "mtllib", 6))
+	{
+	  readMtlLib (Buffer+7);
+	}
+
+      else if (!strncmp(Buffer, "usemtl", 6))
+	{
+	  readUseMtl (Buffer+7);
+	}
+
+      // case VertexNormal
+      else if (!strncmp(Buffer, "vn ", 2))
+      {
+	readVertexNormal(Buffer+3);
+      }
+
+      // case VertexTextureCoordinate
+      else if (!strncmp(Buffer, "vt ", 2))
+      {
+	readVertexTexture(Buffer+3);
+      }
+      // case group
+      else if (!strncmp(Buffer, "g", 1))
+	{
+	  readGroup (Buffer+2);
+	}
+    }
+  OBJ_FILE->close();
+
+}
+
+/**
+   \brief parses a vertex-String
+   If a vertex line is found this function will inject it into the vertex-Array
+   \param vertexString The String that will be parsed.
+*/
+bool Object::readVertex (char* vertexString)
+{
+  readingVertices = true;
+  char subbuffer1[20];
+  char subbuffer2[20];
+  char subbuffer3[20];
+  sscanf (vertexString, "%s %s %s", subbuffer1, subbuffer2, subbuffer3);
+  if (verbose >= 3)
+    printf ("reading in a vertex: %s %s %s\n", subbuffer1, subbuffer2, subbuffer3);
+  currentGroup->vertices->addEntry(atof(subbuffer1)*scaleFactor, atof(subbuffer2)*scaleFactor, atof(subbuffer3)*scaleFactor);
+  return true;
+}
+
+/**
+   \brief parses a face-string
+   If a face line is found this function will add it to the glList.
+   The function makes a difference between QUADS and TRIANGLES, and will if changed re-open, set and re-close the gl-processe.
+   \param faceString The String that will be parsed.
+*/
+bool Object::readFace (char* faceString)
+{
+  // finalize the Arrays;
+  if (readingVertices == true)
+    {
+      currentGroup->vertices->finalizeArray();
+      glVertexPointer(3, GL_FLOAT, 0, currentGroup->vertices->getArray());
+      currentGroup->normals->finalizeArray();
+      glNormalPointer(GL_FLOAT, 0, currentGroup->normals->getArray());
+      currentGroup->vTexture->finalizeArray();
+    }
+
+  readingVertices = false;
+  char subbuffer1[20];
+  char subbuffer2[20];
+  char subbuffer3[20];
+  char subbuffer4[20] ="";
+  sscanf (faceString, "%s %s %s %s", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
+  if (!strcmp(subbuffer4, ""))
+    {
+      if (currentGroup->faceMode != 3)
+	{
+	  if (currentGroup->faceMode != -1)
+	    glEnd();
+	  glBegin(GL_TRIANGLES);
+	}
+      
+      currentGroup->faceMode = 3;
+      if (verbose >=3)
+	printf ("found triag: %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3);
+      addGLElement(subbuffer1);
+      addGLElement(subbuffer2);
+      addGLElement(subbuffer3);
+      return true;
+    }
+  else
+    {
+      if (currentGroup->faceMode != 4)
+	{
+	  if (currentGroup->faceMode != -1)
+	    glEnd();
+	  glBegin(GL_QUADS);
+	}
+      currentGroup->faceMode = 4;
+      if (verbose >=3 )
+	printf ("found quad: %s, %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
+      addGLElement(subbuffer1);
+      addGLElement(subbuffer2);
+      addGLElement(subbuffer3);
+      addGLElement(subbuffer4);
+      return true;
+    }
+}
+
+/**
+   \brief Adds a Face-element (one vertex of a face) with all its information. 
+   It does this by searching:
+   1. The Vertex itself
+   2. The VertexNormale
+   3. The VertexTextureCoordinate
+   merging this information, the face will be drawn.
+
+*/
+bool Object::addGLElement (char* elementString)
+{
+  if (verbose >=3)
+    printf ("importing grafical Element.... including to openGL\n");
+  char* vertex = elementString;
+
+  char* texture;
+  texture = strstr (vertex, "/");
+  texture[0] = '\0';
+  texture ++;
+  glTexCoord2fv(currentGroup->vTexture->getArray()+(atoi(texture)-1 - currentGroup->firstVertexTexture)*2);
+
+  char* normal;
+  if ((normal = strstr (texture, "/")) !=NULL)
+    {
+      normal[0] = '\0';
+      normal ++;
+      //glArrayElement(atoi(vertex)-1);
+      glNormal3fv(currentGroup->normals->getArray() +(atoi(normal)-1 - currentGroup->firstNormal)*3);
+    }
+  glVertex3fv(currentGroup->vertices->getArray() +(atoi(vertex)-1 - currentGroup->firstVertex)*3);
+
+}
+
+/**
+   \brief parses a vertexNormal-String
+   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
+   \param normalString The String that will be parsed.
+*/
+bool Object::readVertexNormal (char* normalString)
+{
+  readingVertices = true;
+  char subbuffer1[20];
+  char subbuffer2[20];
+  char subbuffer3[20];
+  sscanf (normalString, "%s %s %s", subbuffer1, subbuffer2, subbuffer3);
+  if (verbose >=3 )
+    printf("found vertex-Normal %s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3);
+  currentGroup->normals->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3));
+  return true;
+}
+
+/**
+   \brief parses a vertexTextureCoordinate-String
+   If a vertexTextureCoordinate line is found this function will inject it into the vertexTexture-Array
+   \param vTextureString The String that will be parsed.
+*/
+bool Object::readVertexTexture (char* vTextureString)
+{
+  readingVertices = true;
+  char subbuffer1[20];
+  char subbuffer2[20];
+  sscanf (vTextureString, "%s %s", subbuffer1, subbuffer2);
+  if (verbose >=3 )
+    printf("found vertex-Texture %s, %s\n", subbuffer1,subbuffer2);
+  currentGroup->vTexture->addEntry(atof(subbuffer1));
+  currentGroup->vTexture->addEntry(atof(subbuffer2));
+  return true;
+}
+
+/**
+   \brief parses a group String
+   This function initializes a new Group. 
+   With it you should be able to import .obj-files with more than one Objects inside. 
+   \param groupString the new Group to create
+*/
+bool Object::readGroup (char* groupString)
+{
+  //  printf ("test\n");
+  if (!strcmp(groupString, "default"))
+    {
+      if (groupCount != 0)
+	{
+	  Group* newGroup = new Group;
+	  finalizeGroup(currentGroup);
+	  currentGroup->nextGroup = newGroup;
+	  initGroup(newGroup);
+	  currentGroup = newGroup; // must be after init see initGroup for more info
+	}
+      ++groupCount;
+    }
+  else
+    {
+      
+      currentGroup->name = new char [strlen(groupString)];      
+      strcpy(currentGroup->name, groupString);
+    }
+}
+
+/** 
+    \brief Function to read in a mtl File.
+    this Function parses all Lines of an mtl File
+    \param mtlFile The .mtl file to read
+*/
+bool Object::readMtlLib (char* mtlFile)
+{
+  MTL_FILE = new ifstream (mtlFile);
+  if (!MTL_FILE->is_open())
+    {
+      if (verbose >= 1)
+	printf ("unable to open file: %s\n", mtlFile);
+      return false;
+    }
+  mtlFileName = mtlFile;
+  if (verbose >=2)
+    printf ("Opening mtlFile: %s\n", mtlFileName);
+  char Buffer[500];
+  Material* tmpMat = material;
+  while(!MTL_FILE->eof())
+    {
+      MTL_FILE->getline(Buffer, 500);
+      if (verbose >= 4)
+	printf("found line in mtlFile: %s\n", Buffer);
+      
+
+      // create new Material
+      if (!strncmp(Buffer, "newmtl ", 2))
+	{
+	  tmpMat = tmpMat->addMaterial(Buffer+7);
+	  //	  printf ("%s, %p\n", tmpMat->getName(), tmpMat);
+	}
+      // setting a illumMode
+      else if (!strncmp(Buffer, "illum", 5))
+	{
+	  tmpMat->setIllum(Buffer+6);
+
+	}
+      // setting Diffuse Color
+      else if (!strncmp(Buffer, "Kd", 2))
+	{
+	  tmpMat->setDiffuse(Buffer+3);
+	}
+      // setting Ambient Color
+      else if (!strncmp(Buffer, "Ka", 2))
+	{
+	  tmpMat->setAmbient(Buffer+3);
+	}
+      // setting Specular Color
+      else if (!strncmp(Buffer, "Ks", 2))
+	{
+	  tmpMat->setSpecular(Buffer+3);
+	}
+      // setting The Specular Shininess
+      else if (!strncmp(Buffer, "Ns", 2))
+	{
+	  tmpMat->setShininess(Buffer+3);
+	}
+      // setting up transparency
+      else if (!strncmp(Buffer, "d", 1))
+	{
+	  tmpMat->setTransparency(Buffer+2);
+	}
+      else if (!strncpy(Buffer, "Tf", 2))
+	{
+	  tmpMat->setTransparency(Buffer+3);
+	}
+
+    }
+  return true;
+}
+
+/**
+   \brief Function that selects a material, if changed in the obj file.
+   \param matString the Material that will be set.
+*/
+
+bool Object::readUseMtl (char* matString)
+{
+  if (!strcmp (mtlFileName, ""))
+    {
+      if (verbose >= 1)
+	printf ("Not using new defined material, because no mtlFile found yet\n");
+      return false;
+    }
+      
+  if (currentGroup->faceMode != -1)
+    glEnd();
+  currentGroup->faceMode = 0;
+  if (verbose >= 2)
+    printf ("using material %s for coming Faces.\n", matString);
+  material->search(matString)->select();
+}
+
+/**
+   \brief Includes a default object
+   This will inject a Cube, because this is the most basic object.
+*/
+void Object::BoxObject(void)
+{
+  readVertex ("-0.500000 -0.500000 0.500000");
+  readVertex ("0.500000 -0.500000 0.500000");
+  readVertex ("-0.500000 0.500000 0.500000");
+  readVertex ("0.500000 0.500000 0.500000");
+  readVertex ("-0.500000 0.500000 -0.500000");
+  readVertex ("0.500000 0.500000 -0.500000");
+  readVertex ("-0.500000 -0.500000 -0.500000");
+  readVertex ("0.500000 -0.500000 -0.500000");
+  readVertexTexture ("0.000000 0.000000");
+  readVertexTexture ("1.000000 0.000000");
+  readVertexTexture ("0.000000 1.000000");
+  readVertexTexture ("1.000000 1.000000");
+  readVertexTexture ("0.000000 2.000000");
+  readVertexTexture ("1.000000 2.000000");
+  readVertexTexture ("0.000000 3.000000");
+  readVertexTexture ("1.000000 3.000000");
+  readVertexTexture ("0.000000 4.000000");
+  readVertexTexture ("1.000000 4.000000");
+  readVertexTexture ("2.000000 0.000000");
+  readVertexTexture ("2.000000 1.000000");
+  readVertexTexture ("-1.000000 0.000000");
+  readVertexTexture ("-1.000000 1.000000");
+  
+  readVertexNormal ("0.000000 0.000000 1.000000");
+  readVertexNormal ("0.000000 0.000000 1.000000");
+  readVertexNormal ("0.000000 0.000000 1.000000");
+  readVertexNormal ("0.000000 0.000000 1.000000");
+  readVertexNormal ("0.000000 1.000000 0.000000");
+  readVertexNormal ("0.000000 1.000000 0.000000");
+  readVertexNormal ("0.000000 1.000000 0.000000");
+  readVertexNormal ("0.000000 1.000000 0.000000");
+  readVertexNormal ("0.000000 0.000000 -1.000000");
+  readVertexNormal ("0.000000 0.000000 -1.000000");
+  readVertexNormal ("0.000000 0.000000 -1.000000");
+  readVertexNormal ("0.000000 0.000000 -1.000000");
+  readVertexNormal ("0.000000 -1.000000 0.000000");
+  readVertexNormal ("0.000000 -1.000000 0.000000");
+  readVertexNormal ("0.000000 -1.000000 0.000000");
+  readVertexNormal ("0.000000 -1.000000 0.000000");
+  readVertexNormal ("1.000000 0.000000 0.000000");
+  readVertexNormal ("1.000000 0.000000 0.000000");
+  readVertexNormal ("1.000000 0.000000 0.000000");
+  readVertexNormal ("1.000000 0.000000 0.000000");
+  readVertexNormal ("-1.000000 0.000000 0.000000");
+  readVertexNormal ("-1.000000 0.000000 0.000000");
+  readVertexNormal ("-1.000000 0.000000 0.000000");
+  readVertexNormal ("-1.000000 0.000000 0.000000");
+
+  readFace ("1/1/1 2/2/2 4/4/3 3/3/4");
+  readFace ("3/3/5 4/4/6 6/6/7 5/5/8");
+  readFace ("5/5/9 6/6/10 8/8/11 7/7/12");
+  readFace ("7/7/13 8/8/14 2/10/15 1/9/16");
+  readFace ("2/2/17 8/11/18 6/12/19 4/4/20");
+  readFace ("7/13/21 1/1/22 3/3/23 5/14/24");
+}
Index: orxonox/branches/dave/importer/object.h
===================================================================
--- orxonox/branches/dave/importer/object.h	(revision 2860)
+++ orxonox/branches/dave/importer/object.h	(revision 2860)
@@ -0,0 +1,95 @@
+/*!
+  \file object.h
+  \brief Contains the Object Class that handles 3D-Objects
+*/
+
+#ifndef _OBJECT_H
+#define _OBJECT_H
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+#include "array.h"
+#include "material.h"
+#include <fstream>
+
+using namespace std;
+
+extern int verbose; //!< fill be removed and added again as a verbose-class
+
+
+//! Class that handles 3D-Objects. it can also read them in and display them.
+class Object
+{
+ public:
+  Object ();
+  Object (char* fileName);
+  Object(char* fileName, float scaling);
+  ~Object ();
+  
+  bool importFile (char* fileName);
+  bool initialize (void);
+  bool finalize(void);
+  void draw (void);
+  void draw (int groupNumber);
+  void draw (char* groupName);
+  int getGroupCount();
+
+ private:
+  //! Group to handle multiple Objects per obj-file
+  struct Group
+  {
+    char* name;
+
+    GLuint listNumber;
+    Array* vertices;
+    int verticesCount;
+    Array* colors;
+    Array* normals;
+    Array* vTexture;
+    int faceMode;
+
+    int firstVertex;
+    int firstNormal;
+    int firstVertexTexture;
+
+    Group* nextGroup;
+  };
+  
+  Group* firstGroup; //!< the first of all groups.
+  Group* currentGroup; //!< the currentGroup. this is the one we will work with.
+  int groupCount;
+
+  bool readingVertices;
+
+  char* objFileName;
+  char* mtlFileName;
+
+  Material* material;
+  float scaleFactor;
+
+  ifstream* OBJ_FILE;
+  ifstream* MTL_FILE;
+
+  bool initGroup(Group* group);
+  bool finalizeGroup (Group* group);
+
+
+  ///// readin ///
+  bool readFromObjFile (char* fileName);
+  
+  bool readVertex (char* vertexString);
+  bool readFace (char* faceString);
+  bool readVT (char* vtString);
+  bool readVertexNormal (char* normalString);
+  bool readVertexTexture (char* vTextureString);
+  bool readGroup (char* groupString);
+  bool readMtlLib (char* matFile);
+  bool readUseMtl (char* mtlString);
+
+  bool addGLElement (char* elementString);
+
+  void BoxObject (void);
+};
+
+#endif
Index: orxonox/branches/dave/importer/windowHandler.cc
===================================================================
--- orxonox/branches/dave/importer/windowHandler.cc	(revision 2860)
+++ orxonox/branches/dave/importer/windowHandler.cc	(revision 2860)
@@ -0,0 +1,81 @@
+
+
+#include "windowHandler.h"
+#include <stdio.h>
+void WindowHandler::ReSizeGLScene(GLsizei width, GLsizei height)		// Resize And Initialize The GL Window
+{
+	if (height==0)										// Prevent A Divide By Zero By
+	{
+		height=1;										// Making Height Equal One
+	}
+
+	glViewport(0,0,width,height);						// Reset The Current Viewport
+
+
+	glMatrixMode(GL_PROJECTION);						// Select The Projection Matrix
+	glLoadIdentity();	
+
+
+	// Calculate The Aspect Ratio Of The Window
+	gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
+	gluLookAt (0,0,15, 0,0,0, 0,1,0);
+
+	glMatrixMode(GL_MODELVIEW);							// Select The Modelview Matrix
+	glLoadIdentity();									// Reset The Modelview Matrix
+
+}
+
+
+int WindowHandler::InitGL(GLvoid)										// All Setup For OpenGL Goes Here
+{
+	glEnable(GL_TEXTURE_2D);							// Enable Texture Mapping
+	glShadeModel(GL_SMOOTH);							// Enable Smooth Shading
+	glClearColor(0.00f, 0.00f, 0.00f, 0.0f);			// Black Background
+	glClearDepth(1.0f);									// Depth Buffer Setup
+	glEnable(GL_DEPTH_TEST);							// Enables Depth Testing
+	glDepthFunc(GL_LEQUAL);								// The Type Of Depth Testing To Do
+	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations
+
+    return TRUE;
+}
+
+
+GLvoid WindowHandler::KillGLWindow(GLvoid)								// Properly Kill The Window
+{
+	SDL_Quit();
+}
+
+
+BOOL WindowHandler::CreateGLWindow(char* title, int width, int height, int bits, BOOL fullscreenflag)
+{
+	Uint32 flags;
+	int size;
+
+	/* Initialize SDL */
+	if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
+		fprintf(stderr, "Couldn't init SDL: %s\n", SDL_GetError());
+		return FALSE;
+	}
+
+	flags = SDL_OPENGL;
+	if ( fullscreenflag ) {
+		flags |= SDL_FULLSCREEN;
+	}
+	SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 1 );
+	if ( SDL_SetVideoMode(width, height, 0, flags) == NULL ) {
+		return FALSE;
+	}
+	SDL_GL_GetAttribute( SDL_GL_STENCIL_SIZE, &size);
+
+	ReSizeGLScene(width, height);						// Set Up Our Perspective GL Screen
+
+	if (!InitGL())										// Initialize Our Newly Created GL Window
+	{
+		KillGLWindow();									// Reset The Display
+		return FALSE;									// Return FALSE
+	}
+
+	return TRUE;										// Success
+}
+
+
Index: orxonox/branches/dave/importer/windowHandler.h
===================================================================
--- orxonox/branches/dave/importer/windowHandler.h	(revision 2860)
+++ orxonox/branches/dave/importer/windowHandler.h	(revision 2860)
@@ -0,0 +1,34 @@
+#ifndef _WINDOWHANDLER_H
+#define _WINDOWHANDLER_H
+
+extern int verbose;
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include <SDL/SDL.h>
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+#define TRUE 1
+#define FALSE 0
+#define BOOL int
+
+class WindowHandler
+{
+  public:
+    WindowHandler() { };
+    ~WindowHandler() { };
+    GLvoid KillGLWindow(GLvoid);
+    BOOL CreateGLWindow(char* title, int width, int height, int bits, BOOL fullscreenflag);
+  private:
+    int InitGL(GLvoid);
+    void ReSizeGLScene(GLsizei width, GLsizei height);  
+};
+
+
+#endif
Index: orxonox/branches/dave/src/Makefile.am
===================================================================
--- orxonox/branches/dave/src/Makefile.am	(revision 2746)
+++ orxonox/branches/dave/src/Makefile.am	(revision 2860)
@@ -6,7 +6,8 @@
 
 bin_PROGRAMS=orxonox
-orxonox_SOURCES=orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc
 
-noinst_HEADERS=ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h
+orxonox_SOURCES=orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc object.cc environment.cc array.cc material.cc list.cc
+noinst_HEADERS=ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h object.h array.h material.h list_template.h
+
 
 
Index: orxonox/branches/dave/src/Makefile.in
===================================================================
--- orxonox/branches/dave/src/Makefile.in	(revision 2746)
+++ orxonox/branches/dave/src/Makefile.in	(revision 2860)
@@ -57,5 +57,7 @@
 	command_node.$(OBJEXT) ini_parser.$(OBJEXT) keynames.$(OBJEXT) \
 	track.$(OBJEXT) base_entity.$(OBJEXT) game_loader.$(OBJEXT) \
-	campaign.$(OBJEXT) story_entity.$(OBJEXT)
+	campaign.$(OBJEXT) story_entity.$(OBJEXT) object.$(OBJEXT) \
+	environment.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT) \
+	list.$(OBJEXT)
 orxonox_OBJECTS = $(am_orxonox_OBJECTS)
 orxonox_LDADD = $(LDADD)
@@ -63,15 +65,17 @@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/base_entity.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/camera.Po ./$(DEPDIR)/campaign.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/collision.Po \
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/base_entity.Po ./$(DEPDIR)/camera.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/campaign.Po ./$(DEPDIR)/collision.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/command_node.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/data_tank.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/environment.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/game_loader.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/ini_parser.Po ./$(DEPDIR)/keynames.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/orxonox.Po ./$(DEPDIR)/player.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/track.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/vector.Po ./$(DEPDIR)/world.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/world_entity.Po
+@AMDEP_TRUE@	./$(DEPDIR)/list.Po ./$(DEPDIR)/material.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/object.Po ./$(DEPDIR)/orxonox.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/player.Po ./$(DEPDIR)/story_entity.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/track.Po ./$(DEPDIR)/vector.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/world.Po ./$(DEPDIR)/world_entity.Po
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
@@ -163,6 +167,6 @@
 AM_CXXFLAGS = "-I/usr/X11R6/include"
 AM_LDFLAGS = "-L/usr/Mesa-6.0.1/lib  -L/usr/X11R6/lib -lXt -lX11" $(MWINDOWS)
-orxonox_SOURCES = orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc
-noinst_HEADERS = ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h
+orxonox_SOURCES = orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc object.cc environment.cc array.cc material.cc list.cc
+noinst_HEADERS = ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h object.h array.h material.h list_template.h
 all: all-am
 
@@ -231,4 +235,5 @@
 	-rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_entity.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera.Po@am__quote@
@@ -237,7 +242,11 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command_node.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_tank.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/environment.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_parser.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keynames.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
Index: orxonox/branches/dave/src/array.cc
===================================================================
--- orxonox/branches/dave/src/array.cc	(revision 2860)
+++ orxonox/branches/dave/src/array.cc	(revision 2860)
@@ -0,0 +1,137 @@
+/* 
+   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: ...
+*/
+
+#include "array.h"
+
+/**
+   \brief creates a new Array
+*/
+Array::Array ()
+{
+  initializeArray ();
+}
+
+/**
+   \brief deletes an Array.
+   It does this by first deleting all the array-entries, and then delete the array[] itself
+*/
+Array::~Array()
+{
+  if (verbose >= 2)
+    printf("deleting array\n");
+  Entry* walker = firstEntry;
+  Entry* last;
+  while (walker != NULL)
+    {
+      last = walker;
+      walker = walker->next;
+      delete last;
+    }
+  if (finalized)
+    delete [] array;
+}
+
+/**
+   \brief initializes an Array
+   the Function does this by setting up a fistEntry, and setting the entryCount.
+*/
+void Array::initializeArray ()
+{
+  if (verbose >= 2)
+    printf ("crating new Array\n");
+  firstEntry = new Entry;
+  firstEntry->next =NULL;
+  currentEntry=firstEntry;
+  finalized = false;
+  entryCount = 0; //0 means one entry
+  return;
+}
+
+/**
+   \brief finalizes an array.
+   This Function creates the array, and makes it ready to be sent to the application.
+*/
+void Array::finalizeArray (void)
+{
+  if (verbose >= 3)
+    printf ("Finalizing array.\n");  
+  if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL)
+    printf ("could not allocate %i data Blocks\n", entryCount);
+  Entry* walker = firstEntry;
+  for (int i=0; i<entryCount; i++)
+    {
+      array[i] = walker->value;
+      walker = walker->next;
+    }
+  finalized = true;
+  return;
+}
+
+/**
+   \brief adds a new Entry to the Array
+   \param entry Entry to add.
+*/
+void Array::addEntry (GLfloat entry)
+{
+  if (!finalized)
+    {
+      if (verbose >= 3)
+	printf ("adding new Entry to Array: %f\n", entry);
+      
+      entryCount++;
+      currentEntry->value = entry;
+      currentEntry->next = new Entry;
+      currentEntry = currentEntry->next;
+      currentEntry->next = NULL;
+    }
+  else 
+    if (verbose >= 1)
+      printf ("adding failed, because list has been finalized\n");
+}
+
+/**
+   \brief Adds 3 entries at once (convenience)
+*/
+void Array::addEntry (GLfloat entry0, GLfloat entry1, GLfloat entry2)
+{
+  addEntry (entry0);
+  addEntry (entry1);
+  addEntry (entry2);
+}
+  
+/**
+   \brief Gives back the array !! MUST be executed AFTER finalize.
+   \returns The created array.
+*/
+GLfloat* Array::getArray ()
+{
+  return array;
+}
+
+/**
+   \returns The Count of entries in the Array
+*/
+int Array::getCount()
+{
+  return entryCount;
+}
+
+/**
+   \brief Simple debug info about the Array
+*/
+void Array::debug ()
+{
+  printf ("entryCount=%i, address=%p\n", entryCount, array);
+}
Index: orxonox/branches/dave/src/array.h
===================================================================
--- orxonox/branches/dave/src/array.h	(revision 2860)
+++ orxonox/branches/dave/src/array.h	(revision 2860)
@@ -0,0 +1,49 @@
+/*!
+  \file array.h
+  \brief Contains the Array Class that handles float arrays.
+  this class creates a Array of a semi-Dynamic length.
+  beware, that after finalizing the array may not be resized again.
+*/
+
+#ifndef _ARRAY_H
+#define _ARRAY_H
+
+extern int verbose; //!< will be obsolete soon
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include <fstream>
+
+
+//! Array Class that handles dynamic-float arrays.
+class Array
+{
+ public:
+  Array ();
+  ~Array();
+
+  void initializeArray ();
+  void finalizeArray (void);
+  void addEntry (GLfloat entry);
+  void addEntry(GLfloat entry0, GLfloat entry1, GLfloat entry2);
+  
+  GLfloat* getArray ();
+  int getCount();
+  void debug(void);
+ private:
+  struct Entry
+  {
+    GLfloat value;
+    Entry* next;
+  };
+
+  GLfloat* array;
+  int entryCount;
+  bool finalized;
+  Entry* firstEntry;
+  Entry* currentEntry;
+  
+  
+};
+
+#endif
Index: orxonox/branches/dave/src/campaign.cc
===================================================================
--- orxonox/branches/dave/src/campaign.cc	(revision 2746)
+++ orxonox/branches/dave/src/campaign.cc	(revision 2860)
@@ -27,5 +27,5 @@
 Campaign::Campaign () 
 {
-  this->entities = new List<StoryEntity>();
+  this->entities = new ListTemplate<StoryEntity>();
   this->isInit = false;
 }
@@ -144,5 +144,5 @@
 StoryEntity* Campaign::getStoryEntity(Uint32 storyID)
 {
-  List<StoryEntity>* l;
+  ListTemplate<StoryEntity>* l;
   StoryEntity* entity;
   l = this->entities->get_next();  
Index: orxonox/branches/dave/src/campaign.h
===================================================================
--- orxonox/branches/dave/src/campaign.h	(revision 2746)
+++ orxonox/branches/dave/src/campaign.h	(revision 2860)
@@ -33,5 +33,5 @@
 
  private:
-  List<StoryEntity>* entities;
+  ListTemplate<StoryEntity>* entities;
   bool running;
 
Index: orxonox/branches/dave/src/command_node.cc
===================================================================
--- orxonox/branches/dave/src/command_node.cc	(revision 2746)
+++ orxonox/branches/dave/src/command_node.cc	(revision 2860)
@@ -11,5 +11,5 @@
    ### File Specific:
    main-programmer: Christian Meyer
-   co-programmer: ...
+   co-programmer: Patrick Boenzli
 */
 
@@ -33,5 +33,5 @@
 CommandNode::CommandNode (int ID)
 {
-  bound = new List<WorldEntity>();
+  bound = new List();
   aliases = NULL;
   netID = ID;
@@ -48,5 +48,5 @@
   bLocalInput = true;
   netID = 0;
-  bound = new List<WorldEntity>();
+  bound = new List();
   load_bindings (filename);
 }
@@ -59,4 +59,10 @@
   if( aliases != NULL) free (aliases);
   if( bound != NULL) delete bound;
+}
+
+
+void CommandNode::reset()
+{
+  this->bound->clear();
 }
 
@@ -123,5 +129,5 @@
 void CommandNode::bind (WorldEntity* entity)
 {
-  bound->add (entity, LIST_ADD_NEXT, true);
+  bound->add (entity);
 }
 
@@ -132,5 +138,5 @@
 void CommandNode::unbind (WorldEntity* entity)
 {
-  bound->remove (entity, LIST_FIND_FW);
+  bound->remove (entity);
 }
 
@@ -214,4 +220,5 @@
 }
 
+
 void CommandNode::process_network ()
 {
@@ -219,8 +226,7 @@
 }
 
+
 void CommandNode::relay (Command* cmd)
 {
-  //printf("CommandNode|relay()\n");
-  List<WorldEntity>* plist = bound;
   
   Orxonox *orx = Orxonox::getInstance();
@@ -231,9 +237,12 @@
   if( bLocalInput) send_over_network (cmd);
   
-  while( (plist = plist->get_next()) != NULL)
-    {
-      plist->get_object()->command (cmd);
-    }
-}
+  WorldEntity* entity = bound->enumerate();
+  while(  entity != NULL)
+    {
+      entity->command (cmd);
+      entity = bound->nextElement();
+    }
+}
+
 
 /**
Index: orxonox/branches/dave/src/command_node.h
===================================================================
--- orxonox/branches/dave/src/command_node.h	(revision 2746)
+++ orxonox/branches/dave/src/command_node.h	(revision 2860)
@@ -19,40 +19,42 @@
 //! Key aliasing structure
 /**
-	This structure contains the key aliasing information, e.g. the command strings that
-	have been bound to the keys.
+   This structure contains the key aliasing information, e.g. the command strings that
+   have been bound to the keys.
 */
 typedef struct
 {
-	char keys[N_STD_KEYS][CMD_LENGHT];
-	char buttons[N_BUTTONS][CMD_LENGHT];
+  char keys[N_STD_KEYS][CMD_LENGHT];
+  char buttons[N_BUTTONS][CMD_LENGHT];
 } KeyBindings;
 
 //! Command Node
 /**
-	This class gathers all incoming SDL_Events and processes them. Keyboard, mouse and joystick input is
-	captured and translated into command messages which are passed down to the bound WorldEntities (via WorldEntity::command()).
-	Other SDL_Events are passed to Orxonox::event_handler() to deal with them. If the CommandNode has been created
-	with bLocalInput set to false, it will query the network class for incoming commands that match his netID and pass
-	them on to it's WorldEntities.
+   This class gathers all incoming SDL_Events and processes them. Keyboard, mouse and joystick input is
+   captured and translated into command messages which are passed down to the bound WorldEntities (via WorldEntity::command()).
+   Other SDL_Events are passed to Orxonox::event_handler() to deal with them. If the CommandNode has been created
+   with bLocalInput set to false, it will query the network class for incoming commands that match his netID and pass
+   them on to it's WorldEntities.
 */
 class CommandNode {
  private:
- 	bool bLocalInput;	//!< Identifies the CommandNode that processes local input
- 	int netID;	//!< Unique identifier that is used to determine between remote CommandNodes
-	KeyBindings* aliases;
-	List<WorldEntity>* bound;	//!< List of WorldEntites that recieve commands from this CommandNode
-	Sint32 coord[2];
-	
-	void relay (Command* cmd);
-	int* name_to_index (char* name);
-	void process_local ();
-	void process_network ();
-	void send_over_network (Command* cmd);
-	
+  bool bLocalInput;	//!< Identifies the CommandNode that processes local input
+  int netID;	//!< Unique identifier that is used to determine between remote CommandNodes
+  KeyBindings* aliases;
+  List* bound;	//!< List of WorldEntites that recieve commands from this CommandNode
+  Sint32 coord[2];
+  
+
+  void relay (Command* cmd);
+  int* name_to_index (char* name);
+  void process_local ();
+  void process_network ();
+  void send_over_network (Command* cmd);
+  
  public:
   CommandNode (int ID);
   CommandNode (char* filename);
   ~CommandNode ();
-  
+
+  void reset();  
   void load_bindings (char* filename);
   void bind (WorldEntity* entity);
Index: orxonox/branches/dave/src/environment.cc
===================================================================
--- orxonox/branches/dave/src/environment.cc	(revision 2746)
+++ orxonox/branches/dave/src/environment.cc	(revision 2860)
@@ -16,11 +16,9 @@
 */
 
-#include <iostream>
-#include <GL/glut.h>
-#include <stdlib.h>
-
-#include "data_tank.h"
 
 #include "environment.h"
+#include "stdincl.h"
+#include "world_entity.h"
+#include "vector.h"
 
 using namespace std;
@@ -30,6 +28,5 @@
 #define LEVEL_LENGTH 500
 
-Environment::Environment () 
-  : WorldEntity()
+Environment::Environment () : WorldEntity()
 {
 
@@ -60,8 +57,48 @@
 Environment::~Environment () {}
 
+void Environment::tick (float time) {}
 
+void Environment::hit (WorldEntity* weapon, Vector loc) {}
+
+void Environment::destroy () {}
+
+void Environment::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
+
+void Environment::draw () 
+{
+  printf("Environment::draw()");
+
+  glMatrixMode(GL_MODELVIEW);
+  glLoadIdentity();
+  float matrix[4][4];
+  
+  glTranslatef(get_placement()->r.x,get_placement()->r.y,get_placement()->r.z);
+  get_placement()->w.matrix (matrix);
+  glMultMatrixf ((float*)matrix);
+
+  glBegin(GL_TRIANGLES);
+  glColor3f(1,1,1);
+  glVertex3f(0,0,0.5);
+  glVertex3f(-0.5,0,-1);
+  glVertex3f(0.5,0,-1);
+  
+  glVertex3f(0,0,0.5);
+  glVertex3f(0,0.5,-1);
+  glVertex3f(0,-0.5,-1);
+  glEnd();
+    
+  glBegin(GL_QUADS);
+  glColor3f(0,0,1);
+  glVertex3f(0.5,0.5,-1);
+  glVertex3f(0.5,-0.5,-1);
+  glVertex3f(-0.5,-0.5,-1);
+  glVertex3f(-0.5,0.5,-1);
+  glEnd();
+}
+
+/*
 void Environment::paint()
 {
-  /*
+  
   glPushMatrix();
   //glScalef(0.5, 0.5, 1.0);
@@ -95,5 +132,5 @@
   
   glPopMatrix();
-  */
+  
 }
 
@@ -103,2 +140,3 @@
 }
 
+*/
Index: orxonox/branches/dave/src/environment.h
===================================================================
--- orxonox/branches/dave/src/environment.h	(revision 2746)
+++ orxonox/branches/dave/src/environment.h	(revision 2860)
@@ -1,12 +1,11 @@
-
-
-
 #ifndef ENVIRONEMENT_H
 #define ENVIRONEMENT_H
 
-
 #include "world_entity.h"
 
-class Environment : public WorldEntity {
+
+class Environment : public WorldEntity 
+{
+  friend class World;
 
  private:
@@ -21,8 +20,10 @@
   ~Environment ();
 
-  void paint(void);
-  void drawEnvironment(void);
-  void setEnvPosition(void);
-  void getEnvPosition(void);
+  
+  virtual void tick (float time);
+  virtual void hit (WorldEntity* weapon, Vector loc);
+  virtual void destroy ();
+  virtual void collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags);
+  virtual void draw ();
 
 };
Index: orxonox/branches/dave/src/list.cc
===================================================================
--- orxonox/branches/dave/src/list.cc	(revision 2860)
+++ orxonox/branches/dave/src/list.cc	(revision 2860)
@@ -0,0 +1,147 @@
+
+
+/* 
+   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::clear()
+{
+  printf("List::clear() - clearing all world objects, releasing mem\n");
+  this->currentEl = this->first;
+  while(this->currentEl != NULL)
+    {
+      listElement* le = this->currentEl->next;
+      delete this->currentEl->curr;
+      delete this->currentEl;
+      this->currentEl = le;
+    }
+  this->first = NULL;
+  this->last = NULL;
+  this->size = 0;
+}
+
+
+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/dave/src/list.h
===================================================================
--- orxonox/branches/dave/src/list.h	(revision 2746)
+++ orxonox/branches/dave/src/list.h	(revision 2860)
@@ -1,300 +1,211 @@
-/* 
-   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_H
 #define LIST_H
 
-#include "stdlib.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};
+//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};
-
-//! A generic doubly linked list
-template<class T> class List 
-{
-  T* object;
-  List<T>* next;
-  List<T>* prev;
-  bool bReference;
-  int size;
+//enum FINDMODE {LIST_FIND_BW, LIST_FIND_FW};
+
+
+
+class WorldEntity;
+
+class List {
+
+ public:
+  List ();
+  ~List ();
+
+  void add(WorldEntity* entity);
+  void remove(WorldEntity* entity);
+  void clear();
+  WorldEntity* firstElement();
+  bool isEmpty();
+  int getSize();
+  WorldEntity* enumerate();
+  WorldEntity* nextElement();
+  WorldEntity* toArray();
+  void debug();
+
+ private:
+  struct listElement
+  {
+    listElement* prev;
+    WorldEntity* curr;
+    listElement* next;
+  };
+  Uint32 size;
+  listElement* first;
+  listElement* last;
+  listElement* currentEl;
+
+
+};
+
+class Iterator
+{
+
+ public:
+  bool hasNext();
+  WorldEntity* next();
+
+ private:
+
+};
+
+
+template<class T> class tList 
+{
+ private:
+  struct listElement
+  {
+    listElement* prev;
+    T* curr;
+    listElement* next;
+  };
+
+  Uint32 size;
+  listElement* first;
+  listElement* last;
+  listElement* currentEl;
   
  public:
-  List (T* obj, List<T>* n, List<T>* p, bool bRef);
-  ~List ();
+  tList ();
+  ~tList ();
   
-  int add (T* obj, ADDMODE mode, bool bRef);
-  T* get_object();
-  List<T>* get_next ();
-  List<T>* get_previous ();
-  List<T>* get_last ();
-  List<T>* get_first ();
-  void set_next (List<T>* ptr);
-  void set_prev (List<T>* ptr);
-  int remove (T* obj, FINDMODE mode);
+
+  void add(WorldEntity* entity);
+  void remove(WorldEntity* entity);
+  void clear();
+  T* firstElement();
+  bool isEmpty();
   int getSize();
+  T* enumerate();
+  T* nextElement();
+  T* toArray();
+  void debug();
 };
 
 
-/**
-  \brief Standard constructor
-  
-  Call this without any parameters to generate a new List which can be filled with content.
-  DO NOT create a List 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>
-List<T>::List (T* obj = NULL, List<T>* n = NULL, List<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 List element to remove the whole List from the memory.
-  You can safely do this to any List element you want without messing up the rest of the List, but keep in mind
-  that the contained object will be deleted as well when bRef had been set to false.
-*/
-template<class T>
-List<T>::~List ()
-{
-  if (object == NULL) // deleted foot node => disband the list
-  {
-    while( next != NULL)
+template<class T>
+tList<T>::tList () 
+{
+  this->first = NULL;
+  this->last = NULL;
+  this->size = 0;
+}
+
+template<class T>
+tList<T>::~tList () 
+{}
+
+template<class T>
+void tList<T>::add(WorldEntity* entity)
+{
+  printf("tList<T>::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++;
+}
+
+
+template<class T>
+void tList<T>::remove(WorldEntity* entity)
+{
+  this->currentEl = this->first;
+  listElement* te;
+  while( this->currentEl != NULL)
     {
-      delete next;
+      if( this->currentEl->curr == entity)
+	{
+	  printf("tList<T>::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;
     }
-    while( prev != NULL)
+}
+
+
+template<class T>
+void tList<T>::clear()
+{
+  printf("tList<T>::clear() - clearing all world objects, releasing mem\n");
+  this->currentEl = this->first;
+  while(this->currentEl != NULL)
     {
-      delete prev;
+      listElement* le = this->currentEl->next;
+      delete this->currentEl->curr;
+      delete this->currentEl;
+      this->currentEl = le;
     }
-  }
-  else
-  {
-    if (prev != NULL) prev->set_next (next);
-    if (next != NULL) next->set_prev (prev);
-    if (!bReference) delete object;
-  }
-}
- 
-/**
-  \brief Add an object to the List
-  \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 List 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 List 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 List can be used for temporary listings as
-  well as permanent data storage.
-*/
-template<class T> 
-int List<T>::add (T* obj, ADDMODE mode = LIST_ADD_NEXT, bool bRef = false)
-{
-  List<T>* p;
-  if( obj == NULL) return -1;
-  switch (mode)
-  {
-    case LIST_ADD_NEXT:
-      p = new List<T>( obj, next, this, bRef);
-      if( next != NULL) next->set_prev (p);
-      next = p;
-      break;
-    case LIST_ADD_PREV:
-      p = new List<T>( obj, this, prev, bRef);
-      if( prev != NULL) prev->set_next (p);
-      prev = p;
-      break;
-    case LIST_ADD_FIRST:
-      if (prev == NULL) prev = new List<T> (obj, this, NULL, bRef);
-      else return prev->add (obj, mode, bRef);
-      break;
-    case LIST_ADD_LAST:
-      if (next == NULL) next = new List<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 List
-  \return The List element after the current List element
-*/
-template<class T>
-List<T>* List<T>::get_next ()
-{
-  return next;
-}
- 
-/**
-  \brief Get the previous element of the List
-  \return The List element before the current List element
-*/
-template<class T>
-List<T>* List<T>::get_previous ()
-{
-  return prev;
-}
-
-/**
-  \brief Get the last element of the List
-  \return The last List element
-*/
-template<class T>
-List<T>* List<T>::get_last ()
-{
-  if (next == NULL) return this;
-  else return next->get_last();
-}
-
-/**
-  \brief Get the first element of the List
-  \return The first List element
-*/
-template<class T>
-List<T>* List<T>::get_first ()
-{
-  if (prev == NULL) return this;
-  else return prev->get_first();
-}
-
-/**
-  \brief Removes a certain element from the List
-  \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 List specified with mode for the object in question.
-  When the object is found it is deleted and the List 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 List element is NOT deleted when bRef was set to true.
-*/
-template<class T>
-int List<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->get_object() == obj)
-          {
-            delete prev;
-          }
-          else
-          {
-            return prev->remove( obj, mode);
-          }
-        }
-        break;
-      case LIST_FIND_FW:
-        if (next == NULL) return -1;
-        else
-        {
-          if( next->get_object() == obj)
-          {
-            delete next;
-          }
-          else
-          {
-            return next->remove( obj, mode);
-          }
-        }
-        break;
-      default:
-        return -1;
-    }
-  }
-  --size;
-  return 0;
-}
-
-/**
-  \brief Set the next element of a List element
-  \param ptr: A pointer to the new next element
-    
-  Sets the next element of a List element... Better not touch this, it can really mess up a List.
-*/
-template<class T>
-void List<T>::set_next (List<T>* ptr)
-{
-  next = ptr;
-}
-
-/**
-  \brief Set the prev element of a List element
-  \param ptr: A pointer to the new previous element
-    
-  Sets the previous element of a List element... Better not touch this, it can really mess up a List.
-*/
-template<class T>
-void List<T>::set_prev (List<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* List<T>::get_object()
-{
-  return object;
-}
-
-
-/**
-  \brief Returns the current size of the List
-  \return Size of List
-*/
-template<class T>
-int List<T>::getSize()
+  this->first = NULL;
+  this->last = NULL;
+  this->size = 0;
+}
+
+
+template<class T>
+T* tList<T>::firstElement()
+{
+  return this->first->curr;
+}
+
+
+template<class T>
+bool tList<T>::isEmpty()
+{
+  return (this->size==0)?true:false;
+}
+
+
+template<class T>
+int tList<T>::getSize()
 {
   return this->size;
 }
 
+
+template<class T>
+T* tList<T>::enumerate()
+{
+  if(this->size == 0) return NULL;
+  this->currentEl = this->first;
+  return this->currentEl->curr;
+}
+
+
+template<class T>
+T* tList<T>::nextElement()
+{
+  if(this->size == 0) return NULL;
+  this->currentEl = this->currentEl->next;
+  if(this->currentEl == NULL) return NULL;
+  return this->currentEl->curr;
+}
+
+
+template<class T>
+T* tList<T>::toArray()
+{}
+
 #endif
-
Index: orxonox/branches/dave/src/list_template.h
===================================================================
--- orxonox/branches/dave/src/list_template.h	(revision 2860)
+++ orxonox/branches/dave/src/list_template.h	(revision 2860)
@@ -0,0 +1,300 @@
+/* 
+   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* get_object();
+  ListTemplate<T>* get_next ();
+  ListTemplate<T>* get_previous ();
+  ListTemplate<T>* get_last ();
+  ListTemplate<T>* get_first ();
+  void set_next (ListTemplate<T>* ptr);
+  void set_prev (ListTemplate<T>* ptr);
+  int remove (T* obj, FINDMODE mode);
+  int getSize();
+};
+
+
+/**
+  \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->set_next (next);
+    if (next != NULL) next->set_prev (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->set_prev (p);
+      next = p;
+      break;
+    case LIST_ADD_PREV:
+      p = new ListTemplate<T>( obj, this, prev, bRef);
+      if( prev != NULL) prev->set_next (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>::get_next ()
+{
+  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>::get_previous ()
+{
+  return prev;
+}
+
+/**
+  \brief Get the last element of the ListTemplate
+  \return The last ListTemplate element
+*/
+template<class T>
+ListTemplate<T>* ListTemplate<T>::get_last ()
+{
+  if (next == NULL) return this;
+  else return next->get_last();
+}
+
+/**
+  \brief Get the first element of the ListTemplate
+  \return The first ListTemplate element
+*/
+template<class T>
+ListTemplate<T>* ListTemplate<T>::get_first ()
+{
+  if (prev == NULL) return this;
+  else return prev->get_first();
+}
+
+/**
+  \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->get_object() == obj)
+          {
+            delete prev;
+          }
+          else
+          {
+            return prev->remove( obj, mode);
+          }
+        }
+        break;
+      case LIST_FIND_FW:
+        if (next == NULL) return -1;
+        else
+        {
+          if( next->get_object() == 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>::set_next (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>::set_prev (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>::get_object()
+{
+  return object;
+}
+
+
+/**
+  \brief Returns the current size of the ListTemplate
+  \return Size of ListTemplate
+*/
+template<class T>
+int ListTemplate<T>::getSize()
+{
+  return this->size;
+}
+
+#endif
+
Index: orxonox/branches/dave/src/material.cc
===================================================================
--- orxonox/branches/dave/src/material.cc	(revision 2860)
+++ orxonox/branches/dave/src/material.cc	(revision 2860)
@@ -0,0 +1,293 @@
+/* 
+   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: ...
+*/
+
+#include "material.h"
+
+/**
+   \brief creates a default Material with no Name
+   normally you call this to create a material List (for an obj-file) and then append with addMaterial()
+*/
+Material::Material()
+{
+  init();
+  
+  setName ("");
+}
+
+/**
+   \brief creates a Material.
+   \param mtlName Name of the Material to be added to the Material List
+*/
+Material::Material (char* mtlName)
+{
+  init();
+  
+  setName (mtlName);
+}
+
+/** 
+    \brief deletes a Material
+*/
+Material::~Material()
+{
+  if (verbose >= 2)
+    printf ("delete Material %s\n", name);
+  if (nextMat != NULL)
+    delete 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)
+{
+  if (verbose >=2)
+    printf ("adding Material %s\n", mtlName);
+  Material* newMat = new Material(mtlName);
+  Material* tmpMat = this;
+  while (tmpMat->nextMat != NULL)
+    {
+      tmpMat = tmpMat->nextMat;
+    }
+      tmpMat->nextMat = newMat;
+      return newMat;
+  
+}
+
+/**
+   \brief initializes a new Material with its default Values
+*/
+void Material::init(void)
+{
+  if (verbose >= 3)
+    printf ("initializing new Material\n");
+  nextMat = NULL;
+
+  setIllum(1);
+  setDiffuse(0,0,0);
+  setAmbient(0,0,0);
+  setSpecular(0,0,0);
+  setShininess(2.0);
+  setTransparency(0.0);
+  
+}
+
+/**
+   \brief Set the Name of the Material. (Important for searching)
+   \param mtlName the Name of the Material to be set.
+*/ 
+void Material::setName (char* mtlName)
+{
+  if (verbose >= 3)
+    printf("setting Material Name to %s", mtlName);
+  strcpy(name, mtlName);
+  //  printf ("adding new Material: %s, %p\n", this->getName(), this);
+
+}
+/**
+   \returns The Name of The Material
+*/
+char* Material::getName (void)
+{
+  return name;
+}
+
+/**
+   \brief Sets the Material Illumination Model. 
+   \brief illu illumination Model in int form
+*/
+void Material::setIllum (int illum)
+{
+  if (verbose >= 3)
+    printf("setting illumModel of Material %s to %i", name, illum);
+  illumModel = illum;
+  //  printf ("setting illumModel to: %i\n", illumModel);
+}
+/**
+   \brief Sets the Material Illumination Model. 
+   \brief illu illumination Model in char* form
+*/void Material::setIllum (char* illum)
+{
+  setIllum (atoi(illum));
+}
+
+/**
+   \brief Sets the Material Diffuse Color.
+   \param r Red Color Channel.
+   \param g Green Color Channel.
+   \param b Blue Color Channel.
+*/
+void Material::setDiffuse (float r, float g, float b)
+{
+  if (verbose >= 3)
+    printf ("setting Diffuse Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
+  diffuse[0] = r;
+  diffuse[1] = g;
+  diffuse[2] = b;  
+  diffuse[3] = 1.0;
+
+}
+/**
+   \brief Sets the Material Diffuse Color.
+   \param rgb The red, green, blue channel in char format (with spaces between them)
+*/
+void Material::setDiffuse (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setDiffuse (atof(r), atof(g), atof(b));
+}
+
+/**
+   \brief Sets the Material Ambient Color. 
+   \param r Red Color Channel.
+   \param g Green Color Channel.
+   \param b Blue Color Channel.
+*/
+void Material::setAmbient (float r, float g, float b)
+{
+  if (verbose >=3)
+    printf ("setting Ambient Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
+  ambient[0] = r;
+  ambient[1] = g;
+  ambient[2] = b;
+  ambient[3] = 1.0;
+}
+/**
+   \brief Sets the Material Ambient Color.
+   \param rgb The red, green, blue channel in char format (with spaces between them)
+*/
+void Material::setAmbient (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setAmbient (atof(r), atof(g), atof(b));
+}
+
+/**
+   \brief Sets the Material Specular Color. 
+   \param r Red Color Channel.
+   \param g Green Color Channel.
+   \param b Blue Color Channel.
+*/
+void Material::setSpecular (float r, float g, float b)
+{
+  if (verbose >= 3)
+    printf ("setting Specular Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
+  specular[0] = r;
+  specular[1] = g;
+  specular[2] = b;
+  specular[3] = 1.0;
+ }
+/**
+   \brief Sets the Material Specular Color.
+   \param rgb The red, green, blue channel in char format (with spaces between them)
+*/
+void Material::setSpecular (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setSpecular (atof(r), atof(g), atof(b));
+}
+
+/**
+   \brief Sets the Material Shininess.
+   \param shini stes the Shininess from float.
+*/
+void Material::setShininess (float shini)
+{
+  shininess = shini;
+}
+/**
+   \brief Sets the Material Shininess.
+   \param shini stes the Shininess from char*.
+*/
+void Material::setShininess (char* shini)
+{
+  setShininess (atof(shini));
+}
+
+/**
+   \brief Sets the Material Transparency.
+   \param trans stes the Transparency from int.
+*/
+void Material::setTransparency (float trans)
+{
+  if (verbose >= 3)
+    printf ("setting Transparency of Material %s to %f\n", name, trans);
+  transparency = trans;
+}
+/**
+   \brief Sets the Material Transparency.
+   \param trans stes the Transparency from char*.
+*/
+void Material::setTransparency (char* trans)
+{
+  char tr[20];
+  sscanf (trans, "%s", tr);
+  setTransparency (atof(tr));
+}
+
+/**
+   \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)
+{
+  if (verbose >=3)
+    printf ("Searching for material %s", mtlName);
+  Material* searcher = this;
+  while (searcher != NULL)
+    {
+      if (verbose >= 3)
+	printf (".");
+      if (!strcmp (searcher->getName(), mtlName))
+	{
+	  if (verbose >= 3)
+	    printf ("found.\n");
+	  return searcher;
+	}
+      searcher = searcher->nextMat;
+    }
+  return NULL;
+}
+
+/**
+   \brief sets the material with which the following Faces will be painted
+*/
+bool Material::select (void)
+{
+  // setting diffuse color
+  //  glColor3f (diffuse[0], diffuse[1], diffuse[2]);
+  glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse);
+
+  // setting ambient color
+  glMaterialfv(GL_FRONT, GL_AMBIENT, ambient);
+
+  // setting up Sprecular
+  glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
+
+  // setting up Shininess
+  glMaterialf(GL_FRONT, GL_SHININESS, shininess);
+  
+  // setting illumination Model 
+  if (illumModel == 1)
+    glShadeModel(GL_FLAT);
+  else if (illumModel >= 2)
+    glShadeModel(GL_SMOOTH);
+}
Index: orxonox/branches/dave/src/material.h
===================================================================
--- orxonox/branches/dave/src/material.h	(revision 2860)
+++ orxonox/branches/dave/src/material.h	(revision 2860)
@@ -0,0 +1,59 @@
+/*!
+  \file material.h
+  \brief Contains the Material Class that handles Material for 3D-Objects.
+*/
+
+#ifndef _MATERIAL_H
+#define _MATERIAL_H
+
+extern int verbose; //!< will be obsolete soon.
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include <stdlib.h>
+#include <fstream>
+
+//! Class to handle Materials.
+class Material
+{
+ public:
+  Material ();
+  Material (char* mtlName);
+  Material* addMaterial(char* mtlName);
+
+  void init(void);
+  ~Material ();
+
+
+  void setName (char* mtlName);
+  char* getName (void);
+  void setIllum (int illum);
+  void setIllum (char* illum);
+  void setDiffuse (float r, float g, float b);
+  void setDiffuse (char* rgb);
+  void setAmbient (float r, float g, float b);
+  void setAmbient (char* rgb);
+  void setSpecular (float r, float g, float b);
+  void setSpecular (char* rgb);
+  void setShininess (float shini);
+  void setShininess (char* shini);
+  void setTransparency (float trans);
+  void setTransparency (char* trans);
+
+  Material* search (char* mtlName);
+
+  bool select (void);
+
+  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
+
+ private:
+  char name [50];
+  int illumModel;
+  float diffuse [4];
+  float ambient [4];
+  float specular [4];
+  float shininess;
+  float transparency;
+
+};
+#endif
Index: orxonox/branches/dave/src/object.cc
===================================================================
--- orxonox/branches/dave/src/object.cc	(revision 2860)
+++ orxonox/branches/dave/src/object.cc	(revision 2860)
@@ -0,0 +1,665 @@
+/* 
+   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: ...
+*/
+
+int verbose = 0;
+
+#include "object.h"
+
+/**
+   \brief Creates a 3D-Object, but does not load any 3D-models
+   pretty useless
+*/
+Object::Object ()
+{
+
+  initialize();
+
+  BoxObject();
+
+  finalize();
+}
+
+/**
+   \brief Crates a 3D-Object and loads in a File
+   \param fileName file to parse and load (must be a .obj file)
+*/
+Object::Object(char* fileName)
+{
+  initialize();
+
+  importFile (fileName);
+
+  finalize();
+}
+
+/**
+   \brief Crates a 3D-Object, loads in a File and scales it.
+   \param fileName file to parse and load (must be a .obj file)
+   \param scaling The factor that the object will be scaled with.
+*/
+
+Object::Object(char* fileName, float scaling)
+{
+  initialize();
+  scaleFactor = scaling;
+
+  importFile (fileName);
+
+  finalize();
+}
+
+/**
+   \brief deletes an Object
+*/
+Object::~Object()
+{
+  if (verbose >= 2)
+    printf ("Deleting display List.\n");
+  Group* walker = firstGroup;
+  while (walker != NULL)
+    {
+      glDeleteLists (walker->listNumber, 1);
+      Group* lastWalker = walker;
+      walker = walker->nextGroup;
+      delete lastWalker;
+    } 
+}
+
+/** 
+    \brief initializes the Object
+    This Function initializes all the needed arrays, Lists and clientStates
+*/
+bool Object::initialize (void)
+{
+  if (verbose >=3)
+    printf("new 3D-Object is being created\n"); 
+
+  // setting the start group;
+  firstGroup = new Group;
+  currentGroup = firstGroup;
+  groupCount = 0;
+  
+  initGroup (currentGroup);
+  mtlFileName = "";
+  scaleFactor = 1;
+  material = new Material();
+
+  glEnableClientState (GL_VERTEX_ARRAY);
+  //  glEnableClientState (GL_NORMAL_ARRAY);
+  //  glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+
+
+  return true;
+}
+
+/**
+   \brief Imports a obj file and handles the the relative location
+   \param fileName The file to import
+*/
+bool Object::importFile (char* fileName)
+{
+  if (verbose >=3)
+    printf("preparing to read in file: %s\n", fileName);   
+  objFileName = fileName;
+  this->readFromObjFile (objFileName);
+  return true;
+}
+
+/**
+   \brief finalizes an Object.
+   This funcion is needed, to close the glList and all the other lists.
+*/
+bool Object::finalize(void)
+{
+  //  if (verbose >=3)
+    printf("finalizing the 3D-Object\n"); 
+  finalizeGroup (currentGroup);
+  if (material != NULL)
+    delete material;
+  return true;
+}
+
+/**
+   \brief Draws the Objects of all Groups.
+   It does this by just calling the Lists that must have been created earlier.
+*/
+void Object::draw (void)
+{
+  if (verbose >=2)
+    printf("drawing the 3D-Objects\n"); 
+  Group* walker = firstGroup;
+  while (walker != NULL)
+    {
+      if (verbose >= 3)
+	printf ("Drawing object %s\n", walker->name);
+      glCallList (walker->listNumber);
+      walker = walker->nextGroup;
+    }
+}
+
+/**
+   \brief Draws the Object number groupNumber
+   It does this by just calling the List that must have been created earlier.
+   \param groupNumber The number of the group that will be displayed.
+*/
+void Object::draw (int groupNumber)
+{
+  if (groupNumber >= groupCount)
+    {
+      if (verbose>=2)
+	printf ("You requested object number %i, but this File only contains of %i Objects.\n", groupNumber-1, groupCount);
+      return;
+    }
+  if (verbose >=2)
+    printf("drawing the requested 3D-Objects if found.\n"); 
+  Group* walker = firstGroup;
+  int counter = 0;
+  while (walker != NULL)
+    {
+      if (counter == groupNumber)
+	{
+	  if (verbose >= 2)
+	    printf ("Drawing object number %s named %s\n", counter, walker->name);
+	  glCallList (walker->listNumber);
+	  return;
+	}
+      ++counter;
+      walker = walker->nextGroup;
+    }
+  if (verbose >= 2)
+    printf("Object number %i in %s not Found.\n", groupNumber, objFileName);
+  return;
+
+}
+
+/**
+   \brief Draws the Object with a specific groupname
+   It does this by just calling the List that must have been created earlier.
+   \param groupName The name of the group that will be displayed.
+*/
+void Object::draw (char* groupName)
+{
+  if (verbose >=2)
+    printf("drawing the requested 3D-Objects if found.\n"); 
+  Group* walker = firstGroup;
+  while (walker != NULL)
+    {
+      if (!strcmp(walker->name, groupName))
+	{
+	  if (verbose >= 2)
+	    printf ("Drawing object %s\n", walker->name);
+	  glCallList (walker->listNumber);
+	  return;
+	}
+      walker = walker->nextGroup;
+    }
+  if (verbose >= 2)
+    printf("Object Named %s in %s not Found.\n", groupName, objFileName);
+  return;
+}
+
+/**
+   \returns Count of the Objects in this File
+*/
+int Object::getGroupCount (void)
+{
+  return groupCount;
+}
+
+/**
+   \brief initializes a new Group object
+*/
+bool Object::initGroup(Group* group)
+{
+  if (verbose >= 2)
+    printf("Adding new Group\n");
+  group->faceMode = -1;
+  group->name = "";
+  if ((group->listNumber = glGenLists(1)) == 0 )
+    {
+      printf ("list could not be created for this Object\n");
+      return false;
+    }
+  
+  if (groupCount == 0)
+    {
+      group->firstVertex = 0;
+      group->firstNormal = 0;
+      group->firstNormal = 0;
+    }
+  else
+    {
+      group->firstVertex = currentGroup->firstVertex + currentGroup->vertices->getCount()/3;
+      group->firstNormal = currentGroup->firstNormal + currentGroup->normals->getCount()/3;
+      group->firstVertexTexture = currentGroup->firstVertexTexture + currentGroup->vTexture->getCount()/2;
+    }
+
+  group->vertices = new Array();
+  group->normals = new Array();
+  group->vTexture = new Array();
+
+  glNewList (group->listNumber, GL_COMPILE);
+}
+
+/**
+   \brief finalizes a Group.
+*/
+bool Object::finalizeGroup(Group* group)
+{
+  glEnd();
+  glEndList();
+  
+  delete group->vertices;
+  delete group->normals;
+  delete group->vTexture;
+}
+/**
+   \brief Reads in the .obj File and sets all the Values.
+   This function does read the file, parses it for the occurence of things like vertices, faces and so on, and executes the specific tasks
+   \param fileName the File that will be parsed (.obj-file)
+*/
+bool Object::readFromObjFile (char* fileName)
+{
+  OBJ_FILE = new ifstream(fileName);
+  if (!OBJ_FILE->is_open())
+    {
+      if (verbose >=1)
+	printf ("unable to open .OBJ file: %s\n Loading Box Object instead.\n", fileName);
+      BoxObject();
+      return false;
+    }
+  objFileName = fileName;
+  char Buffer[500];
+  while(!OBJ_FILE->eof())
+    {
+      OBJ_FILE->getline(Buffer, 500);
+      if (verbose >=4)
+	printf ("Read input line: %s\n",Buffer);
+      
+
+      // case vertice
+      if (!strncmp(Buffer, "v ", 2))
+	{
+	  readVertex(Buffer+2);
+	}
+
+      // case face
+      else if (!strncmp(Buffer, "f ", 2))
+	{
+	  readFace (Buffer+2);
+	}
+      
+      else if (!strncmp(Buffer, "mtllib", 6))
+	{
+	  readMtlLib (Buffer+7);
+	}
+
+      else if (!strncmp(Buffer, "usemtl", 6))
+	{
+	  readUseMtl (Buffer+7);
+	}
+
+      // case VertexNormal
+      else if (!strncmp(Buffer, "vn ", 2))
+      {
+	readVertexNormal(Buffer+3);
+      }
+
+      // case VertexTextureCoordinate
+      else if (!strncmp(Buffer, "vt ", 2))
+      {
+	readVertexTexture(Buffer+3);
+      }
+      // case group
+      else if (!strncmp(Buffer, "g", 1))
+	{
+	  readGroup (Buffer+2);
+	}
+    }
+  OBJ_FILE->close();
+
+}
+
+/**
+   \brief parses a vertex-String
+   If a vertex line is found this function will inject it into the vertex-Array
+   \param vertexString The String that will be parsed.
+*/
+bool Object::readVertex (char* vertexString)
+{
+  readingVertices = true;
+  char subbuffer1[20];
+  char subbuffer2[20];
+  char subbuffer3[20];
+  sscanf (vertexString, "%s %s %s", subbuffer1, subbuffer2, subbuffer3);
+  if (verbose >= 3)
+    printf ("reading in a vertex: %s %s %s\n", subbuffer1, subbuffer2, subbuffer3);
+  currentGroup->vertices->addEntry(atof(subbuffer1)*scaleFactor, atof(subbuffer2)*scaleFactor, atof(subbuffer3)*scaleFactor);
+  return true;
+}
+
+/**
+   \brief parses a face-string
+   If a face line is found this function will add it to the glList.
+   The function makes a difference between QUADS and TRIANGLES, and will if changed re-open, set and re-close the gl-processe.
+   \param faceString The String that will be parsed.
+*/
+bool Object::readFace (char* faceString)
+{
+  // finalize the Arrays;
+  if (readingVertices == true)
+    {
+      currentGroup->vertices->finalizeArray();
+      glVertexPointer(3, GL_FLOAT, 0, currentGroup->vertices->getArray());
+      currentGroup->normals->finalizeArray();
+      glNormalPointer(GL_FLOAT, 0, currentGroup->normals->getArray());
+      currentGroup->vTexture->finalizeArray();
+    }
+
+  readingVertices = false;
+  char subbuffer1[20];
+  char subbuffer2[20];
+  char subbuffer3[20];
+  char subbuffer4[20] ="";
+  sscanf (faceString, "%s %s %s %s", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
+  if (!strcmp(subbuffer4, ""))
+    {
+      if (currentGroup->faceMode != 3)
+	{
+	  if (currentGroup->faceMode != -1)
+	    glEnd();
+	  glBegin(GL_TRIANGLES);
+	}
+      
+      currentGroup->faceMode = 3;
+      if (verbose >=3)
+	printf ("found triag: %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3);
+      addGLElement(subbuffer1);
+      addGLElement(subbuffer2);
+      addGLElement(subbuffer3);
+      return true;
+    }
+  else
+    {
+      if (currentGroup->faceMode != 4)
+	{
+	  if (currentGroup->faceMode != -1)
+	    glEnd();
+	  glBegin(GL_QUADS);
+	}
+      currentGroup->faceMode = 4;
+      if (verbose >=3 )
+	printf ("found quad: %s, %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
+      addGLElement(subbuffer1);
+      addGLElement(subbuffer2);
+      addGLElement(subbuffer3);
+      addGLElement(subbuffer4);
+      return true;
+    }
+}
+
+/**
+   \brief Adds a Face-element (one vertex of a face) with all its information. 
+   It does this by searching:
+   1. The Vertex itself
+   2. The VertexNormale
+   3. The VertexTextureCoordinate
+   merging this information, the face will be drawn.
+
+*/
+bool Object::addGLElement (char* elementString)
+{
+  if (verbose >=3)
+    printf ("importing grafical Element.... including to openGL\n");
+  char* vertex = elementString;
+
+  char* texture;
+  texture = strstr (vertex, "/");
+  texture[0] = '\0';
+  texture ++;
+  glTexCoord2fv(currentGroup->vTexture->getArray()+(atoi(texture)-1 - currentGroup->firstVertexTexture)*2);
+
+  char* normal;
+  if ((normal = strstr (texture, "/")) !=NULL)
+    {
+      normal[0] = '\0';
+      normal ++;
+      //glArrayElement(atoi(vertex)-1);
+      glNormal3fv(currentGroup->normals->getArray() +(atoi(normal)-1 - currentGroup->firstNormal)*3);
+    }
+  glVertex3fv(currentGroup->vertices->getArray() +(atoi(vertex)-1 - currentGroup->firstVertex)*3);
+
+}
+
+/**
+   \brief parses a vertexNormal-String
+   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
+   \param normalString The String that will be parsed.
+*/
+bool Object::readVertexNormal (char* normalString)
+{
+  readingVertices = true;
+  char subbuffer1[20];
+  char subbuffer2[20];
+  char subbuffer3[20];
+  sscanf (normalString, "%s %s %s", subbuffer1, subbuffer2, subbuffer3);
+  if (verbose >=3 )
+    printf("found vertex-Normal %s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3);
+  currentGroup->normals->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3));
+  return true;
+}
+
+/**
+   \brief parses a vertexTextureCoordinate-String
+   If a vertexTextureCoordinate line is found this function will inject it into the vertexTexture-Array
+   \param vTextureString The String that will be parsed.
+*/
+bool Object::readVertexTexture (char* vTextureString)
+{
+  readingVertices = true;
+  char subbuffer1[20];
+  char subbuffer2[20];
+  sscanf (vTextureString, "%s %s", subbuffer1, subbuffer2);
+  if (verbose >=3 )
+    printf("found vertex-Texture %s, %s\n", subbuffer1,subbuffer2);
+  currentGroup->vTexture->addEntry(atof(subbuffer1));
+  currentGroup->vTexture->addEntry(atof(subbuffer2));
+  return true;
+}
+
+/**
+   \brief parses a group String
+   This function initializes a new Group. 
+   With it you should be able to import .obj-files with more than one Objects inside. 
+   \param groupString the new Group to create
+*/
+bool Object::readGroup (char* groupString)
+{
+  //  printf ("test\n");
+  if (!strcmp(groupString, "default"))
+    {
+      if (groupCount != 0)
+	{
+	  Group* newGroup = new Group;
+	  finalizeGroup(currentGroup);
+	  currentGroup->nextGroup = newGroup;
+	  initGroup(newGroup);
+	  currentGroup = newGroup; // must be after init see initGroup for more info
+	}
+      ++groupCount;
+    }
+  else
+    {
+      
+      currentGroup->name = new char [strlen(groupString)];      
+      strcpy(currentGroup->name, groupString);
+    }
+}
+
+/** 
+    \brief Function to read in a mtl File.
+    this Function parses all Lines of an mtl File
+    \param mtlFile The .mtl file to read
+*/
+bool Object::readMtlLib (char* mtlFile)
+{
+  MTL_FILE = new ifstream (mtlFile);
+  if (!MTL_FILE->is_open())
+    {
+      if (verbose >= 1)
+	printf ("unable to open file: %s\n", mtlFile);
+      return false;
+    }
+  mtlFileName = mtlFile;
+  if (verbose >=2)
+    printf ("Opening mtlFile: %s\n", mtlFileName);
+  char Buffer[500];
+  Material* tmpMat = material;
+  while(!MTL_FILE->eof())
+    {
+      MTL_FILE->getline(Buffer, 500);
+      if (verbose >= 4)
+	printf("found line in mtlFile: %s\n", Buffer);
+      
+
+      // create new Material
+      if (!strncmp(Buffer, "newmtl ", 2))
+	{
+	  tmpMat = tmpMat->addMaterial(Buffer+7);
+	  //	  printf ("%s, %p\n", tmpMat->getName(), tmpMat);
+	}
+      // setting a illumMode
+      else if (!strncmp(Buffer, "illum", 5))
+	{
+	  tmpMat->setIllum(Buffer+6);
+
+	}
+      // setting Diffuse Color
+      else if (!strncmp(Buffer, "Kd", 2))
+	{
+	  tmpMat->setDiffuse(Buffer+3);
+	}
+      // setting Ambient Color
+      else if (!strncmp(Buffer, "Ka", 2))
+	{
+	  tmpMat->setAmbient(Buffer+3);
+	}
+      // setting Specular Color
+      else if (!strncmp(Buffer, "Ks", 2))
+	{
+	  tmpMat->setSpecular(Buffer+3);
+	}
+      // setting The Specular Shininess
+      else if (!strncmp(Buffer, "Ns", 2))
+	{
+	  tmpMat->setShininess(Buffer+3);
+	}
+      // setting up transparency
+      else if (!strncmp(Buffer, "d", 1))
+	{
+	  tmpMat->setTransparency(Buffer+2);
+	}
+      else if (!strncpy(Buffer, "Tf", 2))
+	{
+	  tmpMat->setTransparency(Buffer+3);
+	}
+
+    }
+  return true;
+}
+
+/**
+   \brief Function that selects a material, if changed in the obj file.
+   \param matString the Material that will be set.
+*/
+
+bool Object::readUseMtl (char* matString)
+{
+  if (!strcmp (mtlFileName, ""))
+    {
+      if (verbose >= 1)
+	printf ("Not using new defined material, because no mtlFile found yet\n");
+      return false;
+    }
+      
+  if (currentGroup->faceMode != -1)
+    glEnd();
+  currentGroup->faceMode = 0;
+  if (verbose >= 2)
+    printf ("using material %s for coming Faces.\n", matString);
+  material->search(matString)->select();
+}
+
+/**
+   \brief Includes a default object
+   This will inject a Cube, because this is the most basic object.
+*/
+void Object::BoxObject(void)
+{
+  readVertex ("-0.500000 -0.500000 0.500000");
+  readVertex ("0.500000 -0.500000 0.500000");
+  readVertex ("-0.500000 0.500000 0.500000");
+  readVertex ("0.500000 0.500000 0.500000");
+  readVertex ("-0.500000 0.500000 -0.500000");
+  readVertex ("0.500000 0.500000 -0.500000");
+  readVertex ("-0.500000 -0.500000 -0.500000");
+  readVertex ("0.500000 -0.500000 -0.500000");
+  readVertexTexture ("0.000000 0.000000");
+  readVertexTexture ("1.000000 0.000000");
+  readVertexTexture ("0.000000 1.000000");
+  readVertexTexture ("1.000000 1.000000");
+  readVertexTexture ("0.000000 2.000000");
+  readVertexTexture ("1.000000 2.000000");
+  readVertexTexture ("0.000000 3.000000");
+  readVertexTexture ("1.000000 3.000000");
+  readVertexTexture ("0.000000 4.000000");
+  readVertexTexture ("1.000000 4.000000");
+  readVertexTexture ("2.000000 0.000000");
+  readVertexTexture ("2.000000 1.000000");
+  readVertexTexture ("-1.000000 0.000000");
+  readVertexTexture ("-1.000000 1.000000");
+  
+  readVertexNormal ("0.000000 0.000000 1.000000");
+  readVertexNormal ("0.000000 0.000000 1.000000");
+  readVertexNormal ("0.000000 0.000000 1.000000");
+  readVertexNormal ("0.000000 0.000000 1.000000");
+  readVertexNormal ("0.000000 1.000000 0.000000");
+  readVertexNormal ("0.000000 1.000000 0.000000");
+  readVertexNormal ("0.000000 1.000000 0.000000");
+  readVertexNormal ("0.000000 1.000000 0.000000");
+  readVertexNormal ("0.000000 0.000000 -1.000000");
+  readVertexNormal ("0.000000 0.000000 -1.000000");
+  readVertexNormal ("0.000000 0.000000 -1.000000");
+  readVertexNormal ("0.000000 0.000000 -1.000000");
+  readVertexNormal ("0.000000 -1.000000 0.000000");
+  readVertexNormal ("0.000000 -1.000000 0.000000");
+  readVertexNormal ("0.000000 -1.000000 0.000000");
+  readVertexNormal ("0.000000 -1.000000 0.000000");
+  readVertexNormal ("1.000000 0.000000 0.000000");
+  readVertexNormal ("1.000000 0.000000 0.000000");
+  readVertexNormal ("1.000000 0.000000 0.000000");
+  readVertexNormal ("1.000000 0.000000 0.000000");
+  readVertexNormal ("-1.000000 0.000000 0.000000");
+  readVertexNormal ("-1.000000 0.000000 0.000000");
+  readVertexNormal ("-1.000000 0.000000 0.000000");
+  readVertexNormal ("-1.000000 0.000000 0.000000");
+
+  readFace ("1/1/1 2/2/2 4/4/3 3/3/4");
+  readFace ("3/3/5 4/4/6 6/6/7 5/5/8");
+  readFace ("5/5/9 6/6/10 8/8/11 7/7/12");
+  readFace ("7/7/13 8/8/14 2/10/15 1/9/16");
+  readFace ("2/2/17 8/11/18 6/12/19 4/4/20");
+  readFace ("7/13/21 1/1/22 3/3/23 5/14/24");
+}
Index: orxonox/branches/dave/src/object.h
===================================================================
--- orxonox/branches/dave/src/object.h	(revision 2860)
+++ orxonox/branches/dave/src/object.h	(revision 2860)
@@ -0,0 +1,95 @@
+/*!
+  \file object.h
+  \brief Contains the Object Class that handles 3D-Objects
+*/
+
+#ifndef _OBJECT_H
+#define _OBJECT_H
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+#include "array.h"
+#include "material.h"
+#include <fstream>
+
+using namespace std;
+
+extern int verbose; //!< fill be removed and added again as a verbose-class
+
+
+//! Class that handles 3D-Objects. it can also read them in and display them.
+class Object
+{
+ public:
+  Object ();
+  Object (char* fileName);
+  Object(char* fileName, float scaling);
+  ~Object ();
+  
+  bool importFile (char* fileName);
+  bool initialize (void);
+  bool finalize(void);
+  void draw (void);
+  void draw (int groupNumber);
+  void draw (char* groupName);
+  int getGroupCount();
+
+ private:
+  //! Group to handle multiple Objects per obj-file
+  struct Group
+  {
+    char* name;
+
+    GLuint listNumber;
+    Array* vertices;
+    int verticesCount;
+    Array* colors;
+    Array* normals;
+    Array* vTexture;
+    int faceMode;
+
+    int firstVertex;
+    int firstNormal;
+    int firstVertexTexture;
+
+    Group* nextGroup;
+  };
+  
+  Group* firstGroup; //!< the first of all groups.
+  Group* currentGroup; //!< the currentGroup. this is the one we will work with.
+  int groupCount;
+
+  bool readingVertices;
+
+  char* objFileName;
+  char* mtlFileName;
+
+  Material* material;
+  float scaleFactor;
+
+  ifstream* OBJ_FILE;
+  ifstream* MTL_FILE;
+
+  bool initGroup(Group* group);
+  bool finalizeGroup (Group* group);
+
+
+  ///// readin ///
+  bool readFromObjFile (char* fileName);
+  
+  bool readVertex (char* vertexString);
+  bool readFace (char* faceString);
+  bool readVT (char* vtString);
+  bool readVertexNormal (char* normalString);
+  bool readVertexTexture (char* vTextureString);
+  bool readGroup (char* groupString);
+  bool readMtlLib (char* matFile);
+  bool readUseMtl (char* mtlString);
+
+  bool addGLElement (char* elementString);
+
+  void BoxObject (void);
+};
+
+#endif
Index: orxonox/branches/dave/src/orxonox.cc
===================================================================
--- orxonox/branches/dave/src/orxonox.cc	(revision 2746)
+++ orxonox/branches/dave/src/orxonox.cc	(revision 2860)
@@ -158,6 +158,20 @@
   glClearColor(0.0, 0.0, 0.0, 0.0);
   glEnable(GL_DEPTH_TEST);
-  glEnable(GL_COLOR);
-  glShadeModel(GL_FLAT);
+ 
+  // LIGHTING
+  GLfloat lmodelAmbient[] = {.1, .1, .1, 1.0};
+  GLfloat whiteLight[] = {1.0, 1.0, 1.0,1.0};
+  GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0};
+
+  glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
+  glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight);
+  glEnable(GL_LIGHTING);
+  glEnable(GL_LIGHT0);
+  glEnable(GL_DEPTH_TEST);
+  glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
+  glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
+   
+  //  glEnable(GL_COLOR);
+  //  glShadeModel(GL_SMOOTH);
   
   // create camera
Index: orxonox/branches/dave/src/player.cc
===================================================================
--- orxonox/branches/dave/src/player.cc	(revision 2746)
+++ orxonox/branches/dave/src/player.cc	(revision 2860)
@@ -25,4 +25,7 @@
 Player::Player(bool isFree) : WorldEntity(isFree)
 {
+
+  obj = new Object ("reaphigh.obj");
+  /*
   objectList = glGenLists(1);
   glNewList (objectList, GL_COMPILE);
@@ -48,5 +51,5 @@
   
   glEndList ();
-
+  */
 }
 
@@ -58,10 +61,10 @@
 void Player::post_spawn ()
 {
-	travel_speed = 15.0;
-	velocity = Vector();
-	bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
-	bFire = false;
-	acceleration = 10.0;
-	set_collision (new CollisionCluster (1.0, Vector(0,0,0)));
+  travel_speed = 15.0;
+  velocity = Vector();
+  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
+  bFire = false;
+  acceleration = 10.0;
+  set_collision (new CollisionCluster (1.0, Vector(0,0,0)));
 }
 
@@ -104,6 +107,10 @@
   glMultMatrixf ((float*)matrix);
   
-  glCallList (objectList);
+  glMatrixMode (GL_MODELVIEW);
+  glRotatef (-90, 0,1,0);
+  obj->draw();
+  //  glCallList (objectList);
 
+  
   
   //printf("Player@%f/%f/%f\n", get_placement()->r.x, get_placement()->r.y, get_placement()->r.z);
Index: orxonox/branches/dave/src/player.h
===================================================================
--- orxonox/branches/dave/src/player.h	(revision 2746)
+++ orxonox/branches/dave/src/player.h	(revision 2860)
@@ -8,4 +8,5 @@
 
 #include "world_entity.h"
+#include "object.h"
 
 //! Basic controllable WorldEntity
@@ -37,4 +38,5 @@
   float acceleration;
   GLuint objectList;
+  Object* obj;
   
   void move (float time);
Index: orxonox/branches/dave/src/stdincl.h
===================================================================
--- orxonox/branches/dave/src/stdincl.h	(revision 2746)
+++ orxonox/branches/dave/src/stdincl.h	(revision 2860)
@@ -15,4 +15,5 @@
 #include "coordinates.h"
 #include "list.h"
+#include "list_template.h"
 #include "error.h"
 #include "message_structures.h"
Index: orxonox/branches/dave/src/vector.cc
===================================================================
--- orxonox/branches/dave/src/vector.cc	(revision 2746)
+++ orxonox/branches/dave/src/vector.cc	(revision 2860)
@@ -33,5 +33,5 @@
 {
   Vector r;
-  
+
   r.x = x + v.x;
   r.y = y + v.y;
Index: orxonox/branches/dave/src/world.cc
===================================================================
--- orxonox/branches/dave/src/world.cc	(revision 2746)
+++ orxonox/branches/dave/src/world.cc	(revision 2860)
@@ -22,4 +22,5 @@
 #include "command_node.h"
 #include "camera.h"
+#include "environment.h"
 
 using namespace std;
@@ -35,5 +36,5 @@
   this->worldName = name;
   this->debugWorldNr = -1;
-  this->entities = new List<WorldEntity>();
+  this->entities = new tList<WorldEntity>();
 }
 
@@ -42,5 +43,5 @@
   this->debugWorldNr = worldID;
   this->worldName = NULL;
-  this->entities = new List<WorldEntity>();
+  this->entities = new tList<WorldEntity>();
 }
 
@@ -74,4 +75,6 @@
   this->bQuitCurrentGame = true;
   this->localCamera->setWorld(NULL);
+  this->entities->clear();
+  Orxonox::getInstance()->get_localinput()->reset();
   this->~World();
 }
@@ -98,13 +101,13 @@
 	    this->pathnodes = new Vector[6];
 	    this->pathnodes[0] = Vector(0, 0, 0);
-	    this->pathnodes[1] = Vector(-100, 40, 0);
-	    this->pathnodes[2] = Vector(-100, 140, 0);
-	    this->pathnodes[3] = Vector(0, 180, 0);
-	    this->pathnodes[4] = Vector(100, 140, 0);
-	    this->pathnodes[5] = Vector(100, 40, 0);
+	    this->pathnodes[1] = Vector(1000, 0, 0);
+	    //	    this->pathnodes[2] = Vector(-100, 140, 0);
+	    //	    this->pathnodes[3] = Vector(0, 180, 0);
+	    //	    this->pathnodes[4] = Vector(100, 140, 0);
+	    //	    this->pathnodes[5] = Vector(100, 40, 0);
 	    
 	    // create the tracks
-	    this->tracklen = 6;
-	    this->track = new Track[6];
+	    this->tracklen = 2;
+	    this->track = new Track[2];
 	    for( int i = 0; i < this->tracklen; i++)
 	      {
@@ -113,5 +116,4 @@
 	    
 	    // create a player
-	    //WorldEntity* myPlayer = (WorldEntity*) this->spawn<Player>();
 	    WorldEntity* myPlayer = new Player();
 	    this->spawn(myPlayer);
@@ -125,4 +127,11 @@
 	    this->localCamera = new Camera(this);
 	    this->getCamera()->bind (myPlayer);	
+
+	    Placement* plc = new Placement;
+	    plc->r = Vector(100, 10, 10);
+	    plc->w = Quaternion();
+	    WorldEntity* env = new Environment();
+	    this->spawn(env, plc);
+
 	    break;
 	  }
@@ -174,6 +183,137 @@
   glNewList (objectList, GL_COMPILE);
   glLoadIdentity();
+  glColor3f(1.0,0,0);
+  glBegin(GL_QUADS);
+  float height [500][50];
+  Vector normal_vectors[500][50];
+  float size = 2;
+    for(int i=0;i<400;i+=1){
+		for(int j=0;j<50;j+=1){
+	normal_vectors[i][j].x=0;
+    normal_vectors[i][j].y=1;
+	normal_vectors[i][j].z=0;
+	
+	
+	
+	}
+	}
+	
+	
+	for ( int i = 0; i<400; i+=1)
+      {
+	for (int j = 0; j<50;j+=1)
+	  {
+	    //height[i][j] = rand()/20046 + (j-25)*(j-25)/30;
+	    height[i][j]=(sin((float)j/3)*rand()*i/182400)*.2;
+	  }
+      }
+	 for(int a=0;a<2;a+=1){
+	 for (int i=1;i<399 ;i+=1 ){
+		 for(int j=1;j<49;j+=1){
+			 height[i][j]=(height[i+1][j]+height[i][j+1]+height[i-1][j]+height[i][j-1])/4;
+
+		 }
+	 }
+	 }
+    //Berechnung von normalen Vektoren
+
+	for(int i=1;i<399;i+=1){
+    for(int j=1;j<49 ;j+=1)
+
+    {
+		Vector* v1 = new Vector (size*i,        size*(j-25),      height[i][j]-20 );
+	    Vector* v2 = new Vector (size*(i+1),    size*(j-25),      height[i+1][j]-20);
+	    Vector* v3 = new Vector (size*(i),    size*(j-24),  height[i][j+1]-20);
+	    Vector* v4 = new Vector (size*(i-1),        size*(j-25),  height[i-1][j]-20);
+		Vector* v5 = new Vector (size*(i), size*(j-26), height[i][j-1]-20);
+		
+		Vector c1 = *v1 - *v2;
+	    Vector c2 = *v1 - *v3;
+	    Vector c3= *v1 - *v4;
+	    Vector c4 = *v1 - *v5;
+	    normal_vectors[i][j]=c1.cross(*v1-*v3)+c2.cross(*v1-*v4)+c3.cross(*v1-*v5)+c4.cross(*v1-*v2);
+		normal_vectors[i][j].normalize();
+	    
+    
+	
+	
+	}
+	}
+	int snowheight=3;
+	for ( int i = 0; i<400; i+=1)
+      {
+	for (int j = 0; j<50;j+=1)
+	  {	  
+	    Vector* v1 = new Vector (size*i,        size*(j-25),      height[i][j]-20 );
+	    Vector* v2 = new Vector (size*(i+1),    size*(j-25),      height[i+1][j]-20);
+	    Vector* v3 = new Vector (size*(i+1),    size*(j-24),  height[i+1][j+1]-20);
+	    Vector* v4 = new Vector (size*(i),        size*(j-24),  height[i][j+1]-20);
+	    float a[3];
+		if(height[i][j]<snowheight){
+		a[0]=0;
+		a[1]=1.0-height[i][j]/10-.3;
+		a[2]=0;
+		glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+		}
+		else{
+		a[0]=1.0;
+		a[1]=1.0;
+		a[2]=1.0;
+		glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+
+		}
+		glNormal3f(normal_vectors[i][j].x, normal_vectors[i][j].y, normal_vectors[i][j].z);
+	    glVertex3f(v1->x, v1->y, v1->z);
+		if(height[i+1][j]<snowheight){
+		a[0]=0;
+		a[1] =1.0-height[i+1][j]/10-.3;
+		a[2]=0;
+		glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+	    }
+		else{
+		a[0]=1.0;
+		a[1]=1.0;
+		a[2]=1.0;
+		glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+		
+		}
+		glNormal3f(normal_vectors[i+1][j].x, normal_vectors[i+1][j].y, normal_vectors[i+1][j].z);
+	    glVertex3f(v2->x, v2->y, v2->z);
+		if(height[i+1][j+1]<snowheight){
+		a[0]=0;
+		a[1] =1.0-height[i+1][j+1]/10-.3;
+		a[2]=0;
+		glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+	    }
+		else{
+		a[0]=1.0;
+		a[1]=1.0;
+		a[2]=1.0;
+		glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+		
+		
+		}
+		glNormal3f(normal_vectors[i+1][j+1].x, normal_vectors[i+1][j+1].y, normal_vectors[i+1][j+1].z);
+	    glVertex3f(v3->x, v3->y, v3->z);
+		if(height[i][j+1]<snowheight){
+		a[0]=0;
+		a[1] =1.0-height[i+1][j+1]/10-.3;
+		a[2]=0;
+		glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+	    }
+		else{
+			a[0]=1.0;
+		a[1]=1.0;
+		a[2]=1.0;
+			glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+		}
+		glNormal3f(normal_vectors[i][j+1].x, normal_vectors[i][j+1].y, normal_vectors[i][j+1].z);
+	    glVertex3f(v4->x, v4->y, v4->z);
+
+	  }
+      }
+glEnd();
+/*  
   glBegin(GL_LINES);
-  
   for( float x = -128.0; x < 128.0; x += 25.0)
     {
@@ -213,6 +353,7 @@
       
     }
-  
+  */  
   //draw track
+  glBegin(GL_LINES);
   glColor3f(0,1,1);
   for( int i = 0; i < tracklen; i++)
@@ -235,18 +376,19 @@
 void World::collide ()
 {
-  List<WorldEntity> *a, *b;
+  /*
+  List *a, *b;
   WorldEntity *aobj, *bobj;
-  
-  a = entities->get_next();
+   
+  a = entities;
   
   while( a != NULL)
     {
-      aobj = a->get_object();
+      aobj = a->nextElement();
       if( aobj->bCollide && aobj->collisioncluster != NULL)
 	{
-	  b = a->get_next();
+	  b = a->nextElement();
 	  while( b != NULL )
 	    {
-	      bobj = b->get_object();
+	      bobj = b->nextElement();
 	      if( bobj->bCollide && bobj->collisioncluster != NULL )
 		{
@@ -260,9 +402,10 @@
 		  }
 		}
-	      b = b->get_next();
+	      b = b->nextElement();
 	    }
 	}
-      a = a->get_next();
-    }
+      a = a->enumerate();
+    }
+  */
 }
 
@@ -275,13 +418,11 @@
   
   // draw entities
-  List<WorldEntity> *l;
   WorldEntity* entity;
   
-  l = entities->get_next();  
-  while( l != NULL ) 
+  entity = this->entities->enumerate();
+  while( entity != NULL ) 
     { 
-      entity = l->get_object();
       if( entity->bDraw ) entity->draw();
-      l = l->get_next();
+      entity = this->entities->nextElement();
     }
   
@@ -303,5 +444,5 @@
 void World::update ()
 {
-  List<WorldEntity> *l;
+  //List<WorldEntity> *l;
   WorldEntity* entity;
   Location* loc;
@@ -309,8 +450,9 @@
   Uint32 t;
   
-  l = entities->get_next();  
-  while( l != NULL ) 
+  //  l = entities->enumerate(); 
+  entity = this->entities->enumerate();
+  while( entity != NULL ) 
     { 
-      entity = l->get_object();
+
       
       if( !entity->isFree() )
@@ -350,5 +492,5 @@
 	}
       
-      l = l->get_next();
+      entity = entities->nextElement();
     }
   
@@ -361,5 +503,5 @@
 void World::time_slice (Uint32 deltaT)
 {
-  List<WorldEntity> *l;
+  //List<WorldEntity> *l;
   WorldEntity* entity;
   float seconds = deltaT;
@@ -367,12 +509,11 @@
   seconds /= 1000;
   
-  l = entities->get_next();  
-  while( l != NULL) 
+  entity = entities->enumerate(); 
+  while( entity != NULL) 
     { 
-      entity = l->get_object();
       entity->tick (seconds);
-      l = l->get_next();
-    }
-  
+      entity = entities->nextElement();
+    }
+
   for( int i = 0; i < tracklen; i++) track[i].tick (seconds);
 }
@@ -411,14 +552,14 @@
 void World::debug()
 {
-  List<WorldEntity> *l;
+  //List<WorldEntity> *l;
   WorldEntity* entity;
   
   printf("counting all entities\n");
-  l = entities->get_next();  
-  while( l != NULL ) 
+  printf("World::debug() - enumerate()\n");
+  entity = entities->enumerate();  
+  while( entity != NULL ) 
     { 
-      entity = l->get_object();
       if( entity->bDraw ) printf("got an entity\n");
-      l = l->get_next();
+      entity = entities->nextElement();
     }
 }
@@ -445,4 +586,7 @@
       // Draw
       display();
+  
+      //for(int i = 0; i < 1000000; i++){}
+
     }
   printf("World|Exiting the main loop\n");
@@ -477,5 +621,5 @@
     {
       Uint32 dt = currentFrame - this->lastFrame;
-      /*
+      
       if(dt > 0)
 	{
@@ -485,7 +629,7 @@
       else
 	{
-	  printf("fps = 1000\n");
-	}
-      */
+	  printf("fps = 1000 but 0ms!\n");
+	}
+      
       this->time_slice (dt);
       this->update ();
@@ -545,14 +689,11 @@
   Location* loc = NULL;
   WorldEntity* owner;
-  //T* entity = new T();
-  entities->add (entity, LIST_ADD_NEXT);
-  //if( loc == NULL)
-  //{
-      zeroloc.dist = 0;
-      zeroloc.part = 0;
-      zeroloc.pos = Vector();
-      zeroloc.rot = Quaternion();
-      loc = &zeroloc;
-      //}
+
+  entities->add (entity);
+  zeroloc.dist = 0;
+  zeroloc.part = 0;
+  zeroloc.pos = Vector();
+  zeroloc.rot = Quaternion();
+  loc = &zeroloc;
   entity->init (loc, owner);
   if (entity->bFree)
@@ -561,4 +702,43 @@
     }
   entity->post_spawn ();
+}
+
+
+void World::spawn(WorldEntity* entity, Location* loc)
+{
+  Location zeroLoc;
+  WorldEntity* owner;
+  this->entities->add (entity);
+  if( loc == NULL)
+    {
+      zeroLoc.dist = 0;
+      zeroLoc.part = 0;
+      zeroLoc.pos = Vector();
+      zeroLoc.rot = Quaternion();
+      loc = &zeroLoc;
+    }
+  entity->init (loc, owner);
+  if (entity->bFree)
+    {
+      this->track[loc->part].map_coords( loc, entity->get_placement());
+    }
+  entity->post_spawn ();
   //return entity;
 }
+
+
+void World::spawn(WorldEntity* entity, Placement* plc)
+{
+  Placement zeroPlc;
+  WorldEntity* owner;
+  if( plc == NULL)
+    {
+      zeroPlc.r = Vector();
+      zeroPlc.w = Quaternion();
+      plc = &zeroPlc;
+    }
+  this->entities->add (entity);
+  entity->init (plc, owner);
+  entity->post_spawn ();
+  //return entity;
+}
Index: orxonox/branches/dave/src/world.h
===================================================================
--- orxonox/branches/dave/src/world.h	(revision 2746)
+++ orxonox/branches/dave/src/world.h	(revision 2860)
@@ -49,9 +49,10 @@
   bool system_command (Command* cmd);
   Camera* getCamera();
-  //private:
 
   void spawn(WorldEntity* entity);
+  void spawn(WorldEntity* entity, Location* loc);
+  void spawn(WorldEntity* entity, Placement* plc);
 
-  List<WorldEntity>* entities;
+  tList<WorldEntity>* entities;
   
   // base level data
Index: orxonox/branches/dave/src/world_entity.cc
===================================================================
--- orxonox/branches/dave/src/world_entity.cc	(revision 2746)
+++ orxonox/branches/dave/src/world_entity.cc	(revision 2860)
@@ -36,6 +36,7 @@
 WorldEntity::WorldEntity (bool isFree) : bFree(isFree)
 {
-	collisioncluster = NULL;
-	owner = NULL;
+  this->bDraw = true;
+  collisioncluster = NULL;
+  owner = NULL;
 }
 
@@ -45,28 +46,28 @@
 WorldEntity::~WorldEntity ()
 {
-	if( collisioncluster != NULL) delete collisioncluster;
+  if( collisioncluster != NULL) delete collisioncluster;
 }
 
 /**
-	\brief get the Location of the WorldEntity
-	\return a pointer to location
+   \brief get the Location of the WorldEntity
+   \return a pointer to location
 */
 Location* WorldEntity::get_location ()
 {
-	return &loc;
+  return &loc;
 }
 
 /**
-	\brief get the Placement of the WorldEntity
-	\return a pointer to placement
+   \brief get the Placement of the WorldEntity
+   \return a pointer to placement
 */
 Placement* WorldEntity::get_placement ()
 {
-	return &place;
+  return &place;
 }
 
 /**
-	\brief query whether the WorldEntity in question is free
-	\return true if the WorldEntity is free or false if it isn't
+   \brief query whether the WorldEntity in question is free
+   \return true if the WorldEntity is free or false if it isn't
 */
 bool WorldEntity::isFree ()
@@ -76,21 +77,21 @@
 
 /**
-	\brief set the WorldEntity's collision hull
-	\param newhull: a pointer to a completely assembled CollisionCluster
-	
-	Any previously assigned collision hull will be deleted on reassignment
+   \brief set the WorldEntity's collision hull
+   \param newhull: a pointer to a completely assembled CollisionCluster
+   
+   Any previously assigned collision hull will be deleted on reassignment
 */
 void WorldEntity::set_collision (CollisionCluster* newhull)
 {
-	if( newhull == NULL) return;
-	if( collisioncluster != NULL) delete collisioncluster;
-	collisioncluster = newhull;
+  if( newhull == NULL) return;
+  if( collisioncluster != NULL) delete collisioncluster;
+  collisioncluster = newhull;
 }
 
 /**
-	\brief this method is called every frame
-	\param time: the time in seconds that has passed since the last tick
-	
-	Handle all stuff that should update with time inside this method (movement, animation, etc.)
+   \brief this method is called every frame
+   \param time: the time in seconds that has passed since the last tick
+   
+   Handle all stuff that should update with time inside this method (movement, animation, etc.)
 */
 void WorldEntity::tick(float time) 
@@ -100,5 +101,5 @@
 /**
    \brief the entity is drawn onto the screen with this function
-
+   
    This is a central function of an entity: call it to let the entity painted to the screen. Just override this function with whatever you want to be drawn.
 */
@@ -108,10 +109,10 @@
 
 /**
-	\brief this function is called, when two entities collide
-	\param other: the world entity with whom it collides
-	\param ownhitflags: flags to the CollisionCluster subsections that registered an impact
-	\param otherhitflags: flags to the CollisionCluster subsections of the other entity that registered an impact
+   \brief this function is called, when two entities collide
+   \param other: the world entity with whom it collides
+   \param ownhitflags: flags to the CollisionCluster subsections that registered an impact
+   \param otherhitflags: flags to the CollisionCluster subsections of the other entity that registered an impact
 
-	Implement behaviour like damage application or other miscellaneous collision stuff in this function
+   Implement behaviour like damage application or other miscellaneous collision stuff in this function
 */
 void WorldEntity::collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) {}
@@ -135,26 +136,26 @@
 
 /**
-	\brief basic initialisation for bound Entities
+   \brief basic initialisation for bound Entities
 */
 void WorldEntity::init( Location* spawnloc, WorldEntity* spawnowner)
 {
-	loc = *spawnloc;
-	owner = spawnowner;
+  loc = *spawnloc;
+  owner = spawnowner;
 }
 
 /**
-	\brief basic initialisation for free Entities
+   \brief basic initialisation for free Entities
 */
 void WorldEntity::init( Placement* spawnplc, WorldEntity* spawnowner)
 {
-	place = *spawnplc;
-	owner = spawnowner;
+  place = *spawnplc;
+  owner = spawnowner;
 }
 
 /**
-	\brief this is called immediately after the Entity has been constructed and initialized
-	
-	Put any initialisation code that requires knowledge of location (placement if the Entity is free) and owner of the entity here.
-	DO NOT place such code in the constructor, those variables are set AFTER the entity is constucted.
+   \brief this is called immediately after the Entity has been constructed and initialized
+   
+   Put any initialisation code that requires knowledge of location (placement if the Entity is free) and owner of the entity here.
+   DO NOT place such code in the constructor, those variables are set AFTER the entity is constucted.
 */
 void WorldEntity::post_spawn ()
@@ -163,9 +164,9 @@
 
 /**
-	\brief this handles incoming command messages
-	\param cmd: a pointer to the incoming Command structure
-	
-	Put all code that handles Command messages here, this will mainly be called by the assigned CommandNode but can also be used
-	to send commands from one WorldEntity to another.
+   \brief this handles incoming command messages
+   \param cmd: a pointer to the incoming Command structure
+   
+   Put all code that handles Command messages here, this will mainly be called by the assigned CommandNode but can also be used
+   to send commands from one WorldEntity to another.
 */
 void WorldEntity::command (Command* cmd)
@@ -174,9 +175,9 @@
 
 /**
-	\brief this is called by the local Camera to determine the point it should look at on the WorldEntity
-	\param locbuf: a pointer to the buffer to fill with a location to look at
+   \brief this is called by the local Camera to determine the point it should look at on the WorldEntity
+   \param locbuf: a pointer to the buffer to fill with a location to look at
 	
-	You may put any Location you want into locbuf, the Camera will determine via the corresponding Track how
-	to look at the location you return with this.
+   You may put any Location you want into locbuf, the Camera will determine via the corresponding Track how
+   to look at the location you return with this.
 */
 void WorldEntity::get_lookat (Location* locbuf)
@@ -185,8 +186,8 @@
 
 /**
-	\brief this method is called by the world if the WorldEntity leaves valid gamespace
-	
-	For free entities this means it left the Track boundaries. With bound entities it means its Location adresses a
-	place that is not in the world anymore. In both cases you might have to take extreme measures (a.k.a. call destroy).
+   \brief this method is called by the world if the WorldEntity leaves valid gamespace
+   
+   For free entities this means it left the Track boundaries. With bound entities it means its Location adresses a
+   place that is not in the world anymore. In both cases you might have to take extreme measures (a.k.a. call destroy).
 */
 void WorldEntity::left_world ()
