Index: orxonox/trunk/Makefile.am
===================================================================
--- orxonox/trunk/Makefile.am	(revision 3195)
+++ orxonox/trunk/Makefile.am	(revision 3196)
@@ -1,6 +1,6 @@
 AUTOMAKE_OPTIONS = foreign no-installman no-installinfo 
 
-SUBDIRS = src \
-	  importer
+SUBDIRS = src 
+
 
 
@@ -10,5 +10,5 @@
 ##
 
-DOXYGEN_INPUT = src src/gui
+DOXYGEN_INPUT = "src src/gui src/importer"
 
 ## Exclude the application wizard templates, and some file templates
Index: orxonox/trunk/Makefile.in
===================================================================
--- orxonox/trunk/Makefile.in	(revision 3195)
+++ orxonox/trunk/Makefile.in	(revision 3196)
@@ -166,8 +166,6 @@
 target_vendor = @target_vendor@
 AUTOMAKE_OPTIONS = foreign no-installman no-installinfo 
-SUBDIRS = src \
-	  importer
-
-DOXYGEN_INPUT = src src/gui
+SUBDIRS = src 
+DOXYGEN_INPUT = "src src/gui src/importer"
 DOXYGEN_EXCLUDE = 
 DOXYGEN_EXAMPLE_PATH = 
Index: orxonox/trunk/configure
===================================================================
--- orxonox/trunk/configure	(revision 3195)
+++ orxonox/trunk/configure	(revision 3196)
@@ -7545,5 +7545,5 @@
 
 
-                                                  ac_config_files="$ac_config_files Makefile src/console/Makefile src/gui/Makefile src/Makefile importer/Makefile"
+                                                  ac_config_files="$ac_config_files Makefile src/console/Makefile src/gui/Makefile src/Makefile src/importer/Makefile"
 
 cat >confcache <<\_ACEOF
@@ -8114,5 +8114,5 @@
   "src/gui/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/gui/Makefile" ;;
   "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
-  "importer/Makefile" ) CONFIG_FILES="$CONFIG_FILES importer/Makefile" ;;
+  "src/importer/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/importer/Makefile" ;;
   "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
   "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
Index: orxonox/trunk/configure.ac
===================================================================
--- orxonox/trunk/configure.ac	(revision 3195)
+++ orxonox/trunk/configure.ac	(revision 3196)
@@ -353,4 +353,4 @@
                  src/gui/Makefile
                  src/Makefile
-		 importer/Makefile])
+		 src/importer/Makefile])
 AC_OUTPUT
Index: orxonox/trunk/src/Makefile.am
===================================================================
--- orxonox/trunk/src/Makefile.am	(revision 3195)
+++ orxonox/trunk/src/Makefile.am	(revision 3196)
@@ -23,8 +23,8 @@
 		 campaign.cc \
 		 story_entity.cc \
-		 object.cc \
+		 importer/object.cc \
 		 environment.cc \
-		 array.cc \
-		 material.cc \
+		 importer/array.cc \
+		 importer/material.cc \
 		 list.cc
 
@@ -56,7 +56,4 @@
 		 message_structures.h \
 		 shoot_rocket.h \
-		 object.h \
-		 array.h \
-		 material.h \
 		 list_template.h \
 		 story_entity.h \
@@ -72,5 +69,6 @@
 endif
 
-SUBDIRS = gui \
+SUBDIRS = importer \
+	  gui \
 	  $(GTK_PROGS)
 
Index: orxonox/trunk/src/Makefile.in
===================================================================
--- orxonox/trunk/src/Makefile.in	(revision 3195)
+++ orxonox/trunk/src/Makefile.in	(revision 3196)
@@ -95,5 +95,5 @@
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = gui console
+DIST_SUBDIRS = importer gui console
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
@@ -209,8 +209,8 @@
 		 campaign.cc \
 		 story_entity.cc \
-		 object.cc \
+		 importer/object.cc \
 		 environment.cc \
-		 array.cc \
-		 material.cc \
+		 importer/array.cc \
+		 importer/material.cc \
 		 list.cc
 
@@ -242,7 +242,4 @@
 		 message_structures.h \
 		 shoot_rocket.h \
-		 object.h \
-		 array.h \
-		 material.h \
 		 list_template.h \
 		 story_entity.h \
@@ -253,5 +250,6 @@
 @HAVE_GTK2_FALSE@GTK_PROGS = 
 @HAVE_GTK2_TRUE@GTK_PROGS = console
-SUBDIRS = gui \
+SUBDIRS = importer \
+	  gui \
 	  $(GTK_PROGS)
 
