Index: orxonox/trunk/src/lib/base_entity.cc
===================================================================
--- orxonox/trunk/src/lib/base_entity.cc	(revision 3483)
+++ 	(revision )
@@ -1,32 +1,0 @@
-
-
-/* 
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Patrick Boenzli
-   co-programmer: ...
-*/
-
-
-#include "base_entity.h"
-
-
-using namespace std;
-
-
-
-BaseEntity::BaseEntity () {}
-
-
-
-BaseEntity::~BaseEntity () {}
-
-
Index: orxonox/trunk/src/lib/base_entity.h
===================================================================
--- orxonox/trunk/src/lib/base_entity.h	(revision 3483)
+++ 	(revision )
@@ -1,20 +1,0 @@
-/*! 
-  \file base_entity.h
-  \brief This includes the default values every entity should have.						\
-*/
-
-#ifndef _BASE_ENTITY_H
-#define _BASE_ENTITY_H
-
-#include "stdincl.h"
-
-//! The Base of each entity-Class
-class BaseEntity {
-
- public:
-  BaseEntity ();
-  ~BaseEntity ();
-
-};
-
-#endif /* _BASE_ENTITY_H */
Index: orxonox/trunk/src/lib/base_object.cc
===================================================================
--- orxonox/trunk/src/lib/base_object.cc	(revision 3483)
+++ 	(revision )
@@ -1,52 +1,0 @@
-
-
-/* 
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Patrick Boenzli
-   co-programmer: ...
-*/
-
-
-#include "base_object.h"
-
-
-using namespace std;
-
-
-/**
-   \brief standard constructor
-*/
-BaseObject::BaseObject () {}
-
-
-/**
-   \brief standard deconstructor
-*/
-BaseObject::~BaseObject () {}
-
-
-void BaseObject::setClassName (char* className)
-{
-  this->className = className;
-}
-
-char* BaseObject::getClassName(void) const
-{
-  return className;
-}
-
-bool BaseObject::isA (char* className)
-{
-  if( this->className == className)
-    return false;
-  return true;
-}
Index: orxonox/trunk/src/lib/base_object.h
===================================================================
--- orxonox/trunk/src/lib/base_object.h	(revision 3483)
+++ 	(revision )
@@ -1,28 +1,0 @@
-/*! 
-    \file proto_class.h
-    \brief Definition of the proto class template, used quickly start work
-*/
-
-
-#ifndef _BASE_OBJECT_H
-#define _BASE_OBJECT_H
-
-#include "stdincl.h"
-
-
-class BaseObject {
-
- public:
-  BaseObject ();
-  ~BaseObject ();
-
-  void setClassName (char* className);
-  char* getClassName(void) const;
-  bool isA (char* className);
-
- private:
-  char* className;
-
-};
-
-#endif /* _BASE_OBJECT_H */
Index: orxonox/trunk/src/lib/data/data_tank.cc
===================================================================
--- orxonox/trunk/src/lib/data/data_tank.cc	(revision 3484)
+++ orxonox/trunk/src/lib/data/data_tank.cc	(revision 3484)
@@ -0,0 +1,26 @@
+
+/* 
+   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.
+
+   Copyright by: Patrick Boenzli
+   Fixes by:
+*/
+
+
+#include "data_tank.h"
+
+using namespace std;
+
+long DataTank::timeStamp = 0;
+
+DataTank::DataTank () {}
+DataTank::~DataTank () {}
+
+
Index: orxonox/trunk/src/lib/data/data_tank.h
===================================================================
--- orxonox/trunk/src/lib/data/data_tank.h	(revision 3484)
+++ orxonox/trunk/src/lib/data/data_tank.h	(revision 3484)
@@ -0,0 +1,16 @@
+
+#ifndef _DATA_TANK_H
+#define _DATA_TANK_H
+
+
+class DataTank {
+
+ public:
+  DataTank ();
+  ~DataTank ();
+
+  static long timeStamp;
+
+};
+
+#endif /* _DATA_TANK_H */
Index: orxonox/trunk/src/lib/data_tank.cc
===================================================================
--- orxonox/trunk/src/lib/data_tank.cc	(revision 3483)
+++ 	(revision )
@@ -1,26 +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.
-
-   Copyright by: Patrick Boenzli
-   Fixes by:
-*/
-
-
-#include "data_tank.h"
-
-using namespace std;
-
-long DataTank::timeStamp = 0;
-
-DataTank::DataTank () {}
-DataTank::~DataTank () {}
-
-
Index: orxonox/trunk/src/lib/data_tank.h
===================================================================
--- orxonox/trunk/src/lib/data_tank.h	(revision 3483)
+++ 	(revision )
@@ -1,16 +1,0 @@
-
-#ifndef _DATA_TANK_H
-#define _DATA_TANK_H
-
-
-class DataTank {
-
- public:
-  DataTank ();
-  ~DataTank ();
-
-  static long timeStamp;
-
-};
-
-#endif /* _DATA_TANK_H */
Index: orxonox/trunk/src/lib/graphics/importer/Makefile.am
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/Makefile.am	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/Makefile.am	(revision 3484)
@@ -0,0 +1,51 @@
+MAINSRCDIR=..
+AM_CXXFLAGS=-I$(MAINSRCDIR)
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/world_entities
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/story_entities
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/mathlib
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/defs
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/font
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/network
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/glmenu
+
+AM_LDFLAGS=$(MWINDOWS)
+
+#"-O3 -pedantic -fPIC -ffast-math -I/usr/X11R6/include"
+
+
+bin_PROGRAMS=importer
+importer_SOURCES= framework.cc \
+	          windowHandler.cc \
+	  	  model.cc \
+		  objModel.cc \
+	  	  array.cc \
+	  	  material.cc \
+		  texture.cc \
+		  $(MAINSRCDIR)/mathlib/vector.cc
+
+noinst_HEADERS= framework.h \
+	  	windowHandler.h \
+	  	model.h \
+		objModel.h \
+	  	array.h \
+		material.h \
+		texture.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/lib/graphics/importer/Makefile.in
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/Makefile.in	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/Makefile.in	(revision 3484)
@@ -0,0 +1,496 @@
+# 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/lib/graphics/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) \
+	model.$(OBJEXT) objModel.$(OBJEXT) array.$(OBJEXT) \
+	material.$(OBJEXT) texture.$(OBJEXT) vector.$(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)/model.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/objModel.Po ./$(DEPDIR)/texture.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@
+CURL_CFLAGS = @CURL_CFLAGS@
+CURL_LIBS = @CURL_LIBS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG = @DEBUG@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_FALSE = @DOXYGEN_FALSE@
+DOXYGEN_TRUE = @DOXYGEN_TRUE@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
+GTHREAD_LIBS = @GTHREAD_LIBS@
+GTK2_CFLAGS = @GTK2_CFLAGS@
+GTK2_LIBS = @GTK2_LIBS@
+HAVE_CURL_FALSE = @HAVE_CURL_FALSE@
+HAVE_CURL_TRUE = @HAVE_CURL_TRUE@
+HAVE_GTHREAD_FALSE = @HAVE_GTHREAD_FALSE@
+HAVE_GTHREAD_TRUE = @HAVE_GTHREAD_TRUE@
+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@
+SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@
+SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@
+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@
+MAINSRCDIR = ..
+AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/mathlib -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu
+AM_LDFLAGS = $(MWINDOWS)
+importer_SOURCES = framework.cc \
+	          windowHandler.cc \
+	  	  model.cc \
+		  objModel.cc \
+	  	  array.cc \
+	  	  material.cc \
+		  texture.cc \
+		  $(MAINSRCDIR)/mathlib/vector.cc
+
+noinst_HEADERS = framework.h \
+	  	windowHandler.h \
+	  	model.h \
+		objModel.h \
+	  	array.h \
+		material.h \
+		texture.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/lib/graphics/importer/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  src/lib/graphics/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)/model.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objModel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@
+@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) '$<'`
+
+vector.o: $(MAINSRCDIR)/mathlib/vector.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vector.o -MD -MP -MF "$(DEPDIR)/vector.Tpo" -c -o vector.o `test -f '$(MAINSRCDIR)/mathlib/vector.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/mathlib/vector.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/vector.Tpo" "$(DEPDIR)/vector.Po"; else rm -f "$(DEPDIR)/vector.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/mathlib/vector.cc' object='vector.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/vector.Po' tmpdepfile='$(DEPDIR)/vector.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 vector.o `test -f '$(MAINSRCDIR)/mathlib/vector.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/mathlib/vector.cc
+
+vector.obj: $(MAINSRCDIR)/mathlib/vector.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vector.obj -MD -MP -MF "$(DEPDIR)/vector.Tpo" -c -o vector.obj `if test -f '$(MAINSRCDIR)/mathlib/vector.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/mathlib/vector.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/mathlib/vector.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/vector.Tpo" "$(DEPDIR)/vector.Po"; else rm -f "$(DEPDIR)/vector.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(MAINSRCDIR)/mathlib/vector.cc' object='vector.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/vector.Po' tmpdepfile='$(DEPDIR)/vector.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 vector.obj `if test -f '$(MAINSRCDIR)/mathlib/vector.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/mathlib/vector.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/mathlib/vector.cc'; fi`
+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/lib/graphics/importer/array.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/array.cc	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/array.cc	(revision 3484)
@@ -0,0 +1,134 @@
+/* 
+   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()
+{
+  PRINTF(2)("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 ()
+{
+  PRINTF(2)("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)
+{
+  PRINTF(3)("Finalizing array. Length: %i\n", entryCount);  
+  //  if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL)
+  if (!(this->array = new GLfloat [this->entryCount]))
+    PRINTF(1)("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)
+    {
+      PRINTF(3)("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 
+    PRINTF(1)("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(0)("entryCount=%i, address=%p\n", this->entryCount, this->array);
+}
Index: orxonox/trunk/src/lib/graphics/importer/array.h
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/array.h	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/array.h	(revision 3484)
@@ -0,0 +1,47 @@
+/*!
+  \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"
+
+//! 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/lib/graphics/importer/framework.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/framework.cc	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/framework.cc	(revision 3484)
@@ -0,0 +1,293 @@
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#include "framework.h"
+
+#include "vector.h"
+
+int verbose;
+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);
+  if (obj)
+    obj->draw();
+
+  glPopMatrix();
+
+  SDL_GL_SwapBuffers(); // Swap the buffers
+  lastFrame = currFrame;
+}
+
+
+int main(int argc, char *argv[])
+{
+  verbose = 3;
+
+  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(1)("Could not initalize OpenGL :(\n\n");
+    wHandler.KillGLWindow();
+    return 0;
+  }
+  
+  PRINTF(2)("screensize: %i, %i\n", wHandler.screen->w, wHandler.screen->h);
+  if (argc>=3)
+    obj = new OBJModel (argv[1], atof(argv[2]));
+  else if (argc>=2)
+    obj = new OBJModel(argv[1]);
+  else 
+    {
+      // This is an example, of how it is possible, to create a new Model, and adding some vertex-information.
+      // This also packs everything into a DisplayList, and can be handled exactly as any other model.
+      // This is an example of a cube with Texture-Coordinates, but without explicite Vertex-Normals. (they are soft-created).
+      /*
+      obj = (OBJModel*) new Model();
+      obj->setName("CUBE");
+      obj->addVertex (-0.5, -0.5, 0.5);
+      obj->addVertex (0.5, -0.5, 0.5);
+      obj->addVertex (-0.5, 0.5, 0.5);
+      obj->addVertex (0.5, 0.5, 0.5);
+      obj->addVertex (-0.5, 0.5, -0.5);
+      obj->addVertex (0.5, 0.5, -0.5);
+      obj->addVertex (-0.5, -0.5, -0.5);
+      obj->addVertex (0.5, -0.5, -0.5);
+      
+      obj->addVertexTexture (0.0, 0.0);
+      obj->addVertexTexture (1.0, 0.0);
+      obj->addVertexTexture (0.0, 1.0);
+      obj->addVertexTexture (1.0, 1.0);
+      obj->addVertexTexture (0.0, 2.0);
+      obj->addVertexTexture (1.0, 2.0);
+      obj->addVertexTexture (0.0, 3.0);
+      obj->addVertexTexture (1.0, 3.0);
+      obj->addVertexTexture (0.0, 4.0);
+      obj->addVertexTexture (1.0, 4.0);
+      obj->addVertexTexture (2.0, 0.0);
+      obj->addVertexTexture (2.0, 1.0);
+      obj->addVertexTexture (-1.0, 0.0);
+      obj->addVertexTexture (-1.0, 1.0);
+
+      obj->addFace ("1 2 4 3");
+      obj->addFace ("3 4 6 5");
+      obj->addFace ("5 6 8 7");
+      obj->addFace ("7 8 2 1");
+      obj->addFace ("2 8 6 4");
+      obj->addFace ("7 1 3 5");
+      obj->finalize();
+      */
+      obj = (OBJModel*) new Model(CYLINDER);
+    }
+  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:
+	PRINTF(3)("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(0)("tmpV: %f, %f, %f\n", tmpV.x, tmpV.y, tmpV.z);
+	    p2 = tmpV-M;
+	    p2.y = -p2.y;
+	    rotAxis = p1.cross(p2);
+	    //  PRINTF(0)("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(0)("rotAxis: %f, %f, %f\n", rotAxis.x, rotAxis.y, rotAxis.z, rotAngle);
+				
+		rotAngle = angleRad (p1, p2);
+		rotQ = Quaternion (rotAngle, rotAxis);
+		rotQ = rotQ * rotQlast;
+		rotQ.matrix (matQ);
+		//	dir = rotQ.apply(dir);
+		//      dir.normalize();
+		//	PRINTF(0)("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(0)("MouseWheel up\n");
+	    zoomTo *= .5;
+	  }
+	else if (event.button.button == 5)
+	  {
+	    PRINTF(2)("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(0)("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(2)("MouseButton %d released at (%d,%d).\n",
+			event.button.button, event.button.x, event.button.y);
+	    }
+	break;
+
+
+      case SDL_KEYDOWN:
+	switch (event.key.keysym.sym)
+	  {
+	  case SDLK_x:
+	    delete obj;
+	    obj = NULL;
+	    break;
+	  case SDLK_c:
+	    if (!obj)
+	      obj = new OBJModel(argv[1]);
+	    break;
+	  case SDLK_a:
+	    zoomTo /=2;
+	    break;
+	  case SDLK_z:
+	    zoomTo *=2;
+
+	  }
+	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
+  if (obj)
+    delete obj;
+  wHandler.KillGLWindow();
+  // And quit
+  return 0;
+}
Index: orxonox/trunk/src/lib/graphics/importer/framework.h
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/framework.h	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/framework.h	(revision 3484)
@@ -0,0 +1,39 @@
+#ifndef _FRAMEWORK_H
+#define _FRAMEWORK_H
+ 
+#include "windowHandler.h" // Include the Whandler Basecode
+#include "objModel.h"
+
+class Vector;
+
+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
+OBJModel* obj;
+
+
+#endif /* _FRAMEWORK_H */
Index: orxonox/trunk/src/lib/graphics/importer/material.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/material.cc	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/material.cc	(revision 3484)
@@ -0,0 +1,363 @@
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+
+*/
+
+#include "material.h"
+
+#include "texture.h"
+#include <stdlib.h>
+#include <string.h>
+
+using namespace std;
+
+
+/**
+   \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()
+{
+  PRINTF(2)("delete Material %s.\n", this->name);
+  if (this->name)
+    delete []this->name;
+  if (this->diffuseTexture)
+    this->diffuseTexture;
+  if (this->nextMat)
+    delete this->nextMat;
+}
+
+/**
+   \brief adds a new Material to the List.
+   this Function will append a new Material to the end of a Material List.
+   \param mtlName The name of the Material to be added.
+*/
+Material* Material::addMaterial(char* mtlName)
+{
+  PRINTF(2)("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)
+{
+  PRINTF(2)("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);
+
+
+  this->diffuseTexture = NULL;
+  this->ambientTexture = NULL;
+  this->specularTexture = NULL;
+
+  this->diffuseTextureSet = false;
+  this->ambientTextureSet = false;
+  this->specularTextureSet = false;
+
+  
+}
+
+/**
+   \brief Search for a Material called mtlName
+   \param mtlName the Name of the Material to search for
+   \returns Material named mtlName if it is found. NULL otherwise.
+*/
+Material* Material::search(char* mtlName)
+{
+  PRINTF(2)("Searching for material %s", mtlName);
+  Material* searcher = this;
+  while (searcher != NULL)
+    {
+      PRINT(2)(".");
+      if (!strcmp (searcher->getName(), mtlName))
+	{
+	  PRINT(2)("found.\n");
+	  return searcher;
+	}
+      searcher = searcher->nextMat;
+    }
+  PRINT(2)("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->getTexture());
+  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)
+{
+  PRINTF(3)("setting Material Name to %s.\n", this->name);
+  this->name = new char [strlen(mtlName)+1];
+  strcpy(this->name, mtlName);
+}
+
+/**
+   \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)
+{
+  PRINTF(3)("setting illumModel of Material %s to %i\n", this->name, illum);
+  this->illumModel = illum;
+  //  PRINTF(3)("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)
+{
+  PRINTF(3)("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)
+{
+  PRINTF(3)("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)
+{
+  PRINTF(3)("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)
+{
+  PRINTF(3)("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)
+{
+  PathList::getInstance()->addPath(pathName);
+}
+
+// MAPPING //
+
+/**
+   \brief Sets the Materials Diffuse Map
+   \param dMap the Name of the Image to Use
+*/
+void Material::setDiffuseMap(char* dMap)
+{
+  PRINTF(3)("setting Diffuse Map %s\n", dMap);
+  diffuseTexture = new Texture();
+  this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
+
+}
+
+/**
+   \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)
+{
+
+}
Index: orxonox/trunk/src/lib/graphics/importer/material.h
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/material.h	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/material.h	(revision 3484)
@@ -0,0 +1,81 @@
+/*!
+  \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.
+
+#if HAVE_CONFIG_H 
+#include <config.h> 
+#endif /* HAVE_CONFIG_H */
+
+// FORWARD DEFINITIONS //
+class Texture;
+
+
+//! 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);
+ // MAPPING //
+  void setDiffuseMap(char* dMap);
+  void setAmbientMap(char* aMap);
+  void setSpecularMap(char* sMap);
+  void setBump(char* bump);
+
+ private:
+  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.
+
+  Texture* diffuseTexture; //!< The diffuse texture of the Material.
+  Texture* ambientTexture; //!< The ambient texture of the Material.
+  Texture* 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.
+
+
+};
+#endif
Index: orxonox/trunk/src/lib/graphics/importer/model.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/model.cc	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/model.cc	(revision 3484)
@@ -0,0 +1,954 @@
+/* 
+   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 "model.h"
+
+#include <math.h>
+#include <stdarg.h>
+
+#include "array.h"
+#include "vector.h"
+
+using namespace std;
+
+/**
+   \brief Creates a 3D-Model.
+
+   This only initializes a 3D-Model, but does not cleanup the Faces.
+*/
+Model::Model(void)
+{
+  this->initialize();
+}
+
+/**
+   \brief Creates a 3D-Model of Primitive-Type type
+
+   if you want to just display a Cube/Sphere/Cylinder/... without any material.
+   
+   \todo implement Cube/Sphere/Cylinder/...
+*/
+Model::Model(PRIMITIVE type)
+{
+  this->initialize();
+
+  switch (type)
+    {
+    default:
+    case CUBE:
+      this->cubeModel();
+      break;
+    case SPHERE:
+      this->sphereModel();
+      break;
+    case CYLINDER:
+      this->cylinderModel();
+      break;
+
+    }
+  this->importToGL ();
+
+  this->cleanup();
+}
+
+/**
+   \brief Creates a 3D-Model. and assigns it a Name.
+*/
+Model::Model(char* modelName)
+{
+  this->initialize();
+  this->setName(modelName);
+}
+
+/**
+   \brief deletes an Model.
+
+   Looks if any from model allocated space is still in use, and if so deleted it.
+*/
+Model::~Model(void)
+{
+  PRINTF(3)("Deleting Model ");
+  if (this->name)
+    {
+      PRINT(3)("%s\n", this->name);
+      delete []this->name;
+    }
+  else
+      PRINT(3)("\n");
+
+  PRINTF(3)("Deleting display Lists.\n");
+  Group* walker = this->firstGroup;
+  while (walker != NULL)
+    {
+      glDeleteLists (walker->listNumber, 1);
+      Group* delWalker = walker;
+      walker = walker->next;
+      delete delWalker;
+    }
+
+  PRINTF(3)("Deleting Materials.\n");
+  if (this->material)
+    delete this->material;
+}
+
+/**
+   \brief Finalizes an Object. This can be done outside of the Class.
+*/
+void Model::finalize(void)
+{
+  this->importToGL ();
+  
+  this->cleanup();
+
+  this->finalized = true;
+}
+
+/**
+   \brief Draws the Models of all Groups.
+   It does this by just calling the Lists that must have been created earlier.
+*/
+void Model::draw (void) const
+{
+  PRINTF(2)("drawing the 3D-Models\n"); 
+  Group* walker = this->firstGroup;
+  while (walker != NULL)
+    {
+      PRINTF(3)("Drawing model %s\n", walker->name);
+      glCallList (walker->listNumber);
+      walker = walker->next;
+    }
+}
+
+/**
+   \brief Draws the Model number groupNumber
+   \param groupNumber The number of the group that will be displayed.
+
+   It does this by just calling the List that must have been created earlier.
+*/
+void Model::draw (int groupNumber) const 
+{
+  if (groupNumber >= this->groupCount)
+    {
+      PRINTF(1)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);
+      return;
+    }
+  PRINTF(2)("drawing the requested 3D-Models if found.\n"); 
+  Group* walker = this->firstGroup;
+  int counter = 0;
+  while (walker != NULL)
+    {
+      if (counter == groupNumber)
+	{
+	  PRINTF(2)("Drawing model number %i named %s\n", counter, walker->name);
+	  glCallList (walker->listNumber);
+	  return;
+	}
+      ++counter;
+      walker = walker->next;
+    }
+  PRINTF(1)("Model number %i in %s not Found.\n", groupNumber, this->name);
+  return;
+
+}
+
+/**
+   \brief Draws the Model with a specific groupName
+   \param groupName The name of the group that will be displayed.
+
+   It does this by just calling the List that must have been created earlier.
+*/
+void Model::draw (char* groupName) const
+{
+  PRINTF(2)("drawing the requested 3D-Models if found.\n"); 
+  Group* walker = this->firstGroup;
+  while (walker != NULL)
+    {
+      if (!strcmp(walker->name, groupName))
+	{
+	  PRINTF(2)("Drawing model %s\n", walker->name);
+	  glCallList (walker->listNumber);
+	  return;
+	}
+      walker = walker->next;
+    }
+  PRINTF(1)("Model Named %s in %s not Found.\n", groupName, this->name);
+  return;
+}
+
+/**
+   \returns Count of the Models in this File
+*/
+int Model::getGroupCount (void) const
+{
+  return this->groupCount;
+}
+
+/**
+    \brief initializes the Model.
+
+    This Function initializes all the needed arrays, Lists and clientStates.
+    It also defines default values.
+*/
+bool Model::initialize (void)
+{
+  PRINTF(2)("new 3D-Model is being created\n"); 
+
+  this->name = NULL;
+  this->finalized = false;
+  // setting the start group;
+  this->firstGroup = new Group;
+  this->currentGroup = this->firstGroup;
+  this->groupCount = 0;
+  
+  this->initGroup (this->currentGroup);
+  this->scaleFactor = 1;
+  this->material = new Material();
+
+  this->vertices = new Array();
+  this->vTexture = new Array();
+  this->normals = new Array();
+
+  return true;
+}
+
+/**
+   \brief sets a name to the Model
+   \param name The name to set to this Model
+*/
+void Model::setName(const char* name)
+{
+  if (this->name) 
+    delete this->name;
+  this->name = new char[strlen(name)+1];
+  strcpy(this->name, name);
+}
+/**
+   \brief initializes a new Group model
+   \param group the group that should be initialized.
+   \todo Maybe Group should be a Class, because it does a lot of stuff
+   
+*/
+bool Model::initGroup(Group* group)
+{
+  PRINTF(3)("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 Model::initFace (Face* face)
+{
+  face->vertexCount = 0;
+
+  face->firstElem = NULL;
+  
+  face->materialString = NULL;
+  
+  face->next = NULL;
+
+  return true;
+}
+
+/**
+   \brief finalizes an Model.
+   This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process.
+*/
+bool Model::cleanup(void)
+{
+  PRINTF(3)("cleaning up the 3D-Model 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 Model::cleanupGroup (Group* group)
+{
+  PRINTF(3)("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 Model::cleanupFace (Face* face)
+{
+  PRINTF(3)("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 Model::cleanupFaceElement(FaceElement* faceElem)
+{
+  if (faceElem->next != NULL)
+    {
+      this->cleanupFaceElement (faceElem->next);
+      delete faceElem->next;
+    }
+}
+
+/**
+   \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 Models inside. 
+*/
+bool Model::addGroup (char* groupString)
+{
+  PRINTF(3)("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 Model::addVertex (char* vertexString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  float subbuffer3;
+  sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
+  PRINTF(3)("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 vertex-String
+   \param x the X-coordinate of the Vertex to add.
+   \param y the Y-coordinate of the Vertex to add.
+   \param z the Z-coordinate of the Vertex to add.
+   
+*/
+bool Model::addVertex(const float x, const float y, const float z)
+{
+  PRINTF(4)("reading in a vertex: %f %f %f\n", x, y, z);
+  this->vertices->addEntry(x*scaleFactor, y*scaleFactor, z*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.
+*/
+bool Model::addFace (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 adds a new Face
+   \param faceElemCount the number of Vertices to add to the Face.
+   \param type 0: vertex only, 1: vertex and normal, 2: vertex and Texture, 3 vertex, normal and texture
+*/
+bool Model::addFace(const float faceElemCount, int type, ...)
+{
+   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;
+  
+  va_list itemlist;
+  va_start (itemlist, type);
+
+  for (int i = 0; i < faceElemCount; i++)
+    {
+      if (this->currentGroup->currentFace->vertexCount>0)
+	  tmpElem = tmpElem->next = new FaceElement;
+      tmpElem->next = NULL;
+
+      tmpElem->vertexNumber = va_arg (itemlist, int) -1;
+      if (type >= 2)
+	tmpElem->texCoordNumber = va_arg (itemlist, int) -1;
+      if (type == 1 || type ==3)
+ 	tmpElem->normalNumber = va_arg(itemlist, int) -1;
+      this->currentGroup->currentFace->vertexCount++;
+    }
+  va_end(itemlist);
+
+  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 Model::addVertexNormal (char* normalString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  float subbuffer3;
+  sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
+  PRINTF(3)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);
+  this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3);
+  return true;
+}
+
+/**
+   \brief adds a VertexNormal.
+   \param x The x coordinate of the Normal.
+   \param y The y coordinate of the Normal.
+   \param z The z coordinate of the Normal.
+
+   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
+*/
+bool Model::addVertexNormal(const float x, const float y, const float z)
+{
+  PRINTF(3)("found vertex-Normal %f, %f, %f\n", x, y, z);
+  this->normals->addEntry(x, y, z);
+}
+
+/**
+   \brief parses a vertexTextureCoordinate-String
+   \param vTextureString The String that will be parsed.
+
+   If a vertexTextureCoordinate line is found,
+   this function will inject it into the vertexTexture-Array
+*/
+bool Model::addVertexTexture (char* vTextureString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2);
+  PRINTF(3)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);
+  this->vTexture->addEntry(subbuffer1);
+  this->vTexture->addEntry(subbuffer2);
+  return true;
+}
+
+/**
+   \brief adds a Texture Coordinate
+   \param u The u coordinate of the TextureCoordinate.
+   \param v The y coordinate of the TextureCoordinate.
+
+   If a TextureCoordinate line is found this function will inject it into the TextureCoordinate-Array
+*/
+bool Model::addVertexTexture(const float u, const float v)
+{
+  PRINTF(3)("found vertex-Texture %f, %f\n", u, v);
+  this->vTexture->addEntry(u);
+  this->vTexture->addEntry(v);
+}
+
+/**
+   \brief Function that selects a material, if changed in the obj file.
+   \param matString the Material that will be set.
+*/
+bool Model::addUseMtl (char* matString)
+{
+  /*
+  if (!this->mtlFileName)
+    {
+      PRINTF(4)("Not using new defined material, because no mtlFile found yet\n");
+      return false;
+    }
+  */      
+  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 Model::importToGL (void)
+{
+
+  // finalize the Arrays
+  this->vertices->finalizeArray();
+  this->vTexture->finalizeArray();
+  if (normals->getCount() == 0) // vertices-Array must be built for this
+    this->buildVertexNormals();
+  this->normals->finalizeArray();
+
+  this->currentGroup = this->firstGroup;
+
+  while (this->currentGroup != NULL)
+    {
+
+      // creating a glList for the Group
+      if ((this->currentGroup->listNumber = glGenLists(1)) == 0)
+	{
+	  PRINTF(1)("list could not be created for this Model\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;
+	      Material* tmpMat;
+	      if ((tmpMat = material->search(tmpFace->materialString)) != NULL)
+		{
+		  tmpMat->select();
+		  PRINTF(2)("using material %s for coming Faces.\n", tmpFace->materialString);
+		}
+	      else 
+		PRINTF(1)("material %s not found.\n", tmpFace->materialString);
+
+
+	    }
+
+	  else if (tmpFace->vertexCount == 3)
+	    {
+	      if (this->currentGroup->faceMode != 3)
+		{
+		  if (this->currentGroup->faceMode != -1)
+		    glEnd();
+		  glBegin(GL_TRIANGLES);
+		}
+	      
+	      this->currentGroup->faceMode = 3;
+	      PRINTF(3)("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;
+	      PRINTF(3)("found quad.\n");
+	    }
+	  
+	  else if (tmpFace->vertexCount > 4)
+	    {
+	      if (this->currentGroup->faceMode != -1)
+		glEnd();
+	      glBegin(GL_POLYGON);
+	      PRINTF(3)("Polygon with %i faces found.", tmpFace->vertexCount);
+	      this->currentGroup->faceMode = tmpFace->vertexCount;
+	    }
+	  
+	  FaceElement* tmpElem = tmpFace->firstElem;
+	  while (tmpElem != NULL)
+	    {
+	      //      PRINTF(2)("%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 Model::addGLElement (FaceElement* elem)
+{
+  PRINTF(3)("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 Model::buildVertexNormals ()
+{
+  
+  PRINTF(2)("Normals are being calculated.\n");
+
+  Vector* normArray = new Vector [vertices->getCount()/3];
+  for (int i=0; i<vertices->getCount()/3;i++)
+    normArray[i] = Vector(.0,.0,.0);
+  
+  int firstTouch;
+  int secondTouch;
+  Vector prevV;
+  Vector nextV;
+  Vector curV;
+
+  Group* tmpGroup = firstGroup;
+  while (tmpGroup)
+    {
+      Face* tmpFace = tmpGroup->firstFace;
+      while (tmpFace)
+	{
+	  if (tmpFace->firstElem)
+	    {
+	      FaceElement* firstElem = tmpFace->firstElem;
+	      FaceElement* prevElem;
+	      FaceElement* curElem = firstElem;
+	      FaceElement* nextElem;
+	      FaceElement* lastElem;
+	      // find last Element of the Chain. !! IMPORTANT:the last Element of the Chain must point to NULL, or it will resolv into an infinity-loop.
+	      while (curElem)
+		{
+		  prevElem = curElem;
+		  curElem = curElem->next;
+		}
+	      lastElem = prevElem;
+	      
+	      curElem = firstElem;
+	      for (int j=0; j<tmpFace->vertexCount; j++)
+		{
+		  if (!(nextElem = curElem->next))
+		    nextElem = firstElem;
+		  curElem->normalNumber = curElem->vertexNumber;
+		  
+		  curV = Vector (vertices->getArray()[curElem->vertexNumber*3], vertices->getArray()[curElem->vertexNumber*3+1], vertices->getArray()[curElem->vertexNumber*3+2]);
+		  prevV = Vector (vertices->getArray()[prevElem->vertexNumber*3], vertices->getArray()[prevElem->vertexNumber*3+1], vertices->getArray()[prevElem->vertexNumber*3+2]) - curV;
+		  nextV = Vector (vertices->getArray()[nextElem->vertexNumber*3], vertices->getArray()[nextElem->vertexNumber*3+1], vertices->getArray()[nextElem->vertexNumber*3+2]) - curV;
+		  normArray[curElem->vertexNumber] = normArray[curElem->vertexNumber] + nextV.cross(prevV);
+
+		  prevElem = curElem;
+		  curElem = curElem->next;
+		}
+	    }
+	  tmpFace = tmpFace->next;
+	}
+      tmpGroup = tmpGroup->next;
+    }
+
+  for (int i=0; i<vertices->getCount()/3;i++)
+    {
+      normArray[i].normalize();
+      PRINTF(3)("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 model
+
+   This will inject a Cube, because this is the most basic model.
+*/
+void Model::cubeModel(void)
+{
+  this->addVertex ("-0.5 -0.5 0.5");
+  this->addVertex ("0.5 -0.5 0.5");
+  this->addVertex ("-0.5 0.5 0.5");
+  this->addVertex ("0.5 0.5 0.5");
+  this->addVertex ("-0.5 0.5 -0.5");
+  this->addVertex ("0.5 0.5 -0.5");
+  this->addVertex ("-0.5 -0.5 -0.5");
+  this->addVertex ("0.5 -0.5 -0.5");
+
+  this->addVertexTexture ("0.0 0.0");
+  this->addVertexTexture ("1.0 0.0");
+  this->addVertexTexture ("0.0 1.0");
+  this->addVertexTexture ("1.0 1.0");
+  this->addVertexTexture ("0.0 2.0");
+  this->addVertexTexture ("1.0 2.0");
+  this->addVertexTexture ("0.0 3.0");
+  this->addVertexTexture ("1.0 3.0");
+  this->addVertexTexture ("0.0 4.0");
+  this->addVertexTexture ("1.0 4.0");
+  this->addVertexTexture ("2.0 0.0");
+  this->addVertexTexture ("2.0 1.0");
+  this->addVertexTexture ("-1.0 0.0");
+  this->addVertexTexture ("-1.0 1.0");
+
+  this->addVertexNormal ("0.0 0.0 1.0");
+  this->addVertexNormal ("0.0 0.0 1.0");
+  this->addVertexNormal ("0.0 0.0 1.0");
+  this->addVertexNormal ("0.0 0.0 1.0");
+  this->addVertexNormal ("0.0 1.0 0.0");
+  this->addVertexNormal ("0.0 1.0 0.0");
+  this->addVertexNormal ("0.0 1.0 0.0");
+  this->addVertexNormal ("0.0 1.0 0.0");
+  this->addVertexNormal ("0.0 0.0 -1.0");
+  this->addVertexNormal ("0.0 0.0 -1.0");
+  this->addVertexNormal ("0.0 0.0 -1.0");
+  this->addVertexNormal ("0.0 0.0 -1.0");
+  this->addVertexNormal ("0.0 -1.0 0.0");
+  this->addVertexNormal ("0.0 -1.0 0.0");
+  this->addVertexNormal ("0.0 -1.0 0.0");
+  this->addVertexNormal ("0.0 -1.0 0.0");
+  this->addVertexNormal ("1.0 0.0 0.0");
+  this->addVertexNormal ("1.0 0.0 0.0");
+  this->addVertexNormal ("1.0 0.0 0.0");
+  this->addVertexNormal ("1.0 0.0 0.0");
+  this->addVertexNormal ("-1.0 0.0 0.0");
+  this->addVertexNormal ("-1.0 0.0 0.0");
+  this->addVertexNormal ("-1.0 0.0 0.0");
+  this->addVertexNormal ("-1.0 0.0 0.0");
+
+  /* normaleLess-testingMode
+  this->addFace ("1 2 4 3");
+  this->addFace ("3 4 6 5");
+  this->addFace ("5 6 8 7");
+  this->addFace ("7 8 2 1");
+  this->addFace ("2 8 6 4");
+  this->addFace ("7 1 3 5");
+  */
+
+  this->addFace ("1/1/1 2/2/2 4/4/3 3/3/4");
+  this->addFace ("3/3/5 4/4/6 6/6/7 5/5/8");
+  this->addFace ("5/5/9 6/6/10 8/8/11 7/7/12");
+  this->addFace ("7/7/13 8/8/14 2/10/15 1/9/16");
+  this->addFace ("2/2/17 8/11/18 6/12/19 4/4/20");
+  this->addFace ("7/13/21 1/1/22 3/3/23 5/14/24");
+
+}
+
+/**
+   \brief Builds a Sphere into the Model
+*/
+void Model::sphereModel()
+{
+  int detail = 30;
+  if (detail <= 0) detail = 1;
+  float df = (float)detail;
+  for (float i = 0.0; i < df/2; i+=1.0)
+    {
+      for (float j = 0.0; j < df; j+=1.0)
+      {
+	float vz = i/df *2.0*PI - PI/2.0;
+	this->addVertex(cos(j/df*2.0*PI) * cos(vz) ,
+			sin(j/df*2.0*PI) * cos(vz),
+			sin(vz));
+	//if (j==0.0)
+	//printf ("%f %f\n", vz, sin (vz));
+	if (i==0.0)
+		  printf("%f, %f\n", j/df*2.0*PI, cos(j/df*PI));
+      }
+    }
+  vertices->debug();
+  for (int i = 0; i < detail/2; i++)
+    for (int j = 1; j < detail; j++)
+      {
+	unsigned int v1,v2,v3,v4;
+	v1 = i*detail +j;
+
+	/*	if (j+1 == detail)
+	  {
+	    v2 = i*detail +1;
+	    v3 = i*detail+detail + 1;
+	  }
+	  else*/
+	  {
+	    v2 = i*detail +j+1;
+	    v3 = i*detail+detail + j+1;
+	  }
+	v4 = i*detail+detail + j;
+	//printf("%i %i %i %i\n", v1, v2, v3, v4);
+	this->addFace(4, 0, v1, v2, v3, v4);
+      }
+}
+
+/**
+   \brief Creates a Cylinder.
+*/
+void Model::cylinderModel(void)
+{
+  unsigned int detail = 20;
+  float size = 1.0;
+
+  // check if devision by zero
+  if (detail <= 3)
+    detail = 3;
+  int count = 0;
+  // defining Points of the Cylinder.
+  for (float phi = 0.0; phi < 2.0*PI; phi += 2.0*PI/(float)detail)
+    {
+      this->addVertex(size*cos(phi), size*sin(phi), -size);
+      this->addVertex(size*cos(phi), size*sin(phi), size);
+      count ++;
+    }
+  this->addVertex(0, 0, -size);
+  this->addVertex(0, 0, size);
+
+  
+  if (count != detail)
+    cout << "calculation error, count should be " << detail << " but is " << count << endl;
+  vertices->debug();
+
+  // adding Faces
+  for (int i = 0; i < detail-1; i++)
+    {
+      int p1, p2, p3, p4;
+      p1 = 2*i+1;
+      p2 = 2*i+2;
+      if (i <= detail);
+      p3 = 2*i+4;
+      p4 = 2*i+3;
+      cout <<i+1 <<": "<< p1 <<" "<< p2 <<" "<< p3 <<" "<< p4 <<endl;
+      this->addFace(4, 0, p1, p2, p3, p4);
+      this->addFace(3, 0, p4, p1, 2*detail+1);
+      this->addFace(3, 0, p2, p3, 2*detail+2);
+    }
+  addFace(4,0, 2*detail-1, 2*detail, 2, 1);
+  this->addFace(3, 0, 1, 2*detail-1, 2*detail+1);
+  this->addFace(3, 0, 2*detail, 2, 2*detail+2);
+
+}
Index: orxonox/trunk/src/lib/graphics/importer/model.h
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/model.h	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/model.h	(revision 3484)
@@ -0,0 +1,120 @@
+/*!
+  \file model.h
+  \brief Contains the Model Class that handles 3D-Models
+*/
+
+#ifndef _MODEL_H
+#define _MODEL_H
+
+#include "material.h"
+
+// FORWARD DEFINITION //
+class Array;
+class Vector;
+
+using namespace std;
+
+//! Specification of different primitives the Model knows
+enum PRIMITIVE {PLANE, CUBE, SPHERE, CYLINDER};
+
+//! Class that handles 3D-Models. it can also read them in and display them.
+class Model
+{
+ public:
+  Model(void);
+  Model(PRIMITIVE type);
+  Model(char* modelName);
+  virtual ~Model(void);
+
+  void setName(const char* name);
+  
+  void draw(void) const;
+  void draw(int groupNumber) const;
+  void draw(char* groupName) const;
+  int getGroupCount() const;
+
+ protected:
+  char* name;            //!< This is the name of the Model.
+  bool finalized;        //!< Sets the Object to be finalized.
+  
+  //! 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.
+  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 Models 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.
+
+    unsigned int 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 Model should be scaled. \todo maybe one wants to scale the Model after Initialisation
+
+  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);
+
+ public:
+  bool addGroup(char* groupString);
+  bool addVertex(char* vertexString);
+  bool addVertex(const float x, const float y, const float z);
+  bool addFace(char* faceString);
+  bool addFace(const float faceElemCount, int type, ...);
+  bool addVertexNormal(char* normalString);
+  bool addVertexNormal(const float x, const float y, const float z);
+  bool addVertexTexture(char* vTextureString);
+  bool addVertexTexture(const float u, const float v);
+  bool addUseMtl(char* mtlString);
+  void finalize(void);
+
+ protected:
+  bool importToGL(void);
+  bool addGLElement(FaceElement* elem);
+
+  bool buildVertexNormals(void);
+
+  void cubeModel(void);
+  void sphereModel(void);
+  void cylinderModel(void);
+};
+
+#endif
Index: orxonox/trunk/src/lib/graphics/importer/objModel.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/objModel.cc	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/objModel.cc	(revision 3484)
@@ -0,0 +1,307 @@
+/* 
+   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 "objModel.h"
+
+#include <fstream>
+
+#include "debug.h"
+
+/**
+   \brief Crates a 3D-Model and loads in a File.
+   \param fileName file to parse and load (must be a .obj file)
+*/
+OBJModel::OBJModel(char* fileName)
+{
+  this->initializeOBJ();
+
+  this->importFile (fileName);
+
+  this->importToGL ();
+
+  this->cleanup();
+}
+
+/**
+   \brief Crates a 3D-Model, 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 model will be scaled with.
+*/
+OBJModel::OBJModel(char* fileName, float scaling)
+{
+  this->initializeOBJ();
+  this->scaleFactor = scaling;
+
+  this->importFile (fileName);
+
+  this->importToGL ();
+
+  this->cleanup();
+}
+
+/**
+   \brief deletes an OBJModel.
+
+   Looks if any from model allocated space is still in use, and if so deleted it.
+*/
+OBJModel::~OBJModel()
+{
+  PRINTF(4)("Deleting the obj-names\n");
+  if (this->objPath)
+    delete []this->objPath;
+  if (this->objFileName)
+    delete []this->objFileName;
+  if (this->mtlFileName)
+    delete []this->mtlFileName;
+}
+
+/**
+   \brief Initializes an obj-model
+*/
+void OBJModel::initializeOBJ(void)
+{
+  this->objPath = NULL;
+  this->objFileName = NULL;
+  this->mtlFileName = NULL;
+
+  this->initialize();
+}
+
+/**
+   \brief Imports a obj file and handles the the relative location
+   \param fileName The file to import
+*/
+bool OBJModel::importFile (char* fileName)
+{
+  PRINTF(3)("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+1];
+  strncpy(this->objPath, fileName, name-fileName);
+  this->objPath[name-fileName] = '\0';
+  if (verbose>=2)
+    if (strlen(objPath)> 0)
+      PRINTF(0)("Resolved file %s to folder: %s.\n", name, objPath);
+    else
+      PRINTF(0)("Resolved file %s.\n", name);
+  
+  this->setName(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 OBJModel::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())
+    {
+      PRINTF(1)("unable to open .OBJ file: %s\n Loading cube-Model instead.\n", fileName);
+      cubeModel();
+      OBJ_FILE->close();
+      delete []fileName;
+      delete OBJ_FILE;
+      return false;
+    }
+  PRINTF(2)("Reading from opened file %s\n", fileName);
+  char Buffer[10000];
+  while(!OBJ_FILE->eof())
+    {
+      OBJ_FILE->getline(Buffer, 10000);
+      PRINTF(3)("Read input line: %s\n", Buffer);
+      
+
+      // case vertice
+      if (!strncmp(Buffer, "v ", 2))
+	{
+	  this->addVertex(Buffer+2);
+	}
+
+      // case face
+      else if (!strncmp(Buffer, "f ", 2))
+	{
+	  this->addFace (Buffer+2);
+	}
+      
+      else if (!strncmp(Buffer, "mtllib ", 7))
+	{
+	  this->readMtlLib (Buffer+7);
+	}
+
+      else if (!strncmp(Buffer, "usemtl ", 7))
+	{
+	  this->addUseMtl (Buffer+7);
+	}
+
+      // case VertexNormal
+      else if (!strncmp(Buffer, "vn ", 3))
+	{
+	  this->addVertexNormal(Buffer+3);
+	}
+      
+      // case VertexTextureCoordinate
+      else if (!strncmp(Buffer, "vt ", 3))
+	{
+	  this->addVertexTexture(Buffer+3);
+	}
+      // case group
+      else if (!strncmp(Buffer, "g ", 2))
+	{
+	  this->addGroup (Buffer+2);
+	}
+      else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented
+	{
+	  if (verbose >= 2)
+	    PRINTF(2)("smoothing groups not supportet yet. line: %s\n", Buffer);
+	}
+    }
+  OBJ_FILE->close();
+  delete OBJ_FILE;
+  delete []fileName;
+  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 OBJModel::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);
+  
+
+  PRINTF(3)("Opening mtlFile: %s\n", fileName);
+
+  ifstream* MTL_FILE = new ifstream (fileName);
+  if (MTL_FILE->fail())
+    {
+      PRINTF(1)("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);
+      PRINTF(4)("found line in mtlFile: %s\n", Buffer);
+      
+
+      // create new Material
+      if (!strncmp(Buffer, "newmtl ", 7))
+	{
+	  tmpMat = tmpMat->addMaterial(Buffer+7);
+	  //	  PRINTF(2)("%s, %p\n", tmpMat->getName(), tmpMat);
+	}
+      // setting a illumMode
+      else if (!strncmp(Buffer, "illum ", 6))
+	{
+	  tmpMat->setIllum(Buffer+6);
+
+	}
+      // setting Diffuse Color
+      else if (!strncmp(Buffer, "Kd ", 3))
+	{
+	  tmpMat->setDiffuse(Buffer+3);
+	}
+      // setting Ambient Color
+      else if (!strncmp(Buffer, "Ka ", 3))
+	{
+	  tmpMat->setAmbient(Buffer+3);
+	}
+      // setting Specular Color
+      else if (!strncmp(Buffer, "Ks ", 3))
+	{
+	  tmpMat->setSpecular(Buffer+3);
+	}
+      // setting The Specular Shininess
+      else if (!strncmp(Buffer, "Ns ", 3))
+	{
+	  tmpMat->setShininess(Buffer+3);
+	}
+      // setting up transparency
+      else if (!strncmp(Buffer, "d ", 2))
+	{
+	  tmpMat->setTransparency(Buffer+2);
+	}
+      else if (!strncmp(Buffer, "Tf ", 3))
+	{
+	  tmpMat->setTransparency(Buffer+3);
+	}
+      
+      else if (!strncmp(Buffer, "map_Kd ", 7))
+	{
+	  tmpMat->setDiffuseMap(Buffer+7);
+	}
+      else if (!strncmp(Buffer, "map_Ka ", 7))
+	{
+	  tmpMat->setAmbientMap(Buffer+7);
+	}
+      else if (!strncmp(Buffer, "map_Ks ", 7))
+	{
+	  tmpMat->setSpecularMap(Buffer+7);
+	}
+      else if (!strncmp(Buffer, "bump ", 5))
+	{
+	  tmpMat->setBump(Buffer+7);
+	}
+     
+
+    }
+  MTL_FILE->close();
+  delete []fileName;
+  delete MTL_FILE;
+  return true;
+}
Index: orxonox/trunk/src/lib/graphics/importer/objModel.h
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/objModel.h	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/objModel.h	(revision 3484)
@@ -0,0 +1,33 @@
+/*!
+  \file objModel.h
+  \brief Contains the OBJ-model Class, that reads in a Model from a .obj-file
+*/
+
+#ifndef _OBJMODEL_H
+#define _OBJMODEL_H
+
+#include "model.h"
+
+//! A Class, that handles the parsing of an obj-file, and inclusion as a Model.
+class OBJModel : public Model
+{
+ public:
+  OBJModel(char* fileName);
+  OBJModel(char* fileName, float scaling);
+  virtual ~OBJModel();
+  void initializeOBJ(void);
+
+ private:
+  // Variables
+  char* objPath;        //!< The Path where 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)
+
+  ///// readin /////
+  bool importFile (char* fileName);
+  bool readFromObjFile (void);
+  bool readMtlLib (char* matFile);
+
+};
+
+#endif /* _OBJ_MODEL_H */
Index: orxonox/trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/texture.cc	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/texture.cc	(revision 3484)
@@ -0,0 +1,942 @@
+/* 
+   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 "texture.h"
+
+// headers only for PathList
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <fstream>
+
+/**
+   \brief creates a ned PathList.
+   
+   It is a good idea to use this as an initial List,
+   because if you give on a name the Path will not be checked for its existence.
+*/
+PathList::PathList()
+{
+  this->pathName = NULL;
+  this->next = NULL;
+}
+
+/**
+   \brief Creates a new PathList with a Name.
+   \param pName the Name of The Path.
+
+   This function just adds the Path without checking if it exists.
+*/
+PathList::PathList(char* pName)
+{
+  this->pathName = new char [strlen(pName)+1];
+  strcpy (this->pathName, pName);
+  this->next = NULL;
+}
+
+/**
+   \brief destroys a PathList
+
+   It does this by deleting the Name and then delete its preceding PathList.
+*/
+PathList::~PathList()
+{
+  if (this->pathName)
+    delete []this->pathName;
+  if (this->next)
+    delete this->next;
+}
+
+PathList* PathList::firstPath = NULL;
+
+/**
+   \returns A Pointer to the first Path of the Pathlist
+*/
+PathList* PathList::getInstance(void)
+{
+  if (firstPath)
+    return firstPath;
+  firstPath = new PathList();
+}
+/**
+   \brief Adds a new Pathlist Element.
+   \param pName
+   
+   Adding a Path automatically checks if the Path exists,
+   and if it does not it will not add it to the List.
+*/
+void PathList::addPath (char* pName)
+{
+  if (pName[0] == '\0')
+    {
+      PRINTF(3)("not Adding empty Path to the List.\n");
+      return;
+    }
+  char* tmpPName = new char[strlen(pName)];
+  strncpy(tmpPName, pName, strlen(pName)-1);
+  tmpPName[strlen(pName)-1] = '\0';
+  if (access (tmpPName, F_OK) == 0)
+    {
+      struct stat status;
+      stat(tmpPName, &status);
+      if (status.st_mode & S_IFDIR)
+	{
+	  PRINTF(2)("Adding Path %s to the PathList.\n", pName);
+	  PathList* tmpPathList = this;
+	  while (tmpPathList->next)
+	    tmpPathList = tmpPathList->next;
+	  tmpPathList->next = new PathList(pName);
+	}
+      else
+	PRINTF(2)("You tried to add non-folder %s to a PathList.\n", tmpPName);
+    }
+  else
+      PRINTF(2)("You tried to add non-existing folder %s to a PathList.\n", tmpPName);
+  delete []tmpPName;
+}
+
+
+
+/**
+   \brief Constructor for a Texture
+*/
+Texture::Texture(void)
+{
+  this->pImage = new Image;
+  this->pImage->data = NULL;
+  this->map = NULL;
+  this->texture = 0;
+}
+
+/**
+   \brief Destructor of a Texture
+   
+   Frees Data, and deletes the textures from GL
+*/
+Texture::~Texture(void)
+{
+  if (this->pImage->data)
+    delete []this->pImage->data;
+  delete pImage;
+  if (this->texture)
+    glDeleteTextures(1, &this->texture);
+}
+
+/**
+   \brief Searches for a Texture inside one of the defined Paths
+   \param texName The name of the texture o search for.
+   \returns pathName+texName if texName was found in the pathList. NULL if the Texture is not found.
+*/
+char* Texture::searchTextureInPaths(char* texName) const
+{
+  char* tmpName = NULL;
+  PathList* pList = PathList::getInstance();
+  while (pList)
+    {
+      if (pList->pathName)
+	{
+	  tmpName = new char [strlen(pList->pathName)+strlen(texName)+1];
+	  strcpy(tmpName, pList->pathName);
+	}
+      else
+	{
+	  tmpName = new char [strlen(texName)+1];
+	  tmpName[0]='\0';
+	}
+      strcat(tmpName, texName);
+      if (access (tmpName, F_OK) == 0)
+	return tmpName;
+      
+      if (tmpName)
+	delete []tmpName;
+      tmpName = NULL;
+      pList = pList->next;
+    }
+  return NULL;
+}
+
+/**
+   \brief a Simple function that switches two char values
+   \param a The first value
+   \param b The second value
+*/
+inline void Texture::swap (unsigned char &a, unsigned char &b)
+{
+  unsigned char temp;
+  temp = a;
+  a    = b;
+  b    = temp;
+}
+
+
+/**
+   \brief Loads a Texture to the openGL-environment.
+   \param pImage The Image to load to openGL
+*/
+bool Texture::loadTexToGL (Image* pImage)
+{
+  PRINTF(2)("Loading texture to OpenGL-Environment.\n");
+  glGenTextures(1, &this->texture);
+  glBindTexture(GL_TEXTURE_2D, this->texture);
+  /* not Working, and not needed. 
+  glTexImage2D( GL_TEXTURE_2D, 0, 3, width,
+		height, 0, GL_BGR,
+		GL_UNSIGNED_BYTE, map->pixels );
+  */ 
+  gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImage->width, pImage->height, pImage->format, GL_UNSIGNED_BYTE, pImage->data);
+  
+  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
+  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);	
+}
+
+
+#ifdef HAVE_SDL_SDL_IMAGE_H
+bool Texture::loadImage(char* imageName)
+{
+  char* imgNameWithPath = searchTextureInPaths(imageName);
+  if (imgNameWithPath)
+    {
+      this->map=IMG_Load(imgNameWithPath);
+      if(!map)
+	{
+	  PRINTF(1)("IMG_Load: %s\n", IMG_GetError());
+	  return false;
+	}
+      pImage->height = map->h;
+      pImage->width  = map->w;
+      pImage->data   = (GLubyte*)map->pixels;
+      pImage->bpp    = map->format->BytesPerPixel;
+      if (pImage->bpp == 3)
+	pImage->format = GL_RGB;
+      else if (pImage->bpp == 4)
+	pImage->format = GL_RGBA;
+	  
+      PRINTF(0)("Bits Per Pixel: %d\n", pImage->bpp);
+      if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb")))
+	for (int i=0;i<map->h * map->w *3;i+=3)
+	  { 
+	    GLuint temp = pImage->data[i];
+	    pImage->data[i] = pImage->data[i+2];
+	    pImage->data[i+2] = temp;
+	  }
+      /* this is the real swapping algorithm */
+      for( int i = 0 ; i < (pImage->height / 2) ; ++i )
+	for( int j = 0 ; j < pImage->width * pImage->bpp; j += pImage->bpp )
+	  for(int k = 0; k < pImage->bpp; ++k)
+	    swap( pImage->data[ (i * pImage->width * pImage->bpp) + j + k], pImage->data[ ( (pImage->height - i - 1) * pImage->width * pImage->bpp ) + j + k]);
+ 
+      this->loadTexToGL (this->pImage);
+      SDL_FreeSurface(map);
+      this->pImage->data = NULL;
+    }
+  else
+    {
+      PRINTF(1)("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
+   \todo Checks where to find the Image
+*/
+bool Texture::loadImage(char* imageName)
+{
+  char* imgNameWithPath = searchTextureInPaths(imageName);
+  if (imgNameWithPath)
+    {
+      if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4))
+	{
+	  PRINTF(3)("Requested bmp-image. Trying to Import.\n");
+	  return this->loadBMP(imgNameWithPath);
+	}
+      
+      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5))
+	{
+	  PRINTF(3)("Requested jpeg-image. Trying to Import\n");
+	  return this->loadJPG(imgNameWithPath);
+	}
+      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4))
+	{
+	  PRINTF(3)("Requested tga-image. Trying to Import\n");
+	  return this->loadTGA(imgNameWithPath);
+	}
+      else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4))
+	{
+	  PRINTF(3)("Requested png-image. Trying to Import\n");
+	  return this->loadPNG(imgNameWithPath);
+	}
+      else
+	{
+	  PRINTF(1)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath);
+	  return false;
+	}
+    }
+  else
+    {
+      PRINTF(1)("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.
+*/
+bool Texture::loadBMP (char* bmpName)
+{
+  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)
+    {
+      PRINTF(1)("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) 
+    {
+      PRINTF(1)("Error reading width from %s.\n", bmpName);
+      return false;
+    }
+  // read the height 
+  if ((i = fread(&pImage->height, 4, 1, file)) != 1) 
+    {
+      PRINTF(1)("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) 
+    {
+      PRINTF(1)("Error reading planes from %s.\n", bmpName);
+      return false;
+    }
+  if (planes != 1) 
+    {
+      PRINTF(1)("Planes from %s is not 1: %u\n", bmpName, planes);
+      return false;
+    }
+  
+  // read the bpp
+  if ((i = fread(&bpp, 2, 1, file)) != 1) 
+    {
+      PRINTF(1)("Error reading bpp from %s.\n", bmpName);
+      return false;
+    }
+  if (bpp != 24) 
+    {
+      PRINTF(1)("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) 
+    {
+      PRINTF(1)("Error allocating memory for color-corrected image data");
+      return false;	
+    }
+  
+  if ((i = fread(pImage->data, size, 1, file)) != 1) 
+    {
+      PRINTF(1)("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);
+  
+
+  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
+*/
+bool Texture::loadJPG (char* jpgName)
+{
+#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(1)("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);
+  if (pImage)
+    {
+      if (pImage->data)
+	{
+	  free(pImage->data);
+	}
+      
+      free(pImage);
+    }
+  return true;
+#else /* HAVE_JPEGLIB_H */
+  PRINTF(1)("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
+*/
+bool Texture::loadTGA(const char * tgaName)
+{
+  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(1)("Error could not open texture file: %s\n", tgaName);
+      return false;
+    }
+  
+  if(fread(&tgaHeader, sizeof(TGAHeader), 1, fTGA) == 0)
+    {
+      PRINTF(1)("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);
+      if (fTGA)
+	fclose (fTGA);
+    }
+  else if(memcmp(cTGAcompare, &tgaHeader, sizeof(TGAHeader)) == 0)
+    {
+      loadCompressedTGA(tgaName, fTGA);
+	if (fTGA)
+	  fclose (fTGA);
+    }
+  else
+    {
+      PRINTF(1)("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
+*/
+bool Texture::loadUncompressedTGA(const char * filename, FILE * fTGA)
+{
+  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 
+
+  GLuint cswap;
+  if(fread(header, sizeof(header), 1, fTGA) == 0)
+    {
+      PRINTF(1)("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(1)("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(1)("Error could not allocate memory for image\n");
+      return false;
+    }
+  
+  if(fread(pImage->data, 1, imageSize, fTGA) != imageSize)
+    {
+      PRINTF(1)("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);
+
+  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
+*/
+bool Texture::loadCompressedTGA(const char * filename, FILE * fTGA)
+{
+  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 
+
+  if(fread(header, sizeof(header), 1, fTGA) == 0)
+    {
+      PRINTF(1)("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(1)("Error Invalid pImage information\n");
+      return false;
+    }
+  
+  bytesPerPixel	= (Bpp / 8);
+  imageSize		= (bytesPerPixel * Width * Height);
+  pImage->data	= (GLubyte*) malloc(imageSize);
+  
+  if(pImage->data == NULL)
+    {
+      PRINTF(1)("Error could not allocate memory for image\n");
+      return false;
+    }
+  
+  do
+    {
+      GLubyte chunkheader = 0;
+      
+      if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0)
+	{
+	  PRINTF(1)("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(1)("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(1)("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(1)("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(1)("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);
+
+  return true;
+}
+
+
+/**
+   \brief reads in a png-file
+   \param pngName the Name of the Image to load
+*/
+bool Texture::loadPNG(const char* pngName)
+{
+#ifdef HAVE_PNG_H
+
+  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)
+    {
+      PRINTF(2)("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);  
+  
+  free(pImage->data);
+  
+  return true;
+#else /* HAVE_PNG_H */
+  PRINTF(1)("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/lib/graphics/importer/texture.h
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/texture.h	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/texture.h	(revision 3484)
@@ -0,0 +1,99 @@
+/*!
+  \file texture.h
+  \brief Contains the texture class, that handles the reading of Images into Texutre-files.
+
+  \todo free SDL-surface when deleting Material.
+  \todo delete imgNameWithPath after use creation.
+*/
+
+#ifndef _TEXTURE_H
+#define _TEXTURE_H
+
+#include "stdincl.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
+{
+ private:
+  PathList();
+  static PathList* firstPath; //!< A static Pointer to the first PathList in the List.
+ public:
+  PathList(char* pName);
+  ~PathList();
+  static PathList* getInstance(void);
+  
+  void addPath (char* pName);
+  char* pathName;              //!< The Name of the current Path.
+  PathList* next;              //!< Pointer to the next Pathlist.
+};
+
+//! A Class, that reads in Textures from different fileformats.
+class Texture
+{
+ private:
+  //! Struct to handle Infos about an Image
+  struct Image
+  {
+    int rowSpan;    //!< The count of the rows this Image has.
+    GLuint width;   //!< The width of the Image.
+    GLuint height;  //!< The height of the Image.
+    GLuint bpp;     //!< BytesPerPixel
+    GLenum format;  //!< The Format of the PixelData
+    GLuint type;    //!< Type of the Image.
+    GLubyte *data;  //!< The Image Data comes here! DANGER: uncompressed data.
+  };
+  Image* pImage;    //!< The data of an Image
+  GLuint texture;   //!< The Texture-ID of opengl from this Texture.
+  SDL_Surface* map; //!< The map SDL initializes for this element.
+  char* searchTextureInPaths(char* texName) const;
+  inline void swap(unsigned char &a, unsigned char &b);
+ public:
+  Texture(void);
+  ~Texture(void);
+  /** \returns The textureID of this texture.  */
+  inline GLuint getTexture(void) {return this->texture;} 
+  bool loadTexToGL (Image* pImage);
+
+  bool loadImage(char* imageName);
+#ifndef HAVE_SDL_SDL_IMAGE_H
+
+  bool loadBMP (char* bmpName);
+
+  bool loadJPG (char* jpgName);
+
+  /// TGA ///
+
+  bool loadTGA(const char * tgaName);
+  bool loadUncompressedTGA(const char * filename, FILE * fTGA);
+  bool loadCompressedTGA(const char * filename, FILE * fTGA);
+
+  bool loadPNG(const char* pngName);
+#endif
+
+
+};
+
+
+
+#endif /* _TEXTURE_H */
Index: orxonox/trunk/src/lib/graphics/importer/toDo
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/toDo	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/toDo	(revision 3484)
@@ -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/lib/graphics/importer/windowHandler.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/windowHandler.cc	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/windowHandler.cc	(revision 3484)
@@ -0,0 +1,112 @@
+/* 
+   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>
+
+/**
+   \brief Resizes the Window
+   \param width the new size in the width.
+   \param height the new size in the height.
+*/
+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
+
+}
+
+/**
+   \brief initializes openGL
+*/
+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;
+}
+
+/**
+   \brief kills the window
+*/
+GLvoid WindowHandler::KillGLWindow(GLvoid) // Properly Kill The Window
+{
+	SDL_Quit();
+}
+
+/**
+   \brief creates a new Window for the scene
+   \param title the name of the Window
+   \param width the width of the window
+   \param height the height of the window
+   \param bits the bits per pixel to use
+   \param fullscreenflag TRUE if fullscreen FALSE if windowed/
+   \returns FALSE if initialisation failed, TRUE otherwise
+*/
+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/lib/graphics/importer/windowHandler.h
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/windowHandler.h	(revision 3484)
+++ orxonox/trunk/src/lib/graphics/importer/windowHandler.h	(revision 3484)
@@ -0,0 +1,43 @@
+/*!
+  \file windowHandler.h
+  \brief contains the WindowHandler class for the minimal display system
+*/
+
+
+#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 true
+#define FALSE 0    //!< define false
+#define BOOL int   //!< define BOOL
+
+//! A simple class to handle a minimal display system
+class WindowHandler
+{
+  public:
+    WindowHandler() { };
+    ~WindowHandler() { };
+    GLvoid KillGLWindow(GLvoid);
+    BOOL CreateGLWindow(char* title, int width, int height, int bits, BOOL fullscreenflag);
+    SDL_Surface* screen;   //!< The screen to which to display the rendered stuff
+  private:
+    int InitGL(GLvoid);
+    void ReSizeGLScene(GLsizei width, GLsizei height);  
+};
+
+
+#endif
Index: orxonox/trunk/src/lib/ini_parser.cc
===================================================================
--- orxonox/trunk/src/lib/ini_parser.cc	(revision 3483)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/* 
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Christian Meyer
-   co-programmer: ...
-*/
-
-
-#include "ini_parser.h"
-
-using namespace std;
-
-/**
-	\brief constructs an IniParser using a file
-	\param filename: the path and name of the file to parse
-*/
-IniParser::IniParser (char* filename)
-{
-  stream = NULL;
-  bInSection = false;
-  openFile(filename);
-}
-
-/**
-	\brief removes the IniParser from memory
-*/
-IniParser::~IniParser ()
-{
-  if( stream != NULL) fclose (stream);
-}
-
-/**
-   \brief opens another file to parse
-   \param filename: path and name of the new file to parse
-   \return zero on success or -1 if an error occured;
-*/
-int IniParser::openFile( char* filename)
-{
-  if( filename == NULL) return -1;
-  if( stream != NULL)	fclose (stream);
-  if( (stream = fopen (filename, "r")) == NULL)
-    {
-      printf("IniParser could not open %s\n", filename);
-      return -1;
-    }
-  bInSection = false;
-  return 0;
-}
-
-/**
-   \brief set the parsing cursor to the specified section
-   \param section: the name of the section to set the cursor to
-   \return zero on success or -1 if the section could not be found
-*/
-int IniParser::getSection( char* section)
-{
-  bInSection = false;
-  if( stream == NULL) return -1;
-  
-  char linebuffer[PARSELINELENGHT];
-  char secbuffer[PARSELINELENGHT];
-  char* ptr;
-  
-  rewind (stream);
-  while( !feof( stream))
-    {
-      // get next line
-      fgets (linebuffer, PARSELINELENGHT, stream);
-      // remove newline char
-      if( (ptr = strchr( linebuffer, '\n')) != NULL) *ptr = 0;
-      // check for section identifyer
-      if( sscanf (linebuffer, "[%s", secbuffer) == 1)
-	{
-	  if( (ptr = strchr( secbuffer, ']')) != NULL)
-	    {
-	      *ptr = 0;
-	      if( !strcmp( secbuffer, section))
-		{
-		  bInSection = true;
-		  return 0;
-		}
-	    }
-	}
-    }
-  return -1;
-}
-
-/**
-   \brief gets the next VarName=VarValue pair from the parsing stream
-   \param name: a pointer to a buffer to store the name of the entry
-   \param value: a pointer to a buffer to store the value of the entry
-   \return zero if the buffers have been filled with data or -1 if there are no entries left in the current section
-*/
-int IniParser::nextVar( char* name, char* value)
-{
-  if( stream == NULL)
-    {
-      bInSection = false;
-      return -1;
-    }
-  if( !bInSection) return -1;
-  
-  char linebuffer[PARSELINELENGHT];
-  char* ptr;
-  
-  while( !feof( stream))
-    {
-      // get next line
-      fgets (linebuffer, PARSELINELENGHT, stream);
-      // remove newline char
-      if( (ptr = strchr( linebuffer, '\n')) != NULL) *ptr = 0;
-      if( linebuffer[0] == '[')
-	{
-	  bInSection = false;
-	  return -1;
-	}
-      if( (ptr = strchr( linebuffer, '=')) != NULL)
-	{
-	  if( ptr == linebuffer) continue;
-	  strcpy (value, &ptr[1]);
-	  strncpy (name, linebuffer, strlen (linebuffer) - strlen (value) - 1);
-	  return 0;
-	}
-    }
-  return -1;	
-}
-
-/**
-   \brief directly acesses an entry in a section
-   \param name: the name of the entry to find
-   \param section: the section where the entry is to be found
-   \param defvalue: what should be returned in case the entry cannot be found
-   \return a pointer to a buffer conatining the value of the specified entry. This buffer will contain the data specified in defvalue in case the entry wasn't found
-   
-   The returned pointer points to an internal buffer, so do not free it on your own. Do not give a NULL pointer to defvalue, this will certainly
-   lead to unwanted behaviour.
-*/
-char* IniParser::getVar( char* name, char* section, char* defvalue = "")
-{
-  strcpy (internbuf, defvalue);
-  if( getSection (section) == -1) return internbuf;
-  
-  char namebuf[PARSELINELENGHT];
-  char valuebuf[PARSELINELENGHT];
-  
-  while( nextVar (namebuf, valuebuf) != -1)
-    {
-      if( !strcmp (name, namebuf))
-	{
-	  strcpy (internbuf, valuebuf);
-	  return internbuf;
-	}
-    }
-  return internbuf;
-}
Index: orxonox/trunk/src/lib/ini_parser.h
===================================================================
--- orxonox/trunk/src/lib/ini_parser.h	(revision 3483)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*!
-    \file ini_parser.h
-    \brief A small ini file parser
-    
-    Can be used to find a defined [Section] in an ini file and get the VarName=Value entries
-*/
-
-#ifndef _INI_PARSER_H
-#define _INI_PARSER_H
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define PARSELINELENGHT 512
-
-//! ini-file parser
-/**
-	This class can be used to load an initializer file and parse it's contents for variablename=value pairs.
-*/
-class IniParser {
- private:
-	FILE* stream;
-	bool bInSection;
-	char internbuf[PARSELINELENGHT];
-	
- public:
-  IniParser (char* filename);
-  ~IniParser ();
-  
-  char* getVar( char* name, char* section, char* defvalue);
-	int openFile( char* name);
-  int getSection( char* section);
-  int nextVar( char* name, char* value);
-};
-
-#endif /* _INI_PARSER_H */
Index: orxonox/trunk/src/lib/lang/base_entity.cc
===================================================================
--- orxonox/trunk/src/lib/lang/base_entity.cc	(revision 3484)
+++ orxonox/trunk/src/lib/lang/base_entity.cc	(revision 3484)
@@ -0,0 +1,32 @@
+
+
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Patrick Boenzli
+   co-programmer: ...
+*/
+
+
+#include "base_entity.h"
+
+
+using namespace std;
+
+
+
+BaseEntity::BaseEntity () {}
+
+
+
+BaseEntity::~BaseEntity () {}
+
+
Index: orxonox/trunk/src/lib/lang/base_entity.h
===================================================================
--- orxonox/trunk/src/lib/lang/base_entity.h	(revision 3484)
+++ orxonox/trunk/src/lib/lang/base_entity.h	(revision 3484)
@@ -0,0 +1,20 @@
+/*! 
+  \file base_entity.h
+  \brief This includes the default values every entity should have.						\
+*/
+
+#ifndef _BASE_ENTITY_H
+#define _BASE_ENTITY_H
+
+#include "stdincl.h"
+
+//! The Base of each entity-Class
+class BaseEntity {
+
+ public:
+  BaseEntity ();
+  ~BaseEntity ();
+
+};
+
+#endif /* _BASE_ENTITY_H */
Index: orxonox/trunk/src/lib/lang/base_object.cc
===================================================================
--- orxonox/trunk/src/lib/lang/base_object.cc	(revision 3484)
+++ orxonox/trunk/src/lib/lang/base_object.cc	(revision 3484)
@@ -0,0 +1,52 @@
+
+
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Patrick Boenzli
+   co-programmer: ...
+*/
+
+
+#include "base_object.h"
+
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+*/
+BaseObject::BaseObject () {}
+
+
+/**
+   \brief standard deconstructor
+*/
+BaseObject::~BaseObject () {}
+
+
+void BaseObject::setClassName (char* className)
+{
+  this->className = className;
+}
+
+char* BaseObject::getClassName(void) const
+{
+  return className;
+}
+
+bool BaseObject::isA (char* className)
+{
+  if( this->className == className)
+    return false;
+  return true;
+}
Index: orxonox/trunk/src/lib/lang/base_object.h
===================================================================
--- orxonox/trunk/src/lib/lang/base_object.h	(revision 3484)
+++ orxonox/trunk/src/lib/lang/base_object.h	(revision 3484)
@@ -0,0 +1,28 @@
+/*! 
+    \file proto_class.h
+    \brief Definition of the proto class template, used quickly start work
+*/
+
+
+#ifndef _BASE_OBJECT_H
+#define _BASE_OBJECT_H
+
+#include "stdincl.h"
+
+
+class BaseObject {
+
+ public:
+  BaseObject ();
+  ~BaseObject ();
+
+  void setClassName (char* className);
+  char* getClassName(void) const;
+  bool isA (char* className);
+
+ private:
+  char* className;
+
+};
+
+#endif /* _BASE_OBJECT_H */
Index: orxonox/trunk/src/lib/util/ini_parser.cc
===================================================================
--- orxonox/trunk/src/lib/util/ini_parser.cc	(revision 3484)
+++ orxonox/trunk/src/lib/util/ini_parser.cc	(revision 3484)
@@ -0,0 +1,163 @@
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Christian Meyer
+   co-programmer: ...
+*/
+
+
+#include "ini_parser.h"
+
+using namespace std;
+
+/**
+	\brief constructs an IniParser using a file
+	\param filename: the path and name of the file to parse
+*/
+IniParser::IniParser (char* filename)
+{
+  stream = NULL;
+  bInSection = false;
+  openFile(filename);
+}
+
+/**
+	\brief removes the IniParser from memory
+*/
+IniParser::~IniParser ()
+{
+  if( stream != NULL) fclose (stream);
+}
+
+/**
+   \brief opens another file to parse
+   \param filename: path and name of the new file to parse
+   \return zero on success or -1 if an error occured;
+*/
+int IniParser::openFile( char* filename)
+{
+  if( filename == NULL) return -1;
+  if( stream != NULL)	fclose (stream);
+  if( (stream = fopen (filename, "r")) == NULL)
+    {
+      printf("IniParser could not open %s\n", filename);
+      return -1;
+    }
+  bInSection = false;
+  return 0;
+}
+
+/**
+   \brief set the parsing cursor to the specified section
+   \param section: the name of the section to set the cursor to
+   \return zero on success or -1 if the section could not be found
+*/
+int IniParser::getSection( char* section)
+{
+  bInSection = false;
+  if( stream == NULL) return -1;
+  
+  char linebuffer[PARSELINELENGHT];
+  char secbuffer[PARSELINELENGHT];
+  char* ptr;
+  
+  rewind (stream);
+  while( !feof( stream))
+    {
+      // get next line
+      fgets (linebuffer, PARSELINELENGHT, stream);
+      // remove newline char
+      if( (ptr = strchr( linebuffer, '\n')) != NULL) *ptr = 0;
+      // check for section identifyer
+      if( sscanf (linebuffer, "[%s", secbuffer) == 1)
+	{
+	  if( (ptr = strchr( secbuffer, ']')) != NULL)
+	    {
+	      *ptr = 0;
+	      if( !strcmp( secbuffer, section))
+		{
+		  bInSection = true;
+		  return 0;
+		}
+	    }
+	}
+    }
+  return -1;
+}
+
+/**
+   \brief gets the next VarName=VarValue pair from the parsing stream
+   \param name: a pointer to a buffer to store the name of the entry
+   \param value: a pointer to a buffer to store the value of the entry
+   \return zero if the buffers have been filled with data or -1 if there are no entries left in the current section
+*/
+int IniParser::nextVar( char* name, char* value)
+{
+  if( stream == NULL)
+    {
+      bInSection = false;
+      return -1;
+    }
+  if( !bInSection) return -1;
+  
+  char linebuffer[PARSELINELENGHT];
+  char* ptr;
+  
+  while( !feof( stream))
+    {
+      // get next line
+      fgets (linebuffer, PARSELINELENGHT, stream);
+      // remove newline char
+      if( (ptr = strchr( linebuffer, '\n')) != NULL) *ptr = 0;
+      if( linebuffer[0] == '[')
+	{
+	  bInSection = false;
+	  return -1;
+	}
+      if( (ptr = strchr( linebuffer, '=')) != NULL)
+	{
+	  if( ptr == linebuffer) continue;
+	  strcpy (value, &ptr[1]);
+	  strncpy (name, linebuffer, strlen (linebuffer) - strlen (value) - 1);
+	  return 0;
+	}
+    }
+  return -1;	
+}
+
+/**
+   \brief directly acesses an entry in a section
+   \param name: the name of the entry to find
+   \param section: the section where the entry is to be found
+   \param defvalue: what should be returned in case the entry cannot be found
+   \return a pointer to a buffer conatining the value of the specified entry. This buffer will contain the data specified in defvalue in case the entry wasn't found
+   
+   The returned pointer points to an internal buffer, so do not free it on your own. Do not give a NULL pointer to defvalue, this will certainly
+   lead to unwanted behaviour.
+*/
+char* IniParser::getVar( char* name, char* section, char* defvalue = "")
+{
+  strcpy (internbuf, defvalue);
+  if( getSection (section) == -1) return internbuf;
+  
+  char namebuf[PARSELINELENGHT];
+  char valuebuf[PARSELINELENGHT];
+  
+  while( nextVar (namebuf, valuebuf) != -1)
+    {
+      if( !strcmp (name, namebuf))
+	{
+	  strcpy (internbuf, valuebuf);
+	  return internbuf;
+	}
+    }
+  return internbuf;
+}
Index: orxonox/trunk/src/lib/util/ini_parser.h
===================================================================
--- orxonox/trunk/src/lib/util/ini_parser.h	(revision 3484)
+++ orxonox/trunk/src/lib/util/ini_parser.h	(revision 3484)
@@ -0,0 +1,37 @@
+/*!
+    \file ini_parser.h
+    \brief A small ini file parser
+    
+    Can be used to find a defined [Section] in an ini file and get the VarName=Value entries
+*/
+
+#ifndef _INI_PARSER_H
+#define _INI_PARSER_H
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define PARSELINELENGHT 512
+
+//! ini-file parser
+/**
+	This class can be used to load an initializer file and parse it's contents for variablename=value pairs.
+*/
+class IniParser {
+ private:
+	FILE* stream;
+	bool bInSection;
+	char internbuf[PARSELINELENGHT];
+	
+ public:
+  IniParser (char* filename);
+  ~IniParser ();
+  
+  char* getVar( char* name, char* section, char* defvalue);
+	int openFile( char* name);
+  int getSection( char* section);
+  int nextVar( char* name, char* value);
+};
+
+#endif /* _INI_PARSER_H */