@@ -359,4 +357,52 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+object.o: importer/object.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object.o -MD -MP -MF "$(DEPDIR)/object.Tpo" -c -o object.o `test -f 'importer/object.cc' || echo '$(srcdir)/'`importer/object.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/object.Tpo" "$(DEPDIR)/object.Po"; else rm -f "$(DEPDIR)/object.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='importer/object.cc' object='object.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/object.Po' tmpdepfile='$(DEPDIR)/object.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object.o `test -f 'importer/object.cc' || echo '$(srcdir)/'`importer/object.cc
+
+object.obj: importer/object.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object.obj -MD -MP -MF "$(DEPDIR)/object.Tpo" -c -o object.obj `if test -f 'importer/object.cc'; then $(CYGPATH_W) 'importer/object.cc'; else $(CYGPATH_W) '$(srcdir)/importer/object.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/object.Tpo" "$(DEPDIR)/object.Po"; else rm -f "$(DEPDIR)/object.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='importer/object.cc' object='object.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/object.Po' tmpdepfile='$(DEPDIR)/object.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object.obj `if test -f 'importer/object.cc'; then $(CYGPATH_W) 'importer/object.cc'; else $(CYGPATH_W) '$(srcdir)/importer/object.cc'; fi`
+
+array.o: importer/array.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT array.o -MD -MP -MF "$(DEPDIR)/array.Tpo" -c -o array.o `test -f 'importer/array.cc' || echo '$(srcdir)/'`importer/array.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/array.Tpo" "$(DEPDIR)/array.Po"; else rm -f "$(DEPDIR)/array.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='importer/array.cc' object='array.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/array.Po' tmpdepfile='$(DEPDIR)/array.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o array.o `test -f 'importer/array.cc' || echo '$(srcdir)/'`importer/array.cc
+
+array.obj: importer/array.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT array.obj -MD -MP -MF "$(DEPDIR)/array.Tpo" -c -o array.obj `if test -f 'importer/array.cc'; then $(CYGPATH_W) 'importer/array.cc'; else $(CYGPATH_W) '$(srcdir)/importer/array.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/array.Tpo" "$(DEPDIR)/array.Po"; else rm -f "$(DEPDIR)/array.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='importer/array.cc' object='array.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/array.Po' tmpdepfile='$(DEPDIR)/array.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o array.obj `if test -f 'importer/array.cc'; then $(CYGPATH_W) 'importer/array.cc'; else $(CYGPATH_W) '$(srcdir)/importer/array.cc'; fi`
+
+material.o: importer/material.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT material.o -MD -MP -MF "$(DEPDIR)/material.Tpo" -c -o material.o `test -f 'importer/material.cc' || echo '$(srcdir)/'`importer/material.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/material.Tpo" "$(DEPDIR)/material.Po"; else rm -f "$(DEPDIR)/material.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='importer/material.cc' object='material.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/material.Po' tmpdepfile='$(DEPDIR)/material.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o material.o `test -f 'importer/material.cc' || echo '$(srcdir)/'`importer/material.cc
+
+material.obj: importer/material.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT material.obj -MD -MP -MF "$(DEPDIR)/material.Tpo" -c -o material.obj `if test -f 'importer/material.cc'; then $(CYGPATH_W) 'importer/material.cc'; else $(CYGPATH_W) '$(srcdir)/importer/material.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/material.Tpo" "$(DEPDIR)/material.Po"; else rm -f "$(DEPDIR)/material.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='importer/material.cc' object='material.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/material.Po' tmpdepfile='$(DEPDIR)/material.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o material.obj `if test -f 'importer/material.cc'; then $(CYGPATH_W) 'importer/material.cc'; else $(CYGPATH_W) '$(srcdir)/importer/material.cc'; fi`
 uninstall-info-am:
 
Index: orxonox/trunk/src/array.cc
===================================================================
--- orxonox/trunk/src/array.cc	(revision 3195)
+++ 	(revision )
@@ -1,139 +1,0 @@
-/* 
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Benjamin Grauer
-   co-programmer: ...
-*/
-
-#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* previous;
-  while (walker)
-    {
-      previous = walker;
-      walker = walker->next;
-      delete previous;
-    }
-  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. Length: %i\n", entryCount);  
-  //  if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL)
-  if ((array = new GLfloat [entryCount]) == 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);
-      
-      currentEntry->value = entry;
-      currentEntry->next = new Entry;
-      currentEntry = currentEntry->next;
-      currentEntry->next = NULL;
-      ++entryCount;
-    }
-  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/trunk/src/array.h
===================================================================
--- orxonox/trunk/src/array.h	(revision 3195)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*!
-  \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 "stdincl.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:
-  //! One entry of the Array
-  struct Entry
-  {
-    GLfloat value;  //!< The value of this Entry.
-    Entry* next;    //!< Pointer to the Next entry.
-  };
-
-  GLfloat* array;      //!< The array that will be produced when finalizing the Array.
-  int entryCount;      //!< The count of Entries in this Array.
-  bool finalized;      //!< If this variable is set to true, the Array can not be changed anymore. true if finalized, false else (initially).
-  Entry* firstEntry;   //!< Pointer to the first Entry of this Array
-  Entry* currentEntry; //!< Pointer to the current Entry of this Array. The one Entry we are working with.
-  
-  
-};
-
-#endif
Index: orxonox/trunk/src/importer/Makefile.am
===================================================================
--- orxonox/trunk/src/importer/Makefile.am	(revision 3196)
+++ orxonox/trunk/src/importer/Makefile.am	(revision 3196)
@@ -0,0 +1,38 @@
+#AM_CXXFLAGS="-I/usr/X11R6/include"
+AM_LDFLAGS=$(MWINDOWS)
+
+#"-O3 -pedantic -fPIC -ffast-math -I/usr/X11R6/include"
+
+
+bin_PROGRAMS=importer
+importer_SOURCES= framework.cc \
+	          windowHandler.cc \
+	  	  vector.cc \
+	  	  object.cc \
+	  	  array.cc \
+	  	  material.cc
+
+noinst_HEADERS= framework.h \
+	  	windowHandler.h \
+	  	vector.h \
+	  	object.h \
+	  	array.h \
+		material.h \
+		stdincl.h
+
+
+#  uncomment the following if orxonox 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/trunk/src/importer/Makefile.in
===================================================================
--- orxonox/trunk/src/importer/Makefile.in	(revision 3196)
+++ orxonox/trunk/src/importer/Makefile.in	(revision 3196)
@@ -0,0 +1,462 @@
+# 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 = :
+host_triplet = @host@
+bin_PROGRAMS = importer$(EXEEXT)
+subdir = src/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) \
+	vector.$(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)/vector.Po ./$(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@
+DEBUG = @DEBUG@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GTK2_CFLAGS = @GTK2_CFLAGS@
+GTK2_LIBS = @GTK2_LIBS@
+HAVE_GTK2_FALSE = @HAVE_GTK2_FALSE@
+HAVE_GTK2_TRUE = @HAVE_GTK2_TRUE@
+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 = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+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 = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+
+#AM_CXXFLAGS="-I/usr/X11R6/include"
+AM_LDFLAGS = $(MWINDOWS)
+importer_SOURCES = framework.cc \
+	          windowHandler.cc \
+	  	  vector.cc \
+	  	  object.cc \
+	  	  array.cc \
+	  	  material.cc
+
+noinst_HEADERS = framework.h \
+	  	windowHandler.h \
+	  	vector.h \
+	  	object.h \
+	  	array.h \
+		material.h \
+		stdincl.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) --foreign  src/importer/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  src/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)/vector.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 orxonox 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/trunk/src/importer/array.cc
===================================================================
--- orxonox/trunk/src/importer/array.cc	(revision 3196)
+++ orxonox/trunk/src/importer/array.cc	(revision 3196)
@@ -0,0 +1,139 @@
+/* 
+   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 ()
+{
+  this->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 = this->firstEntry;
+  Entry* previous;
+  while (walker)
+    {
+      previous = walker;
+      walker = walker->next;
+      delete previous;
+    }
+  if (finalized)
+    delete []this->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");
+  this->firstEntry = new Entry;
+  this->firstEntry->next =NULL;
+  this->currentEntry=firstEntry;
+  this->finalized = false;
+  this->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. Length: %i\n", entryCount);  
+  //  if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL)
+  if ((this->array = new GLfloat [this->entryCount]) == NULL)
+    printf ("could not allocate %i data Blocks\n", this->entryCount);
+  Entry* walker = this->firstEntry;
+  for (int i=0; i<this->entryCount; i++)
+    {
+      this->array[i] = walker->value;
+      walker = walker->next;
+    }
+  this->finalized = true;
+
+  return;
+}
+
+/**
+   \brief adds a new Entry to the Array
+   \param entry Entry to add.
+*/
+void Array::addEntry (GLfloat entry)
+{
+  if (!this->finalized)
+    {
+      if (verbose >= 3)
+	printf ("adding new Entry to Array: %f\n", entry);
+      
+      this->currentEntry->value = entry;
+      this->currentEntry->next = new Entry;
+      this->currentEntry = currentEntry->next;
+      this->currentEntry->next = NULL;
+      ++this->entryCount;
+    }
+  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)
+{
+  this->addEntry (entry0);
+  this->addEntry (entry1);
+  this->addEntry (entry2);
+}
+  
+/**
+   \brief Gives back the array !! MUST be executed AFTER finalize.
+   \returns The created array.
+*/
+GLfloat* Array::getArray ()
+{
+  return this->array;
+}
+
+/**
+   \returns The Count of entries in the Array
+*/
+int Array::getCount()
+{
+  return this->entryCount;
+}
+
+/**
+   \brief Simple debug info about the Array
+*/
+void Array::debug ()
+{
+  printf ("entryCount=%i, address=%p\n", this->entryCount, this->array);
+}
Index: orxonox/trunk/src/importer/array.h
===================================================================
--- orxonox/trunk/src/importer/array.h	(revision 3196)
+++ orxonox/trunk/src/importer/array.h	(revision 3196)
@@ -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 "../stdincl.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:
+  //! One entry of the Array
+  struct Entry
+  {
+    GLfloat value;  //!< The value of this Entry.
+    Entry* next;    //!< Pointer to the Next entry.
+  };
+
+  GLfloat* array;      //!< The array that will be produced when finalizing the Array.
+  int entryCount;      //!< The count of Entries in this Array.
+  bool finalized;      //!< If this variable is set to true, the Array can not be changed anymore. true if finalized, false else (initially).
+  Entry* firstEntry;   //!< Pointer to the first Entry of this Array
+  Entry* currentEntry; //!< Pointer to the current Entry of this Array. The one Entry we are working with.
+  
+  
+};
+
+#endif
Index: orxonox/trunk/src/importer/framework.cc
===================================================================
--- orxonox/trunk/src/importer/framework.cc	(revision 3196)
+++ orxonox/trunk/src/importer/framework.cc	(revision 3196)
@@ -0,0 +1,229 @@
+/* 
+   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 "framework.h"
+
+
+void DrawGLScene()
+{
+  currFrame = SDL_GetTicks();
+  dt = currFrame - lastFrame; 
+  if (dt == 0)
+    dist += (zoomTo-dist)/500;
+  else 
+    dist += (zoomTo-dist)/500 *(float)dt;
+
+  rotatorP += rotatorV *(float)dt;
+  
+
+  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,dist * 5.0f);
+    gluLookAt (0, dist , dist, 0,0,0, up.x,up.y,up.z);
+
+  glMatrixMode(GL_MODELVIEW);
+  glPushMatrix();
+  //  glRotatef (180, dir.x, dir.y, dir.z);
+  glMultMatrixf (*matQ);
+  obj->draw();
+
+  glPopMatrix();
+
+  SDL_GL_SwapBuffers(); // Swap the buffers
+  lastFrame = currFrame;
+}
+
+
+int main(int argc, char *argv[])
+{
+  int verbose = 2;
+  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", 800, 600, 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;
+  }
+  
+  printf ("%i, %i\n", wHandler.screen->w, wHandler.screen->h);
+  if (argc>=3)
+    obj = new Object (argv[1], atof(argv[2]));
+  else if (argc>=2)
+    obj = new Object(argv[1]);
+  else 
+    obj = new Object();
+  
+  M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0); 
+  rotAxis = Vector (0.0,1.0,0.0);
+  rotAngle = 0;
+
+  matQ[0][0] = matQ[1][1] = matQ[2][2] = matQ[3][3] = 1;
+  rotQ = Quaternion (rotAngle, rotAxis);
+  rotQlast = rotQ;
+  dir = Vector (0.0, 0.0, 1.0);
+  up = Vector (0.0, 1.0, 0.0);
+
+  glEnable(GL_LIGHTING);
+  glEnable(GL_DEPTH_TEST);
+
+  GLfloat whiteLight[] = {1.0, 1.0, 1.0,1.0};
+  GLfloat light0Position[] = {10.0, 10.0, 10.0, 0.0};
+  GLfloat light1Position[] = {-10.0, -7.0, -6.0, 0.0};
+  GLfloat lmodelAmbient[] = {.1, .1, .1, 1.0};
+
+  glEnable(GL_LIGHT0);
+  glLightfv(GL_LIGHT0, GL_POSITION, light0Position);
+  glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
+  glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight);
+  
+  glEnable(GL_LIGHT1);
+  glLightfv(GL_LIGHT1, GL_POSITION, light1Position);
+  glLightfv(GL_LIGHT1, GL_DIFFUSE, whiteLight);
+  glLightfv(GL_LIGHT1, GL_SPECULAR, whiteLight);
+  
+
+  glEnable(GL_TEXTURE_2D);
+  rotatorP = .0;
+  rotatorV = .0;
+  dist = 5.0;
+  zoomTo = dist;
+  // Build the font from a TGA image font.tga in the data directory
+  // Hide the mouse cursor
+    SDL_ShowCursor(2);
+    mouse1Down = false;
+
+  // 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) {
+      case SDL_MOUSEMOTION:
+	if (verbose >=3)
+	  printf("Mouse motion about %d,%d Pixels to (%d,%d).\n", 
+		 event.motion.xrel, event.motion.yrel,
+		 event.motion.x, event.motion.y);
+	// TRACKBALL
+	if (mouse1Down)
+	  {
+	    int mX = event.button.x;
+	    int mY = event.button.y;
+	    int wH = wHandler.screen->h;
+	    int wW = wHandler.screen->w;
+	    Vector tmpV (mX, mY, sqrt ( (float) abs(wH * wH/4 - (wW/2-mX) * (wW/2-mX) - (wH/2-mY) * (wH/2-mY)) ));
+	    //	    printf ("tmpV: %f, %f, %f\n", tmpV.x, tmpV.y, tmpV.z);
+	    p2 = tmpV-M;
+	    p2.y = -p2.y;
+	    rotAxis = p1.cross(p2);
+	    //  printf ("rotAxis: %f, %f, %f\n", rotAxis.x, rotAxis.y, rotAxis.z);
+
+	    // in case that there is no rotation-axis defined
+	    if (rotAxis.x != 0 || rotAxis.y != 0 || rotAxis.z != 0)
+	      {
+		rotAxis.normalize();
+		//		printf ("rotAxis: %f, %f, %f\n", rotAxis.x, rotAxis.y, rotAxis.z, rotAngle);
+				
+		rotAngle = angle_rad (p1, p2);
+		rotQ = Quaternion (rotAngle, rotAxis);
+		rotQ = rotQ * rotQlast;
+		rotQ.matrix (matQ);
+		//	dir = rotQ.apply(dir);
+		//      dir.normalize();
+		//	printf ("rotAxis: %f, %f, %f, %f\n", dir.x, dir.y, dir.z, rotAngle);
+	      }
+	    rotQlast = rotQ;
+	    p1 = p2;
+
+	  }
+	break;
+      case SDL_MOUSEBUTTONDOWN:
+	if (event.button.button == 4)
+	  {
+	    printf("MouseWheel up\n");
+	    zoomTo *= .5;
+	  }
+	else if (event.button.button == 5)
+	  {
+	    printf("MouseWheel down\n");
+	    zoomTo *= 2.0;
+	  }
+	else if (event.button.button == 1)
+	  {
+	    mouse1Down = true;
+	    int mX = event.button.x;
+	    int mY = event.button.y;
+	    int wH = wHandler.screen->h;
+	    int wW = wHandler.screen->w;
+	    Vector tmpV (mX, mY, sqrt ( (float) abs(wH * wH/4 - (wW/2-mX) * (wW/2-mX) - (wH/2-mY) * (wH/2-mY)) ));
+	    p1 = tmpV-M;
+	    p1.y = -p1.y;
+
+	  }
+	else
+	  {
+	    printf("MouseButton %d pressed at (%d,%d).\n",
+		   event.button.button, event.button.x, event.button.y);
+	    rotatorV = ( (float)wHandler.screen->w/2 -event.button.x) / (float)wHandler.screen->w / 100.0;
+	  }
+	    
+	break;
+      case SDL_MOUSEBUTTONUP:
+	if (event.button.button == 4);
+	else if (event.button.button == 5);
+	else if (event.button.button == 1)
+	  mouse1Down =false;
+	else 
+	    {
+	printf("MouseButton %d released at (%d,%d).\n",
+	       event.button.button, event.button.x, event.button.y);
+	    }
+	break;
+	    
+        // 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/trunk/src/importer/framework.h
===================================================================
--- orxonox/trunk/src/importer/framework.h	(revision 3196)
+++ orxonox/trunk/src/importer/framework.h	(revision 3196)
@@ -0,0 +1,38 @@
+#ifndef _FRAMEWORK_H
+#define _FRAMEWORK_H
+ 
+#include "windowHandler.h" // Include the Whandler Basecode
+#include "object.h"
+#include "vector.h"
+
+float rotatorP;
+float rotatorV;
+
+float dist;
+float zoomTo;
+
+Uint32 lastFrame;
+Uint32 currFrame;
+Uint32 dt;
+
+
+Vector dir;
+Vector up;
+
+float matQ[4][4];
+
+Vector M;
+Vector p1;
+Vector p2;
+Vector rotAxis;
+float rotAngle;
+Quaternion rotQ;
+Quaternion rotQlast;
+
+bool mouse1Down;
+
+WindowHandler wHandler;  // Create an instance of the whandler basecode class
+Object* obj;
+
+
+#endif /* _FRAMEWORK_H */
Index: orxonox/trunk/src/importer/material.cc
===================================================================
--- orxonox/trunk/src/importer/material.cc	(revision 3196)
+++ orxonox/trunk/src/importer/material.cc	(revision 3196)
@@ -0,0 +1,1283 @@
+/* 
+   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: ...
+
+   TGA-code: borrowed from nehe-Tutorials
+
+*/
+
+#include "material.h"
+
+// headers only for PathList
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <fstream>
+
+using namespace std;
+
+/**
+   \brief creates a ned PathList.
+   
+   It is a good idea to use this as an initial List,
+   because if you give on a name the Path will not be checked for its existence.
+*/
+PathList::PathList()
+{
+  this->pathName = NULL;
+  this->next = NULL;
+}
+
+/**
+   \brief Creates a new PathList with a Name.
+   \param pName the Name of The Path.
+
+   This function just adds the Path without checking if it exists.
+*/
+PathList::PathList(char* pName)
+{
+  this->pathName = new char [strlen(pName)+1];
+  strcpy (this->pathName, pName);
+  this->next = NULL;
+}
+
+/**
+   \brief destroys a PathList
+
+   It does this by deleting the Name and then delete its preceding PathList.
+*/
+PathList::~PathList()
+{
+  if (this->pathName)
+    delete []this->pathName;
+  if (this->next)
+    delete this->next;
+}
+
+/**
+   \brief Adds a new Pathlist Element.
+   \param pName
+   
+   Adding a Path automatically checks if the Path exists,
+   and if it does not it will not add it to the List.
+*/
+void PathList::addPath (char* pName)
+{
+  if (pName[0] == '\0')
+    {
+      if (verbose >=3)
+	printf("not Adding empty Path to the List.\n");
+      return;
+    }
+  char* tmpPName = new char[strlen(pName)];
+  strncpy(tmpPName, pName, strlen(pName)-1);
+  tmpPName[strlen(pName)-1] = '\0';
+  printf ("%s\n",tmpPName);
+  if (access (tmpPName, F_OK) == 0)
+    {
+      struct stat status;
+      stat(tmpPName, &status);
+      if (status.st_mode & S_IFDIR)
+	{
+	  if (verbose >=2)
+	    printf ("Adding Path %s to the PathList.\n", pName);
+	  PathList* tmpPathList = this;
+	  while (tmpPathList->next)
+	    tmpPathList = tmpPathList->next;
+	  tmpPathList->next = new PathList(pName);
+	}
+      else
+	if (verbose >=1)
+	  printf ("You tried to add non-folder %s to a PathList.\n", tmpPName);
+    }
+  else
+    if (verbose >=1)
+      printf ("You tried to add non-existing folder %s to a PathList.\n", tmpPName);
+  delete []tmpPName;
+}
+
+/**
+   \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()
+{
+  this->init();
+  
+  this->setName ("");
+}
+
+/**
+   \brief creates a Material.
+   \param mtlName Name of the Material to be added to the Material List
+*/
+Material::Material (char* mtlName)
+{
+  this->init();
+  
+  this->setName (mtlName);
+}
+
+/** 
+    \brief deletes a Material
+*/
+Material::~Material()
+{
+  if (verbose >= 2)
+    printf ("delete Material %s.\n", this->name);
+  if (this->name)
+    delete []this->name;
+  if (this->diffuseTextureSet)
+    glDeleteTextures (1, &this->diffuseTexture);
+  if (this->nextMat)
+    delete this->nextMat;
+}
+
+/**
+   \brief adds a new Material to the List.
+   this Function will append a new Material to the end of a Material List.
+   \param mtlName The name of the Material to be added.
+*/
+Material* Material::addMaterial(char* mtlName)
+{
+  if (verbose >=2)
+    printf ("adding Material %s.\n", mtlName);
+   Material* tmpMat = this;
+  while (tmpMat->nextMat != NULL)
+    {
+      tmpMat = tmpMat->nextMat;
+    }
+  tmpMat->nextMat = new Material(mtlName);
+  return tmpMat->nextMat;
+  
+}
+
+/**
+   \brief initializes a new Material with its default Values
+*/
+void Material::init(void)
+{
+  if (verbose >= 3)
+    printf ("initializing new Material.\n");
+  this->nextMat = NULL;
+  this->name ="";
+  this->setIllum(1);
+  this->setDiffuse(0,0,0);
+  this->setAmbient(0,0,0);
+  this->setSpecular(.5,.5,.5);
+  this->setShininess(2.0);
+  this->setTransparency(0.0);
+
+  if (!this->pathList)
+    this->pathList = new PathList("");
+
+
+  this->diffuseTextureSet = false;
+  this->ambientTextureSet = false;
+  this->specularTextureSet = false;
+
+  
+}
+
+PathList *Material::pathList = NULL;
+
+/**
+   \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;
+    }
+  if (verbose >=3)
+    printf ("not found\n");
+  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, this->diffuse);
+
+  // setting ambient color
+  glMaterialfv(GL_FRONT, GL_AMBIENT, this->ambient);
+
+  // setting up Sprecular
+  glMaterialfv(GL_FRONT, GL_SPECULAR, this->specular);
+
+  // setting up Shininess
+  glMaterialf(GL_FRONT, GL_SHININESS, this->shininess);
+  
+  // setting illumination Model 
+  if (this->illumModel == 1) //! \todo make this work, if no vertex-normals are read.
+    glShadeModel(GL_FLAT);
+  else if (this->illumModel >= 2)
+    glShadeModel(GL_SMOOTH);
+
+  if (this->diffuseTextureSet)
+    glBindTexture(GL_TEXTURE_2D, this->diffuseTexture);
+  else
+    glBindTexture(GL_TEXTURE_2D, 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)
+{
+  this->name = new char [strlen(mtlName)+1];
+  strcpy(this->name, mtlName);
+  if (verbose >= 3)
+    printf("setting Material Name to %s.\n", this->name);
+
+  //  printf ("adding new Material: %s, %p\n", this->getName(), this);
+
+}
+/**
+   \returns The Name of The Material
+*/
+char* Material::getName (void)
+{
+  return this->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\n", this->name, illum);
+  this->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)
+{
+  this->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", this->name, r, g, b);
+  this->diffuse[0] = r;
+  this->diffuse[1] = g;
+  this->diffuse[2] = b;  
+  this->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)
+{
+  float r,g,b;
+  sscanf (rgb, "%f %f %f", &r, &g, &b);
+  this->setDiffuse (r, g, 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", this->name, r, g, b);
+  this->ambient[0] = r;
+  this->ambient[1] = g;
+  this->ambient[2] = b;
+  this->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)
+{
+  float r,g,b;
+  sscanf (rgb, "%f %f %f", &r, &g, &b);
+  this->setAmbient (r, g, 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", this->name, r, g, b);
+  this->specular[0] = r;
+  this->specular[1] = g;
+  this->specular[2] = b;
+  this->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)
+{
+  float r,g,b;
+  sscanf (rgb, "%f %f %f", &r, &g, &b);
+  this->setSpecular (r, g, b);
+}
+
+/**
+   \brief Sets the Material Shininess.
+   \param shini stes the Shininess from float.
+*/
+void Material::setShininess (float shini)
+{
+  this->shininess = shini;
+}
+/**
+   \brief Sets the Material Shininess.
+   \param shini stes the Shininess from char*.
+*/
+void Material::setShininess (char* shini)
+{
+  this->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", this->name, trans);
+  this->transparency = trans;
+}
+/**
+   \brief Sets the Material Transparency.
+   \param trans stes the Transparency from char*.
+*/
+void Material::setTransparency (char* trans)
+{
+  this->setTransparency (atof(trans));
+}
+
+/**
+   \brief Adds a Texture Path to the List of already existing Paths
+   \param pathName The Path to add.
+*/
+void Material::addTexturePath(char* pathName)
+{
+  this->pathList->addPath (pathName);
+}
+
+/**
+   \brief Searches for a Texture inside one of the defined Paths
+   \param texName The name of the texture o search for.
+   \returns pathName+texName if texName was found in the pathList. NULL if the Texture is not found.
+*/
+char* Material::searchTextureInPaths(char* texName) const
+{
+  char* tmpName = NULL;
+  PathList* pList = pathList;
+  while (pList)
+    {
+      if (pList->pathName)
+	{
+	  tmpName = new char [strlen(pList->pathName)+strlen(texName)+1];
+	  strcpy(tmpName, pList->pathName);
+	}
+      else
+	{
+	  tmpName = new char [strlen(texName)+1];
+	  tmpName[0]='\0';
+	}
+      strcat(tmpName, texName);
+      printf("%s\n", tmpName);
+      if (access (tmpName, F_OK) == 0)
+	return tmpName;
+      
+      if (tmpName)
+	delete []tmpName;
+      tmpName = NULL;
+      pList = pList->next;
+    }
+  return NULL;
+}
+
+
+// MAPPING //
+
+/**
+   \brief Sets the Materials Diffuse Map
+   \param dMap the Name of the Image to Use
+*/
+void Material::setDiffuseMap(char* dMap)
+{
+  if (verbose>=2)
+    printf ("setting Diffuse Map %s\n", dMap);
+
+  //  diffuseTextureSet = loadBMP(dMap, &diffuseTexture);
+  this->diffuseTextureSet = this->loadImage(dMap, &this->diffuseTexture);
+
+}
+
+/**
+   \brief Sets the Materials Ambient Map
+   \param aMap the Name of the Image to Use
+   \todo implement this
+*/
+void Material::setAmbientMap(char* aMap)
+{
+  SDL_Surface* ambientMap;
+
+}
+
+/**
+   \brief Sets the Materials Specular Map
+   \param sMap the Name of the Image to Use
+   \todo implement this
+*/
+void Material::setSpecularMap(char* sMap)
+{
+  SDL_Surface* specularMap;
+
+}
+
+/**
+   \brief Sets the Materials Bumpiness
+   \param bump the Name of the Image to Use
+   \todo implemet this
+*/
+void Material::setBump(char* bump)
+{
+
+}
+
+/**
+   \brief Loads a Texture to the openGL-environment.
+   \param pImage The Image to load to openGL
+   \param texture The Texture to apply it to.
+*/
+bool Material::loadTexToGL (Image* pImage, GLuint* texture)
+{
+  if (verbose >=3)
+    printf ("Loading texture to OpenGL-Environment.\n");
+  glGenTextures(1, texture);
+  glBindTexture(GL_TEXTURE_2D, *texture);
+  /* not Working, and not needed. 
+  glTexImage2D( GL_TEXTURE_2D, 0, 3, width,
+		height, 0, GL_BGR,
+		GL_UNSIGNED_BYTE, map->pixels );
+  */ 
+  gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImage->width, pImage->height, GL_RGB, GL_UNSIGNED_BYTE, pImage->data);
+  
+  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
+  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);	
+}
+
+
+#ifdef HAVE_SDL_SDL_IMAGE_H
+bool Material::loadImage(char* imageName, GLuint* texture)
+{
+  char* imgNameWithPath = searchTextureInPaths(imageName);
+  if (imgNameWithPath)
+    {
+      SDL_Surface* map;
+      Image* pImage = new Image;
+      map=IMG_Load(imgNameWithPath);
+      if(!map)
+	{
+	  printf("IMG_Load: %s\n", IMG_GetError());
+	  return false;
+	}
+      pImage->height = map->h;
+      pImage->width  = map->w;
+      pImage->data   = (GLubyte*)map->pixels;
+      if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb")))
+	for (int i=0;i<map->h * map->w *3;i+=3)
+	  { 
+	    GLuint temp = pImage->data[i];
+	    pImage->data[i] = pImage->data[i+2];
+	    pImage->data[i+2] = temp;
+	  }
+      this->loadTexToGL (pImage, texture);
+    }
+  else
+    {
+      if (verbose >=1)
+	printf ("Image not Found: %s\n", imgNameWithPath);
+      return false;
+    }
+}
+
+
+#else /* HAVE_SDL_SDL_IMAGE_H */
+/**
+   \brief Makes the Programm ready to Read-in a texture-File
+   1. Checks what type of Image should be imported
+   2. ToDO: Checks where to find the Image
+*/
+bool Material::loadImage(char* imageName, GLuint* texture)
+{
+  char* imgNameWithPath = searchTextureInPaths(imageName);
+  if (imgNameWithPath)
+    {
+      if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4))
+	{
+	  if (verbose >=2)
+	    printf ("Requested bmp-image. Trying to Import.\n");
+	  return this->loadBMP(imgNameWithPath, texture);
+	}
+      
+      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5))
+	{
+	  if (verbose >=2)
+	    printf ("Requested jpeg-image. Trying to Import\n");
+	  return this->loadJPG(imgNameWithPath, texture);
+	}
+      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4))
+	{
+	  if (verbose >=2)
+	    printf ("Requested tga-image. Trying to Import\n");
+	  return this->loadTGA(imgNameWithPath, texture);
+	}
+      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4))
+	{
+	  if (verbose >=2)
+	    printf ("Requested png-image. Trying to Import\n");
+	  return this->loadPNG(imgNameWithPath, texture);
+	}
+      else
+	{
+	  if (verbose >=1)
+	    printf ("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath);
+	  return false;
+	}
+    }
+  else
+    {
+      if (verbose >=1)
+	printf ("Image not Found: %s\n", imgNameWithPath);
+      return false;
+    }
+}
+
+/**
+   \brief reads in a Windows BMP-file, and imports it to openGL.
+   \param bmpName The name of the Image to load.
+   \param texture A pointer to the Texture which should be read to.
+*/
+bool Material::loadBMP (char* bmpName, GLuint* texture)
+{
+  Image* pImage = new Image;
+  FILE *file;
+  unsigned long size;                 // size of the image in bytes.
+  unsigned long i;                    // standard counter.
+  unsigned short int planes;          // number of planes in image (must be 1) 
+  unsigned short int bpp;             // number of bits per pixel (must be 24)
+  GLuint temp;                          // temporary color storage for bgr-rgb conversion.
+
+  // make sure the file is there.
+  if ((file = fopen(bmpName, "rb"))==NULL)
+    {
+      if (verbose >=1)
+	printf("File Not Found : %s\n",bmpName);
+      return false;
+    }
+  // seek through the bmp header, up to the width/height:
+  fseek(file, 18, SEEK_CUR);
+  
+  // read the width
+  if ((i = fread(&pImage->width, 4, 1, file)) != 1) 
+    {
+      if (verbose >=1)
+	printf("Error reading width from %s.\n", bmpName);
+      return false;
+    }
+  // read the height 
+  if ((i = fread(&pImage->height, 4, 1, file)) != 1) 
+    {
+      if (verbose>=1)
+	printf("Error reading height from %s.\n", bmpName);
+      return false;
+    }
+  
+  // calculate the size (assuming 24 bits or 3 bytes per pixel).
+  size = pImage->width * pImage->height * 3;
+  
+  // read the planes
+  if ((fread(&planes, 2, 1, file)) != 1) 
+    {
+      if (verbose>=1)
+	printf("Error reading planes from %s.\n", bmpName);
+      return false;
+    }
+  if (planes != 1) 
+    {
+      if (verbose>=1)
+	printf("Planes from %s is not 1: %u\n", bmpName, planes);
+      return false;
+    }
+  
+  // read the bpp
+  if ((i = fread(&bpp, 2, 1, file)) != 1) 
+    {
+      if (verbose>=1)
+	printf("Error reading bpp from %s.\n", bmpName);
+      return false;
+    }
+  if (bpp != 24) 
+    {
+      if (verbose>=1)
+	printf("Bpp from %s is not 24: %u\n", bmpName, bpp);
+      return false;
+    }
+  
+  // seek past the rest of the bitmap header.
+  fseek(file, 24, SEEK_CUR);
+  
+  // read the data. 
+  pImage->data = (GLubyte *) malloc(size);
+  if (pImage->data == NULL) 
+    {
+      if (verbose>=1)
+	printf("Error allocating memory for color-corrected image data");
+      return false;	
+    }
+  
+  if ((i = fread(pImage->data, size, 1, file)) != 1) 
+    {
+      if (verbose>=1)
+	printf("Error reading image data from %s.\n", bmpName);
+      return false;
+    }
+  fclose(file);
+
+  // reverse all of the colors. (bgr -> rgb)
+  for (i=0;i<size;i+=3) 
+    { 
+      temp = pImage->data[i];
+      pImage->data[i] = pImage->data[i+2];
+      pImage->data[i+2] = temp;
+    }
+  this->loadTexToGL (pImage, texture);
+  
+
+  if (pImage)
+    {
+      if (pImage->data)
+	{
+	  free(pImage->data);
+	}
+      
+      free(pImage);
+    }
+  return true;
+
+}
+
+/**
+   \brief reads in a jpg-file
+   \param jpgName the Name of the Image to load
+   \param texture a reference to the Texture to write the image to
+*/
+bool Material::loadJPG (char* jpgName, GLuint* texture)
+{
+#ifdef HAVE_JPEGLIB_H
+  struct jpeg_decompress_struct cinfo;
+  Image *pImage = NULL;
+  FILE *pFile;
+  
+  // Open a file pointer to the jpeg file and check if it was found and opened 
+  if((pFile = fopen(jpgName, "rb")) == NULL) 
+    {
+      // Display an error message saying the file was not found, then return NULL
+      printf("Unable to load JPG File %s.\n", jpgName);
+      return false;
+    }
+  
+  // Create an error handler
+  jpeg_error_mgr jerr;
+  
+  // Have our compression info object point to the error handler address
+  cinfo.err = jpeg_std_error(&jerr);
+  
+  // Initialize the decompression object
+  jpeg_create_decompress(&cinfo);
+  
+  // Specify the data source (Our file pointer)	
+  jpeg_stdio_src(&cinfo, pFile);
+  
+  // Allocate the structure that will hold our eventual jpeg data (must free it!)
+  pImage = (Image*)malloc(sizeof(Image));
+  
+  // DECOFING
+  // Read in the header of the jpeg file
+  jpeg_read_header(&cinfo, TRUE);
+  
+  // Start to decompress the jpeg file with our compression info
+  jpeg_start_decompress(&cinfo);
+  
+  // Get the image dimensions and row span to read in the pixel data
+  pImage->rowSpan = cinfo.image_width * cinfo.num_components;
+  pImage->width   = cinfo.image_width;
+  pImage->height   = cinfo.image_height;
+  
+  // Allocate memory for the pixel buffer
+  pImage->data = new unsigned char[pImage->rowSpan * pImage->height];
+  
+  // Here we use the library's state variable cinfo.output_scanline as the
+  // loop counter, so that we don't have to keep track ourselves.
+  
+  // Create an array of row pointers
+  unsigned char** rowPtr = new unsigned char*[pImage->height];
+  for (int i = 0; i < pImage->height; i++)
+    rowPtr[i] = &(pImage->data[i*pImage->rowSpan]);
+  
+  // Now comes the juice of our work, here we extract all the pixel data
+  int rowsRead = 0;
+  while (cinfo.output_scanline < cinfo.output_height) 
+    {
+      // Read in the current row of pixels and increase the rowsRead count
+      rowsRead += jpeg_read_scanlines(&cinfo, &rowPtr[rowsRead], cinfo.output_height - rowsRead);
+    }
+  
+  // Delete the temporary row pointers
+  delete [] rowPtr;
+  
+  // Finish decompressing the data
+  jpeg_finish_decompress(&cinfo);//  decodeJPG(&cinfo, pImage);
+  
+  // This releases all the stored memory for reading and decoding the jpeg
+  jpeg_destroy_decompress(&cinfo);
+  
+  // Close the file pointer that opened the file
+  fclose(pFile);
+  
+
+  if(pImage == NULL)
+    exit(0);
+  
+  this->loadTexToGL (pImage, texture);
+  if (pImage)
+    {
+      if (pImage->data)
+	{
+	  free(pImage->data);
+	}
+      
+      free(pImage);
+    }
+  return true;
+#else /* HAVE_JPEGLIB_H */
+  if (verbose >=1)
+    printf ("sorry, but you did not compile with jpeg-support.\nEither install SDL_image or jpeglib, and recompile to see the image\n");
+  return false;
+#endif /* HAVE_JPEGLIB_H */
+
+}
+
+/**
+   \brief reads in a tga-file
+   \param tgaName the Name of the Image to load
+   \param texture a reference to the Texture to write the image to
+*/
+bool Material::loadTGA(const char * tgaName, GLuint* texture)
+{
+  typedef struct
+  {
+    GLubyte Header[12];
+  } TGAHeader;
+  TGAHeader tgaHeader;			
+  
+  GLubyte uTGAcompare[12] = {0,0,2, 0,0,0,0,0,0,0,0,0};	// Uncompressed TGA Header 
+  GLubyte cTGAcompare[12] = {0,0,10,0,0,0,0,0,0,0,0,0};	// Compressed TGA Header 
+  FILE * fTGA;
+  fTGA = fopen(tgaName, "rb");
+
+  if(fTGA == NULL)
+    {
+      printf("Error could not open texture file: %s\n", tgaName);
+      return false;
+    }
+  
+  if(fread(&tgaHeader, sizeof(TGAHeader), 1, fTGA) == 0)
+    {
+      printf("Error could not read file header of %s\n", tgaName);
+      if(fTGA != NULL)
+	{
+	  fclose(fTGA);
+	}
+      return false;
+    }
+  
+  if(memcmp(uTGAcompare, &tgaHeader, sizeof(TGAHeader)) == 0)
+    {
+      loadUncompressedTGA(tgaName, fTGA, texture);
+      if (fTGA)
+	fclose (fTGA);
+    }
+  else if(memcmp(cTGAcompare, &tgaHeader, sizeof(TGAHeader)) == 0)
+    {
+      loadCompressedTGA(tgaName, fTGA, texture);
+	if (fTGA)
+	  fclose (fTGA);
+    }
+  else
+    {
+      printf("Error TGA file be type 2 or type 10\n");
+      if (fTGA)
+	fclose(fTGA);
+      return false;
+    }
+  return true;
+}
+
+/**
+   \brief reads in an uncompressed tga-file
+   \param filename the Name of the Image to load
+   \param fTGA a Pointer to a File, that should be read
+   \param texture a reference to the Texture to write the image to
+*/
+bool Material::loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture)
+{
+  GLubyte header[6];      // First 6 Useful Bytes From The Header 
+  GLuint  bytesPerPixel;  // Holds Number Of Bytes Per Pixel Used In The TGA File 
+  GLuint  imageSize;	  // Used To Store The Image Size When Setting Aside Ram 
+  GLuint  temp;		  // Temporary Variable
+  GLuint  type;
+  GLuint  Height;	  // Height of Image 
+  GLuint  Width;	  // Width of Image 
+  GLuint  Bpp;		  // Bits Per Pixel 
+
+  Image* pImage = new Image;
+  GLuint cswap;
+  if(fread(header, sizeof(header), 1, fTGA) == 0)
+    {
+      printf("Error could not read info header\n");
+      return false;
+    }
+  
+  Width = pImage->width  = header[1] * 256 + header[0];
+  Height =  pImage->height = header[3] * 256 + header[2];
+  Bpp = pImage->bpp = header[4];
+  // Make sure all information is valid
+  if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32)))
+    {
+      printf("Error invalid texture information\n");
+      return false;
+    }
+  
+  if(pImage->bpp == 24)	
+    {
+      pImage->type = GL_RGB;
+    }
+  else
+    {
+      pImage->type = GL_RGBA;
+    }
+  
+  bytesPerPixel	= (Bpp / 8);
+  imageSize = (bytesPerPixel * Width * Height);
+  pImage->data = (GLubyte*) malloc(imageSize);
+  
+  if(pImage->data == NULL)
+    {
+      printf("Error could not allocate memory for image\n");
+      return false;
+    }
+  
+  if(fread(pImage->data, 1, imageSize, fTGA) != imageSize)
+    {
+      printf("Error could not read image data\n");
+      if(pImage->data != NULL)
+	{
+	  free(pImage->data);
+	}
+      return false;
+    }
+  
+  for(cswap = 0; cswap < (int)imageSize; cswap += bytesPerPixel)
+    {
+      pImage->data[cswap] ^= pImage->data[cswap+2] ^=
+	pImage->data[cswap] ^= pImage->data[cswap+2];
+    }
+  
+  this->loadTexToGL (pImage, texture);
+
+  return true;
+}
+
+/**
+   \brief reads in a compressed tga-file
+   \param filename the Name of the Image to load
+   \param fTGA a Pointer to a File, that should be read
+   \param texture a reference to the Texture to write the image to
+*/
+bool Material::loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture)
+{
+  GLubyte header[6];      // First 6 Useful Bytes From The Header 
+  GLuint  bytesPerPixel;  // Holds Number Of Bytes Per Pixel Used In The TGA File 
+  GLuint  imageSize;	  // Used To Store The Image Size When Setting Aside Ram 
+  GLuint  temp;		  // Temporary Variable
+  GLuint  type;
+  GLuint  Height;	  // Height of Image 
+  GLuint  Width;	  // Width of Image 
+  GLuint  Bpp;		  // Bits Per Pixel 
+
+  Image* pImage = new Image;
+
+  
+  if(fread(header, sizeof(header), 1, fTGA) == 0)
+    {
+      printf("Error could not read info header\n");
+      return false;
+    }
+  
+  Width = pImage->width  = header[1] * 256 + header[0];
+  Height = pImage->height = header[3] * 256 + header[2];
+  Bpp = pImage->bpp	= header[4];
+
+  GLuint pixelcount	= Height * Width;
+  GLuint currentpixel	= 0;
+  GLuint currentbyte	= 0;
+  GLubyte * colorbuffer = (GLubyte *)malloc(bytesPerPixel);
+
+  //Make sure all pImage info is ok 
+  if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32)))
+    {
+      printf("Error Invalid pImage information\n");
+      return false;
+    }
+  
+  bytesPerPixel	= (Bpp / 8);
+  imageSize		= (bytesPerPixel * Width * Height);
+  pImage->data	= (GLubyte*) malloc(imageSize);
+  
+  if(pImage->data == NULL)
+    {
+      printf("Error could not allocate memory for image\n");
+      return false;
+    }
+  
+  do
+    {
+      GLubyte chunkheader = 0;
+      
+      if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0)
+	{
+	  printf("Error could not read RLE header\n");
+	  if(pImage->data != NULL)
+	    {
+	      free(pImage->data);
+	    }
+	  return false;
+	}
+      // If the ehader is < 128, it means the that is the number of RAW color packets minus 1 
+      if(chunkheader < 128)
+	{
+	  short counter;
+	  chunkheader++;
+	  // Read RAW color values
+	  for(counter = 0; counter < chunkheader; counter++)
+	    { 
+	      // Try to read 1 pixel 
+	      if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel)
+		{
+		  printf("Error could not read image data\n");
+		  if(colorbuffer != NULL)
+		    {
+		      free(colorbuffer);
+		    }
+		  
+		  if(pImage->data != NULL)
+		    {
+		      free(pImage->data);
+		    }
+		  
+		  return false;	
+		}
+	      // write to memory 
+	      // Flip R and B vcolor values around in the process 
+	      pImage->data[currentbyte	  ] = colorbuffer[2];				    
+	      pImage->data[currentbyte + 1] = colorbuffer[1];
+	      pImage->data[currentbyte + 2] = colorbuffer[0];
+	      
+	      if(bytesPerPixel == 4) // if its a 32 bpp image 
+		{
+		  pImage->data[currentbyte + 3] = colorbuffer[3];// copy the 4th byte 
+		}
+	      
+	      currentbyte += bytesPerPixel;
+	      currentpixel++;
+
+	      // Make sure we haven't read too many pixels 
+	      if(currentpixel > pixelcount)	
+		{
+		  printf("Error too many pixels read\n");
+		  if(colorbuffer != NULL)
+		    {
+		      free(colorbuffer);
+		    }
+		  
+		  if(pImage->data != NULL)
+		    {
+		      free(pImage->data);
+		    }
+		  
+		  return false;
+		}
+	    }
+	}
+      // chunkheader > 128 RLE data, next color  reapeated chunkheader - 127 times
+      else
+	{
+	  short counter;
+	  chunkheader -= 127;	// Subteact 127 to get rid of the ID bit 
+	  if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel) // Attempt to read following color values 
+	    {
+	      printf("Error could not read from file");
+	      if(colorbuffer != NULL)
+		{
+		  free(colorbuffer);
+		}
+	      
+	      if(pImage->data != NULL)
+		{
+		  free(pImage->data);
+		}
+	      
+	      return false;
+	    }
+	  
+	  for(counter = 0; counter < chunkheader; counter++) //copy the color into the image data as many times as dictated
+	    {							
+	      // switch R and B bytes areound while copying
+	      pImage->data[currentbyte	  ] = colorbuffer[2];
+	      pImage->data[currentbyte + 1] = colorbuffer[1];
+	      pImage->data[currentbyte + 2] = colorbuffer[0];
+	      
+	      if(bytesPerPixel == 4)
+		{
+		  pImage->data[currentbyte + 3] = colorbuffer[3];
+		}
+	      
+	      currentbyte += bytesPerPixel;
+	      currentpixel++;
+	      
+	      if(currentpixel > pixelcount)
+		{
+		  printf("Error too many pixels read\n");
+		  if(colorbuffer != NULL)
+		    {
+		      free(colorbuffer);
+		    }
+		  
+		  if(pImage->data != NULL)
+		    {
+		      free(pImage->data);
+		    }
+		  
+		  return false;
+		}
+	    }
+	}
+    }
+  
+  while(currentpixel < pixelcount);	// Loop while there are still pixels left
+
+  this->loadTexToGL (pImage, texture);
+
+  return true;
+}
+
+
+/*
+static int ST_is_power_of_two(unsigned int number)
+{
+  return (number & (number - 1)) == 0;
+}
+*/
+
+/**
+   \brief reads in a png-file
+   \param pngName the Name of the Image to load
+   \param texture a reference to the Texture to write the image to
+*/
+bool Material::loadPNG(const char* pngName, GLuint* texture)
+{
+#ifdef HAVE_PNG_H
+  Image* pImage = new Image;
+
+  FILE *PNG_file = fopen(pngName, "rb");
+  if (PNG_file == NULL)
+    {
+      return 0;
+    }
+  
+  GLubyte PNG_header[8];
+  
+  fread(PNG_header, 1, 8, PNG_file);
+  if (png_sig_cmp(PNG_header, 0, 8) != 0)
+    {
+      if (verbose >=2)
+	printf ("Not Recognized as a pngFile\n");
+      fclose (PNG_file);
+      return 0;
+    }
+  
+  png_structp PNG_reader = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+  if (PNG_reader == NULL)
+    {
+      fclose(PNG_file);
+      return 0;
+    }
+  
+  png_infop PNG_info = png_create_info_struct(PNG_reader);
+  if (PNG_info == NULL)
+    {
+      png_destroy_read_struct(&PNG_reader, NULL, NULL);
+      fclose(PNG_file);
+      return 0;
+    }
+  
+  png_infop PNG_end_info = png_create_info_struct(PNG_reader);
+  if (PNG_end_info == NULL)
+    {
+      png_destroy_read_struct(&PNG_reader, &PNG_info, NULL);
+      fclose(PNG_file);
+      return 0;
+    }
+  
+  if (setjmp(png_jmpbuf(PNG_reader)))
+    {
+      png_destroy_read_struct(&PNG_reader, &PNG_info, &PNG_end_info);
+      fclose(PNG_file);
+      return (0);
+    }
+  
+  png_init_io(PNG_reader, PNG_file);
+  png_set_sig_bytes(PNG_reader, 8);
+  
+  png_read_info(PNG_reader, PNG_info);
+  
+  pImage->width = png_get_image_width(PNG_reader, PNG_info);
+  pImage->height = png_get_image_height(PNG_reader, PNG_info);
+  
+  png_uint_32 bit_depth, color_type;
+  bit_depth = png_get_bit_depth(PNG_reader, PNG_info);
+  color_type = png_get_color_type(PNG_reader, PNG_info);
+  
+  if (color_type == PNG_COLOR_TYPE_PALETTE)
+    {
+      png_set_palette_to_rgb(PNG_reader);
+    }
+  
+  if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+    {
+      png_set_gray_1_2_4_to_8(PNG_reader);
+    }
+  
+  if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+    {
+      png_set_gray_to_rgb(PNG_reader);
+    }
+  
+  if (png_get_valid(PNG_reader, PNG_info, PNG_INFO_tRNS))
+    {
+      png_set_tRNS_to_alpha(PNG_reader);
+    }
+  else
+    {
+      png_set_filler(PNG_reader, 0xff, PNG_FILLER_AFTER);
+    }
+  
+  if (bit_depth == 16)
+    {
+      png_set_strip_16(PNG_reader);
+    }
+  
+  png_read_update_info(PNG_reader, PNG_info);
+  
+  pImage->data = (png_byte*)malloc(4 * pImage->width * pImage->height);
+  png_byte** PNG_rows = (png_byte**)malloc(pImage->height * sizeof(png_byte*));
+  
+  unsigned int row;
+  for (row = 0; row < pImage->height; ++row)
+    {
+      PNG_rows[pImage->height - 1 - row] = pImage->data + (row * 4 * pImage->width);
+    }
+  
+  png_read_image(PNG_reader, PNG_rows);
+  
+  free(PNG_rows);
+  
+  png_destroy_read_struct(&PNG_reader, &PNG_info, &PNG_end_info);
+  fclose(PNG_file);
+  
+  /*  if (!ST_is_power_of_two(pImage->width) || !ST_is_power_of_two(pImage->height))
+    {
+      free(pImage->data);
+      return 0;
+    }
+  */
+  this->loadTexToGL (pImage, texture);  
+  
+  free(pImage->data);
+  
+  return true;
+#else /* HAVE_PNG_H */
+  if (verbose >=1)
+    printf ("sorry, but you did not compile with png-support.\nEither install SDL_image or libpng, and recompile to see the image\n");
+  return false;
+#endif /* HAVE_PNG_H */
+
+}
+
+#endif /* HAVE_SDL_SDL_IMAGE_H */
Index: orxonox/trunk/src/importer/material.h
===================================================================
--- orxonox/trunk/src/importer/material.h	(revision 3196)
+++ orxonox/trunk/src/importer/material.h	(revision 3196)
@@ -0,0 +1,145 @@
+/*!
+  \file material.h
+  \brief Contains the Material Class that handles Material for 3D-Objects.
+  \todo free SDL-surface when deleting Material.
+  \todo delete imgNameWithPath after use creation.
+*/
+
+#ifndef _MATERIAL_H
+#define _MATERIAL_H
+
+
+
+extern int verbose; //!< will be obsolete soon.
+
+#include "../stdincl.h"
+
+#if HAVE_CONFIG_H 
+#include <config.h> 
+#endif /* HAVE_CONFIG_H */
+
+#ifdef HAVE_SDL_SDL_IMAGE_H
+#include <SDL/SDL_image.h>
+#else
+// IMAGE LIBS //
+#ifdef HAVE_JPEGLIB_H
+extern "C"{         // This has to be done, because not a c++ lib
+#include <jpeglib.h>
+}
+#endif /* HAVE_JPEGLIB_H */
+#ifdef HAVE_PNG_H
+#include <png.h>
+#endif /* HAVE_PNG_H */
+#endif /* HAVE_SDL_SDL_IMAGE_H */
+
+//! Class to handle lists of paths.
+/**
+   \todo Ability to return Paths by itself.
+
+   It is simple to use, and good, for all PathList you want.
+   just create a new Pathlist, and add Paths.
+*/
+class PathList
+{
+ public:
+  PathList();
+  PathList(char* pName);
+
+  ~PathList();
+  void addPath (char* pName);
+  char* pathName;          //!< The Name of the current Path.
+  PathList* next;          //!< Pointer to the next Pathlist.
+};
+
+
+//! Class to handle Materials.
+class Material
+{
+ public:
+  Material ();
+  Material (char* mtlName);
+  Material* addMaterial(char* mtlName);
+  ~Material ();
+  void init(void);
+
+  Material* search (char* mtlName);
+  bool select (void);
+
+  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);
+
+
+ 
+  void addTexturePath(char* pathName);
+  char* searchTextureInPaths(char* texName) const;
+ // MAPPING //
+  void setDiffuseMap(char* dMap);
+  void setAmbientMap(char* aMap);
+  void setSpecularMap(char* sMap);
+  void setBump(char* bump);
+
+ private:
+  //! Struct to handle Infos about an Image
+  struct Image
+  {
+    int rowSpan;    //!< The count of the rows this Image has.
+    GLuint width;   //!< The width of the Image.
+    GLuint height;  //!< The height of the Image.
+    GLuint bpp;     //!< BitsPerPixel
+    GLuint type;    //!< Type of the Image.
+    GLubyte *data;  //!< The Image Data comes here! DANGER: uncompressed data.
+  };
+
+
+  char* name;        //!< The Name of the Material.
+  int illumModel;    //!< The IlluminationModel is either flat or smooth.
+  float diffuse [4]; //!< The diffuse color of the Material.
+  float ambient [4]; //!< The ambient color of the Material.
+  float specular [4];//!< The specular color of the Material.
+  float shininess;   //!< The shininess of the Material.
+  float transparency;//!< The transperency of the Material.
+
+  static PathList* pathList; //!< A pointer to the first element of Pathlist. This is static, because pathlists are global \todo copy this to the Globals.h or DataTank for deletion at the end.
+  
+  GLuint diffuseTexture; //!< The diffuse texture of the Material.
+  GLuint ambientTexture; //!< The ambient texture of the Material.
+  GLuint specularTexture;//!< The specular texture of the Material.
+  
+  bool diffuseTextureSet; //!< Chekcs if the diffuse texture is Set.
+  bool ambientTextureSet; //!< Chekcs if the ambient texture is Set.
+  bool specularTextureSet;//!< Chekcs if the specular texture is Set.
+
+  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
+
+  // TEXTURING
+  bool loadTexToGL (Image* pImage, GLuint* texture);
+
+  bool loadImage(char* imageName, GLuint* texture);
+#ifndef HAVE_SDL_SDL_IMAGE_H
+
+  bool loadBMP (char* bmpName, GLuint* texture);
+
+  bool loadJPG (char* jpgName, GLuint* texture);
+
+  /// TGA ///
+
+  bool loadTGA(const char * tgaName, GLuint* texture);
+  bool loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
+  bool loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
+
+  bool loadPNG(const char* pngName, GLuint* texture);
+#endif
+};
+#endif
Index: orxonox/trunk/src/importer/object.cc
===================================================================
--- orxonox/trunk/src/importer/object.cc	(revision 3196)
+++ orxonox/trunk/src/importer/object.cc	(revision 3196)
@@ -0,0 +1,1014 @@
+/* 
+   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"
+int verbose = 1; //! \todo should be GLOBAL
+using namespace std;
+
+/**
+   \brief Creates a 3D-Object, but does not load any 3D-models.
+
+   This Constructor is pretty useless, because why load no object in an object-loader??
+*/
+Object::Object ()
+{
+
+  this->initialize();
+
+  this->BoxObject();
+
+  this->importToGL ();
+
+  this->cleanup();
+}
+
+/**
+   \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)
+{
+  this->initialize();
+
+  this->importFile (fileName);
+
+  this->importToGL ();
+
+  this->cleanup();
+}
+
+/**
+   \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)
+{
+  this->initialize();
+  this->scaleFactor = scaling;
+
+  this->importFile (fileName);
+
+  this->importToGL ();
+
+  this->cleanup();
+}
+
+/**
+   \brief deletes an Object.
+
+   Looks if any from object allocated space is still in use, and if so deleted it.
+*/
+Object::~Object()
+{
+  if (verbose >= 2)
+    printf ("Deleting display Lists.\n");
+  Group* walker = this->firstGroup;
+  while (walker != NULL)
+    {
+      glDeleteLists (walker->listNumber, 1);
+      Group* delWalker = walker;
+      walker = walker->next;
+      delete delWalker;
+    }
+
+  if (this->objPath)
+    delete []this->objPath;
+  if (this->objFileName)
+    delete []this->objFileName;
+  if (this->mtlFileName)
+    delete []this->mtlFileName;
+
+  if (verbose >=2)
+    printf("Deleting Materials.\n");
+  if (this->material)
+    delete this->material;
+}
+
+
+/**
+   \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) const
+{
+  if (verbose >=2)
+    printf("drawing the 3D-Objects\n"); 
+  Group* walker = this->firstGroup;
+  while (walker != NULL)
+    {
+      if (verbose >= 3)
+	printf ("Drawing object %s\n", walker->name);
+      glCallList (walker->listNumber);
+      walker = walker->next;
+    }
+}
+
+/**
+   \brief Draws the Object number groupNumber
+   \param groupNumber The number of the group that will be displayed.
+
+   It does this by just calling the List that must have been created earlier.
+*/
+void Object::draw (int groupNumber) const 
+{
+  if (groupNumber >= this->groupCount)
+    {
+      if (verbose>=1)
+	printf ("You requested object number %i, but this File only contains of %i Objects.\n", groupNumber-1, this->groupCount);
+      return;
+    }
+  if (verbose >=2)
+    printf("drawing the requested 3D-Objects if found.\n"); 
+  Group* walker = this->firstGroup;
+  int counter = 0;
+  while (walker != NULL)
+    {
+      if (counter == groupNumber)
+	{
+	  if (verbose >= 2)
+	    printf ("Drawing object number %i named %s\n", counter, walker->name);
+	  glCallList (walker->listNumber);
+	  return;
+	}
+      ++counter;
+      walker = walker->next;
+    }
+  if (verbose >= 1)
+    printf("Object number %i in %s not Found.\n", groupNumber, this->objFileName);
+  return;
+
+}
+
+/**
+   \brief Draws the Object with a specific groupName
+   \param groupName The name of the group that will be displayed.
+
+   It does this by just calling the List that must have been created earlier.
+*/
+void Object::draw (char* groupName) const
+{
+  if (verbose >=2)
+    printf("drawing the requested 3D-Objects if found.\n"); 
+  Group* walker = this->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->next;
+    }
+  if (verbose >= 2)
+    printf("Object Named %s in %s not Found.\n", groupName, this->objFileName);
+  return;
+}
+
+/**
+   \returns Count of the Objects in this File
+*/
+int Object::getGroupCount (void) const
+{
+  return this->groupCount;
+}
+
+/**
+    \brief initializes the Object.
+
+    This Function initializes all the needed arrays, Lists and clientStates.
+    It also defines default values.
+*/
+bool Object::initialize (void)
+{
+  if (verbose >=3)
+    printf("new 3D-Object is being created\n"); 
+
+  // setting the start group;
+  this->firstGroup = new Group;
+  this->currentGroup = this->firstGroup;
+  this->groupCount = 0;
+  
+  this->initGroup (this->currentGroup);
+  this->objPath = NULL;
+  this->objFileName = NULL;
+  this->mtlFileName = NULL;
+  this->scaleFactor = 1;
+  this->material = new Material();
+
+  this->vertices = new Array();
+  this->vTexture = new Array();
+  this->normals = new Array();
+
+  return true;
+}
+
+/**
+   \brief initializes a new Group object
+   \param group the group that should be initialized.
+   \todo Maybe Group should be a Class, because it does a lot of stuff
+   
+*/
+bool Object::initGroup(Group* group)
+{
+  if (verbose >= 2)
+    printf("Adding new Group\n");
+  group->name = "";
+  group->faceMode = -1;
+  group->faceCount = 0;  
+  group->next = NULL;
+
+  group->firstFace = new Face;
+  this->initFace (group->firstFace);
+  group->currentFace = group->firstFace;
+}
+
+/**
+   \brief initializes a new Face. (sets default Values)
+   \param face The face to initialize
+*/
+bool Object::initFace (Face* face)
+{
+  face->vertexCount = 0;
+
+  face->firstElem = NULL;
+  
+  face->materialString = NULL;
+  
+  face->next = NULL;
+
+  return true;
+}
+
+/**
+   \brief finalizes an Object.
+   This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process.
+*/
+bool Object::cleanup(void)
+{
+  if (verbose >=2)
+    printf("cleaning up the 3D-Object to save Memory.\n");
+
+  if (this->vertices)
+    delete this->vertices;
+  if (this->vTexture)
+    delete this->vTexture;
+  if (this->normals)
+    delete this->normals;
+
+  this->cleanupGroup(this->firstGroup);
+  return true; 
+}
+
+/**
+   \brief Cleans up all groups starting from group.
+   \param group the first Group to clean
+*/
+bool Object::cleanupGroup (Group* group)
+{
+  if (verbose>=4)
+    printf ("Cleaning up group\n");
+  if (group->firstFace != NULL)
+    {
+      cleanupFace (group->firstFace);
+      delete group->firstFace;
+    }
+
+  if (group->next !=NULL)
+    cleanupGroup (group->next);
+  return true;
+}
+
+/**
+   \brief Cleans up all Faces starting from face until NULL is reached.
+   \param face the first face to clean.
+*/
+bool Object::cleanupFace (Face* face)
+{
+  if (verbose>=4)
+    printf ("Cleaning up Face\n");
+
+  if (face->materialString != NULL)
+      delete []face->materialString;
+  if (face->firstElem != NULL)
+    {
+      this->cleanupFaceElement(face->firstElem);
+      delete face->firstElem;
+    }
+      
+  if (face->next != NULL)
+    {
+      this->cleanupFace (face->next);
+      delete face->next;
+    }
+      
+}
+
+
+/**
+   \brief Cleans up all FaceElements starting from faceElem.
+   \param faceElem the first FaceElement to clean.
+*/
+bool Object::cleanupFaceElement(FaceElement* faceElem)
+{
+  if (faceElem->next != NULL)
+    {
+      this->cleanupFaceElement (faceElem->next);
+      delete faceElem->next;
+    }
+}
+
+/**
+   \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);
+
+
+#ifdef __WIN32__
+  // win32 path reading
+  char pathSplitter= '\\';
+#else /* __WIN32__ */
+  // unix path reading
+  char pathSplitter='/';
+#endif /* __WIN32__ */
+  char* tmpName = fileName;
+  if (tmpName[0] == pathSplitter)
+    tmpName++;
+  char* name = tmpName;
+  while (( tmpName = strchr (tmpName+1, pathSplitter)))
+    {
+      name = tmpName+1;
+    }
+  this->objPath = new char[name-fileName];
+  strncpy(this->objPath, fileName, name-fileName);
+  this->objPath[name-fileName] = '\0';
+  if (verbose >=2)
+    if (strlen(objPath)> 0)
+      {
+	printf("Resolved file %s to folder: %s.\n", name, objPath);
+      }
+    else
+      printf("Resolved file %s.\n", name);
+  
+  if (this->material)
+    this->material->addTexturePath(this->objPath);
+  this->objFileName = new char[strlen(name)+1];
+  strcpy (this->objFileName, name);
+  this->readFromObjFile ();
+  return true;
+}
+
+/**
+   \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
+*/
+bool Object::readFromObjFile (void)
+{
+  char* fileName = new char [strlen(objPath)+strlen(objFileName)+1];
+  if (this->objFileName != NULL && !strcmp(this->objFileName, ""))
+    return false;
+  strcpy(fileName, this->objPath);
+  strcat(fileName, this->objFileName);
+
+  ifstream* OBJ_FILE = new ifstream(fileName);
+  if (OBJ_FILE->fail())
+    {
+      if (verbose >=1)
+	printf ("unable to open .OBJ file: %s\n Loading Box Object instead.\n", fileName);
+      BoxObject();
+      OBJ_FILE->close();
+      delete []fileName;
+      delete OBJ_FILE;
+      return false;
+    }
+  if (verbose >=2)
+    printf ("Reading from opened file %s\n", fileName);
+  char Buffer[10000];
+  while(!OBJ_FILE->eof())
+    {
+      OBJ_FILE->getline(Buffer, 10000);
+      if (verbose >=4)
+	printf ("Read input line: %s\n", Buffer);
+      
+
+      // case vertice
+      if (!strncmp(Buffer, "v ", 2))
+	{
+	  this->readVertex(Buffer+2);
+	}
+
+      // case face
+      else if (!strncmp(Buffer, "f ", 2))
+	{
+	  this->readFace (Buffer+2);
+	}
+      
+      else if (!strncmp(Buffer, "mtllib ", 7))
+	{
+	  this->readMtlLib (Buffer+7);
+	}
+
+      else if (!strncmp(Buffer, "usemtl ", 7))
+	{
+	  this->readUseMtl (Buffer+7);
+	}
+
+      // case VertexNormal
+      else if (!strncmp(Buffer, "vn ", 3))
+	{
+	  this->readVertexNormal(Buffer+3);
+	}
+      
+      // case VertexTextureCoordinate
+      else if (!strncmp(Buffer, "vt ", 3))
+	{
+	  this->readVertexTexture(Buffer+3);
+	}
+      // case group
+      else if (!strncmp(Buffer, "g ", 2))
+	{
+	  this->readGroup (Buffer+2);
+	}
+      else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented
+	{
+	  if (verbose >= 2)
+	    printf("smoothing groups not supportet yet. line: %s\n", Buffer);
+	}
+    }
+  OBJ_FILE->close();
+  delete OBJ_FILE;
+  delete []fileName;
+  return true;
+
+}
+
+/**
+   \brief parses a group String
+   \param groupString the new Group to create
+
+   This function initializes a new Group. 
+   With it you should be able to import .obj-files with more than one Objects inside. 
+*/
+bool Object::readGroup (char* groupString)
+{
+  if (verbose >=3)
+    printf ("Read Group: %s.\n", groupString);
+  if (this->groupCount != 0 && this->currentGroup->faceCount>0)
+    {
+      //      finalizeGroup(currentGroup);
+      this->currentGroup = this->currentGroup->next = new Group;
+      this->initGroup(this->currentGroup);
+    }
+  // setting the group name if not default.
+  if (strcmp(groupString, "default"))
+    {
+      this->currentGroup->name = new char [strlen(groupString)+1];
+      strcpy(this->currentGroup->name, groupString);
+    }
+  ++this->groupCount;
+
+}
+
+/**
+   \brief parses a vertex-String
+   \param vertexString The String that will be parsed.
+
+   If a vertex line is found this function will inject it into the vertex-Array
+*/
+bool Object::readVertex (char* vertexString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  float subbuffer3;
+  sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
+  if (verbose >= 3)
+    printf ("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3);
+  this->vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor);
+  return true;
+}
+
+/**
+   \brief parses a face-string
+   \param faceString The String that will be parsed.
+
+   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.
+*/
+bool Object::readFace (char* faceString)
+{
+  if (this->currentGroup->faceCount >0)
+    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new Face;
+  this->initFace (this->currentGroup->currentFace);
+
+  FaceElement* tmpElem = this->currentGroup->currentFace->firstElem = new FaceElement;
+  tmpElem->next = NULL;
+  while(strcmp (faceString, "\0"))
+    {
+      if (this->currentGroup->currentFace->vertexCount>0)
+	  tmpElem = tmpElem->next = new FaceElement;
+      tmpElem->next = NULL;
+
+      char tmpValue [50];
+      int tmpLen;
+      char* vertex = NULL;
+      char* texture = NULL;
+      char* normal = NULL;
+
+      sscanf (faceString, "%s", tmpValue);
+      tmpLen = strlen(tmpValue);
+      vertex = tmpValue;
+
+      if ((texture = strstr (vertex, "/")) != NULL)
+	{
+	  texture[0] = '\0';
+	  texture ++;
+	  
+	  if ((normal = strstr (texture, "/")) !=NULL)
+	    {
+	      normal[0] = '\0';
+	      normal ++;
+	    }	  
+	}
+      if (vertex)
+	tmpElem->vertexNumber = atoi(vertex)-1;
+      else
+	tmpElem->vertexNumber = -1;
+      if (texture)
+	tmpElem->texCoordNumber = atoi(texture)-1;
+      else
+	tmpElem->texCoordNumber = -1;
+      if (normal)
+	tmpElem->normalNumber = atoi(normal)-1;
+      else
+	tmpElem->normalNumber = -1;
+
+      faceString += tmpLen;
+      if (strcmp (faceString, "\0"))
+	faceString++;
+      this->currentGroup->currentFace->vertexCount++;
+    }
+
+  this->currentGroup->faceCount += this->currentGroup->currentFace->vertexCount -2;
+}
+
+/**
+   \brief parses a vertexNormal-String
+   \param normalString The String that will be parsed.
+
+   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
+*/
+bool Object::readVertexNormal (char* normalString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  float subbuffer3;
+  sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
+  if (verbose >=3 )
+    printf("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);
+  this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3);
+  return true;
+}
+
+/**
+   \brief parses a vertexTextureCoordinate-String
+   \param vTextureString The String that will be parsed.
+
+   If a vertexTextureCoordinate line is found,
+   this function will inject it into the vertexTexture-Array
+*/
+bool Object::readVertexTexture (char* vTextureString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2);
+  if (verbose >=3 )
+    printf("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);
+  this->vTexture->addEntry(subbuffer1);
+  this->vTexture->addEntry(subbuffer2);
+  return true;
+}
+
+/** 
+    \brief Function to read in a mtl File.
+    \param mtlFile The .mtl file to read
+
+    This Function parses all Lines of an mtl File.
+    The reason for it not to be in the materials-class is,
+    that a material does not have to be able to read itself in from a File.
+
+*/
+bool Object::readMtlLib (char* mtlFile)
+{
+  this->mtlFileName = new char [strlen(mtlFile)+1];
+  strcpy(this->mtlFileName, mtlFile);
+  char* fileName = new char [strlen(objPath) + strlen(this->mtlFileName)+1];
+  strcpy(fileName, this->objPath);
+  strcat(fileName, this->mtlFileName);
+  
+
+  if (verbose >=2)
+    printf ("Opening mtlFile: %s\n", fileName);
+
+  ifstream* MTL_FILE = new ifstream (fileName);
+  if (MTL_FILE->fail())
+    {
+      if (verbose >= 1)
+	printf ("unable to open file: %s\n", fileName);
+      MTL_FILE->close();
+      delete []fileName;
+      delete MTL_FILE;
+      return false;
+    }
+  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 ", 7))
+	{
+	  tmpMat = tmpMat->addMaterial(Buffer+7);
+	  //	  printf ("%s, %p\n", tmpMat->getName(), tmpMat);
+	}
+      // setting a illumMode
+      else if (!strncmp(Buffer, "illum ", 6))
+	{
+	  tmpMat->setIllum(Buffer+6);
+
+	}
+      // setting Diffuse Color
+      else if (!strncmp(Buffer, "Kd ", 3))
+	{
+	  tmpMat->setDiffuse(Buffer+3);
+	}
+      // setting Ambient Color
+      else if (!strncmp(Buffer, "Ka ", 3))
+	{
+	  tmpMat->setAmbient(Buffer+3);
+	}
+      // setting Specular Color
+      else if (!strncmp(Buffer, "Ks ", 3))
+	{
+	  tmpMat->setSpecular(Buffer+3);
+	}
+      // setting The Specular Shininess
+      else if (!strncmp(Buffer, "Ns ", 3))
+	{
+	  tmpMat->setShininess(Buffer+3);
+	}
+      // setting up transparency
+      else if (!strncmp(Buffer, "d ", 2))
+	{
+	  tmpMat->setTransparency(Buffer+2);
+	}
+      else if (!strncmp(Buffer, "Tf ", 3))
+	{
+	  tmpMat->setTransparency(Buffer+3);
+	}
+      
+      else if (!strncmp(Buffer, "map_Kd ", 7))
+	{
+	  tmpMat->setDiffuseMap(Buffer+7);
+	}
+      else if (!strncmp(Buffer, "map_Ka ", 7))
+	{
+	  tmpMat->setAmbientMap(Buffer+7);
+	}
+      else if (!strncmp(Buffer, "map_Ks ", 7))
+	{
+	  tmpMat->setSpecularMap(Buffer+7);
+	}
+      else if (!strncmp(Buffer, "bump ", 5))
+	{
+	  tmpMat->setBump(Buffer+7);
+	}
+     
+
+    }
+  MTL_FILE->close();
+  delete []fileName;
+  delete MTL_FILE;
+  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 (!this->mtlFileName)
+    {
+      if (verbose >= 1)
+	printf ("Not using new defined material, because no mtlFile found yet\n");
+      return false;
+    }
+      
+  if (this->currentGroup->faceCount >0)
+    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new Face;
+  this->initFace (this->currentGroup->currentFace);
+  
+  this->currentGroup->currentFace->materialString = new char[strlen(matString)+1];
+  strcpy (this->currentGroup->currentFace->materialString, matString);
+  
+  if (this->currentGroup->faceCount == 0)
+    this->currentGroup->faceCount ++;
+
+}
+
+/**
+   \brief reads and includes the Faces/Materials into the openGL state Machine
+*/
+bool Object::importToGL (void)
+{
+
+  // finalize the Arrays
+  this->vertices->finalizeArray();
+  this->vTexture->finalizeArray();
+  if (normals->getCount() == 0) // vertices-Array must be uilt for this
+    this->buildVertexNormals();
+  this->normals->finalizeArray();
+
+  this->currentGroup = this->firstGroup;
+
+  while (this->currentGroup != NULL)
+    {
+
+      // creating a glList for the Group
+      if ((this->currentGroup->listNumber = glGenLists(1)) == 0)
+	{
+	  printf ("list could not be created for this Object\n");
+	  return false;
+	}
+      glNewList (this->currentGroup->listNumber, GL_COMPILE);
+
+      // Putting Faces to GL
+      Face* tmpFace = this->currentGroup->firstFace;
+      while (tmpFace != NULL)
+	{
+	  if (tmpFace->vertexCount == 0 && tmpFace->materialString != NULL)
+	    {
+	      if (this->currentGroup->faceMode != -1)
+		glEnd();
+	      this->currentGroup->faceMode = 0;
+	      if (verbose >= 2)
+		printf ("using material %s for coming Faces.\n", tmpFace->materialString);
+	      Material* tmpMat;
+	      if ((tmpMat = material->search(tmpFace->materialString)) != NULL)
+		tmpMat->select();
+
+	    }
+
+	  else if (tmpFace->vertexCount == 3)
+	    {
+	      if (this->currentGroup->faceMode != 3)
+		{
+		  if (this->currentGroup->faceMode != -1)
+		    glEnd();
+		  glBegin(GL_TRIANGLES);
+		}
+	      
+	      this->currentGroup->faceMode = 3;
+	      if (verbose >=3)
+		printf ("found triag.\n");
+	    }
+	  
+	  else if (tmpFace->vertexCount == 4)
+	    {
+	      if (this->currentGroup->faceMode != 4)
+		{
+		  if (this->currentGroup->faceMode != -1)
+		    glEnd();
+		  glBegin(GL_QUADS);
+		}
+	      this->currentGroup->faceMode = 4;
+	      if (verbose >=3 )
+		printf ("found quad.\n");
+	    }
+	  
+	  else if (tmpFace->vertexCount > 4)
+	    {
+	      if (this->currentGroup->faceMode != -1)
+		glEnd();
+	      glBegin(GL_POLYGON);
+	      if (verbose >=3)
+		printf ("Polygon with %i faces found.", tmpFace->vertexCount);
+	      this->currentGroup->faceMode = tmpFace->vertexCount;
+	    }
+	  
+	  FaceElement* tmpElem = tmpFace->firstElem;
+	  while (tmpElem != NULL)
+	    {
+	      //      printf ("%s\n", tmpElem->value);
+	      this->addGLElement(tmpElem);
+	      tmpElem = tmpElem->next;
+	    }
+	  tmpFace = tmpFace->next;
+	}
+      glEnd();
+      glEndList();
+
+      this->currentGroup = this->currentGroup->next;
+    } 
+}
+
+/**
+   \brief Adds a Face-element (one vertex of a face) with all its information. 
+   \param elem The FaceElement to add to the OpenGL-environment.
+
+   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 (FaceElement* elem)
+{
+  if (verbose >=3)
+    printf ("importing grafical Element to openGL.\n");
+
+  if (elem->texCoordNumber != -1)
+    glTexCoord2fv(this->vTexture->getArray() + elem->texCoordNumber * 2);
+  if (elem->normalNumber != -1)
+    glNormal3fv(this->normals->getArray() + elem->normalNumber * 3);
+  if (elem->vertexNumber != -1)
+    glVertex3fv(this->vertices->getArray() + elem->vertexNumber * 3);
+
+}
+
+/**
+   \brief A routine that is able to create normals.
+
+   The algorithm does the following:
+   1. It calculates creates Vectors for each normale, and sets them to zero.
+   2. It then Walks through a) all the Groups b) all the Faces c) all the FaceElements
+   3. It searches for a points two neighbours per Face, takes Vecotrs to them calculates FaceNormals and adds it to the Points Normal.
+   4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array.
+*/
+bool Object::buildVertexNormals ()
+{
+  
+  if (verbose >=2)
+    printf("Normals are being calculated.\n");
+
+  Vector* normArray = new Vector [vertices->getCount()/3];
+  for (int i=0; i<vertices->getCount()/3;i++)
+    normArray[i] = Vector(.0,.0,.0);
+  
+  int firstTouch;
+  int secondTouch;
+  Vector prevV;
+  Vector nextV;
+  Vector curV;
+
+  Group* tmpGroup = firstGroup;
+  while (tmpGroup)
+    {
+      Face* tmpFace = tmpGroup->firstFace;
+      while (tmpFace)
+	{
+	  if (tmpFace->firstElem)
+	    {
+	      FaceElement* firstElem = tmpFace->firstElem;
+	      FaceElement* prevElem;
+	      FaceElement* curElem = firstElem;
+	      FaceElement* nextElem;
+	      FaceElement* lastElem;
+	      // find last Element of the Chain. !! IMPORTANT:the last Element of the Chain must point to NULL, or it will resolv into an infinity-loop.
+	      while (curElem)
+		{
+		  prevElem = curElem;
+		  curElem = curElem->next;
+		}
+	      lastElem = prevElem;
+	      
+	      curElem = firstElem;
+	      for (int j=0; j<tmpFace->vertexCount; j++)
+		{
+		  if (!(nextElem = curElem->next))
+		    nextElem = firstElem;
+		  curElem->normalNumber = curElem->vertexNumber;
+		  
+		  curV = Vector (vertices->getArray()[curElem->vertexNumber*3], vertices->getArray()[curElem->vertexNumber*3+1], vertices->getArray()[curElem->vertexNumber*3+2]);
+		  prevV = Vector (vertices->getArray()[prevElem->vertexNumber*3], vertices->getArray()[prevElem->vertexNumber*3+1], vertices->getArray()[prevElem->vertexNumber*3+2]) - curV;
+		  nextV = Vector (vertices->getArray()[nextElem->vertexNumber*3], vertices->getArray()[nextElem->vertexNumber*3+1], vertices->getArray()[nextElem->vertexNumber*3+2]) - curV;
+		  normArray[curElem->vertexNumber] = normArray[curElem->vertexNumber] + nextV.cross(prevV);
+
+		  prevElem = curElem;
+		  curElem = curElem->next;
+		}
+	    }
+	  tmpFace = tmpFace->next;
+	}
+      tmpGroup = tmpGroup->next;
+    }
+
+  for (int i=0; i<vertices->getCount()/3;i++)
+    {
+      normArray[i].normalize();
+      if (verbose >=3)
+	printf ("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
+
+      this->normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z);
+
+    }
+  delete []normArray; 
+  
+}
+
+
+/**
+   \brief Includes a default object
+
+   This will inject a Cube, because this is the most basic object.
+*/
+void Object::BoxObject(void)
+{
+  this->readVertex ("-0.5 -0.5 0.5");
+  this->readVertex ("0.5 -0.5 0.5");
+  this->readVertex ("-0.5 0.5 0.5");
+  this->readVertex ("0.5 0.5 0.5");
+  this->readVertex ("-0.5 0.5 -0.5");
+  this->readVertex ("0.5 0.5 -0.5");
+  this->readVertex ("-0.5 -0.5 -0.5");
+  this->readVertex ("0.5 -0.5 -0.5");
+
+  this->readVertexTexture ("0.0 0.0");
+  this->readVertexTexture ("1.0 0.0");
+  this->readVertexTexture ("0.0 1.0");
+  this->readVertexTexture ("1.0 1.0");
+  this->readVertexTexture ("0.0 2.0");
+  this->readVertexTexture ("1.0 2.0");
+  this->readVertexTexture ("0.0 3.0");
+  this->readVertexTexture ("1.0 3.0");
+  this->readVertexTexture ("0.0 4.0");
+  this->readVertexTexture ("1.0 4.0");
+  this->readVertexTexture ("2.0 0.0");
+  this->readVertexTexture ("2.0 1.0");
+  this->readVertexTexture ("-1.0 0.0");
+  this->readVertexTexture ("-1.0 1.0");
+
+  this->readVertexNormal ("0.0 0.0 1.0");
+  this->readVertexNormal ("0.0 0.0 1.0");
+  this->readVertexNormal ("0.0 0.0 1.0");
+  this->readVertexNormal ("0.0 0.0 1.0");
+  this->readVertexNormal ("0.0 1.0 0.0");
+  this->readVertexNormal ("0.0 1.0 0.0");
+  this->readVertexNormal ("0.0 1.0 0.0");
+  this->readVertexNormal ("0.0 1.0 0.0");
+  this->readVertexNormal ("0.0 0.0 -1.0");
+  this->readVertexNormal ("0.0 0.0 -1.0");
+  this->readVertexNormal ("0.0 0.0 -1.0");
+  this->readVertexNormal ("0.0 0.0 -1.0");
+  this->readVertexNormal ("0.0 -1.0 0.0");
+  this->readVertexNormal ("0.0 -1.0 0.0");
+  this->readVertexNormal ("0.0 -1.0 0.0");
+  this->readVertexNormal ("0.0 -1.0 0.0");
+  this->readVertexNormal ("1.0 0.0 0.0");
+  this->readVertexNormal ("1.0 0.0 0.0");
+  this->readVertexNormal ("1.0 0.0 0.0");
+  this->readVertexNormal ("1.0 0.0 0.0");
+  this->readVertexNormal ("-1.0 0.0 0.0");
+  this->readVertexNormal ("-1.0 0.0 0.0");
+  this->readVertexNormal ("-1.0 0.0 0.0");
+  this->readVertexNormal ("-1.0 0.0 0.0");
+
+  /* normaleLess-testingMode
+  this->readFace ("1 2 4 3");
+  this->readFace ("3 4 6 5");
+  this->readFace ("5 6 8 7");
+  this->readFace ("7 8 2 1");
+  this->readFace ("2 8 6 4");
+  this->readFace ("7 1 3 5");
+  */
+
+  this->readFace ("1/1/1 2/2/2 4/4/3 3/3/4");
+  this->readFace ("3/3/5 4/4/6 6/6/7 5/5/8");
+  this->readFace ("5/5/9 6/6/10 8/8/11 7/7/12");
+  this->readFace ("7/7/13 8/8/14 2/10/15 1/9/16");
+  this->readFace ("2/2/17 8/11/18 6/12/19 4/4/20");
+  this->readFace ("7/13/21 1/1/22 3/3/23 5/14/24");
+
+}
Index: orxonox/trunk/src/importer/object.h
===================================================================
--- orxonox/trunk/src/importer/object.h	(revision 3196)
+++ orxonox/trunk/src/importer/object.h	(revision 3196)
@@ -0,0 +1,123 @@
+/*!
+  \file object.h
+  \brief Contains the Object Class that handles 3D-Objects
+*/
+
+#ifndef _OBJECT_H
+#define _OBJECT_H
+
+#include "../stdincl.h"
+
+#include "array.h"
+#include "material.h"
+#include "vector.h"
+#include <fstream>
+
+using namespace std;
+
+
+
+
+//! 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 ();
+  
+  void draw (void) const;
+  void draw (int groupNumber) const;
+  void draw (char* groupName) const;
+  int getGroupCount() const;
+
+ private:
+  //! This is the placeholder of one Vertex beloning to a Face.
+  struct FaceElement 
+  {
+    int vertexNumber;    //!< The number of the Vertex out of the Array* vertices, this vertex points to.
+    int normalNumber;    //!< The number of the Normal out of the Array* normals, this vertex points to.
+    int texCoordNumber;  //!< The number of the textureCoordinate out of the Array* vTexture, this vertex points to.
+    FaceElement* next;   //!< Point to the next FaceElement in this List.
+  };
+
+  //! This is the placeholder of a Face belonging to a Group of Faces.
+  /**
+     \todo take Material to a call for itself.
+
+     This can also be a Material-Change switch. 
+     That means if you want to change a Material inside of a group,
+     you can create an empty face and apply a material to it, and the Importer will cahnge Colors
+  */
+  struct Face 
+  {
+    int vertexCount;        //!< The Count of vertices this Face has.
+    FaceElement* firstElem; //!< Points to the first Vertex (FaceElement) of this Face.
+
+    char* materialString;   //!< The Name of the Material to which to Change.
+
+    Face* next;             //!< Pointer to the next Face.
+  }; 
+
+  //! Group to handle multiple Objects per obj-file.
+  struct Group
+  {
+    char* name;         //!< the Name of the Group. this is an identifier, that can be accessed via the draw (char* name) function.
+
+    GLuint listNumber;  //!< The number of the GL-List this Group gets.
+    Face* firstFace;    //!< The first Face in this group.
+    Face* currentFace;  //!< The current Face in this Group (the one we are currently working with.)
+    int faceMode;       //!< The Mode the Face is in: initially -1, 0 for FaceList opened, 1 for Material,  3 for triangle, 4 for Quad, 5+ for Poly \todo ENUM...
+    int faceCount;      //!< The Number of Faces this Group holds.
+
+    Group* next;        //!< Pointer to the next Group.
+  };
+
+
+  Array* vertices;      //!< The Array that handles the Vertices.
+  int verticesCount;    //!< A global Counter for vertices.
+  Array* normals;       //!< The Array that handles the Normals.
+  Array* vTexture;      //!< The Array that handles the VertexTextureCoordinates.
+
+  
+  Group* firstGroup;    //!< The first of all groups.
+  Group* currentGroup;  //!< The currentGroup. this is the one we will work with.
+  int groupCount;       //!< The Count of Groups.
+
+  Material* material;   //!< Initial pointer to the Material. This can hold many materials, because Material can be added with Material::addMaterial(..)
+  float scaleFactor;    //!< The Factor with which the Object hould be scaled. \todo maybe one wants to scale the Object after Initialisation
+
+  char* objPath;        //!< The Path wher the obj and mtl-file are located.
+  char* objFileName;    //!< The Name of the obj-file.
+  char* mtlFileName;    //!< The Name of the mtl-file (parsed out of the obj-file)
+
+  bool initialize (void);
+  bool initGroup(Group* group);
+  bool initFace (Face* face);
+  bool cleanup(void);
+  bool cleanupGroup(Group* group);
+  bool cleanupFace(Face* face);
+  bool cleanupFaceElement(FaceElement* faceElem);
+
+  ///// readin ///
+  bool importFile (char* fileName);
+  bool readFromObjFile (void);
+  
+  bool readGroup (char* groupString);
+  bool readVertex (char* vertexString);
+  bool readFace (char* faceString);
+  bool readVertexNormal (char* normalString);
+  bool readVertexTexture (char* vTextureString);
+  bool readMtlLib (char* matFile);
+  bool readUseMtl (char* mtlString);
+
+  bool importToGL (void);
+  bool addGLElement (FaceElement* elem);
+
+  bool buildVertexNormals ();
+
+  void BoxObject (void);
+};
+
+#endif
Index: orxonox/trunk/src/importer/stdincl.h
===================================================================
--- orxonox/trunk/src/importer/stdincl.h	(revision 3196)
+++ orxonox/trunk/src/importer/stdincl.h	(revision 3196)
@@ -0,0 +1,28 @@
+/*!
+  \file stdincl.h
+  \brief This file includes default headers that nearly every Class needs.
+  
+  no Class is defined here, but many headers to classes, and more general Headers like the openGL-header.
+*/
+
+#ifndef STDINCL_H
+#define STDINCL_H
+
+#define null 0   //!< null
+
+#ifdef __WIN32__
+#include <windows.h>
+#endif
+
+#ifndef __APPLE__
+#include <SDL/SDL.h>
+#include <GL/gl.h>
+#include <GL/glu.h>
+#else
+#include <SDL.h>
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#endif
+
+
+#endif
Index: orxonox/trunk/src/importer/toDo
===================================================================
--- orxonox/trunk/src/importer/toDo	(revision 3196)
+++ orxonox/trunk/src/importer/toDo	(revision 3196)
@@ -0,0 +1,6 @@
+toDO list for orxonox/importer:
+
+groupName is set on the wrong place, if set on the right programm will kill itself.
+
+ray03.obj from nomenes gives back a free, that has no reference.
+
Index: orxonox/trunk/src/importer/vector.cc
===================================================================
--- orxonox/trunk/src/importer/vector.cc	(revision 3196)
+++ orxonox/trunk/src/importer/vector.cc	(revision 3196)
@@ -0,0 +1,844 @@
+
+
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Christian Meyer 
+   co-programmer: Patrick Boenzli : Vector::scale()
+                                    Vector::abs()
+   
+   Quaternion code borrowed from an Gamasutra article by Nick Bobick and Ken Shoemake
+*/
+
+
+#include "vector.h"
+
+
+using namespace std;
+
+/**
+   \brief add two vectors
+   \param v: the other vector
+   \return the sum of both vectors
+*/
+Vector Vector::operator+ (const Vector& v) const
+{
+  Vector r;
+
+  r.x = x + v.x;
+  r.y = y + v.y;
+  r.z = z + v.z;
+  
+  return r;
+}
+
+/**
+   \brief subtract a vector from another
+   \param v: the other vector
+   \return the difference between the vectors
+*/
+Vector Vector::operator- (const Vector& v) const
+{
+  Vector r;
+  
+  r.x = x - v.x;
+  r.y = y - v.y;
+  r.z = z - v.z;
+  
+  return r;
+}
+
+/**
+   \brief calculate the dot product of two vectors
+   \param v: the other vector
+   \return the dot product of the vectors
+*/
+float Vector::operator* (const Vector& v) const
+{
+  return x*v.x+y*v.y+z*v.z;
+}
+
+/**
+   \brief multiply a vector with a float
+   \param f: the factor
+   \return the vector multipied by f
+*/
+Vector Vector::operator* (float f) const
+{  
+  Vector r;
+  
+  r.x = x * f;
+  r.y = y * f;
+  r.z = z * f;
+  
+  return r;
+}
+
+/**
+   \brief divide a vector with a float
+   \param f: the divisor
+   \return the vector divided by f   
+*/
+Vector Vector::operator/ (float f) const
+{
+  Vector r;
+  
+  if( f == 0.0)
+  {
+    // Prevent divide by zero
+    return Vector (0,0,0);
+  }
+  
+  r.x = x / f;
+  r.y = y / f;
+  r.z = z / f;
+  
+  return r;
+}
+
+/**
+   \brief calculate the dot product of two vectors
+   \param v: the other vector
+   \return the dot product of the vectors
+*/
+float Vector::dot (const Vector& v) const
+{
+  return x*v.x+y*v.y+z*v.z;
+}
+
+/**
+  \brief calculate the cross product of two vectors
+  \param v: the other vector
+	\return the cross product of the vectors
+*/
+Vector Vector::cross (const Vector& v) const
+{
+  Vector r;
+  
+  r.x = y * v.z - z * v.y;
+  r.y = z * v.x - x * v.z;
+  r.z = x * v.y - y * v.x;
+  
+  return r;
+}
+  
+/**
+   \brief normalizes the vector to lenght 1.0
+*/
+void Vector::normalize ()
+{
+  float l = len();
+  
+  if( l == 0.0)
+  {
+    // Prevent divide by zero
+    return;
+  }
+  
+  x = x / l;
+  y = y / l;
+  z = z / l;
+}
+
+
+/**
+   \bref returns the voctor normalized to length 1.0
+*/
+
+Vector* Vector::getNormalized()
+{
+  float l = len();
+  if(l != 1.0)
+    {
+      return this;
+    }
+  else if(l == 0.0)
+    {
+      return 0;
+    }
+  
+  Vector *normalizedVector = new Vector(x / l, y /l, z / l);
+  return normalizedVector;
+}
+
+
+void Vector::scale(const Vector& v)
+{
+  x *= v.x;
+  y *= v.y;
+  z *= v.z;
+}
+
+ 
+/**
+   \brief calculates the lenght of the vector
+   \return the lenght of the vector
+*/
+float Vector::len () const
+{
+  return sqrt (x*x+y*y+z*z);
+}
+
+
+
+Vector Vector::abs() 
+{
+  Vector v(fabs(x), fabs(y), fabs(z));
+  return v;
+}
+
+
+/**
+   \brief calculate the angle between two vectors in radiances
+   \param v1: a vector
+   \param v2: another vector
+   \return the angle between the vectors in radians
+*/
+float angle_rad (const Vector& v1, const Vector& v2)
+{
+  return acos( v1 * v2 / (v1.len() * v2.len()));
+}
+
+
+/**
+   \brief calculate the angle between two vectors in degrees
+   \param v1: a vector
+   \param v2: another vector
+   \return the angle between the vectors in degrees
+*/
+float angle_deg (const Vector& v1, const Vector& v2)
+{
+  float f;
+  f = acos( v1 * v2 / (v1.len() * v2.len()));
+  return f * 180 / PI;
+}
+
+/**
+	\brief creates a multiplicational identity Quaternion
+*/
+Quaternion::Quaternion ()
+{
+	w = 1;
+	v = Vector(0,0,0);
+}
+
+/**
+	\brief turns a rotation along an axis into a Quaternion
+	\param angle: the amount of radians to rotate
+	\param axis: the axis to rotate around
+*/
+Quaternion::Quaternion (float angle, const Vector& axis)
+{
+	w = cos(angle/2);
+	v = axis * sin(angle/2);
+}
+
+/**
+   \brief calculates a look_at rotation
+   \param dir: the direction you want to look
+   \param up: specify what direction up should be
+   
+   Mathematically this determines the rotation a (0,0,1)-Vector has to undergo to point
+   the same way as dir. If you want to use this with cameras, you'll have to reverse the
+   dir Vector (Vector(0,0,0) - your viewing direction) or you'll point the wrong way. You
+   can use this for meshes as well (then you do not have to reverse the vector), but keep 
+   in mind that if you do that, the model's front has to point in +z direction, and left 
+   and right should be -x or +x respectively or the mesh wont rotate correctly.
+*/
+Quaternion::Quaternion (const Vector& dir, const Vector& up)
+{
+  Vector z = dir;
+  z.normalize(); 
+  Vector x = up.cross(z);
+  x.normalize(); 
+  Vector y = z.cross(x);
+  
+  float m[4][4];
+  m[0][0] = x.x;
+  m[0][1] = x.y;
+  m[0][2] = x.z;
+  m[0][3] = 0;
+  m[1][0] = y.x;
+  m[1][1] = y.y;
+  m[1][2] = y.z;
+  m[1][3] = 0;
+  m[2][0] = z.x;
+  m[2][1] = z.y;
+  m[2][2] = z.z;
+  m[2][3] = 0;
+  m[3][0] = 0;
+  m[3][1] = 0;
+  m[3][2] = 0;
+  m[3][3] = 1;
+  
+  *this = Quaternion (m);
+}
+
+/**
+	\brief calculates a rotation from euler angles
+	\param roll: the roll in radians
+	\param pitch: the pitch in radians
+	\param yaw: the yaw in radians
+	
+	I DO HONESTLY NOT EXACTLY KNOW WHICH ANGLE REPRESENTS WHICH ROTATION. And I do not know 
+	in what order they are applied,	I just copy-pasted the code.
+*/
+Quaternion::Quaternion (float roll, float pitch, float yaw)
+{
+	float cr, cp, cy, sr, sp, sy, cpcy, spsy;
+	
+	// calculate trig identities
+	cr = cos(roll/2);
+	cp = cos(pitch/2);
+	cy = cos(yaw/2);
+	
+	sr = sin(roll/2);
+	sp = sin(pitch/2);
+	sy = sin(yaw/2);
+	
+	cpcy = cp * cy;
+	spsy = sp * sy;
+	
+	w = cr * cpcy + sr * spsy;
+	v.x = sr * cpcy - cr * spsy;
+	v.y = cr * sp * cy + sr * cp * sy;
+	v.z = cr * cp * sy - sr * sp * cy;
+}
+
+/**
+	\brief rotates one Quaternion by another
+	\param q: another Quaternion to rotate this by
+	\return a quaternion that represents the first one rotated by the second one (WARUNING: this operation is not commutative! e.g. (A*B) != (B*A))
+*/
+Quaternion Quaternion::operator*(const Quaternion& q) const
+{
+	float A, B, C, D, E, F, G, H;
+	Quaternion r;
+	
+	A = (w   + v.x)*(q.w   + q.v.x);
+	B = (v.z - v.y)*(q.v.y - q.v.z);
+	C = (w   - v.x)*(q.v.y + q.v.z); 
+	D = (v.y + v.z)*(q.w   - q.v.x);
+	E = (v.x + v.z)*(q.v.x + q.v.y);
+	F = (v.x - v.z)*(q.v.x - q.v.y);
+	G = (w   + v.y)*(q.w   - q.v.z);
+	H = (w   - v.y)*(q.w   + q.v.z);
+	
+	r.w = B +  (-E - F + G + H)/2;
+	r.v.x = A - (E + F + G + H)/2; 
+	r.v.y = C + (E - F + G - H)/2; 
+	r.v.z = D + (E - F - G + H)/2;
+	
+	return r;
+}
+
+/**
+	\brief add two Quaternions
+	\param q: another Quaternion
+	\return the sum of both Quaternions
+*/
+Quaternion Quaternion::operator+(const Quaternion& q) const
+{
+	Quaternion r(*this);
+	r.w = r.w + q.w;
+	r.v = r.v + q.v;
+	return r;
+}
+
+/**
+	\brief subtract two Quaternions
+	\param q: another Quaternion
+	\return the difference of both Quaternions
+*/
+Quaternion Quaternion::operator- (const Quaternion& q) const
+{
+	Quaternion r(*this);
+	r.w = r.w - q.w;
+	r.v = r.v - q.v;
+	return r;
+}
+
+/**
+	\brief rotate a Vector by a Quaternion
+	\param v: the Vector
+	\return a new Vector representing v rotated by the Quaternion
+*/
+Vector Quaternion::apply (Vector& v) const
+{
+	Quaternion q;
+	q.v = v;
+	q.w = 0;
+	q = *this * q * conjugate();
+	return q.v;
+}
+
+/**
+	\brief multiply a Quaternion with a real value
+	\param f: a real value
+	\return a new Quaternion containing the product
+*/
+Quaternion Quaternion::operator*(const float& f) const
+{
+	Quaternion r(*this);
+	r.w = r.w*f;
+	r.v = r.v*f;
+	return r;
+}
+
+/**
+	\brief divide a Quaternion by a real value
+	\param f: a real value
+	\return a new Quaternion containing the quotient
+*/
+Quaternion Quaternion::operator/(const float& f) const
+{
+	if( f == 0) return Quaternion();
+	Quaternion r(*this);
+	r.w = r.w/f;
+	r.v = r.v/f;
+	return r;
+}
+
+/**
+	\brief calculate the conjugate value of the Quaternion
+	\return the conjugate Quaternion
+*/
+Quaternion Quaternion::conjugate() const
+{
+	Quaternion r(*this);
+	r.v = Vector() - r.v;
+	return r;
+}
+
+/**
+	\brief calculate the norm of the Quaternion
+	\return the norm of The Quaternion
+*/
+float Quaternion::norm() const
+{
+	return w*w + v.x*v.x + v.y*v.y + v.z*v.z;
+}
+
+/**
+	\brief calculate the inverse value of the Quaternion
+	\return the inverse Quaternion
+	
+	Note that this is equal to conjugate() if the Quaternion's norm is 1
+*/
+Quaternion Quaternion::inverse() const
+{
+	float n = norm();
+	if (n != 0)
+	{
+		return conjugate() / norm();
+	}
+	else return Quaternion();
+}
+
+/**
+	\brief convert the Quaternion to a 4x4 rotational glMatrix
+	\param m: a buffer to store the Matrix in
+*/
+void Quaternion::matrix (float m[4][4]) const
+{
+  float wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2; 
+  
+  // calculate coefficients
+  x2 = v.x + v.x;
+  y2 = v.y + v.y; 
+  z2 = v.z + v.z;
+  xx = v.x * x2; xy = v.x * y2; xz = v.x * z2;
+  yy = v.y * y2; yz = v.y * z2; zz = v.z * z2;
+  wx = w * x2; wy = w * y2; wz = w * z2;
+  
+  m[0][0] = 1.0 - (yy + zz); m[1][0] = xy - wz;
+  m[2][0] = xz + wy; m[3][0] = 0.0;
+	
+  m[0][1] = xy + wz; m[1][1] = 1.0 - (xx + zz);
+  m[2][1] = yz - wx; m[3][1] = 0.0;
+  
+  m[0][2] = xz - wy; m[1][2] = yz + wx;
+  m[2][2] = 1.0 - (xx + yy); m[3][2] = 0.0;
+  
+  m[0][3] = 0; m[1][3] = 0;
+  m[2][3] = 0; m[3][3] = 1;
+}
+
+
+void Quaternion::quatSlerp(const Quaternion* from, const Quaternion* to, float t, Quaternion* res)
+{
+  float tol[4];
+  double omega, cosom, sinom, scale0, scale1;
+  DELTA = 0.2;
+
+  cosom = from->v.x * to->v.x + from->v.y * to->v.y + from->v.z * to->v.z + from->w * to->w;
+
+  if( cosom < 0.0 ) 
+    { 
+      cosom = -cosom; 
+      tol[0] = -to->v.x;
+      tol[1] = -to->v.y;
+      tol[2] = -to->v.z;
+      tol[3] = -to->w;
+    }
+  else
+    {
+      tol[0] = to->v.x;
+      tol[1] = to->v.y;
+      tol[2] = to->v.z;
+      tol[3] = to->w;
+    }
+  
+  //if( (1.0 - cosom) > DELTA )
+  //{
+      omega = acos(cosom);
+      sinom = sin(omega);
+      scale0 = sin((1.0 - t) * omega) / sinom;
+      scale1 = sin(t * omega) / sinom;
+      //}
+      /*
+  else
+    {
+      scale0 = 1.0 - t;
+      scale1 = t;
+    }
+      */
+  res->v.x = scale0 * from->v.x + scale1 * tol[0];
+  res->v.y = scale0 * from->v.y + scale1 * tol[1];
+  res->v.z = scale0 * from->v.z + scale1 * tol[2];
+  res->w = scale0 * from->w + scale1 * tol[3];
+}
+
+
+/**
+   \brief convert a rotational 4x4 glMatrix into a Quaternion
+   \param m: a 4x4 matrix in glMatrix order
+*/
+Quaternion::Quaternion (float m[4][4])
+{
+	
+  float  tr, s, q[4];
+  int    i, j, k;
+
+  int nxt[3] = {1, 2, 0};
+
+  tr = m[0][0] + m[1][1] + m[2][2];
+
+  	// check the diagonal
+  if (tr > 0.0) 
+  {
+    s = sqrt (tr + 1.0);
+    w = s / 2.0;
+    s = 0.5 / s;
+    v.x = (m[1][2] - m[2][1]) * s;
+    v.y = (m[2][0] - m[0][2]) * s;
+    v.z = (m[0][1] - m[1][0]) * s;
+	} 
+	else 
+	{
+ 		// diagonal is negative
+  	i = 0;
+  	if (m[1][1] > m[0][0]) i = 1;
+    if (m[2][2] > m[i][i]) i = 2;
+    j = nxt[i];
+    k = nxt[j];
+
+    s = sqrt ((m[i][i] - (m[j][j] + m[k][k])) + 1.0);
+      
+    q[i] = s * 0.5;
+            
+    if (s != 0.0) s = 0.5 / s;
+	
+	  q[3] = (m[j][k] - m[k][j]) * s;
+    q[j] = (m[i][j] + m[j][i]) * s;
+    q[k] = (m[i][k] + m[k][i]) * s;
+
+  	v.x = q[0];
+  	v.y = q[1];
+  	v.z = q[2];
+  	w = q[3];
+  }
+}
+
+/**
+   \brief create a rotation from a vector
+   \param v: a vector
+*/
+Rotation::Rotation (const Vector& v)
+{
+  Vector x = Vector( 1, 0, 0);
+  Vector axis = x.cross( v);
+  axis.normalize();
+  float angle = angle_rad( x, v);
+  float ca = cos(angle);
+  float sa = sin(angle);
+  m[0] = 1.0f+(1.0f-ca)*(axis.x*axis.x-1.0f);
+  m[1] = -axis.z*sa+(1.0f-ca)*axis.x*axis.y;
+  m[2] = axis.y*sa+(1.0f-ca)*axis.x*axis.z;
+  m[3] = axis.z*sa+(1.0f-ca)*axis.x*axis.y;
+  m[4] = 1.0f+(1.0f-ca)*(axis.y*axis.y-1.0f);
+  m[5] = -axis.x*sa+(1.0f-ca)*axis.y*axis.z;
+  m[6] = -axis.y*sa+(1.0f-ca)*axis.x*axis.z;
+  m[7] = axis.x*sa+(1.0f-ca)*axis.y*axis.z;
+  m[8] = 1.0f+(1.0f-ca)*(axis.z*axis.z-1.0f);
+}
+
+/**
+   \brief creates a rotation from an axis and an angle (radians!)
+   \param axis: the rotational axis
+   \param angle: the angle in radians
+*/
+Rotation::Rotation (const Vector& axis, float angle)
+{
+  float ca, sa;
+  ca = cos(angle);
+  sa = sin(angle);
+  m[0] = 1.0f+(1.0f-ca)*(axis.x*axis.x-1.0f);
+  m[1] = -axis.z*sa+(1.0f-ca)*axis.x*axis.y;
+  m[2] = axis.y*sa+(1.0f-ca)*axis.x*axis.z;
+  m[3] = axis.z*sa+(1.0f-ca)*axis.x*axis.y;
+  m[4] = 1.0f+(1.0f-ca)*(axis.y*axis.y-1.0f);
+  m[5] = -axis.x*sa+(1.0f-ca)*axis.y*axis.z;
+  m[6] = -axis.y*sa+(1.0f-ca)*axis.x*axis.z;
+  m[7] = axis.x*sa+(1.0f-ca)*axis.y*axis.z;
+  m[8] = 1.0f+(1.0f-ca)*(axis.z*axis.z-1.0f);
+}
+
+/**
+   \brief creates a rotation from euler angles (pitch/yaw/roll)
+   \param pitch: rotation around z (in radians)
+   \param yaw: rotation around y (in radians)
+   \param roll: rotation around x (in radians)
+*/
+Rotation::Rotation ( float pitch, float yaw, float roll)
+{
+  float cy, sy, cr, sr, cp, sp;
+  cy = cos(yaw);
+  sy = sin(yaw);
+  cr = cos(roll);
+  sr = sin(roll);
+  cp = cos(pitch);
+  sp = sin(pitch);
+  m[0] = cy*cr;
+  m[1] = -cy*sr;
+  m[2] = sy;
+  m[3] = cp*sr+sp*sy*cr;
+  m[4] = cp*cr-sp*sr*sy;
+  m[5] = -sp*cy;
+  m[6] = sp*sr-cp*sy*cr;
+  m[7] = sp*cr+cp*sy*sr;
+  m[8] = cp*cy;
+}
+
+/**
+   \brief creates a nullrotation (an identity rotation)
+*/
+Rotation::Rotation ()
+{
+  m[0] = 1.0f;
+  m[1] = 0.0f;
+  m[2] = 0.0f;
+  m[3] = 0.0f;
+  m[4] = 1.0f;
+  m[5] = 0.0f;
+  m[6] = 0.0f;
+  m[7] = 0.0f;
+  m[8] = 1.0f;
+}
+
+/**
+   \brief fills the specified buffer with a 4x4 glmatrix
+   \param buffer: Pointer to an array of 16 floats
+   
+   Use this to get the rotation in a gl-compatible format
+*/
+void Rotation::glmatrix (float* buffer)
+{
+	buffer[0] = m[0];
+	buffer[1] = m[3];
+	buffer[2] = m[6];
+	buffer[3] = m[0];
+	buffer[4] = m[1];
+	buffer[5] = m[4];
+	buffer[6] = m[7];
+	buffer[7] = m[0];
+	buffer[8] = m[2];
+	buffer[9] = m[5];
+	buffer[10] = m[8];
+	buffer[11] = m[0];
+	buffer[12] = m[0];
+	buffer[13] = m[0];
+	buffer[14] = m[0];
+	buffer[15] = m[1];
+}
+
+/**
+   \brief multiplies two rotational matrices
+   \param r: another Rotation
+   \return the matrix product of the Rotations
+   
+   Use this to rotate one rotation by another
+*/
+Rotation Rotation::operator* (const Rotation& r)
+{
+	Rotation p;
+	
+	p.m[0] = m[0]*r.m[0] + m[1]*r.m[3] + m[2]*r.m[6];
+	p.m[1] = m[0]*r.m[1] + m[1]*r.m[4] + m[2]*r.m[7];
+	p.m[2] = m[0]*r.m[2] + m[1]*r.m[5] + m[2]*r.m[8];
+	
+	p.m[3] = m[3]*r.m[0] + m[4]*r.m[3] + m[5]*r.m[6];
+	p.m[4] = m[3]*r.m[1] + m[4]*r.m[4] + m[5]*r.m[7];
+	p.m[5] = m[3]*r.m[2] + m[4]*r.m[5] + m[5]*r.m[8];
+
+	p.m[6] = m[6]*r.m[0] + m[7]*r.m[3] + m[8]*r.m[6];
+	p.m[7] = m[6]*r.m[1] + m[7]*r.m[4] + m[8]*r.m[7];
+	p.m[8] = m[6]*r.m[2] + m[7]*r.m[5] + m[8]*r.m[8];
+	
+	return p;
+}
+
+
+/**
+   \brief rotates the vector by the given rotation
+   \param v: a vector
+   \param r: a rotation
+   \return the rotated vector
+*/
+Vector rotate_vector( const Vector& v, const Rotation& r)
+{
+  Vector t;
+  
+  t.x = v.x * r.m[0] + v.y * r.m[1] + v.z * r.m[2];
+  t.y = v.x * r.m[3] + v.y * r.m[4] + v.z * r.m[5];
+  t.z = v.x * r.m[6] + v.y * r.m[7] + v.z * r.m[8];
+
+  return t;
+}
+
+/**
+   \brief calculate the distance between two lines
+   \param l: the other line
+   \return the distance between the lines
+*/
+float Line::distance (const Line& l) const
+{
+  float q, d;
+  Vector n = a.cross(l.a);
+  q = n.dot(r-l.r);
+  d = n.len();
+  if( d == 0.0) return 0.0;
+  return q/d;
+}
+
+/**
+   \brief calculate the distance between a line and a point
+   \param v: the point
+   \return the distance between the Line and the point
+*/
+float Line::distance_point (const Vector& v) const
+{
+  Vector d = v-r;
+  Vector u = a * d.dot( a);
+  return (d - u).len();
+}
+
+/**
+   \brief calculate the two points of minimal distance of two lines
+   \param l: the other line
+   \return a Vector[2] (!has to be deleted after use!) containing the two points of minimal distance
+*/
+Vector* Line::footpoints (const Line& l) const
+{
+  Vector* fp = new Vector[2];
+  Plane p = Plane (r + a.cross(l.a), r, r + a);
+  fp[1] = p.intersect_line (l);
+  p = Plane (fp[1], l.a);
+  fp[0] = p.intersect_line (*this);
+  return fp;
+}
+
+/**
+  \brief calculate the length of a line
+  \return the lenght of the line 
+*/
+float Line::len() const
+{
+  return a.len();
+}
+
+/**
+   \brief rotate the line by given rotation
+   \param rot: a rotation
+*/
+void Line::rotate (const Rotation& rot)
+{
+  Vector t = a + r;
+  t = rotate_vector( t, rot);
+  r = rotate_vector( r, rot),
+  a = t - r;
+}
+
+/**
+   \brief create a plane from three points
+   \param a: first point
+   \param b: second point
+   \param c: third point
+*/
+Plane::Plane (Vector a, Vector b, Vector c)
+{
+  n = (a-b).cross(c-b);
+  k = -(n.x*b.x+n.y*b.y+n.z*b.z);
+}
+
+/**
+   \brief create a plane from anchor point and normal
+   \param n: normal vector
+   \param p: anchor point
+*/
+Plane::Plane (Vector norm, Vector p)
+{
+  n = norm;
+  k = -(n.x*p.x+n.y*p.y+n.z*p.z);
+}
+
+/**
+   \brief returns the intersection point between the plane and a line
+   \param l: a line
+*/
+Vector Plane::intersect_line (const Line& l) const
+{
+  if (n.x*l.a.x+n.y*l.a.y+n.z*l.a.z == 0.0) return Vector(0,0,0);
+  float t = (n.x*l.r.x+n.y*l.r.y+n.z*l.r.z+k) / (n.x*l.a.x+n.y*l.a.y+n.z*l.a.z);
+  return l.r + (l.a * t);
+}
+
+/**
+   \brief returns the distance between the plane and a point
+   \param p: a Point
+   \return the distance between the plane and the point (can be negative)
+*/
+float Plane::distance_point (const Vector& p) const
+{
+  float l = n.len();
+  if( l == 0.0) return 0.0;
+  return (n.dot(p) + k) / n.len();
+}
+
+/**
+   \brief returns the side a point is located relative to a Plane
+   \param p: a Point
+   \return 0 if the point is contained within the Plane, positive(negative) if the point is in the positive(negative) semi-space of the Plane
+*/
+float Plane::locate_point (const Vector& p) const
+{
+  return (n.dot(p) + k);
+}
Index: orxonox/trunk/src/importer/vector.h
===================================================================
--- orxonox/trunk/src/importer/vector.h	(revision 3196)
+++ orxonox/trunk/src/importer/vector.h	(revision 3196)
@@ -0,0 +1,151 @@
+/*! 
+    \file vector.h
+    \brief A basic 3D math framework
+    
+    Contains classes to handle vectors, lines, rotations and planes
+*/ 
+
+#ifndef VECTOR_H
+#define VECTOR_H
+
+#include <math.h>
+#define PI 3.14159265359f
+
+//! 3D Vector
+/**
+	Class to handle 3D Vectors
+*/
+class Vector {
+
+  public:
+ 
+  float x, y, z;
+
+  Vector (float x, float y, float z) : x(x), y(y), z(z) {}  //!< assignment constructor
+  Vector () : x(0), y(0), z(0) {}
+  ~Vector () {}
+
+  Vector operator+ (const Vector& v) const;
+  Vector operator- (const Vector& v) const;
+  float operator* (const Vector& v) const;
+  Vector operator* (float f) const;
+  Vector operator/ (float f) const;
+  float dot (const Vector& v) const;
+  Vector cross (const Vector& v) const;
+  void scale(const Vector& v);
+  float len() const;
+  void normalize();
+  Vector* getNormalized();
+  Vector abs();
+};
+
+float angle_deg (const Vector& v1, const Vector& v2);
+float angle_rad (const Vector& v1, const Vector& v2);
+
+//! Quaternion
+/**
+	Class to handle 3-dimensional rotation efficiently
+*/
+class Quaternion
+{
+ public:
+	Vector v;	//!< Imaginary Vector
+	float w; //!< Real part of the number
+
+ 	Quaternion ();
+ 	Quaternion (float m[4][4]);
+ 	Quaternion (float angle, const Vector& axis);
+ 	Quaternion (const Vector& dir, const Vector& up);
+ 	Quaternion (float roll, float pitch, float yaw);
+ 	
+ 	Quaternion operator/ (const float& f) const;
+ 	Quaternion operator* (const float& f) const;
+ 	Quaternion operator* (const Quaternion& q) const;
+	Quaternion operator+ (const Quaternion& q) const;
+	Quaternion operator- (const Quaternion& q) const;
+	Quaternion conjugate () const;
+	Quaternion inverse () const;
+ 	Vector apply (Vector& f) const;
+	float norm () const;
+	void matrix (float m[4][4]) const;
+	void quatSlerp(const Quaternion* from, const Quaternion* to, const float t, Quaternion* res);
+
+ private:
+	float DELTA;
+
+};
+
+//! 3D rotation (OBSOLETE)
+/**
+  Class to handle 3-dimensional rotations.
+  Can create a rotation from several inputs, currently stores rotation using a 3x3 Matrix
+*/
+class Rotation {
+  public:
+  
+  float m[9]; //!< 3x3 Rotation Matrix
+  
+  Rotation ( const Vector& v);
+  Rotation ( const Vector& axis, float angle);
+  Rotation ( float pitch, float yaw, float roll);
+  Rotation ();
+  ~Rotation () {}
+  
+  Rotation operator* (const Rotation& r);
+  
+  void glmatrix (float* buffer);
+};
+
+//!< Apply a rotation to a vector
+Vector rotate_vector( const Vector& v, const Rotation& r);
+
+//! 3D line
+/**
+  Class to store Lines in 3-dimensional space
+
+  Supports line-to-line distance measurements and rotation
+*/
+class Line
+{
+  public:
+  
+  Vector r;   //!< Offset
+  Vector a;   //!< Direction
+  
+  Line ( Vector r, Vector a) : r(r), a(a) {}  //!< assignment constructor
+  Line () : r(Vector(0,0,0)), a(Vector (1,1,1)) {}
+  ~Line () {}
+  
+  float distance (const Line& l) const;
+  float distance_point (const Vector& v) const;
+  Vector* footpoints (const Line& l) const;
+  float len () const;
+  
+  void rotate(const Rotation& rot);
+};
+
+//! 3D plane
+/**
+  Class to handle planes in 3-dimensional space
+  
+  Critical for polygon-based collision detection
+*/
+class Plane
+{
+  public:
+  
+  Vector n;   //!< Normal vector
+  float k;    //!< Offset constant
+  
+  Plane (Vector a, Vector b, Vector c);
+  Plane (Vector norm, Vector p);
+  Plane (Vector n, float k) : n(n), k(k) {} //!< assignment constructor
+  Plane () : n(Vector(1,1,1)), k(0) {}
+  ~Plane () {}
+  
+  Vector intersect_line (const Line& l) const;
+  float distance_point (const Vector& p) const;
+  float locate_point (const Vector& p) const;
+};
+
+#endif
Index: orxonox/trunk/src/importer/windowHandler.cc
===================================================================
--- orxonox/trunk/src/importer/windowHandler.cc	(revision 3196)
+++ orxonox/trunk/src/importer/windowHandler.cc	(revision 3196)
@@ -0,0 +1,94 @@
+/* 
+   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 "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 ( (screen = 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 TRUE;
+}
+
+
Index: orxonox/trunk/src/importer/windowHandler.h
===================================================================
--- orxonox/trunk/src/importer/windowHandler.h	(revision 3196)
+++ orxonox/trunk/src/importer/windowHandler.h	(revision 3196)
@@ -0,0 +1,36 @@
+#ifndef _WINDOWHANDLER_H
+#define _WINDOWHANDLER_H
+
+extern int verbose;
+
+#include "../stdincl.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+
+#ifdef __WIN32__
+#include <windows.h>
+#endif /* __WIN32__ */
+
+#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);
+    SDL_Surface* screen;
+  private:
+    int InitGL(GLvoid);
+    void ReSizeGLScene(GLsizei width, GLsizei height);  
+};
+
+
+#endif
Index: orxonox/trunk/src/material.cc
===================================================================
--- orxonox/trunk/src/material.cc	(revision 3195)
+++ 	(revision )
@@ -1,1280 +1,0 @@
-/* 
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Benjamin Grauer
-   co-programmer: ...
-
-   TGA-code: borrowed from nehe-Tutorials
-
-*/
-
-#include "material.h"
-
-// headers only for PathList
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <fstream>
-
-using namespace std;
-
-/**
-   \brief creates a ned PathList.
-   
-   It is a good idea to use this as an initial List,
-   because if you give on a name the Path will not be checked for its existence.
-*/
-PathList::PathList()
-{
-  pathName = NULL;
-  next = NULL;
-}
-
-/**
-   \brief Creates a new PathList with a Name.
-   \param pName the Name of The Path.
-
-   This function just adds the Path without checking if it exists.
-*/
-PathList::PathList(char* pName)
-{
-  pathName = new char [strlen(pName)+1];
-  strcpy (pathName, pName);
-  next = NULL;
-}
-
-/**
-   \brief destroys a PathList
-
-   It does this by deleting the Name and then delete its preceding PathList.
-*/
-PathList::~PathList()
-{
-  if (pathName)
-    delete []pathName;
-  if (next)
-    delete next;
-}
-
-/**
-   \brief Adds a new Pathlist Element.
-   \param pName
-   
-   Adding a Path automatically checks if the Path exists,
-   and if it does not it will not add it to the List.
-*/
-void PathList::addPath (char* pName)
-{
-  if (pName[0] == '\0')
-    {
-      if (verbose >=3)
-	printf("not Adding empty Path to the List.\n");
-      return;
-    }
-  char* tmpPName = new char[strlen(pName)];
-  strncpy(tmpPName, pName, strlen(pName)-1);
-  tmpPName[strlen(pName)-1] = '\0';
-  printf ("%s\n",tmpPName);
-  if (access (tmpPName, F_OK) == 0)
-    {
-      struct stat status;
-      stat(tmpPName, &status);
-      if (status.st_mode & S_IFDIR)
-	{
-	  if (verbose >=2)
-	    printf ("Adding Path %s to the PathList.\n", pName);
-	  PathList* tmpPathList = this;
-	  while (tmpPathList->next)
-	    tmpPathList = tmpPathList->next;
-	  tmpPathList->next = new PathList(pName);
-	}
-      else
-	if (verbose >=1)
-	  printf ("You tried to add non-folder %s to a PathList.\n", tmpPName);
-    }
-  else
-    if (verbose >=1)
-      printf ("You tried to add non-existing folder %s to a PathList.\n", tmpPName);
-  delete []tmpPName;
-}
-
-/**
-   \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 (name)
-    delete []name;
-  if (diffuseTextureSet)
-    glDeleteTextures (1, &diffuseTexture);
-  if (nextMat)
-    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* tmpMat = this;
-  while (tmpMat->nextMat != NULL)
-    {
-      tmpMat = tmpMat->nextMat;
-    }
-  tmpMat->nextMat = new Material(mtlName);
-  return tmpMat->nextMat;
-  
-}
-
-/**
-   \brief initializes a new Material with its default Values
-*/
-void Material::init(void)
-{
-  if (verbose >= 3)
-    printf ("initializing new Material.\n");
-  nextMat = NULL;
-  name ="";
-  setIllum(1);
-  setDiffuse(0,0,0);
-  setAmbient(0,0,0);
-  setSpecular(.5,.5,.5);
-  setShininess(2.0);
-  setTransparency(0.0);
-
-  if (!pathList)
-    pathList = new PathList("");
-
-
-  diffuseTextureSet = false;
-  ambientTextureSet = false;
-  specularTextureSet = false;
-
-  
-}
-
-PathList *Material::pathList = NULL;
-
-/**
-   \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;
-    }
-  if (verbose >=3)
-    printf ("not found\n");
-  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);
-
-  if (diffuseTextureSet)
-    glBindTexture(GL_TEXTURE_2D, diffuseTexture);
-  else
-    glBindTexture(GL_TEXTURE_2D, 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)
-{
-  name = new char [strlen(mtlName)+1];
-  strcpy(name, mtlName);
-  if (verbose >= 3)
-    printf("setting Material Name to %s.\n", name);
-
-  //  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\n", 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)
-{
-  float r,g,b;
-  sscanf (rgb, "%f %f %f", &r, &g, &b);
-  setDiffuse (r, g, 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)
-{
-  float r,g,b;
-  sscanf (rgb, "%f %f %f", &r, &g, &b);
-  setAmbient (r, g, 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)
-{
-  float r,g,b;
-  sscanf (rgb, "%f %f %f", &r, &g, &b);
-  setSpecular (r, g, 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)
-{
-  setTransparency (atof(trans));
-}
-
-/**
-   \brief Adds a Texture Path to the List of already existing Paths
-   \param pathName The Path to add.
-*/
-void Material::addTexturePath(char* pathName)
-{
-  pathList->addPath (pathName);
-}
-
-/**
-   \brief Searches for a Texture inside one of the defined Paths
-   \param texName The name of the texture o search for.
-   \returns pathName+texName if texName was found in the pathList. NULL if the Texture is not found.
-*/
-char* Material::searchTextureInPaths(char* texName) const
-{
-  char* tmpName = NULL;
-  PathList* pList = pathList;
-  while (pList)
-    {
-      if (pList->pathName)
-	{
-	  tmpName = new char [strlen(pList->pathName)+strlen(texName)+1];
-	  strcpy(tmpName, pList->pathName);
-	}
-      else
-	{
-	  tmpName = new char [strlen(texName)+1];
-	  tmpName[0]='\0';
-	}
-      strcat(tmpName, texName);
-      printf("%s\n", tmpName);
-      if (access (tmpName, F_OK) == 0)
-	return tmpName;
-      
-      if (tmpName)
-	delete []tmpName;
-      tmpName = NULL;
-      pList = pList->next;
-    }
-  return NULL;
-}
-
-
-// MAPPING //
-
-/**
-   \brief Sets the Materials Diffuse Map
-   \param dMap the Name of the Image to Use
-*/
-void Material::setDiffuseMap(char* dMap)
-{
-  if (verbose>=2)
-    printf ("setting Diffuse Map %s\n", dMap);
-
-  //  diffuseTextureSet = loadBMP(dMap, &diffuseTexture);
-  diffuseTextureSet = loadImage(dMap, &diffuseTexture);
-
-}
-
-/**
-   \brief Sets the Materials Ambient Map
-   \param aMap the Name of the Image to Use
-*/
-void Material::setAmbientMap(char* aMap)
-{
-  SDL_Surface* ambientMap;
-
-}
-
-/**
-   \brief Sets the Materials Specular Map
-   \param sMap the Name of the Image to Use
-*/
-void Material::setSpecularMap(char* sMap)
-{
-  SDL_Surface* specularMap;
-
-}
-
-/**
-   \brief Sets the Materials Bumpiness
-   \param bump the Name of the Image to Use
-*/
-void Material::setBump(char* bump)
-{
-
-}
-
-/**
-   \brief Loads a Texture to the openGL-environment.
-   \param pImage The Image to load to openGL
-   \param texture The Texture to apply it to.
-*/
-bool Material::loadTexToGL (Image* pImage, GLuint* texture)
-{
-  if (verbose >=3)
-    printf ("Loading texture to OpenGL-Environment.\n");
-  glGenTextures(1, texture);
-  glBindTexture(GL_TEXTURE_2D, *texture);
-  /* not Working, and not needed. 
-  glTexImage2D( GL_TEXTURE_2D, 0, 3, width,
-		height, 0, GL_BGR,
-		GL_UNSIGNED_BYTE, map->pixels );
-  */ 
-  gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImage->width, pImage->height, GL_RGB, GL_UNSIGNED_BYTE, pImage->data);
-  
-  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
-  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);	
-}
-
-
-#ifdef HAVE_SDL_SDL_IMAGE_H
-bool Material::loadImage(char* imageName, GLuint* texture)
-{
-  char* imgNameWithPath = searchTextureInPaths(imageName);
-  if (imgNameWithPath)
-    {
-      SDL_Surface* map;
-      Image* pImage = new Image;
-      map=IMG_Load(imgNameWithPath);
-      if(!map)
-	{
-	  printf("IMG_Load: %s\n", IMG_GetError());
-	  return false;
-	}
-      pImage->height = map->h;
-      pImage->width  = map->w;
-      pImage->data   = (GLubyte*)map->pixels;
-      if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb")))
-	for (int i=0;i<map->h * map->w *3;i+=3)
-	  { 
-	    GLuint temp = pImage->data[i];
-	    pImage->data[i] = pImage->data[i+2];
-	    pImage->data[i+2] = temp;
-	  }
-      loadTexToGL (pImage, texture);
-    }
-  else
-    {
-      if (verbose >=1)
-	printf ("Image not Found: %s\n", imgNameWithPath);
-      return false;
-    }
-}
-
-
-#else /* HAVE_SDL_SDL_IMAGE_H */
-/**
-   \brief Makes the Programm ready to Read-in a texture-File
-   1. Checks what type of Image should be imported
-   2. ToDO: Checks where to find the Image
-*/
-bool Material::loadImage(char* imageName, GLuint* texture)
-{
-  char* imgNameWithPath = searchTextureInPaths(imageName);
-  if (imgNameWithPath)
-    {
-      if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4))
-	{
-	  if (verbose >=2)
-	    printf ("Requested bmp-image. Trying to Import.\n");
-	  return loadBMP(imgNameWithPath, texture);
-	}
-      
-      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5))
-	{
-	  if (verbose >=2)
-	    printf ("Requested jpeg-image. Trying to Import\n");
-	  return loadJPG(imgNameWithPath, texture);
-	}
-      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4))
-	{
-	  if (verbose >=2)
-	    printf ("Requested tga-image. Trying to Import\n");
-	  return loadTGA(imgNameWithPath, texture);
-	}
-      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4))
-	{
-	  if (verbose >=2)
-	    printf ("Requested png-image. Trying to Import\n");
-	  return loadPNG(imgNameWithPath, texture);
-	}
-      else
-	{
-	  if (verbose >=1)
-	    printf ("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath);
-	  return false;
-	}
-    }
-  else
-    {
-      if (verbose >=1)
-	printf ("Image not Found: %s\n", imgNameWithPath);
-      return false;
-    }
-}
-
-/**
-   \brief reads in a Windows BMP-file, and imports it to openGL.
-   \param bmpName The name of the Image to load.
-   \param texture A pointer to the Texture which should be read to.
-*/
-bool Material::loadBMP (char* bmpName, GLuint* texture)
-{
-  Image* pImage = new Image;
-  FILE *file;
-  unsigned long size;                 // size of the image in bytes.
-  unsigned long i;                    // standard counter.
-  unsigned short int planes;          // number of planes in image (must be 1) 
-  unsigned short int bpp;             // number of bits per pixel (must be 24)
-  GLuint temp;                          // temporary color storage for bgr-rgb conversion.
-
-  // make sure the file is there.
-  if ((file = fopen(bmpName, "rb"))==NULL)
-    {
-      if (verbose >=1)
-	printf("File Not Found : %s\n",bmpName);
-      return false;
-    }
-  // seek through the bmp header, up to the width/height:
-  fseek(file, 18, SEEK_CUR);
-  
-  // read the width
-  if ((i = fread(&pImage->width, 4, 1, file)) != 1) 
-    {
-      if (verbose >=1)
-	printf("Error reading width from %s.\n", bmpName);
-      return false;
-    }
-  // read the height 
-  if ((i = fread(&pImage->height, 4, 1, file)) != 1) 
-    {
-      if (verbose>=1)
-	printf("Error reading height from %s.\n", bmpName);
-      return false;
-    }
-  
-  // calculate the size (assuming 24 bits or 3 bytes per pixel).
-  size = pImage->width * pImage->height * 3;
-  
-  // read the planes
-  if ((fread(&planes, 2, 1, file)) != 1) 
-    {
-      if (verbose>=1)
-	printf("Error reading planes from %s.\n", bmpName);
-      return false;
-    }
-  if (planes != 1) 
-    {
-      if (verbose>=1)
-	printf("Planes from %s is not 1: %u\n", bmpName, planes);
-      return false;
-    }
-  
-  // read the bpp
-  if ((i = fread(&bpp, 2, 1, file)) != 1) 
-    {
-      if (verbose>=1)
-	printf("Error reading bpp from %s.\n", bmpName);
-      return false;
-    }
-  if (bpp != 24) 
-    {
-      if (verbose>=1)
-	printf("Bpp from %s is not 24: %u\n", bmpName, bpp);
-      return false;
-    }
-  
-  // seek past the rest of the bitmap header.
-  fseek(file, 24, SEEK_CUR);
-  
-  // read the data. 
-  pImage->data = (GLubyte *) malloc(size);
-  if (pImage->data == NULL) 
-    {
-      if (verbose>=1)
-	printf("Error allocating memory for color-corrected image data");
-      return false;	
-    }
-  
-  if ((i = fread(pImage->data, size, 1, file)) != 1) 
-    {
-      if (verbose>=1)
-	printf("Error reading image data from %s.\n", bmpName);
-      return false;
-    }
-  fclose(file);
-
-  // reverse all of the colors. (bgr -> rgb)
-  for (i=0;i<size;i+=3) 
-    { 
-      temp = pImage->data[i];
-      pImage->data[i] = pImage->data[i+2];
-      pImage->data[i+2] = temp;
-    }
-  loadTexToGL (pImage, texture);
-  
-  return true;
-
-  if (pImage)
-    {
-      if (pImage->data)
-	{
-	  free(pImage->data);
-	}
-      
-      free(pImage);
-    }
-
-}
-
-/**
-   \brief reads in a jpg-file
-   \param jpgName the Name of the Image to load
-   \param texture a reference to the Texture to write the image to
-*/
-bool Material::loadJPG (char* jpgName, GLuint* texture)
-{
-#ifdef HAVE_JPEGLIB_H
-  struct jpeg_decompress_struct cinfo;
-  Image *pImage = NULL;
-  FILE *pFile;
-  
-  // Open a file pointer to the jpeg file and check if it was found and opened 
-  if((pFile = fopen(jpgName, "rb")) == NULL) 
-    {
-      // Display an error message saying the file was not found, then return NULL
-      printf("Unable to load JPG File %s.\n", jpgName);
-      return false;
-    }
-  
-  // Create an error handler
-  jpeg_error_mgr jerr;
-  
-  // Have our compression info object point to the error handler address
-  cinfo.err = jpeg_std_error(&jerr);
-  
-  // Initialize the decompression object
-  jpeg_create_decompress(&cinfo);
-  
-  // Specify the data source (Our file pointer)	
-  jpeg_stdio_src(&cinfo, pFile);
-  
-  // Allocate the structure that will hold our eventual jpeg data (must free it!)
-  pImage = (Image*)malloc(sizeof(Image));
-  
-  // DECOFING
-  // Read in the header of the jpeg file
-  jpeg_read_header(&cinfo, TRUE);
-  
-  // Start to decompress the jpeg file with our compression info
-  jpeg_start_decompress(&cinfo);
-  
-  // Get the image dimensions and row span to read in the pixel data
-  pImage->rowSpan = cinfo.image_width * cinfo.num_components;
-  pImage->width   = cinfo.image_width;
-  pImage->height   = cinfo.image_height;
-  
-  // Allocate memory for the pixel buffer
-  pImage->data = new unsigned char[pImage->rowSpan * pImage->height];
-  
-  // Here we use the library's state variable cinfo.output_scanline as the
-  // loop counter, so that we don't have to keep track ourselves.
-  
-  // Create an array of row pointers
-  unsigned char** rowPtr = new unsigned char*[pImage->height];
-  for (int i = 0; i < pImage->height; i++)
-    rowPtr[i] = &(pImage->data[i*pImage->rowSpan]);
-  
-  // Now comes the juice of our work, here we extract all the pixel data
-  int rowsRead = 0;
-  while (cinfo.output_scanline < cinfo.output_height) 
-    {
-      // Read in the current row of pixels and increase the rowsRead count
-      rowsRead += jpeg_read_scanlines(&cinfo, &rowPtr[rowsRead], cinfo.output_height - rowsRead);
-    }
-  
-  // Delete the temporary row pointers
-  delete [] rowPtr;
-  
-  // Finish decompressing the data
-  jpeg_finish_decompress(&cinfo);//  decodeJPG(&cinfo, pImage);
-  
-  // This releases all the stored memory for reading and decoding the jpeg
-  jpeg_destroy_decompress(&cinfo);
-  
-  // Close the file pointer that opened the file
-  fclose(pFile);
-  
-
-  if(pImage == NULL)
-    exit(0);
-  
-  loadTexToGL (pImage, texture);
-  if (pImage)
-    {
-      if (pImage->data)
-	{
-	  free(pImage->data);
-	}
-      
-      free(pImage);
-    }
-  return true;
-#else /* HAVE_JPEGLIB_H */
-  if (verbose >=1)
-    printf ("sorry, but you did not compile with jpeg-support.\nEither install SDL_image or jpeglib, and recompile to see the image\n");
-  return false;
-#endif /* HAVE_JPEGLIB_H */
-
-}
-
-/**
-   \brief reads in a tga-file
-   \param tgaName the Name of the Image to load
-   \param texture a reference to the Texture to write the image to
-*/
-bool Material::loadTGA(const char * tgaName, GLuint* texture)
-{
-  typedef struct
-  {
-    GLubyte Header[12];
-  } TGAHeader;
-  TGAHeader tgaHeader;			
-  
-  GLubyte uTGAcompare[12] = {0,0,2, 0,0,0,0,0,0,0,0,0};	// Uncompressed TGA Header 
-  GLubyte cTGAcompare[12] = {0,0,10,0,0,0,0,0,0,0,0,0};	// Compressed TGA Header 
-  FILE * fTGA;
-  fTGA = fopen(tgaName, "rb");
-
-  if(fTGA == NULL)
-    {
-      printf("Error could not open texture file: %s\n", tgaName);
-      return false;
-    }
-  
-  if(fread(&tgaHeader, sizeof(TGAHeader), 1, fTGA) == 0)
-    {
-      printf("Error could not read file header of %s\n", tgaName);
-      if(fTGA != NULL)
-	{
-	  fclose(fTGA);
-	}
-      return false;
-    }
-  
-  if(memcmp(uTGAcompare, &tgaHeader, sizeof(TGAHeader)) == 0)
-    {
-      loadUncompressedTGA(tgaName, fTGA, texture);
-      if (fTGA)
-	fclose (fTGA);
-    }
-  else if(memcmp(cTGAcompare, &tgaHeader, sizeof(TGAHeader)) == 0)
-    {
-      loadCompressedTGA(tgaName, fTGA, texture);
-	if (fTGA)
-	  fclose (fTGA);
-    }
-  else
-    {
-      printf("Error TGA file be type 2 or type 10\n");
-      if (fTGA)
-	fclose(fTGA);
-      return false;
-    }
-  return true;
-}
-
-/**
-   \brief reads in an uncompressed tga-file
-   \param filename the Name of the Image to load
-   \param fTGA a Pointer to a File, that should be read
-   \param texture a reference to the Texture to write the image to
-*/
-bool Material::loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture)
-{
-  GLubyte header[6];      // First 6 Useful Bytes From The Header 
-  GLuint  bytesPerPixel;  // Holds Number Of Bytes Per Pixel Used In The TGA File 
-  GLuint  imageSize;	  // Used To Store The Image Size When Setting Aside Ram 
-  GLuint  temp;		  // Temporary Variable
-  GLuint  type;
-  GLuint  Height;	  // Height of Image 
-  GLuint  Width;	  // Width of Image 
-  GLuint  Bpp;		  // Bits Per Pixel 
-
-  Image* pImage = new Image;
-  GLuint cswap;
-  if(fread(header, sizeof(header), 1, fTGA) == 0)
-    {
-      printf("Error could not read info header\n");
-      return false;
-    }
-  
-  Width = pImage->width  = header[1] * 256 + header[0];
-  Height =  pImage->height = header[3] * 256 + header[2];
-  Bpp = pImage->bpp = header[4];
-  // Make sure all information is valid
-  if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32)))
-    {
-      printf("Error invalid texture information\n");
-      return false;
-    }
-  
-  if(pImage->bpp == 24)	
-    {
-      pImage->type = GL_RGB;
-    }
-  else
-    {
-      pImage->type = GL_RGBA;
-    }
-  
-  bytesPerPixel	= (Bpp / 8);
-  imageSize = (bytesPerPixel * Width * Height);
-  pImage->data = (GLubyte*) malloc(imageSize);
-  
-  if(pImage->data == NULL)
-    {
-      printf("Error could not allocate memory for image\n");
-      return false;
-    }
-  
-  if(fread(pImage->data, 1, imageSize, fTGA) != imageSize)
-    {
-      printf("Error could not read image data\n");
-      if(pImage->data != NULL)
-	{
-	  free(pImage->data);
-	}
-      return false;
-    }
-  
-  for(cswap = 0; cswap < (int)imageSize; cswap += bytesPerPixel)
-    {
-      pImage->data[cswap] ^= pImage->data[cswap+2] ^=
-	pImage->data[cswap] ^= pImage->data[cswap+2];
-    }
-  
-  loadTexToGL (pImage, texture);
-
-  return true;
-}
-
-/**
-   \brief reads in a compressed tga-file
-   \param filename the Name of the Image to load
-   \param fTGA a Pointer to a File, that should be read
-   \param texture a reference to the Texture to write the image to
-*/
-bool Material::loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture)
-{
-  GLubyte header[6];      // First 6 Useful Bytes From The Header 
-  GLuint  bytesPerPixel;  // Holds Number Of Bytes Per Pixel Used In The TGA File 
-  GLuint  imageSize;	  // Used To Store The Image Size When Setting Aside Ram 
-  GLuint  temp;		  // Temporary Variable
-  GLuint  type;
-  GLuint  Height;	  // Height of Image 
-  GLuint  Width;	  // Width of Image 
-  GLuint  Bpp;		  // Bits Per Pixel 
-
-  Image* pImage = new Image;
-
-  
-  if(fread(header, sizeof(header), 1, fTGA) == 0)
-    {
-      printf("Error could not read info header\n");
-      return false;
-    }
-  
-  Width = pImage->width  = header[1] * 256 + header[0];
-  Height = pImage->height = header[3] * 256 + header[2];
-  Bpp = pImage->bpp	= header[4];
-
-  GLuint pixelcount	= Height * Width;
-  GLuint currentpixel	= 0;
-  GLuint currentbyte	= 0;
-  GLubyte * colorbuffer = (GLubyte *)malloc(bytesPerPixel);
-
-  //Make sure all pImage info is ok 
-  if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32)))
-    {
-      printf("Error Invalid pImage information\n");
-      return false;
-    }
-  
-  bytesPerPixel	= (Bpp / 8);
-  imageSize		= (bytesPerPixel * Width * Height);
-  pImage->data	= (GLubyte*) malloc(imageSize);
-  
-  if(pImage->data == NULL)
-    {
-      printf("Error could not allocate memory for image\n");
-      return false;
-    }
-  
-  do
-    {
-      GLubyte chunkheader = 0;
-      
-      if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0)
-	{
-	  printf("Error could not read RLE header\n");
-	  if(pImage->data != NULL)
-	    {
-	      free(pImage->data);
-	    }
-	  return false;
-	}
-      // If the ehader is < 128, it means the that is the number of RAW color packets minus 1 
-      if(chunkheader < 128)
-	{
-	  short counter;
-	  chunkheader++;
-	  // Read RAW color values
-	  for(counter = 0; counter < chunkheader; counter++)
-	    { 
-	      // Try to read 1 pixel 
-	      if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel)
-		{
-		  printf("Error could not read image data\n");
-		  if(colorbuffer != NULL)
-		    {
-		      free(colorbuffer);
-		    }
-		  
-		  if(pImage->data != NULL)
-		    {
-		      free(pImage->data);
-		    }
-		  
-		  return false;	
-		}
-	      // write to memory 
-	      // Flip R and B vcolor values around in the process 
-	      pImage->data[currentbyte	  ] = colorbuffer[2];				    
-	      pImage->data[currentbyte + 1] = colorbuffer[1];
-	      pImage->data[currentbyte + 2] = colorbuffer[0];
-	      
-	      if(bytesPerPixel == 4) // if its a 32 bpp image 
-		{
-		  pImage->data[currentbyte + 3] = colorbuffer[3];// copy the 4th byte 
-		}
-	      
-	      currentbyte += bytesPerPixel;
-	      currentpixel++;
-
-	      // Make sure we haven't read too many pixels 
-	      if(currentpixel > pixelcount)	
-		{
-		  printf("Error too many pixels read\n");
-		  if(colorbuffer != NULL)
-		    {
-		      free(colorbuffer);
-		    }
-		  
-		  if(pImage->data != NULL)
-		    {
-		      free(pImage->data);
-		    }
-		  
-		  return false;
-		}
-	    }
-	}
-      // chunkheader > 128 RLE data, next color  reapeated chunkheader - 127 times
-      else
-	{
-	  short counter;
-	  chunkheader -= 127;	// Subteact 127 to get rid of the ID bit 
-	  if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel) // Attempt to read following color values 
-	    {
-	      printf("Error could not read from file");
-	      if(colorbuffer != NULL)
-		{
-		  free(colorbuffer);
-		}
-	      
-	      if(pImage->data != NULL)
-		{
-		  free(pImage->data);
-		}
-	      
-	      return false;
-	    }
-	  
-	  for(counter = 0; counter < chunkheader; counter++) //copy the color into the image data as many times as dictated
-	    {							
-	      // switch R and B bytes areound while copying
-	      pImage->data[currentbyte	  ] = colorbuffer[2];
-	      pImage->data[currentbyte + 1] = colorbuffer[1];
-	      pImage->data[currentbyte + 2] = colorbuffer[0];
-	      
-	      if(bytesPerPixel == 4)
-		{
-		  pImage->data[currentbyte + 3] = colorbuffer[3];
-		}
-	      
-	      currentbyte += bytesPerPixel;
-	      currentpixel++;
-	      
-	      if(currentpixel > pixelcount)
-		{
-		  printf("Error too many pixels read\n");
-		  if(colorbuffer != NULL)
-		    {
-		      free(colorbuffer);
-		    }
-		  
-		  if(pImage->data != NULL)
-		    {
-		      free(pImage->data);
-		    }
-		  
-		  return false;
-		}
-	    }
-	}
-    }
-  
-  while(currentpixel < pixelcount);	// Loop while there are still pixels left
-
-  loadTexToGL (pImage, texture);
-
-  return true;
-}
-
-
-/*
-static int ST_is_power_of_two(unsigned int number)
-{
-  return (number & (number - 1)) == 0;
-}
-*/
-
-/**
-   \brief reads in a png-file
-   \param pngName the Name of the Image to load
-   \param texture a reference to the Texture to write the image to
-*/
-bool Material::loadPNG(const char* pngName, GLuint* texture)
-{
-#ifdef HAVE_PNG_H
-  Image* pImage = new Image;
-
-  FILE *PNG_file = fopen(pngName, "rb");
-  if (PNG_file == NULL)
-    {
-      return 0;
-    }
-  
-  GLubyte PNG_header[8];
-  
-  fread(PNG_header, 1, 8, PNG_file);
-  if (png_sig_cmp(PNG_header, 0, 8) != 0)
-    {
-      if (verbose >=2)
-	printf ("Not Recognized as a pngFile\n");
-      fclose (PNG_file);
-      return 0;
-    }
-  
-  png_structp PNG_reader = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-  if (PNG_reader == NULL)
-    {
-      fclose(PNG_file);
-      return 0;
-    }
-  
-  png_infop PNG_info = png_create_info_struct(PNG_reader);
-  if (PNG_info == NULL)
-    {
-      png_destroy_read_struct(&PNG_reader, NULL, NULL);
-      fclose(PNG_file);
-      return 0;
-    }
-  
-  png_infop PNG_end_info = png_create_info_struct(PNG_reader);
-  if (PNG_end_info == NULL)
-    {
-      png_destroy_read_struct(&PNG_reader, &PNG_info, NULL);
-      fclose(PNG_file);
-      return 0;
-    }
-  
-  if (setjmp(png_jmpbuf(PNG_reader)))
-    {
-      png_destroy_read_struct(&PNG_reader, &PNG_info, &PNG_end_info);
-      fclose(PNG_file);
-      return (0);
-    }
-  
-  png_init_io(PNG_reader, PNG_file);
-  png_set_sig_bytes(PNG_reader, 8);
-  
-  png_read_info(PNG_reader, PNG_info);
-  
-  pImage->width = png_get_image_width(PNG_reader, PNG_info);
-  pImage->height = png_get_image_height(PNG_reader, PNG_info);
-  
-  png_uint_32 bit_depth, color_type;
-  bit_depth = png_get_bit_depth(PNG_reader, PNG_info);
-  color_type = png_get_color_type(PNG_reader, PNG_info);
-  
-  if (color_type == PNG_COLOR_TYPE_PALETTE)
-    {
-      png_set_palette_to_rgb(PNG_reader);
-    }
-  
-  if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
-    {
-      png_set_gray_1_2_4_to_8(PNG_reader);
-    }
-  
-  if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-    {
-      png_set_gray_to_rgb(PNG_reader);
-    }
-  
-  if (png_get_valid(PNG_reader, PNG_info, PNG_INFO_tRNS))
-    {
-      png_set_tRNS_to_alpha(PNG_reader);
-    }
-  else
-    {
-      png_set_filler(PNG_reader, 0xff, PNG_FILLER_AFTER);
-    }
-  
-  if (bit_depth == 16)
-    {
-      png_set_strip_16(PNG_reader);
-    }
-  
-  png_read_update_info(PNG_reader, PNG_info);
-  
-  pImage->data = (png_byte*)malloc(4 * pImage->width * pImage->height);
-  png_byte** PNG_rows = (png_byte**)malloc(pImage->height * sizeof(png_byte*));
-  
-  unsigned int row;
-  for (row = 0; row < pImage->height; ++row)
-    {
-      PNG_rows[pImage->height - 1 - row] = pImage->data + (row * 4 * pImage->width);
-    }
-  
-  png_read_image(PNG_reader, PNG_rows);
-  
-  free(PNG_rows);
-  
-  png_destroy_read_struct(&PNG_reader, &PNG_info, &PNG_end_info);
-  fclose(PNG_file);
-  
-  /*  if (!ST_is_power_of_two(pImage->width) || !ST_is_power_of_two(pImage->height))
-    {
-      free(pImage->data);
-      return 0;
-    }
-  */
-  loadTexToGL (pImage, texture);  
-  
-  free(pImage->data);
-  
-  return true;
-#else /* HAVE_PNG_H */
-  if (verbose >=1)
-    printf ("sorry, but you did not compile with png-support.\nEither install SDL_image or libpng, and recompile to see the image\n");
-  return false;
-#endif /* HAVE_PNG_H */
-
-}
-
-#endif /* HAVE_SDL_SDL_IMAGE_H */
Index: orxonox/trunk/src/material.h
===================================================================
--- orxonox/trunk/src/material.h	(revision 3195)
+++ 	(revision )
@@ -1,145 +1,0 @@
-/*!
-  \file material.h
-  \brief Contains the Material Class that handles Material for 3D-Objects.
-  \todo free SDL-surface when deleting Material.
-  \todo delete imgNameWithPath after use creation.
-*/
-
-#ifndef _MATERIAL_H
-#define _MATERIAL_H
-
-
-
-extern int verbose; //!< will be obsolete soon.
-
-#include "stdincl.h"
-
-#if HAVE_CONFIG_H 
-#include <config.h> 
-#endif /* HAVE_CONFIG_H */
-
-#ifdef HAVE_SDL_SDL_IMAGE_H
-#include <SDL/SDL_image.h>
-#else
-// IMAGE LIBS //
-#ifdef HAVE_JPEGLIB_H
-extern "C"{         // This has to be done, because not a c++ lib
-#include <jpeglib.h>
-}
-#endif /* HAVE_JPEGLIB_H */
-#ifdef HAVE_PNG_H
-#include <png.h>
-#endif /* HAVE_PNG_H */
-#endif /* HAVE_SDL_SDL_IMAGE_H */
-
-//! Class to handle lists of paths.
-/**
-   \todo Ability to return Paths by itself.
-
-   It is simple to use, and good, for all PathList you want.
-   just create a new Pathlist, and add Paths.
-*/
-class PathList
-{
- public:
-  PathList();
-  PathList(char* pName);
-
-  ~PathList();
-  void addPath (char* pName);
-  char* pathName;          //!< The Name of the current Path.
-  PathList* next;          //!< Pointer to the next Pathlist.
-};
-
-
-//! Class to handle Materials.
-class Material
-{
- public:
-  Material ();
-  Material (char* mtlName);
-  Material* addMaterial(char* mtlName);
-  ~Material ();
-  void init(void);
-
-  Material* search (char* mtlName);
-  bool select (void);
-
-  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);
-
-
- 
-  void addTexturePath(char* pathName);
-  char* searchTextureInPaths(char* texName) const;
- // MAPPING //
-  void setDiffuseMap(char* dMap);
-  void setAmbientMap(char* aMap);
-  void setSpecularMap(char* sMap);
-  void setBump(char* bump);
-
- private:
-  //! Struct to handle Infos about an Image
-  struct Image
-  {
-    int rowSpan;    //!< The count of the rows this Image has.
-    GLuint width;   //!< The width of the Image.
-    GLuint height;  //!< The height of the Image.
-    GLuint bpp;     //!< BitsPerPixel
-    GLuint type;    //!< Type of the Image.
-    GLubyte *data;  //!< The Image Data comes here! DANGER: uncompressed data.
-  };
-
-
-  char* name;        //!< The Name of the Material.
-  int illumModel;    //!< The IlluminationModel is either flat or smooth.
-  float diffuse [4]; //!< The diffuse color of the Material.
-  float ambient [4]; //!< The ambient color of the Material.
-  float specular [4];//!< The specular color of the Material.
-  float shininess;   //!< The shininess of the Material.
-  float transparency;//!< The transperency of the Material.
-
-  static PathList* pathList; //!< A pointer to the first element of Pathlist. This is static, because pathlists are global \todo copy this to the Globals.h or DataTank for deletion at the end.
-  
-  GLuint diffuseTexture; //!< The diffuse texture of the Material.
-  GLuint ambientTexture; //!< The ambient texture of the Material.
-  GLuint specularTexture;//!< The specular texture of the Material.
-  
-  bool diffuseTextureSet; //!< Chekcs if the diffuse texture is Set.
-  bool ambientTextureSet; //!< Chekcs if the ambient texture is Set.
-  bool specularTextureSet;//!< Chekcs if the specular texture is Set.
-
-  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
-
-  // TEXTURING
-  bool loadTexToGL (Image* pImage, GLuint* texture);
-
-  bool loadImage(char* imageName, GLuint* texture);
-#ifndef HAVE_SDL_SDL_IMAGE_H
-
-  bool loadBMP (char* bmpName, GLuint* texture);
-
-  bool loadJPG (char* jpgName, GLuint* texture);
-
-  /// TGA ///
-
-  bool loadTGA(const char * tgaName, GLuint* texture);
-  bool loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
-  bool loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
-
-  bool loadPNG(const char* pngName, GLuint* texture);
-#endif
-};
-#endif
Index: orxonox/trunk/src/object.cc
===================================================================
--- orxonox/trunk/src/object.cc	(revision 3195)
+++ 	(revision )
@@ -1,1009 +1,0 @@
-/* 
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Benjamin Grauer
-   co-programmer: ...
-*/
-
-int verbose = 0;
-
-#include "object.h"
-using namespace std;
-
-/**
-   \brief Creates a 3D-Object, but does not load any 3D-models.
-
-   This Constructor is pretty useless, because why load no object in an object-loader??
-*/
-Object::Object ()
-{
-
-  initialize();
-
-  BoxObject();
-
-  importToGL ();
-
-  cleanup();
-}
-
-/**
-   \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);
-
-  importToGL ();
-
-  cleanup();
-}
-
-/**
-   \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);
-
-  importToGL ();
-
-  cleanup();
-}
-
-/**
-   \brief deletes an Object.
-
-   Looks if any from object allocated space is still in use, and if so deleted it.
-*/
-Object::~Object()
-{
-  if (verbose >= 2)
-    printf ("Deleting display Lists.\n");
-  Group* walker = firstGroup;
-  while (walker != NULL)
-    {
-      glDeleteLists (walker->listNumber, 1);
-      Group* delWalker = walker;
-      walker = walker->next;
-      delete delWalker;
-    }
-
-  if (objPath)
-    delete []objPath;
-  if (objFileName)
-    delete []objFileName;
-  if (mtlFileName)
-    delete []mtlFileName;
-
-  if (verbose >=2)
-    printf("Deleting Materials.\n");
-  if (material)
-    delete material;
-}
-
-
-/**
-   \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) const
-{
-  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->next;
-    }
-}
-
-/**
-   \brief Draws the Object number groupNumber
-   \param groupNumber The number of the group that will be displayed.
-
-   It does this by just calling the List that must have been created earlier.
-*/
-void Object::draw (int groupNumber) const 
-{
-  if (groupNumber >= groupCount)
-    {
-      if (verbose>=1)
-	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 %i named %s\n", counter, walker->name);
-	  glCallList (walker->listNumber);
-	  return;
-	}
-      ++counter;
-      walker = walker->next;
-    }
-  if (verbose >= 1)
-    printf("Object number %i in %s not Found.\n", groupNumber, objFileName);
-  return;
-
-}
-
-/**
-   \brief Draws the Object with a specific groupName
-   \param groupName The name of the group that will be displayed.
-
-   It does this by just calling the List that must have been created earlier.
-*/
-void Object::draw (char* groupName) const
-{
-  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->next;
-    }
-  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) const
-{
-  return groupCount;
-}
-
-/**
-    \brief initializes the Object.
-
-    This Function initializes all the needed arrays, Lists and clientStates.
-    It also defines default values.
-*/
-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 (firstGroup);
-  objPath = NULL;
-  objFileName = NULL;
-  mtlFileName = NULL;
-  scaleFactor = 1;
-  material = new Material();
-
-  vertices = new Array();
-  vTexture = new Array();
-  normals = new Array();
-
-  return true;
-}
-
-/**
-   \brief initializes a new Group object
-   \param group the group that should be initialized.
-   \todo Maybe Group should be a Class, because it does a lot of stuff
-   
-*/
-bool Object::initGroup(Group* group)
-{
-  if (verbose >= 2)
-    printf("Adding new Group\n");
-  group->name = "";
-  group->faceMode = -1;
-  group->faceCount = 0;  
-  group->next = NULL;
-
-  group->firstFace = new Face;
-  initFace (group->firstFace);
-  group->currentFace = group->firstFace;
-}
-
-/**
-   \brief initializes a new Face. (sets default Values)
-   \param face The face to initialize
-*/
-bool Object::initFace (Face* face)
-{
-  face->vertexCount = 0;
-
-  face->firstElem = NULL;
-  
-  face->materialString = NULL;
-  
-  face->next = NULL;
-
-  return true;
-}
-
-/**
-   \brief finalizes an Object.
-   This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process.
-*/
-bool Object::cleanup(void)
-{
-  if (verbose >=2)
-    printf("cleaning up the 3D-Object to save Memory.\n");
-
-  if (vertices != NULL)
-    delete vertices;
-  if (vTexture != NULL)
-    delete vTexture;
-  if (normals != NULL)
-    delete normals;
-
-  cleanupGroup(firstGroup);
-  return true; 
-}
-
-/**
-   \brief Cleans up all groups starting from group.
-   \param group the first Group to clean
-*/
-bool Object::cleanupGroup (Group* group)
-{
-  if (verbose>=4)
-    printf ("Cleaning up group\n");
-  if (group->firstFace != NULL)
-    {
-      cleanupFace (group->firstFace);
-      delete group->firstFace;
-    }
-
-  if (group->next !=NULL)
-    cleanupGroup (group->next);
-  return true;
-}
-
-/**
-   \brief Cleans up all Faces starting from face until NULL is reached.
-   \param face the first face to clean.
-*/
-bool Object::cleanupFace (Face* face)
-{
-  if (verbose>=4)
-    printf ("Cleaning up Face\n");
-
-  if (face->materialString != NULL)
-      delete []face->materialString;
-  if (face->firstElem != NULL)
-    {
-      cleanupFaceElement(face->firstElem);
-      delete face->firstElem;
-    }
-      
-  if (face->next != NULL)
-    {
-      cleanupFace (face->next);
-      delete face->next;
-    }
-      
-}
-
-
-/**
-   \brief Cleans up all FaceElements starting from faceElem.
-   \param faceElem the first FaceElement to clean.
-*/
-bool Object::cleanupFaceElement(FaceElement* faceElem)
-{
-  if (faceElem->next != NULL)
-    {
-      cleanupFaceElement (faceElem->next);
-      delete faceElem->next;
-    }
-}
-
-/**
-   \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);
-
-
-#ifdef __WIN32__
-  // win32 path reading
-  char pathSplitter= '\\';
-#else /* __WIN32__ */
-  // unix path reading
-  char pathSplitter='/';
-#endif /* __WIN32__ */
-  char* tmpName = fileName;
-  if (tmpName[0] == pathSplitter)
-    tmpName++;
-  char* name = tmpName;
-  while (( tmpName = strchr (tmpName+1, pathSplitter)))
-    {
-      name = tmpName+1;
-    }
-  objPath = new char[name-fileName];
-  strncpy(objPath, fileName, name-fileName);
-  objPath[name-fileName] = '\0';
-  if (verbose >=2)
-    if (strlen(objPath)> 0)
-      {
-	printf("Resolved file %s to folder: %s.\n", name, objPath);
-      }
-    else
-      printf("Resolved file %s.\n", name);
-  
-  if (material)
-    material->addTexturePath(objPath);
-  objFileName = new char[strlen(name)+1];
-  strcpy (objFileName, name);
-  this->readFromObjFile ();
-  return true;
-}
-
-/**
-   \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
-*/
-bool Object::readFromObjFile (void)
-{
-  char* fileName = new char [strlen(objPath)+strlen(objFileName)+1];
-  if (objFileName != NULL && !strcmp(objFileName, ""))
-    return false;
-  strcpy(fileName, objPath);
-  strcat(fileName, objFileName);
-
-  ifstream* OBJ_FILE = new ifstream(fileName);
-  if (OBJ_FILE->fail())
-    {
-      if (verbose >=1)
-	printf ("unable to open .OBJ file: %s\n Loading Box Object instead.\n", fileName);
-      BoxObject();
-      delete []fileName;
-      OBJ_FILE->close();
-      return false;
-    }
-  if (verbose >=2)
-    printf ("Reading from opened file %s\n", fileName);
-  char Buffer[10000];
-  while(!OBJ_FILE->eof())
-    {
-      OBJ_FILE->getline(Buffer, 10000);
-      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 ", 7))
-	{
-	  readMtlLib (Buffer+7);
-	}
-
-      else if (!strncmp(Buffer, "usemtl ", 7))
-	{
-	  readUseMtl (Buffer+7);
-	}
-
-      // case VertexNormal
-      else if (!strncmp(Buffer, "vn ", 3))
-      {
-	readVertexNormal(Buffer+3);
-      }
-
-      // case VertexTextureCoordinate
-      else if (!strncmp(Buffer, "vt ", 3))
-      {
-	readVertexTexture(Buffer+3);
-      }
-      // case group
-      else if (!strncmp(Buffer, "g ", 2))
-	{
-	  readGroup (Buffer+2);
-	}
-      else if (!strncmp(Buffer, "s ", 2))
-	{
-	  if (verbose >= 2)
-	    printf("smoothing groups not supportet yet. line: %s\n", Buffer);
-	}
-    }
-  OBJ_FILE->close();
-  delete []fileName;
-  return true;
-
-}
-
-/**
-   \brief parses a group String
-   \param groupString the new Group to create
-
-   This function initializes a new Group. 
-   With it you should be able to import .obj-files with more than one Objects inside. 
-*/
-bool Object::readGroup (char* groupString)
-{
-  if (verbose >=3)
-    printf ("Read Group: %s.\n", groupString);
-  if (groupCount != 0 && currentGroup->faceCount>0)
-    {
-      //      finalizeGroup(currentGroup);
-      currentGroup = currentGroup->next = new Group;
-      initGroup(currentGroup);
-    }
-  // setting the group name if not default.
-  if (strcmp(groupString, "default"))
-    {
-      currentGroup->name = new char [strlen(groupString)+1];
-      strcpy(currentGroup->name, groupString);
-    }
-  ++groupCount;
-
-}
-
-/**
-   \brief parses a vertex-String
-   \param vertexString The String that will be parsed.
-
-   If a vertex line is found this function will inject it into the vertex-Array
-*/
-bool Object::readVertex (char* vertexString)
-{
-  float subbuffer1;
-  float subbuffer2;
-  float subbuffer3;
-  sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
-  if (verbose >= 3)
-    printf ("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3);
-  vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor);
-  return true;
-}
-
-/**
-   \brief parses a face-string
-   \param faceString The String that will be parsed.
-
-   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.
-*/
-bool Object::readFace (char* faceString)
-{
-  if (currentGroup->faceCount >0)
-    currentGroup->currentFace = currentGroup->currentFace->next = new Face;
-  initFace (currentGroup->currentFace);
-
-  FaceElement* tmpElem = currentGroup->currentFace->firstElem = new FaceElement;
-  tmpElem->next = NULL;
-  while(strcmp (faceString, "\0"))
-    {
-      if (currentGroup->currentFace->vertexCount>0)
-	  tmpElem = tmpElem->next = new FaceElement;
-      tmpElem->next = NULL;
-
-      char tmpValue [50];
-      int tmpLen;
-      char* vertex = NULL;
-      char* texture = NULL;
-      char* normal = NULL;
-
-      sscanf (faceString, "%s", tmpValue);
-      tmpLen = strlen(tmpValue);
-      vertex = tmpValue;
-
-      if ((texture = strstr (vertex, "/")) != NULL)
-	{
-	  texture[0] = '\0';
-	  texture ++;
-	  
-	  if ((normal = strstr (texture, "/")) !=NULL)
-	    {
-	      normal[0] = '\0';
-	      normal ++;
-	    }	  
-	}
-      if (vertex)
-	tmpElem->vertexNumber = atoi(vertex)-1;
-      else
-	tmpElem->vertexNumber = -1;
-      if (texture)
-	tmpElem->texCoordNumber = atoi(texture)-1;
-      else
-	tmpElem->texCoordNumber = -1;
-      if (normal)
-	tmpElem->normalNumber = atoi(normal)-1;
-      else
-	tmpElem->normalNumber = -1;
-
-      faceString += tmpLen;
-      if (strcmp (faceString, "\0"))
-	faceString++;
-      currentGroup->currentFace->vertexCount++;
-    }
-
-  currentGroup->faceCount += currentGroup->currentFace->vertexCount -2;
-}
-
-/**
-   \brief parses a vertexNormal-String
-   \param normalString The String that will be parsed.
-
-   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
-*/
-bool Object::readVertexNormal (char* normalString)
-{
-  float subbuffer1;
-  float subbuffer2;
-  float subbuffer3;
-  sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
-  if (verbose >=3 )
-    printf("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);
-  normals->addEntry(subbuffer1, subbuffer2, subbuffer3);
-  return true;
-}
-
-/**
-   \brief parses a vertexTextureCoordinate-String
-   \param vTextureString The String that will be parsed.
-
-   If a vertexTextureCoordinate line is found,
-   this function will inject it into the vertexTexture-Array
-*/
-bool Object::readVertexTexture (char* vTextureString)
-{
-  float subbuffer1;
-  float subbuffer2;
-  sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2);
-  if (verbose >=3 )
-    printf("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);
-  vTexture->addEntry(subbuffer1);
-  vTexture->addEntry(subbuffer2);
-  return true;
-}
-
-/** 
-    \brief Function to read in a mtl File.
-    \param mtlFile The .mtl file to read
-
-    This Function parses all Lines of an mtl File.
-    The reason for it not to be in the materials-class is,
-    that a material does not have to be able to read itself in from a File.
-
-*/
-bool Object::readMtlLib (char* mtlFile)
-{
-  mtlFileName = new char [strlen(mtlFile)+1];
-  strcpy(mtlFileName, mtlFile);
-  char* fileName = new char [strlen(objPath) + strlen(mtlFileName)+1];
-  strcpy(fileName, objPath);
-  strcat(fileName, mtlFileName);
-  
-
-  if (verbose >=2)
-    printf ("Opening mtlFile: %s\n", fileName);
-
-  ifstream* MTL_FILE = new ifstream (fileName);
-  if (MTL_FILE->fail())
-    {
-      if (verbose >= 1)
-	printf ("unable to open file: %s\n", fileName);
-      delete []fileName;
-      MTL_FILE->close();
-      return false;
-    }
-  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 ", 7))
-	{
-	  tmpMat = tmpMat->addMaterial(Buffer+7);
-	  //	  printf ("%s, %p\n", tmpMat->getName(), tmpMat);
-	}
-      // setting a illumMode
-      else if (!strncmp(Buffer, "illum ", 6))
-	{
-	  tmpMat->setIllum(Buffer+6);
-
-	}
-      // setting Diffuse Color
-      else if (!strncmp(Buffer, "Kd ", 3))
-	{
-	  tmpMat->setDiffuse(Buffer+3);
-	}
-      // setting Ambient Color
-      else if (!strncmp(Buffer, "Ka ", 3))
-	{
-	  tmpMat->setAmbient(Buffer+3);
-	}
-      // setting Specular Color
-      else if (!strncmp(Buffer, "Ks ", 3))
-	{
-	  tmpMat->setSpecular(Buffer+3);
-	}
-      // setting The Specular Shininess
-      else if (!strncmp(Buffer, "Ns ", 3))
-	{
-	  tmpMat->setShininess(Buffer+3);
-	}
-      // setting up transparency
-      else if (!strncmp(Buffer, "d ", 2))
-	{
-	  tmpMat->setTransparency(Buffer+2);
-	}
-      else if (!strncmp(Buffer, "Tf ", 3))
-	{
-	  tmpMat->setTransparency(Buffer+3);
-	}
-      
-      else if (!strncmp(Buffer, "map_Kd ", 7))
-	{
-	  tmpMat->setDiffuseMap(Buffer+7);
-	}
-      else if (!strncmp(Buffer, "map_Ka ", 7))
-	{
-	  tmpMat->setAmbientMap(Buffer+7);
-	}
-      else if (!strncmp(Buffer, "map_Ks ", 7))
-	{
-	  tmpMat->setSpecularMap(Buffer+7);
-	}
-      else if (!strncmp(Buffer, "bump ", 5))
-	{
-	  tmpMat->setBump(Buffer+7);
-	}
-     
-
-    }
-  delete []fileName;
-  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 (!mtlFileName)
-    {
-      if (verbose >= 1)
-	printf ("Not using new defined material, because no mtlFile found yet\n");
-      return false;
-    }
-      
-  if (currentGroup->faceCount >0)
-    currentGroup->currentFace = currentGroup->currentFace->next = new Face;
-  initFace (currentGroup->currentFace);
-  
-  currentGroup->currentFace->materialString = new char[strlen(matString)+1];
-  strcpy (currentGroup->currentFace->materialString, matString);
-  
-  if (currentGroup->faceCount == 0)
-    currentGroup->faceCount ++;
-
-}
-
-/**
-   \brief reads and includes the Faces/Materials into the openGL state Machine
-*/
-bool Object::importToGL (void)
-{
-
-  // finalize the Arrays
-  vertices->finalizeArray();
-  vTexture->finalizeArray();
-  if (normals->getCount() == 0) // vertices-Array must be uilt for this
-    buildVertexNormals();
-  normals->finalizeArray();
-
-  currentGroup = firstGroup;
-
-  while (currentGroup != NULL)
-    {
-
-      // creating a glList for the Group
-      if ((currentGroup->listNumber = glGenLists(1)) == 0)
-	{
-	  printf ("list could not be created for this Object\n");
-	  return false;
-	}
-      glNewList (currentGroup->listNumber, GL_COMPILE);
-
-      // Putting Faces to GL
-      Face* tmpFace = currentGroup->firstFace;
-      while (tmpFace != NULL)
-	{
-	  if (tmpFace->vertexCount == 0 && tmpFace->materialString != NULL)
-	    {
-	      if (currentGroup->faceMode != -1)
-		glEnd();
-	      currentGroup->faceMode = 0;
-	      if (verbose >= 2)
-		printf ("using material %s for coming Faces.\n", tmpFace->materialString);
-	      Material* tmpMat;
-	      if ((tmpMat = material->search(tmpFace->materialString)) != NULL)
-		tmpMat->select();
-
-	    }
-
-	  else if (tmpFace->vertexCount == 3)
-	    {
-	      if (currentGroup->faceMode != 3)
-		{
-		  if (currentGroup->faceMode != -1)
-		    glEnd();
-		  glBegin(GL_TRIANGLES);
-		}
-	      
-	      currentGroup->faceMode = 3;
-	      if (verbose >=3)
-		printf ("found triag.\n");
-	    }
-	  
-	  else if (tmpFace->vertexCount == 4)
-	    {
-	      if (currentGroup->faceMode != 4)
-		{
-		  if (currentGroup->faceMode != -1)
-		    glEnd();
-		  glBegin(GL_QUADS);
-		}
-	      currentGroup->faceMode = 4;
-	      if (verbose >=3 )
-		printf ("found quad.\n");
-	    }
-	  
-	  else if (tmpFace->vertexCount > 4)
-	    {
-	      if (currentGroup->faceMode != -1)
-		glEnd();
-	      glBegin(GL_POLYGON);
-	      if (verbose >=3)
-		printf ("Polygon with %i faces found.", tmpFace->vertexCount);
-	      currentGroup->faceMode = tmpFace->vertexCount;
-	    }
-	  
-	  FaceElement* tmpElem = tmpFace->firstElem;
-	  while (tmpElem != NULL)
-	    {
-	      //      printf ("%s\n", tmpElem->value);
-	      addGLElement(tmpElem);
-	      tmpElem = tmpElem->next;
-	    }
-	  tmpFace = tmpFace->next;
-	}
-      glEnd();
-      glEndList();
-      currentGroup = currentGroup->next;
-    } 
-}
-
-/**
-   \brief Adds a Face-element (one vertex of a face) with all its information. 
-   \param elem The FaceElement to add to the OpenGL-environment.
-
-   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 (FaceElement* elem)
-{
-  if (verbose >=3)
-    printf ("importing grafical Element to openGL.\n");
-
-  if (elem->texCoordNumber != -1)
-    glTexCoord2fv(vTexture->getArray() + elem->texCoordNumber * 2);
-  if (elem->normalNumber != -1)
-    glNormal3fv(normals->getArray() + elem->normalNumber * 3);
-  if (elem->vertexNumber != -1)
-    glVertex3fv(vertices->getArray() + elem->vertexNumber * 3);
-
-}
-
-/**
-   \brief A routine that is able to create normals.
-
-   The algorithm does the following:
-   1. It calculates creates Vectors for each normale, and sets them to zero.
-   2. It then Walks through a) all the Groups b) all the Faces c) all the FaceElements
-   3. It searches for a points two neighbours per Face, takes Vecotrs to them calculates FaceNormals and adds it to the Points Normal.
-   4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array.
-*/
-bool Object::buildVertexNormals ()
-{
-  
-  if (verbose >=2)
-    printf("Normals are being calculated.\n");
-
-  Vector* normArray = new Vector [vertices->getCount()/3];
-  for (int i=0; i<vertices->getCount()/3;i++)
-    normArray[i] = Vector(.0,.0,.0);
-  
-  int firstTouch;
-  int secondTouch;
-  Vector prevV;
-  Vector nextV;
-  Vector curV;
-
-  Group* tmpGroup = firstGroup;
-  while (tmpGroup)
-    {
-      Face* tmpFace = tmpGroup->firstFace;
-      while (tmpFace)
-	{
-	  if (tmpFace->firstElem)
-	    {
-	      FaceElement* firstElem = tmpFace->firstElem;
-	      FaceElement* prevElem;
-	      FaceElement* curElem = firstElem;
-	      FaceElement* nextElem;
-	      FaceElement* lastElem;
-	      // find last Element of the Chain. !! IMPORTANT:the last Element of the Chain must point to NULL, or it will resolv into an infinity-loop.
-	      while (curElem)
-		{
-		  prevElem = curElem;
-		  curElem = curElem->next;
-		}
-	      lastElem = prevElem;
-	      
-	      curElem = firstElem;
-	      for (int j=0; j<tmpFace->vertexCount; j++)
-		{
-		  if (!(nextElem = curElem->next))
-		    nextElem = firstElem;
-		  curElem->normalNumber = curElem->vertexNumber;
-		  
-		  curV = Vector (vertices->getArray()[curElem->vertexNumber*3], vertices->getArray()[curElem->vertexNumber*3+1], vertices->getArray()[curElem->vertexNumber*3+2]);
-		  prevV = Vector (vertices->getArray()[prevElem->vertexNumber*3], vertices->getArray()[prevElem->vertexNumber*3+1], vertices->getArray()[prevElem->vertexNumber*3+2]) - curV;
-		  nextV = Vector (vertices->getArray()[nextElem->vertexNumber*3], vertices->getArray()[nextElem->vertexNumber*3+1], vertices->getArray()[nextElem->vertexNumber*3+2]) - curV;
-		  normArray[curElem->vertexNumber] = normArray[curElem->vertexNumber] + nextV.cross(prevV);
-
-		  prevElem = curElem;
-		  curElem = curElem->next;
-		}
-	    }
-	  tmpFace = tmpFace->next;
-	}
-      tmpGroup = tmpGroup->next;
-    }
-
-  for (int i=0; i<vertices->getCount()/3;i++)
-    {
-      normArray[i].normalize();
-      if (verbose >=3)
-	printf ("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
-
-      normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z);
-
-    }
-  delete []normArray; 
-  
-}
-
-
-/**
-   \brief Includes a default object
-
-   This will inject a Cube, because this is the most basic object.
-*/
-void Object::BoxObject(void)
-{
-  readVertex ("-0.5 -0.5 0.5");
-  readVertex ("0.5 -0.5 0.5");
-  readVertex ("-0.5 0.5 0.5");
-  readVertex ("0.5 0.5 0.5");
-  readVertex ("-0.5 0.5 -0.5");
-  readVertex ("0.5 0.5 -0.5");
-  readVertex ("-0.5 -0.5 -0.5");
-  readVertex ("0.5 -0.5 -0.5");
-
-  readVertexTexture ("0.0 0.0");
-  readVertexTexture ("1.0 0.0");
-  readVertexTexture ("0.0 1.0");
-  readVertexTexture ("1.0 1.0");
-  readVertexTexture ("0.0 2.0");
-  readVertexTexture ("1.0 2.0");
-  readVertexTexture ("0.0 3.0");
-  readVertexTexture ("1.0 3.0");
-  readVertexTexture ("0.0 4.0");
-  readVertexTexture ("1.0 4.0");
-  readVertexTexture ("2.0 0.0");
-  readVertexTexture ("2.0 1.0");
-  readVertexTexture ("-1.0 0.0");
-  readVertexTexture ("-1.0 1.0");
-
-  readVertexNormal ("0.0 0.0 1.0");
-  readVertexNormal ("0.0 0.0 1.0");
-  readVertexNormal ("0.0 0.0 1.0");
-  readVertexNormal ("0.0 0.0 1.0");
-  readVertexNormal ("0.0 1.0 0.0");
-  readVertexNormal ("0.0 1.0 0.0");
-  readVertexNormal ("0.0 1.0 0.0");
-  readVertexNormal ("0.0 1.0 0.0");
-  readVertexNormal ("0.0 0.0 -1.0");
-  readVertexNormal ("0.0 0.0 -1.0");
-  readVertexNormal ("0.0 0.0 -1.0");
-  readVertexNormal ("0.0 0.0 -1.0");
-  readVertexNormal ("0.0 -1.0 0.0");
-  readVertexNormal ("0.0 -1.0 0.0");
-  readVertexNormal ("0.0 -1.0 0.0");
-  readVertexNormal ("0.0 -1.0 0.0");
-  readVertexNormal ("1.0 0.0 0.0");
-  readVertexNormal ("1.0 0.0 0.0");
-  readVertexNormal ("1.0 0.0 0.0");
-  readVertexNormal ("1.0 0.0 0.0");
-  readVertexNormal ("-1.0 0.0 0.0");
-  readVertexNormal ("-1.0 0.0 0.0");
-  readVertexNormal ("-1.0 0.0 0.0");
-  readVertexNormal ("-1.0 0.0 0.0");
-
-  /* normaleLess-testingMode
-  readFace ("1 2 4 3");
-  readFace ("3 4 6 5");
-  readFace ("5 6 8 7");
-  readFace ("7 8 2 1");
-  readFace ("2 8 6 4");
-  readFace ("7 1 3 5");
-  */
-
-  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/trunk/src/object.h
===================================================================
--- orxonox/trunk/src/object.h	(revision 3195)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*!
-  \file object.h
-  \brief Contains the Object Class that handles 3D-Objects
-*/
-
-#ifndef _OBJECT_H
-#define _OBJECT_H
-
-#include "stdincl.h"
-
-#include "array.h"
-#include "material.h"
-#include "vector.h"
-#include <fstream>
-
-using namespace std;
-
-extern int verbose; //!< Will 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 ();
-  
-  void draw (void) const;
-  void draw (int groupNumber) const;
-  void draw (char* groupName) const;
-  int getGroupCount() const;
-
- private:
-  //! This is the placeholder of one Vertex beloning to a Face.
-  struct FaceElement 
-  {
-    int vertexNumber;    //!< The number of the Vertex out of the Array* vertices, this vertex points to.
-    int normalNumber;    //!< The number of the Normal out of the Array* normals, this vertex points to.
-    int texCoordNumber;  //!< The number of the textureCoordinate out of the Array* vTexture, this vertex points to.
-    FaceElement* next;   //!< Point to the next FaceElement in this List.
-  };
-
-  //! This is the placeholder of a Face belonging to a Group of Faces.
-  /**
-     \todo take Material to a call for itself.
-
-     This can also be a Material-Change switch. 
-     That means if you want to change a Material inside of a group,
-     you can create an empty face and apply a material to it, and the Importer will cahnge Colors
-  */
-  struct Face 
-  {
-    int vertexCount;        //!< The Count of vertices this Face has.
-    FaceElement* firstElem; //!< Points to the first Vertex (FaceElement) of this Face.
-
-    char* materialString;   //!< The Name of the Material to which to Change.
-
-    Face* next;             //!< Pointer to the next Face.
-  }; 
-
-  //! Group to handle multiple Objects per obj-file.
-  struct Group
-  {
-    char* name;         //!< the Name of the Group. this is an identifier, that can be accessed via the draw (char* name) function.
-
-    GLuint listNumber;  //!< The number of the GL-List this Group gets.
-    Face* firstFace;    //!< The first Face in this group.
-    Face* currentFace;  //!< The current Face in this Group (the one we are currently working with.)
-    int faceMode;       //!< The Mode the Face is in: initially -1, 0 for FaceList opened, 1 for Material,  3 for triangle, 4 for Quad, 5+ for Poly \todo ENUM...
-    int faceCount;      //!< The Number of Faces this Group holds.
-
-    Group* next;        //!< Pointer to the next Group.
-  };
-
-
-  Array* vertices;      //!< The Array that handles the Vertices.
-  int verticesCount;    //!< A global Counter for vertices.
-  Array* normals;       //!< The Array that handles the Normals.
-  Array* vTexture;      //!< The Array that handles the VertexTextureCoordinates.
-
-  
-  Group* firstGroup;    //!< The first of all groups.
-  Group* currentGroup;  //!< The currentGroup. this is the one we will work with.
-  int groupCount;       //!< The Count of Groups.
-
-  Material* material;   //!< Initial pointer to the Material. This can hold many materials, because Material can be added with Material::addMaterial(..)
-  float scaleFactor;    //!< The Factor with which the Object hould be scaled. \todo maybe one wants to scale the Object after Initialisation
-
-  char* objPath;        //!< The Path wher the obj and mtl-file are located.
-  char* objFileName;    //!< The Name of the obj-file.
-  char* mtlFileName;    //!< The Name of the mtl-file (parsed out of the obj-file)
-
-  bool initialize (void);
-  bool initGroup(Group* group);
-  bool initFace (Face* face);
-  bool cleanup(void);
-  bool cleanupGroup(Group* group);
-  bool cleanupFace(Face* face);
-  bool cleanupFaceElement(FaceElement* faceElem);
-
-  ///// readin ///
-  bool importFile (char* fileName);
-  bool readFromObjFile (void);
-  
-  bool readGroup (char* groupString);
-  bool readVertex (char* vertexString);
-  bool readFace (char* faceString);
-  bool readVertexNormal (char* normalString);
-  bool readVertexTexture (char* vTextureString);
-  bool readMtlLib (char* matFile);
-  bool readUseMtl (char* mtlString);
-
-  bool importToGL (void);
-  bool addGLElement (FaceElement* elem);
-
-  bool buildVertexNormals ();
-
-  void BoxObject (void);
-};
-
-#endif
Index: orxonox/trunk/src/player.h
===================================================================
--- orxonox/trunk/src/player.h	(revision 3195)
+++ orxonox/trunk/src/player.h	(revision 3196)
@@ -8,5 +8,5 @@
 
 #include "world_entity.h"
-#include "object.h"
+#include "importer/object.h"
 
 //! Basic controllable WorldEntity
