Index: trunk/src/lib/collision_detection/bounding_volume.h
===================================================================
--- trunk/src/lib/collision_detection/bounding_volume.h	(revision 6012)
+++ trunk/src/lib/collision_detection/bounding_volume.h	(revision 6022)
@@ -9,5 +9,5 @@
 
 #include "base_object.h"
-#include "abstract_model.h"
+#include "model.h"
 
 class Vector;
Index: trunk/src/lib/collision_detection/bv_tree.h
===================================================================
--- trunk/src/lib/collision_detection/bv_tree.h	(revision 6012)
+++ trunk/src/lib/collision_detection/bv_tree.h	(revision 6022)
@@ -10,5 +10,5 @@
 
 #include "base_object.h"
-#include "abstract_model.h"
+#include "model.h"
 
 // FORWARD DECLARATION
Index: trunk/src/lib/collision_detection/bv_tree_node.h
===================================================================
--- trunk/src/lib/collision_detection/bv_tree_node.h	(revision 6012)
+++ trunk/src/lib/collision_detection/bv_tree_node.h	(revision 6022)
@@ -9,5 +9,5 @@
 
 #include "base_object.h"
-#include "abstract_model.h"
+#include "model.h"
 #include "vector.h"
 
Index: trunk/src/lib/collision_detection/cd_engine.cc
===================================================================
--- trunk/src/lib/collision_detection/cd_engine.cc	(revision 6012)
+++ trunk/src/lib/collision_detection/cd_engine.cc	(revision 6022)
@@ -21,5 +21,5 @@
 #include "list.h"
 
-#include "abstract_model.h"
+#include "model.h"
 #include "world_entity.h"
 #include "terrain.h"
Index: trunk/src/lib/collision_detection/cd_engine.h
===================================================================
--- trunk/src/lib/collision_detection/cd_engine.h	(revision 6012)
+++ trunk/src/lib/collision_detection/cd_engine.h	(revision 6022)
@@ -10,5 +10,5 @@
 #include "base_object.h"
 #include "collision_defs.h"
-#include "abstract_model.h"
+#include "model.h"
 
 
Index: trunk/src/lib/collision_detection/obb_tree.h
===================================================================
--- trunk/src/lib/collision_detection/obb_tree.h	(revision 6012)
+++ trunk/src/lib/collision_detection/obb_tree.h	(revision 6022)
@@ -9,5 +9,5 @@
 
 #include "bv_tree.h"
-#include "abstract_model.h"
+#include "model.h"
 #include "material.h"
 
Index: trunk/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 6012)
+++ trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 6022)
@@ -21,5 +21,5 @@
 #include "obb_tree.h"
 #include "matrix.h"
-#include "abstract_model.h"
+#include "model.h"
 #include "world_entity.h"
 
Index: trunk/src/lib/graphics/importer/Makefile.am
===================================================================
--- trunk/src/lib/graphics/importer/Makefile.am	(revision 6012)
+++ trunk/src/lib/graphics/importer/Makefile.am	(revision 6022)
@@ -4,7 +4,7 @@
 noinst_LIBRARIES = libORXimporter.a
 
-libORXimporter_a_SOURCES = abstract_model.cc \
+libORXimporter_a_SOURCES = model.cc \
                            vertex_array_model.cc \
-                           model.cc \
+                           static_model.cc \
                            objModel.cc \
                            primitive_model.cc \
@@ -16,7 +16,7 @@
 
 
-noinst_HEADERS = abstract_model.h \
+noinst_HEADERS = model.h \
                  vertex_array_model.h \
-                 model.h \
+                 static_model.h \
                  objModel.h \
                  primitive_model.h \
Index: trunk/src/lib/graphics/importer/abstract_model.cc
===================================================================
--- trunk/src/lib/graphics/importer/abstract_model.cc	(revision 6012)
+++ 	(revision )
@@ -1,47 +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: ...
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_MODEL
-
-#include "abstract_model.h"
-
-using namespace std;
-
-
-/**
- * standard constructor
- * @todo this constructor is not jet implemented - do it
-*/
-AbstractModel::AbstractModel()
-{
-//   this->setClassID(CL_PROTO_ID, "ProtoClass");
-  this->pModelInfo.numVertices = 0;
-  this->pModelInfo.numTriangles = 0;
-  this->pModelInfo.numTexCoor = 0;
-
-  this->pModelInfo.pVertices = NULL;
-  this->pModelInfo.pTriangles = NULL;
-  this->pModelInfo.pNormals = NULL;
-  this->pModelInfo.pTexCoor = NULL;
-}
-
-
-/**
- * standard deconstructor
-*/
-AbstractModel::~AbstractModel()
-{
-  // delete what has to be deleted here
-}
Index: trunk/src/lib/graphics/importer/abstract_model.h
===================================================================
--- trunk/src/lib/graphics/importer/abstract_model.h	(revision 6012)
+++ 	(revision )
@@ -1,160 +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:
-*/
-
-/*!
- * @file abstract_model.h
- *  Definition of an abstract model. containing all needed for other model
- */
-
-#ifndef _ABSTRACT_MODEL_H
-#define _ABSTRACT_MODEL_H
-
-#include "base_object.h"
-#include "vector.h"
-
-using namespace std;
-
-
-
-//! compressed vertex data: char insetead of float, the value will be expanded by the scale value. only for loading
-typedef struct
-{
-  char             v[3];                 //!< the vector of the vertex
-  unsigned char    lightNormalIndex;     //!< the index of the light normal
-} sVertex;
-
-
-//! compressed texture offset data: coords scaled by the texture size. Only for loading
-typedef struct
-{
-  short            s;                    //!< the s,t coordinates of a texture
-  short            t;                    //!< the s,t coordinates of a texture
-} sTexCoor;
-
-
-//! holds tha informations about a md2 frame
-typedef struct
-{
-  sVec3D           scale;                //!< scales values of the model
-  sVec3D           translate;            //!< translates the model
-  char             name[16];             //!< frame name: something like "run32"
-  sVertex          pVertices[1];         //!< first vertex of thes frame
-} sFrame;
-
-
-//! holds the information about a triangle
-typedef struct
-{
-  unsigned short   indexToVertices[3];   //!< index to the verteces of the triangle
-  unsigned short   indexToTexCoor[3];    //!< index to the texture coordinates
-} sTriangle;
-
-
-//! holds the information about a triangle
-typedef struct
-{
-  unsigned int   indexToVertices[3];   //!< index to the verteces of the triangle
-  unsigned int   indexToNormals[3];    //!< index to the normals of the triangle
-  unsigned int   indexToTexCoor[3];    //!< index to the texture coordinates
-} sTriangleExt;
-
-
-//! the command list of the md2 model, very md2 specific
-typedef struct
-{
-  float            s;                    //!< texture coordinate 1
-  float            t;                    //!< texture coordinate 2
-  int              vertexIndex;          //!< index of the vertex in the vertex list
-} glCommandVertex;
-
-
-//! a md2 animation definition
-typedef struct
-{
-  int              firstFrame;           //!< first frame of the animation
-  int              lastFrame;            //!< last frame of the animation
-  int              fps;                  //!< speed: number of frames per second
-} sAnim;
-
-
-//! animation state definition
-typedef struct
-{
-  int              startFrame;           //!< the start frame of an animation
-  int              endFrame;             //!< last frame of the animation
-  int              fps;                  //!< fps of the animaion (speed)
-
-  float            localTime;            //!< the local time
-  float            lastTime;             //!< last time stamp
-  float            interpolationState;   //!< the state of the animation [0..1]
-
-  int              type;                 //!< animation type
-
-  int              currentFrame;         //!< the current frame
-  int              nextFrame;            //!< the next frame in the list
-} sAnimState;
-
-//! Model Information definitions
-typedef struct
-{
-  unsigned int     numVertices;          //!< number of Vertices in the Model
-  unsigned int     numTriangles;         //!< number of triangles in the Model
-  unsigned int     numNormals;           //!< how many Normals in the Model
-  unsigned int     numTexCoor;           //!< how many Texture Coordinates in the Model
-
-  const float*     pVertices;            //!< array of the Vertives
-  sTriangleExt*    pTriangles;           //!< array of all triangles
-  const float*     pNormals;             //!< array of the Normals
-  const float*     pTexCoor;             //!< array of the Texture Coordinates
-
-} modelInfo;
-
-
-
-//! This class defines the basic components of a model
-class AbstractModel : public BaseObject {
-
-  public:
-    AbstractModel();
-    virtual ~AbstractModel();
-
-    inline const modelInfo* getModelInfo() const { return &this->pModelInfo; }
-
-    /** @returns a Pointer to the Vertex-Array, if it was deleted it returns NULL */
-    inline const float* getVertexArray() const { return this->pModelInfo.pVertices; };
-    /** @returns the VertexCount of this Model */
-    inline unsigned int getVertexCount() const { return this->pModelInfo.numVertices; };
-
-    /** @returns a Pointer to the Normals-Array, if it was deleted it returns NULL */
-    inline const float* getNormalsArray() const { return this->pModelInfo.pNormals; };
-    /** @returns the NormalsCount of this Model */
-    inline unsigned int getNormalsCount() const { return this->pModelInfo.numNormals; };
-
-    /** @returns a Pointer to the TexCoord-Array, if it was deleted it returns NULL */
-    inline const float* getTexCoordArray() const { return this->pModelInfo.pTexCoor; };
-    /** @returns the TexCoord-Count of this Model */
-    inline unsigned int getTexCoordCount() const { return this->pModelInfo.numTexCoor; };
-
-    /** @returns the Array of triangles */
-    inline sTriangleExt* getTriangles() const { return this->pModelInfo.pTriangles; };
-    /** @returns the Count of Faces of this Model */
-    inline unsigned int getFaceCount() const { return this->pModelInfo.numTriangles; };
-
-
-  protected:
-    modelInfo      pModelInfo;      //!< Reference to the modelInfo
-};
-
-#endif /* _ABSTRACT_MODEL_H */
Index: trunk/src/lib/graphics/importer/md2Model.cc
===================================================================
--- trunk/src/lib/graphics/importer/md2Model.cc	(revision 6012)
+++ trunk/src/lib/graphics/importer/md2Model.cc	(revision 6022)
@@ -160,6 +160,8 @@
 
 /**
-  \brief draws the model: interface for all other classes out in the world
-*/
+ * @brief draws the model: interface for all other classes out in the world
+ * @todo make it const and virtual
+ * FIXME
+ */
 void MD2Model::draw()
 {
Index: trunk/src/lib/graphics/importer/md2Model.h
===================================================================
--- trunk/src/lib/graphics/importer/md2Model.h	(revision 6012)
+++ trunk/src/lib/graphics/importer/md2Model.h	(revision 6022)
@@ -19,5 +19,5 @@
 #define _MD2MODEL_H
 
-#include "abstract_model.h"
+#include "model.h"
 #include "base_object.h"
 #include "stdincl.h"
@@ -137,5 +137,5 @@
 
 //! This is a MD2 Model class
-class MD2Model : public AbstractModel {
+class MD2Model : public Model {
 
 public:
Index: trunk/src/lib/graphics/importer/model.cc
===================================================================
--- trunk/src/lib/graphics/importer/model.cc	(revision 6012)
+++ trunk/src/lib/graphics/importer/model.cc	(revision 6022)
@@ -10,1093 +10,37 @@
 
    ### File Specific:
-   main-programmer: Benjamin Grauer
+   main-programmer: Patrick Boenzli
    co-programmer: ...
-
-   2005-07-06: (Patrick) added new function buildTriangleList()
 */
 
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_MODEL
 
 #include "model.h"
 
-#include "stdlibincl.h"
-#include <stdarg.h>
-
-#include "vector.h"
-
 using namespace std;
 
+/**
+ * standard constructor
+ * @todo this constructor is not jet implemented - do it
+*/
+Model::Model()
+{
+//   this->setClassID(CL_PROTO_ID, "ProtoClass");
+  this->pModelInfo.numVertices = 0;
+  this->pModelInfo.numTriangles = 0;
+  this->pModelInfo.numTexCoor = 0;
 
-////////////////////
-/// SUB-Elements ///
-////////////////////
-/**
- *  creates a new ModelFaceElement
-*/
-ModelFaceElement::ModelFaceElement()
-{
-  this->vertexNumber = -1;
-  this->normalNumber = -1;
-  this->texCoordNumber = -1;
-
-  this->next = NULL;
-}
-
-/**
- *  destroys a ModelFaceElement
-*/
-ModelFaceElement::~ModelFaceElement()
-{
-  if (this->next)
-    delete this->next;
-}
-
-/**
- *  creates a new ModelFace
-*/
-ModelFace::ModelFace()
-{
-  this->vertexCount = 0;
-
-  this->firstElem = NULL;
-
-  this->material = NULL;
-
-  this->next = NULL;
-}
-
-/**
- *  deletes a ModelFace
-*/
-ModelFace::~ModelFace()
-{
-  PRINTF(5)("Cleaning up Face\n");
-
-  if (this->firstElem != NULL)
-    delete this->firstElem;
-
-  if (this->next != NULL)
-    delete this->next;
-}
-
-/**
- *  Creates a new ModelGroup
-*/
-ModelGroup::ModelGroup()
-{
-  PRINTF(4)("Adding new Group\n");
-  this->name = "";
-  this->faceMode = -1;
-  this->faceCount = 0;
-  this->next = NULL;
-  this->listNumber = 0;
-
-  this->firstFace = new ModelFace;
-  this->currentFace = this->firstFace;
-}
-
-/**
- *  deletes a ModelGroup
-*/
-ModelGroup::~ModelGroup()
-{
-  PRINTF(5)("Cleaning up group\n");
-  if (this->firstFace != NULL)
-    delete this->firstFace;
-
-  // deleting the glList
-  if (this->listNumber != 0)
-    glDeleteLists(this->listNumber, 1);
-
-  if (this->name[0] != '\0')
-    delete[] this->name;
-
-  if (this->next !=NULL)
-    delete this->next;
-
-}
-
-/**
- *  cleans up a ModelGroup
-
-   actually does the same as the delete Operator, but does not delete the predecessing group
-*/
-void ModelGroup::cleanup()
-{
-  PRINTF(5)("Cleaning up group\n");
-  if (this->firstFace)
-    delete this->firstFace;
-  this->firstFace = NULL;
-  if (this->next)
-    this->next->cleanup();
-}
-
-
-/////////////
-/// MODEL ///
-/////////////
-/**
- *  Creates a 3D-Model.
-
-   assigns it a Name and a Type
-*/
-Model::Model(const char* modelName, MODEL_TYPE type)
-{
-  this->setClassID(CL_MODEL, "Model");
-  PRINTF(4)("new 3D-Model is being created\n");
-  this->setName(modelName);
-  this->type = type;
-
-  this->finalized = false;
-  // setting the start group;
-  this->currentGroup = this->firstGroup = new ModelGroup;
-  this->groupCount = 0;
-  this->vertexCount = 0;
-  this->normalCount = 0;
-  this->texCoordCount = 0;
-  this->faceCount = 0;
-  this->triangleCount = 0;
-  this->triangles = NULL;
-
-  this->scaleFactor = 1;
-
-  this->vertices = new tArray<GLfloat>();
-  this->vTexture = new tArray<GLfloat>();
-  this->normals = new tArray<GLfloat>();
-
-  if (this->type == MODEL_VERTEX_ARRAY)
-    glEnableClientState(GL_VERTEX_ARRAY | GL_NORMAL_ARRAY | GL_TEXTURE_COORD_ARRAY);
-}
-
-/**
- *  deletes an Model.
-
-   Looks if any from model allocated space is still in use, and if so deleted it.
-*/
-Model::~Model()
-{
-  PRINTF(4)("Deleting Model ");
-  if (this->getName())
-  {
-    PRINT(4)("%s\n", this->getName());
-  }
-  else
-  {
-    PRINT(4)("\n");
-  }
-  this->cleanup();
-
-  PRINTF(5)("Deleting display Lists.\n");
-  delete this->firstGroup;
-
-  // deleting Arrays (if not allready done by finalize)
-  this->deleteArrays();
-
-  // deleting the MaterialList
-  PRINTF(5)("Deleting Materials.\n");
-
-  //! @todo do we really have to delete this material??
-  list<ModelMaterial*>::iterator modMat;
-  for(modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
-  {
-    if (!(*modMat)->external)
-      delete (*modMat)->material;
-    delete (*modMat);
-  }
-}
-
-/**
- *  Finalizes an Object. This can be done outside of the Class.
-*/
-void Model::finalize()
-{
-  // this creates the display List.
-  this->importToDisplayList();
-  this->buildTriangleList();
-
-  // deletes everything we allocated.
-  //if (this->type == MODEL_DISPLAY_LIST)
-    //this->deleteArrays();
-  //  this->cleanup();
-
-  /* load the ModelInfo */
-  this->pModelInfo.numVertices = this->vertexCount;
-  this->pModelInfo.pVertices = this->vertices->getArray();
-  this->pModelInfo.numTriangles = this->triangleCount;
-  this->pModelInfo.pTriangles = this->triangles;
-  this->pModelInfo.numNormals = this->normalCount;
-  this->pModelInfo.pNormals = this->normals->getArray();
-  this->pModelInfo.numTexCoor = this->vTexture->getCount();
-  this->pModelInfo.pTexCoor = this->vTexture->getArray();
-
-  this->finalized = true;
-}
-
-/**
- * rebuild the Model from the Information we got.
- */
-void Model::rebuild()
-{
-  PRINTF(3)("Rebuilding Model '%s'\n", this->getName());
-  this->finalize();
-
-}
-
-//////////
-// DRAW //
-//////////
-/**
- *  Draws the Models of all Groups.
-   It does this by just calling the Lists that must have been created earlier.
-*/
-void Model::draw () const
-{
-
-  PRINTF(4)("drawing the 3D-Models\n");
-  ModelGroup* tmpGroup = this->firstGroup;
-  while (tmpGroup != NULL)
-    {
-      PRINTF(5)("Drawing model %s\n", tmpGroup->name);
-      glCallList (tmpGroup->listNumber);
-      tmpGroup = tmpGroup->next;
-    }
-
-
-/*  const GLfloat* pVertices = NULL;
-  const GLfloat* pNorm = NULL;
-
-  glBegin(GL_TRIANGLES);
-  for( int i = 0; i < this->triangleCount; ++i)
-  {
-    //printf("int i = %i\n", i);
-    pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[0]];
-    pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[0]];
-    glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
-    glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
-
-    pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[1]];
-    pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[1]];
-    glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
-    glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
-
-    pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[2]];
-    pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[2]];
-    glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
-    glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
-
-  }
-  glEnd();*/
-}
-
-/**
- *  Draws the Model number groupNumber
- * @param groupNumber The number of the group that will be displayed.
-
-   It does this by just calling the List that must have been created earlier.
-*/
-void Model::draw (int groupNumber) const
-{
-  if (groupNumber >= this->groupCount)
-    {
-      PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);
-      return;
-    }
-  PRINTF(4)("drawing the requested 3D-Models if found.\n");
-  ModelGroup* tmpGroup = this->firstGroup;
-  int counter = 0;
-  while (tmpGroup != NULL)
-    {
-      if (counter == groupNumber)
-        {
-          PRINTF(4)("Drawing model number %i named %s\n", counter, tmpGroup->name);
-          glCallList (tmpGroup->listNumber);
-          return;
-        }
-      ++counter;
-      tmpGroup = tmpGroup->next;
-    }
-  PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->getName());
-  return;
-
-}
-
-/**
- *  Draws the Model with a specific groupName
- * @param groupName The name of the group that will be displayed.
-
-   It does this by just calling the List that must have been created earlier.
-*/
-void Model::draw (char* groupName) const
-{
-  PRINTF(4)("drawing the requested 3D-Models if found.\n");
-  ModelGroup* tmpGroup = this->firstGroup;
-  while (tmpGroup != NULL)
-    {
-      if (!strcmp(tmpGroup->name, groupName))
-        {
-          PRINTF(4)("Drawing model %s\n", tmpGroup->name);
-          glCallList (tmpGroup->listNumber);
-          return;
-        }
-      tmpGroup = tmpGroup->next;
-    }
-  PRINTF(2)("Model Named %s in %s not Found.\n", groupName, this->getName());
-  return;
-}
-
-//////////
-// INIT //
-//////////
-/**
- *  deletes all the arrays
-*/
-bool Model::deleteArrays()
-{
-  if (this->vertices)
-    delete this->vertices;
-  if (this->vTexture)
-    delete this->vTexture;
-  if (this->normals)
-    delete this->normals;
-  if (this->triangles)
-    delete[] this->triangles;
-
-  this->vertices = NULL;
-  this->vTexture = NULL;
-  this->normals = NULL;
-  this->triangles = NULL;
-  this->triangleCount = 0;
-}
-
-/**
- *  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()
-{
-  PRINTF(4)("cleaning up the 3D-Model to save Memory.\n");
-  this->firstGroup->cleanup();
-  return true;
-}
-
-//////////
-// MESH //
-//////////
-/**
- * adds a new Material to the Material List
- * @param material the Material to add
- * @returns the added material
- *
- * this also tells this Model, that all the Materials are handled externally
- * with this option set the Materials will not be deleted with the Model.
- */
-Material* Model::addMaterial(Material* material)
-{
-  if (material == NULL)
-    return NULL;
-  ModelMaterial* modMat = new ModelMaterial;
-  modMat->external = true;
-  modMat->material = material;
-  this->materialList.push_back(modMat);
-  return modMat->material;
-}
-
-/**
- *  adds a new Material to the Material List
- * @param materialName the name of the Material to add
- * @returns the added material
-*/
-Material* Model::addMaterial(const char* materialName)
-{
-  ModelMaterial* modMat = new ModelMaterial;
-  modMat->external = false;
-  modMat->material = new Material(materialName);
-
-  // adding material to the List of materials
-  this->materialList.push_back(modMat);
-  return modMat->material;
-}
-
-/**
- *  finds a Material by its name and returns it
- * @param materialName the Name of the material to search for.
- * @returns the Material if found, NULL otherwise
-*/
-Material* Model::findMaterialByName(const char* materialName)
-{
-  list<ModelMaterial*>::iterator modMat;
-  for  (modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
-    if (!strcmp((*modMat)->material->getName(), materialName))
-      return (*modMat)->material;
-  return NULL;
-}
-
-/**
- *  parses a group String
- * @param groupString the new Group to create
-
-   This function initializes a new Group.
-   With it you should be able to create Models with more than one SubModel inside
-*/
-bool Model::addGroup(const char* groupString)
-{
-  PRINTF(5)("Read Group: %s.\n", groupString);
-  if (this->groupCount != 0 && this->currentGroup->faceCount > 0)
-    {
-      // finalizeGroup(currentGroup);
-      this->currentGroup = this->currentGroup->next = new ModelGroup;
-    }
-  // 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;
-}
-
-/**
- *  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 (const char* vertexString)
-{
-  float subbuffer1;
-  float subbuffer2;
-  float subbuffer3;
-  sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
-  this->vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor);
-  this->vertexCount++;
-  return true;
-}
-
-/**
- *  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(float x, float y, float z)
-{
-  PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z);
-  this->vertices->addEntry(x*scaleFactor, y*scaleFactor, z*scaleFactor);
-  this->vertexCount++;
-  return true;
-}
-
-/**
- *  parses a vertexNormal-String
- * @param normalString The String that will be parsed.
-
-   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
-*/
-bool Model::addVertexNormal (const char* normalString)
-{
-  float subbuffer1;
-  float subbuffer2;
-  float subbuffer3;
-  sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
-  this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3);
-  this->normalCount++;
-  return true;
-}
-
-/**
- *  adds a VertexNormal.
- * @param x The x coordinate of the Normal.
- * @param y The y coordinate of the Normal.
- * @param z The z coordinate of the Normal.
-
-   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
-*/
-bool Model::addVertexNormal(float x, float y, float z)
-{
-  PRINTF(5)("found vertex-Normal %f, %f, %f\n", x, y, z);
-  this->normals->addEntry(x, y, z);
-  this->normalCount++;
-  return true;
-}
-
-/**
- *  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
-
-   !! WARNING THIS IS DIFFERNT FROM addVervexTexture(float, float); because it changes the second entry to 1-v !!
-*/
-bool Model::addVertexTexture (const char* vTextureString)
-{
-  float subbuffer1;
-  float subbuffer2;
-  sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2);
-  this->vTexture->addEntry(subbuffer1);
-  this->vTexture->addEntry(1 - subbuffer2);
-  this->texCoordCount++;
-  return true;
-}
-
-/**
- *  adds a Texture Coordinate
- * @param u The u coordinate of the TextureCoordinate.
- * @param v The y coordinate of the TextureCoordinate.
-
-   If a TextureCoordinate line is found this function will inject it into the TextureCoordinate-Array
-*/
-bool Model::addVertexTexture(float u, float v)
-{
-  PRINTF(5)("found vertex-Texture %f, %f\n", u, v);
-  this->vTexture->addEntry(u);
-  this->vTexture->addEntry(v);
-  this->texCoordCount++;
-  return true;
-}
-
-/**
- *  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.
-
-   String is different from the argument addFace, in this that the first Vertex/Normal/Texcoord is 1 instead of 0
-*/
-bool Model::addFace (const char* faceString)
-{
-  if (this->currentGroup->faceCount >0)
-    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
-
-  ModelFaceElement* tmpElem = this->currentGroup->currentFace->firstElem = new ModelFaceElement;
-  tmpElem->next = NULL;
-  while(strcmp (faceString, "\0"))
-    {
-      if (this->currentGroup->currentFace->vertexCount>0)
-          tmpElem = tmpElem->next = new ModelFaceElement;
-      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;
-      if (texture)
-        tmpElem->texCoordNumber = atoi(texture)-1;
-      if (normal)
-        tmpElem->normalNumber = atoi(normal)-1;
-
-      faceString += tmpLen;
-      if (strcmp (faceString, "\0"))
-        faceString++;
-      this->currentGroup->currentFace->vertexCount++;
-    }
-
-  this->currentGroup->faceCount += this->currentGroup->currentFace->vertexCount -2;
-  this->faceCount += this->currentGroup->currentFace->vertexCount -2;
-}
-
-/**
- *  adds a new Face
- * @param faceElemCount the number of Vertices to add to the Face.
- * @param type The information Passed with each Vertex
-*/
-bool Model::addFace(int faceElemCount, VERTEX_FORMAT type, ...)
-{
-  if (this->currentGroup->faceCount > 0)
-    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
-
-  ModelFaceElement* tmpElem = this->currentGroup->currentFace->firstElem = new ModelFaceElement;
-
-  va_list itemlist;
-  va_start (itemlist, type);
-
-  for (int i = 0; i < faceElemCount; i++)
-    {
-      if (this->currentGroup->currentFace->vertexCount > 0)
-        tmpElem = tmpElem->next = new ModelFaceElement;
-
-      tmpElem->vertexNumber = va_arg (itemlist, int);
-      if (type & TEXCOORD)
-        tmpElem->texCoordNumber = va_arg (itemlist, int);
-      if (type & NORMAL)
-        tmpElem->normalNumber = va_arg(itemlist, int);
-      this->currentGroup->currentFace->vertexCount++;
-    }
-  va_end(itemlist);
-
-  this->currentGroup->faceCount += this->currentGroup->currentFace->vertexCount - 2;
-  this->faceCount += this->currentGroup->currentFace->vertexCount -2;
-}
-
-/**
- * Function that selects a material, if changed in the obj file.
- * @param matString the Material that will be set.
-*/
-bool Model::setMaterial(const char* matString)
-{
-  if (this->currentGroup->faceCount > 0)
-    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
-
-  this->currentGroup->currentFace->material = this->findMaterialByName(matString);
-
-  if (this->currentGroup->faceCount == 0)
-    this->currentGroup->faceCount ++;
-}
-
-/**
- * Function that selects a material, if changed in the obj file.
- * @param mtl the Material that will be set.
-*/
-bool Model::setMaterial(Material* mtl)
-{
-  if (this->currentGroup->faceCount > 0)
-    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
-
-  this->currentGroup->currentFace->material = mtl;
-
-  if (this->currentGroup->faceCount == 0)
-    this->currentGroup->faceCount ++;
-}
-
-/**
- *  A routine that is able to create normals.
-
-   The algorithm does the following:
-   1. It calculates creates Vectors for each normale, and sets them to zero.
-   2. It then Walks through a) all the Groups b) all the Faces c) all the FaceElements
-   3. It searches for a points two neighbours per Face, takes Vecotrs to them calculates FaceNormals and adds it to the Points Normal.
-   4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array.
-*/
-bool Model::buildVertexNormals ()
-{
-  PRINTF(4)("Normals are being calculated.\n");
-
-  Vector* normArray = new Vector [vertices->getCount()/3];
-  for (int i=0; i<vertices->getCount()/3;i++)
-    normArray[i] = Vector(.0,.0,.0);
-
-  int firstTouch;
-  int secondTouch;
-  Vector prevV;
-  Vector nextV;
-  Vector curV;
-
-  ModelGroup* tmpGroup = firstGroup;
-  while (tmpGroup)
-    {
-      ModelFace* tmpFace = tmpGroup->firstFace;
-      while (tmpFace)
-        {
-          if (tmpFace->firstElem)
-            {
-              ModelFaceElement* firstElem = tmpFace->firstElem;
-              ModelFaceElement* prevElem;
-              ModelFaceElement* curElem = firstElem;
-              ModelFaceElement* nextElem;
-              ModelFaceElement* lastElem;
-              // find last Element of the Chain. !! IMPORTANT:the last Element of the Chain must point to NULL, or it will resolv into an infinity-loop.
-              while (curElem)
-                {
-                  prevElem = curElem;
-                  curElem = curElem->next;
-                }
-              lastElem = prevElem;
-
-              curElem = firstElem;
-              for (int j=0; j<tmpFace->vertexCount; j++)
-                {
-                  if (!(nextElem = curElem->next))
-                    nextElem = firstElem;
-                  curElem->normalNumber = curElem->vertexNumber;
-
-                  curV = Vector (vertices->getArray()[curElem->vertexNumber*3], vertices->getArray()[curElem->vertexNumber*3+1], vertices->getArray()[curElem->vertexNumber*3+2]);
-                  prevV = Vector (vertices->getArray()[prevElem->vertexNumber*3], vertices->getArray()[prevElem->vertexNumber*3+1], vertices->getArray()[prevElem->vertexNumber*3+2]) - curV;
-                  nextV = Vector (vertices->getArray()[nextElem->vertexNumber*3], vertices->getArray()[nextElem->vertexNumber*3+1], vertices->getArray()[nextElem->vertexNumber*3+2]) - curV;
-                  normArray[curElem->vertexNumber] = normArray[curElem->vertexNumber] + nextV.cross(prevV);
-
-                  prevElem = curElem;
-                  curElem = curElem->next;
-                }
-            }
-          tmpFace = tmpFace->next;
-        }
-      tmpGroup = tmpGroup->next;
-    }
-
-  for (int i=0; i < vertices->getCount()/3;i++)
-    {
-      normArray[i].normalize();
-      PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
-
-      this->addVertexNormal(normArray[i].x, normArray[i].y, normArray[i].z);
-
-    }
-  delete []normArray;
-}
-
-////////////
-// openGL //
-////////////
-/**
- *  reads and includes the Faces/Materials into the openGL state Machine
-*/
-bool Model::importToDisplayList()
-{
-  // 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(2)("glList could not be created for this Model\n");
-          return false;
-        }
-      glNewList (this->currentGroup->listNumber, GL_COMPILE);
-
-      // Putting Faces to GL
-      ModelFace* tmpFace = this->currentGroup->firstFace;
-      while (tmpFace != NULL)
-        {
-          if (tmpFace->vertexCount == 0 && tmpFace->material != NULL)
-            {
-              if (this->currentGroup->faceMode != -1)
-                glEnd();
-              this->currentGroup->faceMode = 0;
-              Material* tmpMat;
-              if (tmpFace->material != NULL)
-                {
-                  tmpFace->material->select();
-                  PRINTF(5)("using material %s for coming Faces.\n", tmpFace->material->getName());
-                }
-            }
-
-          else if (tmpFace->vertexCount == 3)
-            {
-              if (this->currentGroup->faceMode != 3)
-                {
-                  if (this->currentGroup->faceMode != -1)
-                    glEnd();
-                  glBegin(GL_TRIANGLES);
-                }
-
-              this->currentGroup->faceMode = 3;
-              PRINTF(5)("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(5)("found quad.\n");
-            }
-
-          else if (tmpFace->vertexCount > 4)
-            {
-              if (this->currentGroup->faceMode != -1)
-                glEnd();
-              glBegin(GL_POLYGON);
-              PRINTF(5)("Polygon with %i faces found.", tmpFace->vertexCount);
-              this->currentGroup->faceMode = tmpFace->vertexCount;
-            }
-
-          ModelFaceElement* 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;
-    }
-}
-
-/**
- *  reads and includes the Faces/Materials into the openGL state Machine
-*/
-bool Model::importToVertexArray()
-{
-  // finalize the Arrays
-  this->vertices->finalizeArray();
-  this->vTexture->finalizeArray();
-  if (normals->getCount() == 0) // vertices-Array must be built for this
-    this->buildVertexNormals();
-  this->normals->finalizeArray();
-
-  this->currentGroup = this->firstGroup;
-  glVertexPointer(3, GL_FLOAT, 0, this->vertices->getArray());
-  glNormalPointer(3, 0, this->normals->getArray());
-  glTexCoordPointer(2, GL_FLOAT, 0, this->vTexture->getArray());
-}
-
-
-
-/**
- *  builds an array of triangles, that can later on be used for obb separation and octree separation
- */
-bool Model::buildTriangleList()
-{
-  if( unlikely(this->triangles != NULL))
-    return true;
-  /* make sure, that all the arrays are finalized */
-  if( unlikely(!this->vertices->isFinalized()))
-    this->vertices->finalizeArray();
-  if( unlikely(!this->vTexture->isFinalized()))
-    this->vTexture->finalizeArray();
-  if( normals->getCount() == 0) // vertices-Array must be built for this
-    this->buildVertexNormals();
-  if( unlikely(!this->normals->isFinalized()))
-    this->normals->finalizeArray();
-
-
-  int index = 0;                   //!< the counter for the triangle array
-  ModelFaceElement* tmpElem;       //!< the temporary faceelement reference
-  ModelFace* tmpFace;              //!< the temporary face referece
-
-  /* count the number of triangles */
-  /* now iterate through all groups and build up the triangle list */
-  this->triangleCount = 0;
-  this->currentGroup = this->firstGroup;
-  while( this->currentGroup != NULL)
-  {
-    tmpFace = this->currentGroup->firstFace;
-    while( tmpFace != NULL)
-    {
-
-      /* if its a triangle just add it to the list */
-      if( tmpFace->vertexCount == 3)
-      {
-        ++this->triangleCount;
-      } /* if the polygon is a quad */
-      else if( tmpFace->vertexCount == 4)
-      {
-        this->triangleCount += 2;
-      }
-      else if( tmpFace->vertexCount > 4)
-      {
-        PRINTF(1)("This model (%s) got over 4 vertices per face <=> conflicts in the CD engine!\n", this->getName());
-      //exit(0);
-      }
-      tmpFace = tmpFace->next;
-    }
-    this->currentGroup = this->currentGroup->next;
-  }
-
-  PRINTF(3)("got %i triangles, %i vertices\n", this->triangleCount, this->vertexCount);
-
-
-  /* write MODELINFO structure */
-
-  /* allocate memory for the new triangle structures */
-  if( (this->triangles = new sTriangleExt[this->triangleCount]) == NULL)
-  {
-    PRINTF(1)("Could not allocate memory for triangle list\n");
-    return false;
-  }
-
-  /* now iterate through all groups and build up the triangle list */
-  this->currentGroup = this->firstGroup;
-  while( this->currentGroup != NULL)
-  {
-      // Putting Faces to GL
-    tmpFace = this->currentGroup->firstFace;
-    while( tmpFace != NULL)
-    {
-      tmpElem = tmpFace->firstElem;
-
-      /* if its a triangle just add it to the list */
-      if( tmpFace->vertexCount == 3)
-      {
-        for( int j = 0; j < 3; ++j)
-        {
-          this->triangles[index].indexToVertices[j] = (unsigned int)tmpElem->vertexNumber * 3;
-          this->triangles[index].indexToNormals[j] = (unsigned int)tmpElem->normalNumber * 3;
-          this->triangles[index].indexToTexCoor[j] = (unsigned int)tmpElem->texCoordNumber * 3;
-          tmpElem = tmpElem->next;
-        }
-        ++index;
-      } /* if the polygon is a quad */
-      else if( tmpFace->vertexCount == 4)
-      {
-
-        this->triangles[index].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->triangles[index].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3;
-        this->triangles[index].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3;
-
-        this->triangles[index + 1].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->triangles[index + 1].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3;
-        this->triangles[index + 1].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3;
-        tmpElem = tmpElem->next;
-
-        this->triangles[index].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->triangles[index].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3;
-        this->triangles[index].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3;
-        tmpElem = tmpElem->next;
-
-        this->triangles[index].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->triangles[index].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3;
-        this->triangles[index].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3;
-
-        this->triangles[index + 1].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->triangles[index + 1].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3;
-        this->triangles[index + 1].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3;
-        tmpElem = tmpElem->next;
-
-        this->triangles[index + 1].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->triangles[index + 1].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3;
-        this->triangles[index + 1].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3;
-
-        index += 2;
-      }
-      tmpFace = tmpFace->next;
-    }
-    this->currentGroup = this->currentGroup->next;
-  }
-  return true;
+  this->pModelInfo.pVertices = NULL;
+  this->pModelInfo.pTriangles = NULL;
+  this->pModelInfo.pNormals = NULL;
+  this->pModelInfo.pTexCoor = NULL;
 }
 
 
 /**
- *  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.
+ * standard deconstructor
 */
-bool Model::addGLElement (ModelFaceElement* elem)
+Model::~Model()
 {
-  PRINTF(5)("importing grafical Element to openGL.\n");
-
-  if (elem->texCoordNumber != -1)
-    {
-      if (likely(elem->texCoordNumber < this->texCoordCount))
-        glTexCoord2fv(this->vTexture->getArray() + elem->texCoordNumber * 2);
-      else
-        PRINTF(2)("TextureCoordinate %d is not in the List (max: %d)\nThe Model might be incomplete\n",
-                  elem->texCoordNumber, this->texCoordCount);
-    }
-  if (elem->normalNumber != -1)
-    {
-    if (likely(elem->normalNumber < this->normalCount))
-      glNormal3fv(this->normals->getArray() + elem->normalNumber * 3);
-    else
-        PRINTF(2)("Normal %d is not in the List (max: %d)\nThe Model might be incomplete",
-                  elem->normalNumber, this->normalCount);
-    }
-  if (elem->vertexNumber != -1)
-    {
-      if (likely(elem->vertexNumber < this->vertexCount))
-          glVertex3fv(this->vertices->getArray() + elem->vertexNumber * 3);
-      else
-        PRINTF(2)("Vertex %d is not in the List (max: %d)\nThe Model might be incomplete",
-                  elem->vertexNumber, this->vertexCount);
-    }
-
+  // delete what has to be deleted here
 }
-
-/**
- *  Includes a default model
-
-   This will inject a Cube, because this is the most basic model.
-*/
-void Model::cubeModel()
-{
-  this->addVertex (-0.5, -0.5, 0.5);
-  this->addVertex (0.5, -0.5, 0.5);
-  this->addVertex (-0.5, 0.5, 0.5);
-  this->addVertex (0.5, 0.5, 0.5);
-  this->addVertex (-0.5, 0.5, -0.5);
-  this->addVertex (0.5, 0.5, -0.5);
-  this->addVertex (-0.5, -0.5, -0.5);
-  this->addVertex (0.5, -0.5, -0.5);
-
-  this->addVertexTexture (0.0, 0.0);
-  this->addVertexTexture (1.0, 0.0);
-  this->addVertexTexture (0.0, 1.0);
-  this->addVertexTexture (1.0, 1.0);
-  this->addVertexTexture (0.0, 2.0);
-  this->addVertexTexture (1.0, 2.0);
-  this->addVertexTexture (0.0, 3.0);
-  this->addVertexTexture (1.0, 3.0);
-  this->addVertexTexture (0.0, 4.0);
-  this->addVertexTexture (1.0, 4.0);
-  this->addVertexTexture (2.0, 0.0);
-  this->addVertexTexture (2.0, 1.0);
-  this->addVertexTexture (-1.0, 0.0);
-  this->addVertexTexture (-1.0, 1.0);
-
-  this->addVertexNormal (0.0, 0.0, 1.0);
-  this->addVertexNormal (0.0, 0.0, 1.0);
-  this->addVertexNormal (0.0, 0.0, 1.0);
-  this->addVertexNormal (0.0, 0.0, 1.0);
-  this->addVertexNormal (0.0, 1.0, 0.0);
-  this->addVertexNormal (0.0, 1.0, 0.0);
-  this->addVertexNormal (0.0, 1.0, 0.0);
-  this->addVertexNormal (0.0, 1.0, 0.0);
-  this->addVertexNormal (0.0, 0.0, -1.0);
-  this->addVertexNormal (0.0, 0.0, -1.0);
-  this->addVertexNormal (0.0, 0.0, -1.0);
-  this->addVertexNormal (0.0, 0.0, -1.0);
-  this->addVertexNormal (0.0, -1.0, 0.0);
-  this->addVertexNormal (0.0, -1.0, 0.0);
-  this->addVertexNormal (0.0, -1.0, 0.0);
-  this->addVertexNormal (0.0, -1.0, 0.0);
-  this->addVertexNormal (1.0, 0.0, 0.0);
-  this->addVertexNormal (1.0, 0.0, 0.0);
-  this->addVertexNormal (1.0, 0.0, 0.0);
-  this->addVertexNormal (1.0, 0.0, 0.0);
-  this->addVertexNormal (-1.0, 0.0, 0.0);
-  this->addVertexNormal (-1.0, 0.0, 0.0);
-  this->addVertexNormal (-1.0, 0.0, 0.0);
-  this->addVertexNormal (-1.0, 0.0, 0.0);
-
-  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,1, 3,3,2, 2,2,3);
-  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,2,4, 3,3,5, 5,5,6, 4,4,7);
-  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,4,8, 5,5,9, 7,7,10, 6,6,11);
-  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,6,12, 7,7,13, 1,9,14, 0,8,15);
-  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,16, 7,10,17, 5,11,18, 3,3,19);
-  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,12,20, 0,0,21, 2,2,22, 4,13,23);
-}
Index: trunk/src/lib/graphics/importer/model.h
===================================================================
--- trunk/src/lib/graphics/importer/model.h	(revision 6012)
+++ trunk/src/lib/graphics/importer/model.h	(revision 6022)
@@ -1,199 +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: Patrick Boenzli
+   co-programmer:
+*/
+
 /*!
-  \file model.h
-  \brief Contains the Model Class that handles 3D-Models
-*/
+ * @file model.h
+ *  Definition of an abstract model.
+ *  containing all needed for other models
+ */
 
 #ifndef _MODEL_H
 #define _MODEL_H
 
-#include "abstract_model.h"
+#include "base_object.h"
+#include "vector.h"
 
-#include "material.h"
-#include "glincl.h"
-#include "array.h"
-#include <list>
-
-// FORWARD DECLARATION //
-template<class T> class tArray;
+using namespace std;
 
 
-//! an enumerator fot the different Model Types.
-/**
-   MODEL_DISPLAY_LIST means, that a DisplayList will be built out of the model. This model will be STATIC, meaning it cannot be changed after initialisation.
-   MODEL_VERTEX_ARRAY means, that a VertexArray will be built out of the model. This moel will be DYNAMIX, meaning that one can change the properties from outside of the model.
- * @todo implement this stuff
-*/
-typedef enum MODEL_TYPE {
-  MODEL_DISPLAY_LIST,
-  MODEL_VERTEX_ARRAY
+
+//! compressed vertex data: char insetead of float, the value will be expanded by the scale value. only for loading
+typedef struct
+{
+  char             v[3];                 //!< the vector of the vertex
+  unsigned char    lightNormalIndex;     //!< the index of the light normal
+} sVertex;
+
+
+//! compressed texture offset data: coords scaled by the texture size. Only for loading
+typedef struct
+{
+  short            s;                    //!< the s,t coordinates of a texture
+  short            t;                    //!< the s,t coordinates of a texture
+} sTexCoor;
+
+
+//! holds tha informations about a md2 frame
+typedef struct
+{
+  sVec3D           scale;                //!< scales values of the model
+  sVec3D           translate;            //!< translates the model
+  char             name[16];             //!< frame name: something like "run32"
+  sVertex          pVertices[1];         //!< first vertex of thes frame
+} sFrame;
+
+
+//! holds the information about a triangle
+typedef struct
+{
+  unsigned short   indexToVertices[3];   //!< index to the verteces of the triangle
+  unsigned short   indexToTexCoor[3];    //!< index to the texture coordinates
+} sTriangle;
+
+
+//! holds the information about a triangle
+typedef struct
+{
+  unsigned int   indexToVertices[3];   //!< index to the verteces of the triangle
+  unsigned int   indexToNormals[3];    //!< index to the normals of the triangle
+  unsigned int   indexToTexCoor[3];    //!< index to the texture coordinates
+} sTriangleExt;
+
+
+//! the command list of the md2 model, very md2 specific
+typedef struct
+{
+  float            s;                    //!< texture coordinate 1
+  float            t;                    //!< texture coordinate 2
+  int              vertexIndex;          //!< index of the vertex in the vertex list
+} glCommandVertex;
+
+
+//! a md2 animation definition
+typedef struct
+{
+  int              firstFrame;           //!< first frame of the animation
+  int              lastFrame;            //!< last frame of the animation
+  int              fps;                  //!< speed: number of frames per second
+} sAnim;
+
+
+//! animation state definition
+typedef struct
+{
+  int              startFrame;           //!< the start frame of an animation
+  int              endFrame;             //!< last frame of the animation
+  int              fps;                  //!< fps of the animaion (speed)
+
+  float            localTime;            //!< the local time
+  float            lastTime;             //!< last time stamp
+  float            interpolationState;   //!< the state of the animation [0..1]
+
+  int              type;                 //!< animation type
+
+  int              currentFrame;         //!< the current frame
+  int              nextFrame;            //!< the next frame in the list
+} sAnimState;
+
+//! Model Information definitions
+typedef struct
+{
+  unsigned int     numVertices;          //!< number of Vertices in the Model
+  unsigned int     numTriangles;         //!< number of triangles in the Model
+  unsigned int     numNormals;           //!< how many Normals in the Model
+  unsigned int     numTexCoor;           //!< how many Texture Coordinates in the Model
+
+  const float*     pVertices;            //!< array of the Vertives
+  sTriangleExt*    pTriangles;           //!< array of all triangles
+  const float*     pNormals;             //!< array of the Normals
+  const float*     pTexCoor;             //!< array of the Texture Coordinates
+
+} modelInfo;
+
+
+
+//! This class defines the basic components of a model
+class Model : public BaseObject {
+
+  public:
+    Model();
+    virtual ~Model();
+
+    virtual void draw() const {  }
+
+    inline const modelInfo* getModelInfo() const { return &this->pModelInfo; }
+
+    /** @returns a Pointer to the Vertex-Array, if it was deleted it returns NULL */
+    inline const float* getVertexArray() const { return this->pModelInfo.pVertices; };
+    /** @returns the VertexCount of this Model */
+    inline unsigned int getVertexCount() const { return this->pModelInfo.numVertices; };
+
+    /** @returns a Pointer to the Normals-Array, if it was deleted it returns NULL */
+    inline const float* getNormalsArray() const { return this->pModelInfo.pNormals; };
+    /** @returns the NormalsCount of this Model */
+    inline unsigned int getNormalsCount() const { return this->pModelInfo.numNormals; };
+
+    /** @returns a Pointer to the TexCoord-Array, if it was deleted it returns NULL */
+    inline const float* getTexCoordArray() const { return this->pModelInfo.pTexCoor; };
+    /** @returns the TexCoord-Count of this Model */
+    inline unsigned int getTexCoordCount() const { return this->pModelInfo.numTexCoor; };
+
+    /** @returns the Array of triangles */
+    inline sTriangleExt* getTriangles() const { return this->pModelInfo.pTriangles; };
+    /** @returns the Count of Faces of this Model */
+    inline unsigned int getFaceCount() const { return this->pModelInfo.numTriangles; };
+
+
+  protected:
+    modelInfo      pModelInfo;      //!< Reference to the modelInfo
 };
 
-
-// definition of different modes for setting up Faces
-#define VERTEX 0       //!< If Faces are created WITH Vertex-Coordinate
-#define NORMAL 1       //!< If Faces are created WITH Normals (otherwise autocalculate)
-#define TEXCOORD 2     //!< If Faces are created WITH TextureCoordinate
-
-//! an enumerator for VERTEX_FORMAT
-typedef enum VERTEX_FORMAT {
-  VERTEX_ONLY = VERTEX,
-  VERTEX_NORMAL = NORMAL,
-  VERTEX_TEXCOORD = TEXCOORD,
-  VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD
-};
-
-////////////////////
-/// SUB-ELEMENTS ///
-////////////////////
-//! This is the placeholder of one Vertex beloning to a Face.
-class ModelFaceElement
-{
- public:
-  ModelFaceElement();
-  ~ModelFaceElement();
-
-  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.
-
-  ModelFaceElement*   next;                 //!< Point to the next FaceElement in this List.
-};
-
-//! This is the placeholder of a Face belonging to a Group of Faces.
-class ModelFace
-{
- public:
-  ModelFace();
-  ~ModelFace();
-
-  unsigned int        vertexCount;     //!< The Count of vertices this Face has.
-  ModelFaceElement*   firstElem;       //!< Points to the first Vertex (FaceElement) of this Face.
-  Material*           material;        //!< The Material to use.
-
-  ModelFace*          next;            //!< Pointer to the next Face.
-};
-
-//! Group to handle multiple Models per obj-file.
-class ModelGroup
-{
- public:
-  ModelGroup();
-  ~ModelGroup();
-
-  void cleanup();
-
-  char*        name;           //!< the Name of the Group. this is an identifier, that can be accessed via the draw (char* name) function.
-  GLubyte*     indices;        //!< The indices of the Groups. Needed for vertex-arrays
-  GLuint       listNumber;     //!< The number of the GL-List this Group gets.
-  ModelFace*   firstFace;      //!< The first Face in this group.
-  ModelFace*   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.
-
-  ModelGroup*  next;           //!< Pointer to the next Group.
-};
-
-struct ModelMaterial
-{
-  Material* material;
-  bool external;
-};
-
-/////////////
-/// MODEL ///
-/////////////
-//! Class that handles 3D-Models. it can also read them in and display them.
-class Model : public AbstractModel
-{
- public:
-  Model(const char* modelName = NULL, MODEL_TYPE type = MODEL_DISPLAY_LIST);
-  virtual ~Model();
-
-  void draw() const;
-  void draw(int groupNumber) const;
-  void draw(char* groupName) const;
-
-  void rebuild();
-
-  /** @returns Count of the Models (Groups) in this File */
-  inline int getGroupCount() const { return this->groupCount; };
-
-  /** @returns a Pointer to the Vertex-Array, if it was deleted it returns NULL */
-  inline const GLfloat* getVertexArray() const { return this->vertices->getArray(); };
-  /** @returns the VertexCount of this Model */
-  inline unsigned int getVertexCount() const { return this->vertexCount; };
-
-  /** @returns a Pointer to the Normals-Array, if it was deleted it returns NULL */
-  inline const GLfloat* getNormalsArray() const { return this->normals->getArray(); };
-  /** @returns the NormalsCount of this Model */
-  inline unsigned int getNormalsCount() const { return this->normalCount; };
-
-  /** @returns a Pointer to the TexCoord-Array, if it was deleted it returns NULL */
-  inline const GLfloat* getTexCoordArray() const { return this->vTexture->getArray(); };
-  /** @returns the TexCoord-Count of this Model */
-  inline unsigned int getTexCoordCount() const { return this->texCoordCount; };
-
-  /** @returns the Count of Faces of this Model */
-  inline unsigned int getFaceCount() const { return this->faceCount; };
-
-
-  Material* addMaterial(Material* material);
-  Material* addMaterial(const char* materialName);
-
-  bool addGroup(const char* groupString);
-  bool addVertex(const char* vertexString);
-  bool addVertex(float x, float y, float z);
-  bool addFace(const char* faceString);
-  bool addFace(int faceElemCount, VERTEX_FORMAT type, ...);
-  bool addVertexNormal(const char* normalString);
-  bool addVertexNormal(float x, float y, float z);
-  bool addVertexTexture(const char* vTextureString);
-  bool addVertexTexture(float u, float v);
-  bool setMaterial(const char* mtlString);
-  bool setMaterial(Material* mtl);
-  void finalize();
-
-
- protected:
-  void cubeModel();
-
-  Material* findMaterialByName(const char* materialName);
-
-
- protected:
-  float            scaleFactor;     //!< The Factor with which the Model should be scaled. @todo maybe one wants to scale the Model after Initialisation
-
- private:
-  bool buildVertexNormals();
-
-  bool importToDisplayList();
-  bool buildTriangleList();
-  bool addGLElement(ModelFaceElement* elem);
-
-  bool importToVertexArray();
-
-  bool deleteArrays();
-  bool cleanup();
-
- private:
-  MODEL_TYPE                 type;            //!< A type for the Model
-  bool                       finalized;       //!< Sets the Object to be finalized.
-
-  unsigned int               vertexCount;     //!< A modelwide Counter for vertices.
-  unsigned int               normalCount;     //!< A modelwide Counter for the normals.
-  unsigned int               texCoordCount;   //!< A modelwide Counter for the texCoord.
-  unsigned int               faceCount;       //!< A modelwide Counter for the faces
-  unsigned int               triangleCount;   //!< Number of triangles >= faceCount
-  tArray<GLfloat>*           vertices;        //!< The Array that handles the Vertices.
-  tArray<GLfloat>*           normals;         //!< The Array that handles the Normals.
-  tArray<GLfloat>*           vTexture;        //!< The Array that handles the VertexTextureCoordinates.
-  sTriangleExt*              triangles;       //!< The Array of triangles in the abstract_model.h style
-
-  ModelGroup*                firstGroup;      //!< The first of all groups.
-  ModelGroup*                currentGroup;    //!< The currentGroup. this is the one we will work with.
-  int                        groupCount;      //!< The Count of Groups.
-
-  std::list<ModelMaterial*>  materialList;    //!< A list for all the Materials in this Model
-};
-
-#endif
+#endif /* _MODEL_H */
Index: trunk/src/lib/graphics/importer/objModel.cc
===================================================================
--- trunk/src/lib/graphics/importer/objModel.cc	(revision 6012)
+++ trunk/src/lib/graphics/importer/objModel.cc	(revision 6022)
@@ -32,5 +32,5 @@
  * @param scaling The factor that the model will be scaled with.
 */
-OBJModel::OBJModel(const char* fileName, float scaling) : Model(fileName)
+OBJModel::OBJModel(const char* fileName, float scaling) : StaticModel(fileName)
 {
   this->objPath = "./";
Index: trunk/src/lib/graphics/importer/objModel.h
===================================================================
--- trunk/src/lib/graphics/importer/objModel.h	(revision 6012)
+++ trunk/src/lib/graphics/importer/objModel.h	(revision 6022)
@@ -7,8 +7,8 @@
 #define _OBJMODEL_H
 
-#include "model.h"
+#include "static_model.h"
 
 //! A Class, that handles the parsing of an obj-file, and inclusion as a Model.
-class OBJModel : public Model
+class OBJModel : public StaticModel
 {
  public:
Index: trunk/src/lib/graphics/importer/primitive_model.h
===================================================================
--- trunk/src/lib/graphics/importer/primitive_model.h	(revision 6012)
+++ trunk/src/lib/graphics/importer/primitive_model.h	(revision 6022)
@@ -8,5 +8,5 @@
 #define _PRIMITIVE_MODEL_H
 
-#include "model.h"
+#include "static_model.h"
 
 //! Specification of different primitives the Model knows
@@ -18,5 +18,5 @@
 
 //! A Class to create some default Models
-class PrimitiveModel : public Model {
+class PrimitiveModel : public StaticModel {
 
  public:
Index: trunk/src/lib/graphics/importer/static_model.cc
===================================================================
--- trunk/src/lib/graphics/importer/static_model.cc	(revision 6022)
+++ trunk/src/lib/graphics/importer/static_model.cc	(revision 6022)
@@ -0,0 +1,1102 @@
+/*
+   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: ...
+
+   2005-07-06: (Patrick) added new function buildTriangleList()
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
+
+#include "static_model.h"
+
+#include "stdlibincl.h"
+#include <stdarg.h>
+
+#include "vector.h"
+
+using namespace std;
+
+
+////////////////////
+/// SUB-Elements ///
+////////////////////
+/**
+ *  creates a new ModelFaceElement
+*/
+ModelFaceElement::ModelFaceElement()
+{
+  this->vertexNumber = -1;
+  this->normalNumber = -1;
+  this->texCoordNumber = -1;
+
+  this->next = NULL;
+}
+
+/**
+ *  destroys a ModelFaceElement
+*/
+ModelFaceElement::~ModelFaceElement()
+{
+  if (this->next)
+    delete this->next;
+}
+
+/**
+ *  creates a new ModelFace
+*/
+ModelFace::ModelFace()
+{
+  this->vertexCount = 0;
+
+  this->firstElem = NULL;
+
+  this->material = NULL;
+
+  this->next = NULL;
+}
+
+/**
+ *  deletes a ModelFace
+*/
+ModelFace::~ModelFace()
+{
+  PRINTF(5)("Cleaning up Face\n");
+
+  if (this->firstElem != NULL)
+    delete this->firstElem;
+
+  if (this->next != NULL)
+    delete this->next;
+}
+
+/**
+ *  Creates a new ModelGroup
+*/
+ModelGroup::ModelGroup()
+{
+  PRINTF(4)("Adding new Group\n");
+  this->name = "";
+  this->faceMode = -1;
+  this->faceCount = 0;
+  this->next = NULL;
+  this->listNumber = 0;
+
+  this->firstFace = new ModelFace;
+  this->currentFace = this->firstFace;
+}
+
+/**
+ *  deletes a ModelGroup
+*/
+ModelGroup::~ModelGroup()
+{
+  PRINTF(5)("Cleaning up group\n");
+  if (this->firstFace != NULL)
+    delete this->firstFace;
+
+  // deleting the glList
+  if (this->listNumber != 0)
+    glDeleteLists(this->listNumber, 1);
+
+  if (this->name[0] != '\0')
+    delete[] this->name;
+
+  if (this->next !=NULL)
+    delete this->next;
+
+}
+
+/**
+ *  cleans up a ModelGroup
+
+   actually does the same as the delete Operator, but does not delete the predecessing group
+*/
+void ModelGroup::cleanup()
+{
+  PRINTF(5)("Cleaning up group\n");
+  if (this->firstFace)
+    delete this->firstFace;
+  this->firstFace = NULL;
+  if (this->next)
+    this->next->cleanup();
+}
+
+
+/////////////
+/// MODEL ///
+/////////////
+/**
+ *  Creates a 3D-Model.
+
+   assigns it a Name and a Type
+*/
+StaticModel::StaticModel(const char* modelName, MODEL_TYPE type)
+{
+  this->setClassID(CL_MODEL, "Model");
+  PRINTF(4)("new 3D-Model is being created\n");
+  this->setName(modelName);
+  this->type = type;
+
+  this->finalized = false;
+  // setting the start group;
+  this->currentGroup = this->firstGroup = new ModelGroup;
+  this->groupCount = 0;
+  this->vertexCount = 0;
+  this->normalCount = 0;
+  this->texCoordCount = 0;
+  this->faceCount = 0;
+  this->triangleCount = 0;
+  this->triangles = NULL;
+
+  this->scaleFactor = 1;
+
+  this->vertices = new tArray<GLfloat>();
+  this->vTexture = new tArray<GLfloat>();
+  this->normals = new tArray<GLfloat>();
+
+  if (this->type == MODEL_VERTEX_ARRAY)
+    glEnableClientState(GL_VERTEX_ARRAY | GL_NORMAL_ARRAY | GL_TEXTURE_COORD_ARRAY);
+}
+
+/**
+ *  deletes an Model.
+
+   Looks if any from model allocated space is still in use, and if so deleted it.
+*/
+StaticModel::~StaticModel()
+{
+  PRINTF(4)("Deleting Model ");
+  if (this->getName())
+  {
+    PRINT(4)("%s\n", this->getName());
+  }
+  else
+  {
+    PRINT(4)("\n");
+  }
+  this->cleanup();
+
+  PRINTF(5)("Deleting display Lists.\n");
+  delete this->firstGroup;
+
+  // deleting Arrays (if not allready done by finalize)
+  this->deleteArrays();
+
+  // deleting the MaterialList
+  PRINTF(5)("Deleting Materials.\n");
+
+  //! @todo do we really have to delete this material??
+  list<ModelMaterial*>::iterator modMat;
+  for(modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
+  {
+    if (!(*modMat)->external)
+      delete (*modMat)->material;
+    delete (*modMat);
+  }
+}
+
+/**
+ *  Finalizes an Object. This can be done outside of the Class.
+*/
+void StaticModel::finalize()
+{
+  // this creates the display List.
+  this->importToDisplayList();
+  this->buildTriangleList();
+
+  // deletes everything we allocated.
+  //if (this->type == MODEL_DISPLAY_LIST)
+    //this->deleteArrays();
+  //  this->cleanup();
+
+  /* load the ModelInfo */
+  this->pModelInfo.numVertices = this->vertexCount;
+  this->pModelInfo.pVertices = this->vertices->getArray();
+  this->pModelInfo.numTriangles = this->triangleCount;
+  this->pModelInfo.pTriangles = this->triangles;
+  this->pModelInfo.numNormals = this->normalCount;
+  this->pModelInfo.pNormals = this->normals->getArray();
+  this->pModelInfo.numTexCoor = this->vTexture->getCount();
+  this->pModelInfo.pTexCoor = this->vTexture->getArray();
+
+  this->finalized = true;
+}
+
+/**
+ * rebuild the Model from the Information we got.
+ */
+void StaticModel::rebuild()
+{
+  PRINTF(3)("Rebuilding Model '%s'\n", this->getName());
+  this->finalize();
+
+}
+
+//////////
+// DRAW //
+//////////
+/**
+ *  Draws the Models of all Groups.
+   It does this by just calling the Lists that must have been created earlier.
+*/
+void StaticModel::draw () const
+{
+
+  PRINTF(4)("drawing the 3D-Models\n");
+  ModelGroup* tmpGroup = this->firstGroup;
+  while (tmpGroup != NULL)
+    {
+      PRINTF(5)("Drawing model %s\n", tmpGroup->name);
+      glCallList (tmpGroup->listNumber);
+      tmpGroup = tmpGroup->next;
+    }
+
+
+/*  const GLfloat* pVertices = NULL;
+  const GLfloat* pNorm = NULL;
+
+  glBegin(GL_TRIANGLES);
+  for( int i = 0; i < this->triangleCount; ++i)
+  {
+    //printf("int i = %i\n", i);
+    pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[0]];
+    pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[0]];
+    glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
+    glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
+
+    pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[1]];
+    pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[1]];
+    glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
+    glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
+
+    pNorm = &this->normals->getArray()[this->triangles[i].indexToNormals[2]];
+    pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[2]];
+    glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
+    glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
+
+  }
+  glEnd();*/
+}
+
+/**
+ *  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 StaticModel::draw (int groupNumber) const
+{
+  if (groupNumber >= this->groupCount)
+    {
+      PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);
+      return;
+    }
+  PRINTF(4)("drawing the requested 3D-Models if found.\n");
+  ModelGroup* tmpGroup = this->firstGroup;
+  int counter = 0;
+  while (tmpGroup != NULL)
+    {
+      if (counter == groupNumber)
+        {
+          PRINTF(4)("Drawing model number %i named %s\n", counter, tmpGroup->name);
+          glCallList (tmpGroup->listNumber);
+          return;
+        }
+      ++counter;
+      tmpGroup = tmpGroup->next;
+    }
+  PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->getName());
+  return;
+
+}
+
+/**
+ *  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 StaticModel::draw (char* groupName) const
+{
+  PRINTF(4)("drawing the requested 3D-Models if found.\n");
+  ModelGroup* tmpGroup = this->firstGroup;
+  while (tmpGroup != NULL)
+    {
+      if (!strcmp(tmpGroup->name, groupName))
+        {
+          PRINTF(4)("Drawing model %s\n", tmpGroup->name);
+          glCallList (tmpGroup->listNumber);
+          return;
+        }
+      tmpGroup = tmpGroup->next;
+    }
+  PRINTF(2)("Model Named %s in %s not Found.\n", groupName, this->getName());
+  return;
+}
+
+//////////
+// INIT //
+//////////
+/**
+ *  deletes all the arrays
+*/
+bool StaticModel::deleteArrays()
+{
+  if (this->vertices)
+    delete this->vertices;
+  if (this->vTexture)
+    delete this->vTexture;
+  if (this->normals)
+    delete this->normals;
+  if (this->triangles)
+    delete[] this->triangles;
+
+  this->vertices = NULL;
+  this->vTexture = NULL;
+  this->normals = NULL;
+  this->triangles = NULL;
+  this->triangleCount = 0;
+}
+
+/**
+ *  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 StaticModel::cleanup()
+{
+  PRINTF(4)("cleaning up the 3D-Model to save Memory.\n");
+  this->firstGroup->cleanup();
+  return true;
+}
+
+//////////
+// MESH //
+//////////
+/**
+ * adds a new Material to the Material List
+ * @param material the Material to add
+ * @returns the added material
+ *
+ * this also tells this Model, that all the Materials are handled externally
+ * with this option set the Materials will not be deleted with the Model.
+ */
+Material* StaticModel::addMaterial(Material* material)
+{
+  if (material == NULL)
+    return NULL;
+  ModelMaterial* modMat = new ModelMaterial;
+  modMat->external = true;
+  modMat->material = material;
+  this->materialList.push_back(modMat);
+  return modMat->material;
+}
+
+/**
+ *  adds a new Material to the Material List
+ * @param materialName the name of the Material to add
+ * @returns the added material
+*/
+Material* StaticModel::addMaterial(const char* materialName)
+{
+  ModelMaterial* modMat = new ModelMaterial;
+  modMat->external = false;
+  modMat->material = new Material(materialName);
+
+  // adding material to the List of materials
+  this->materialList.push_back(modMat);
+  return modMat->material;
+}
+
+/**
+ *  finds a Material by its name and returns it
+ * @param materialName the Name of the material to search for.
+ * @returns the Material if found, NULL otherwise
+*/
+Material* StaticModel::findMaterialByName(const char* materialName)
+{
+  list<ModelMaterial*>::iterator modMat;
+  for  (modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
+    if (!strcmp((*modMat)->material->getName(), materialName))
+      return (*modMat)->material;
+  return NULL;
+}
+
+/**
+ *  parses a group String
+ * @param groupString the new Group to create
+
+   This function initializes a new Group.
+   With it you should be able to create Models with more than one SubModel inside
+*/
+bool StaticModel::addGroup(const char* groupString)
+{
+  PRINTF(5)("Read Group: %s.\n", groupString);
+  if (this->groupCount != 0 && this->currentGroup->faceCount > 0)
+    {
+      // finalizeGroup(currentGroup);
+      this->currentGroup = this->currentGroup->next = new ModelGroup;
+    }
+  // 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;
+}
+
+/**
+ *  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 StaticModel::addVertex (const char* vertexString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  float subbuffer3;
+  sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
+  this->vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor);
+  this->vertexCount++;
+  return true;
+}
+
+/**
+ *  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 StaticModel::addVertex(float x, float y, float z)
+{
+  PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z);
+  this->vertices->addEntry(x*scaleFactor, y*scaleFactor, z*scaleFactor);
+  this->vertexCount++;
+  return true;
+}
+
+/**
+ *  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 StaticModel::addVertexNormal (const char* normalString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  float subbuffer3;
+  sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
+  this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3);
+  this->normalCount++;
+  return true;
+}
+
+/**
+ *  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 StaticModel::addVertexNormal(float x, float y, float z)
+{
+  PRINTF(5)("found vertex-Normal %f, %f, %f\n", x, y, z);
+  this->normals->addEntry(x, y, z);
+  this->normalCount++;
+  return true;
+}
+
+/**
+ *  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
+
+   !! WARNING THIS IS DIFFERNT FROM addVervexTexture(float, float); because it changes the second entry to 1-v !!
+*/
+bool StaticModel::addVertexTexture (const char* vTextureString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2);
+  this->vTexture->addEntry(subbuffer1);
+  this->vTexture->addEntry(1 - subbuffer2);
+  this->texCoordCount++;
+  return true;
+}
+
+/**
+ *  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 StaticModel::addVertexTexture(float u, float v)
+{
+  PRINTF(5)("found vertex-Texture %f, %f\n", u, v);
+  this->vTexture->addEntry(u);
+  this->vTexture->addEntry(v);
+  this->texCoordCount++;
+  return true;
+}
+
+/**
+ *  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.
+
+   String is different from the argument addFace, in this that the first Vertex/Normal/Texcoord is 1 instead of 0
+*/
+bool StaticModel::addFace (const char* faceString)
+{
+  if (this->currentGroup->faceCount >0)
+    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
+
+  ModelFaceElement* tmpElem = this->currentGroup->currentFace->firstElem = new ModelFaceElement;
+  tmpElem->next = NULL;
+  while(strcmp (faceString, "\0"))
+    {
+      if (this->currentGroup->currentFace->vertexCount>0)
+          tmpElem = tmpElem->next = new ModelFaceElement;
+      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;
+      if (texture)
+        tmpElem->texCoordNumber = atoi(texture)-1;
+      if (normal)
+        tmpElem->normalNumber = atoi(normal)-1;
+
+      faceString += tmpLen;
+      if (strcmp (faceString, "\0"))
+        faceString++;
+      this->currentGroup->currentFace->vertexCount++;
+    }
+
+  this->currentGroup->faceCount += this->currentGroup->currentFace->vertexCount -2;
+  this->faceCount += this->currentGroup->currentFace->vertexCount -2;
+}
+
+/**
+ *  adds a new Face
+ * @param faceElemCount the number of Vertices to add to the Face.
+ * @param type The information Passed with each Vertex
+*/
+bool StaticModel::addFace(int faceElemCount, VERTEX_FORMAT type, ...)
+{
+  if (this->currentGroup->faceCount > 0)
+    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
+
+  ModelFaceElement* tmpElem = this->currentGroup->currentFace->firstElem = new ModelFaceElement;
+
+  va_list itemlist;
+  va_start (itemlist, type);
+
+  for (int i = 0; i < faceElemCount; i++)
+    {
+      if (this->currentGroup->currentFace->vertexCount > 0)
+        tmpElem = tmpElem->next = new ModelFaceElement;
+
+      tmpElem->vertexNumber = va_arg (itemlist, int);
+      if (type & TEXCOORD)
+        tmpElem->texCoordNumber = va_arg (itemlist, int);
+      if (type & NORMAL)
+        tmpElem->normalNumber = va_arg(itemlist, int);
+      this->currentGroup->currentFace->vertexCount++;
+    }
+  va_end(itemlist);
+
+  this->currentGroup->faceCount += this->currentGroup->currentFace->vertexCount - 2;
+  this->faceCount += this->currentGroup->currentFace->vertexCount -2;
+}
+
+/**
+ * Function that selects a material, if changed in the obj file.
+ * @param matString the Material that will be set.
+*/
+bool StaticModel::setMaterial(const char* matString)
+{
+  if (this->currentGroup->faceCount > 0)
+    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
+
+  this->currentGroup->currentFace->material = this->findMaterialByName(matString);
+
+  if (this->currentGroup->faceCount == 0)
+    this->currentGroup->faceCount ++;
+}
+
+/**
+ * Function that selects a material, if changed in the obj file.
+ * @param mtl the Material that will be set.
+*/
+bool StaticModel::setMaterial(Material* mtl)
+{
+  if (this->currentGroup->faceCount > 0)
+    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
+
+  this->currentGroup->currentFace->material = mtl;
+
+  if (this->currentGroup->faceCount == 0)
+    this->currentGroup->faceCount ++;
+}
+
+/**
+ *  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 StaticModel::buildVertexNormals ()
+{
+  PRINTF(4)("Normals are being calculated.\n");
+
+  Vector* normArray = new Vector [vertices->getCount()/3];
+  for (int i=0; i<vertices->getCount()/3;i++)
+    normArray[i] = Vector(.0,.0,.0);
+
+  int firstTouch;
+  int secondTouch;
+  Vector prevV;
+  Vector nextV;
+  Vector curV;
+
+  ModelGroup* tmpGroup = firstGroup;
+  while (tmpGroup)
+    {
+      ModelFace* tmpFace = tmpGroup->firstFace;
+      while (tmpFace)
+        {
+          if (tmpFace->firstElem)
+            {
+              ModelFaceElement* firstElem = tmpFace->firstElem;
+              ModelFaceElement* prevElem;
+              ModelFaceElement* curElem = firstElem;
+              ModelFaceElement* nextElem;
+              ModelFaceElement* lastElem;
+              // find last Element of the Chain. !! IMPORTANT:the last Element of the Chain must point to NULL, or it will resolv into an infinity-loop.
+              while (curElem)
+                {
+                  prevElem = curElem;
+                  curElem = curElem->next;
+                }
+              lastElem = prevElem;
+
+              curElem = firstElem;
+              for (int j=0; j<tmpFace->vertexCount; j++)
+                {
+                  if (!(nextElem = curElem->next))
+                    nextElem = firstElem;
+                  curElem->normalNumber = curElem->vertexNumber;
+
+                  curV = Vector (vertices->getArray()[curElem->vertexNumber*3], vertices->getArray()[curElem->vertexNumber*3+1], vertices->getArray()[curElem->vertexNumber*3+2]);
+                  prevV = Vector (vertices->getArray()[prevElem->vertexNumber*3], vertices->getArray()[prevElem->vertexNumber*3+1], vertices->getArray()[prevElem->vertexNumber*3+2]) - curV;
+                  nextV = Vector (vertices->getArray()[nextElem->vertexNumber*3], vertices->getArray()[nextElem->vertexNumber*3+1], vertices->getArray()[nextElem->vertexNumber*3+2]) - curV;
+                  normArray[curElem->vertexNumber] = normArray[curElem->vertexNumber] + nextV.cross(prevV);
+
+                  prevElem = curElem;
+                  curElem = curElem->next;
+                }
+            }
+          tmpFace = tmpFace->next;
+        }
+      tmpGroup = tmpGroup->next;
+    }
+
+  for (int i=0; i < vertices->getCount()/3;i++)
+    {
+      normArray[i].normalize();
+      PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
+
+      this->addVertexNormal(normArray[i].x, normArray[i].y, normArray[i].z);
+
+    }
+  delete []normArray;
+}
+
+////////////
+// openGL //
+////////////
+/**
+ *  reads and includes the Faces/Materials into the openGL state Machine
+*/
+bool StaticModel::importToDisplayList()
+{
+  // 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(2)("glList could not be created for this Model\n");
+          return false;
+        }
+      glNewList (this->currentGroup->listNumber, GL_COMPILE);
+
+      // Putting Faces to GL
+      ModelFace* tmpFace = this->currentGroup->firstFace;
+      while (tmpFace != NULL)
+        {
+          if (tmpFace->vertexCount == 0 && tmpFace->material != NULL)
+            {
+              if (this->currentGroup->faceMode != -1)
+                glEnd();
+              this->currentGroup->faceMode = 0;
+              Material* tmpMat;
+              if (tmpFace->material != NULL)
+                {
+                  tmpFace->material->select();
+                  PRINTF(5)("using material %s for coming Faces.\n", tmpFace->material->getName());
+                }
+            }
+
+          else if (tmpFace->vertexCount == 3)
+            {
+              if (this->currentGroup->faceMode != 3)
+                {
+                  if (this->currentGroup->faceMode != -1)
+                    glEnd();
+                  glBegin(GL_TRIANGLES);
+                }
+
+              this->currentGroup->faceMode = 3;
+              PRINTF(5)("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(5)("found quad.\n");
+            }
+
+          else if (tmpFace->vertexCount > 4)
+            {
+              if (this->currentGroup->faceMode != -1)
+                glEnd();
+              glBegin(GL_POLYGON);
+              PRINTF(5)("Polygon with %i faces found.", tmpFace->vertexCount);
+              this->currentGroup->faceMode = tmpFace->vertexCount;
+            }
+
+          ModelFaceElement* 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;
+    }
+}
+
+/**
+ *  reads and includes the Faces/Materials into the openGL state Machine
+*/
+bool StaticModel::importToVertexArray()
+{
+  // finalize the Arrays
+  this->vertices->finalizeArray();
+  this->vTexture->finalizeArray();
+  if (normals->getCount() == 0) // vertices-Array must be built for this
+    this->buildVertexNormals();
+  this->normals->finalizeArray();
+
+  this->currentGroup = this->firstGroup;
+  glVertexPointer(3, GL_FLOAT, 0, this->vertices->getArray());
+  glNormalPointer(3, 0, this->normals->getArray());
+  glTexCoordPointer(2, GL_FLOAT, 0, this->vTexture->getArray());
+}
+
+
+
+/**
+ *  builds an array of triangles, that can later on be used for obb separation and octree separation
+ */
+bool StaticModel::buildTriangleList()
+{
+  if( unlikely(this->triangles != NULL))
+    return true;
+  /* make sure, that all the arrays are finalized */
+  if( unlikely(!this->vertices->isFinalized()))
+    this->vertices->finalizeArray();
+  if( unlikely(!this->vTexture->isFinalized()))
+    this->vTexture->finalizeArray();
+  if( normals->getCount() == 0) // vertices-Array must be built for this
+    this->buildVertexNormals();
+  if( unlikely(!this->normals->isFinalized()))
+    this->normals->finalizeArray();
+
+
+  int index = 0;                   //!< the counter for the triangle array
+  ModelFaceElement* tmpElem;       //!< the temporary faceelement reference
+  ModelFace* tmpFace;              //!< the temporary face referece
+
+  /* count the number of triangles */
+  /* now iterate through all groups and build up the triangle list */
+  this->triangleCount = 0;
+  this->currentGroup = this->firstGroup;
+  while( this->currentGroup != NULL)
+  {
+    tmpFace = this->currentGroup->firstFace;
+    while( tmpFace != NULL)
+    {
+
+      /* if its a triangle just add it to the list */
+      if( tmpFace->vertexCount == 3)
+      {
+        ++this->triangleCount;
+      } /* if the polygon is a quad */
+      else if( tmpFace->vertexCount == 4)
+      {
+        this->triangleCount += 2;
+      }
+      else if( tmpFace->vertexCount > 4)
+      {
+        PRINTF(1)("This model (%s) got over 4 vertices per face <=> conflicts in the CD engine!\n", this->getName());
+      //exit(0);
+      }
+      tmpFace = tmpFace->next;
+    }
+    this->currentGroup = this->currentGroup->next;
+  }
+
+  PRINTF(3)("got %i triangles, %i vertices\n", this->triangleCount, this->vertexCount);
+
+
+  /* write MODELINFO structure */
+
+  /* allocate memory for the new triangle structures */
+  if( (this->triangles = new sTriangleExt[this->triangleCount]) == NULL)
+  {
+    PRINTF(1)("Could not allocate memory for triangle list\n");
+    return false;
+  }
+
+  /* now iterate through all groups and build up the triangle list */
+  this->currentGroup = this->firstGroup;
+  while( this->currentGroup != NULL)
+  {
+      // Putting Faces to GL
+    tmpFace = this->currentGroup->firstFace;
+    while( tmpFace != NULL)
+    {
+      tmpElem = tmpFace->firstElem;
+
+      /* if its a triangle just add it to the list */
+      if( tmpFace->vertexCount == 3)
+      {
+        for( int j = 0; j < 3; ++j)
+        {
+          this->triangles[index].indexToVertices[j] = (unsigned int)tmpElem->vertexNumber * 3;
+          this->triangles[index].indexToNormals[j] = (unsigned int)tmpElem->normalNumber * 3;
+          this->triangles[index].indexToTexCoor[j] = (unsigned int)tmpElem->texCoordNumber * 3;
+          tmpElem = tmpElem->next;
+        }
+        ++index;
+      } /* if the polygon is a quad */
+      else if( tmpFace->vertexCount == 4)
+      {
+
+        this->triangles[index].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3;
+
+        this->triangles[index + 1].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index + 1].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index + 1].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3;
+        tmpElem = tmpElem->next;
+
+        this->triangles[index].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3;
+        tmpElem = tmpElem->next;
+
+        this->triangles[index].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3;
+
+        this->triangles[index + 1].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index + 1].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index + 1].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3;
+        tmpElem = tmpElem->next;
+
+        this->triangles[index + 1].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index + 1].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index + 1].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3;
+
+        index += 2;
+      }
+      tmpFace = tmpFace->next;
+    }
+    this->currentGroup = this->currentGroup->next;
+  }
+  return true;
+}
+
+
+/**
+ *  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 StaticModel::addGLElement (ModelFaceElement* elem)
+{
+  PRINTF(5)("importing grafical Element to openGL.\n");
+
+  if (elem->texCoordNumber != -1)
+    {
+      if (likely(elem->texCoordNumber < this->texCoordCount))
+        glTexCoord2fv(this->vTexture->getArray() + elem->texCoordNumber * 2);
+      else
+        PRINTF(2)("TextureCoordinate %d is not in the List (max: %d)\nThe Model might be incomplete\n",
+                  elem->texCoordNumber, this->texCoordCount);
+    }
+  if (elem->normalNumber != -1)
+    {
+    if (likely(elem->normalNumber < this->normalCount))
+      glNormal3fv(this->normals->getArray() + elem->normalNumber * 3);
+    else
+        PRINTF(2)("Normal %d is not in the List (max: %d)\nThe Model might be incomplete",
+                  elem->normalNumber, this->normalCount);
+    }
+  if (elem->vertexNumber != -1)
+    {
+      if (likely(elem->vertexNumber < this->vertexCount))
+          glVertex3fv(this->vertices->getArray() + elem->vertexNumber * 3);
+      else
+        PRINTF(2)("Vertex %d is not in the List (max: %d)\nThe Model might be incomplete",
+                  elem->vertexNumber, this->vertexCount);
+    }
+
+}
+
+/**
+ *  Includes a default model
+
+   This will inject a Cube, because this is the most basic model.
+*/
+void StaticModel::cubeModel()
+{
+  this->addVertex (-0.5, -0.5, 0.5);
+  this->addVertex (0.5, -0.5, 0.5);
+  this->addVertex (-0.5, 0.5, 0.5);
+  this->addVertex (0.5, 0.5, 0.5);
+  this->addVertex (-0.5, 0.5, -0.5);
+  this->addVertex (0.5, 0.5, -0.5);
+  this->addVertex (-0.5, -0.5, -0.5);
+  this->addVertex (0.5, -0.5, -0.5);
+
+  this->addVertexTexture (0.0, 0.0);
+  this->addVertexTexture (1.0, 0.0);
+  this->addVertexTexture (0.0, 1.0);
+  this->addVertexTexture (1.0, 1.0);
+  this->addVertexTexture (0.0, 2.0);
+  this->addVertexTexture (1.0, 2.0);
+  this->addVertexTexture (0.0, 3.0);
+  this->addVertexTexture (1.0, 3.0);
+  this->addVertexTexture (0.0, 4.0);
+  this->addVertexTexture (1.0, 4.0);
+  this->addVertexTexture (2.0, 0.0);
+  this->addVertexTexture (2.0, 1.0);
+  this->addVertexTexture (-1.0, 0.0);
+  this->addVertexTexture (-1.0, 1.0);
+
+  this->addVertexNormal (0.0, 0.0, 1.0);
+  this->addVertexNormal (0.0, 0.0, 1.0);
+  this->addVertexNormal (0.0, 0.0, 1.0);
+  this->addVertexNormal (0.0, 0.0, 1.0);
+  this->addVertexNormal (0.0, 1.0, 0.0);
+  this->addVertexNormal (0.0, 1.0, 0.0);
+  this->addVertexNormal (0.0, 1.0, 0.0);
+  this->addVertexNormal (0.0, 1.0, 0.0);
+  this->addVertexNormal (0.0, 0.0, -1.0);
+  this->addVertexNormal (0.0, 0.0, -1.0);
+  this->addVertexNormal (0.0, 0.0, -1.0);
+  this->addVertexNormal (0.0, 0.0, -1.0);
+  this->addVertexNormal (0.0, -1.0, 0.0);
+  this->addVertexNormal (0.0, -1.0, 0.0);
+  this->addVertexNormal (0.0, -1.0, 0.0);
+  this->addVertexNormal (0.0, -1.0, 0.0);
+  this->addVertexNormal (1.0, 0.0, 0.0);
+  this->addVertexNormal (1.0, 0.0, 0.0);
+  this->addVertexNormal (1.0, 0.0, 0.0);
+  this->addVertexNormal (1.0, 0.0, 0.0);
+  this->addVertexNormal (-1.0, 0.0, 0.0);
+  this->addVertexNormal (-1.0, 0.0, 0.0);
+  this->addVertexNormal (-1.0, 0.0, 0.0);
+  this->addVertexNormal (-1.0, 0.0, 0.0);
+
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,1, 3,3,2, 2,2,3);
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,2,4, 3,3,5, 5,5,6, 4,4,7);
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,4,8, 5,5,9, 7,7,10, 6,6,11);
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,6,12, 7,7,13, 1,9,14, 0,8,15);
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,16, 7,10,17, 5,11,18, 3,3,19);
+  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,12,20, 0,0,21, 2,2,22, 4,13,23);
+}
Index: trunk/src/lib/graphics/importer/static_model.h
===================================================================
--- trunk/src/lib/graphics/importer/static_model.h	(revision 6022)
+++ trunk/src/lib/graphics/importer/static_model.h	(revision 6022)
@@ -0,0 +1,203 @@
+/*!
+ * @file static_model.h
+ * @brief Contains the Model Class that handles Static 3D-Models rendered with glList's
+ */
+
+#ifndef _STATIC_MODEL_H
+#define _STATIC_MODEL_H
+
+#include "model.h"
+
+#include "material.h"
+#include "glincl.h"
+#include "array.h"
+#include <list>
+
+// FORWARD DECLARATION //
+template<class T> class tArray;
+
+
+//! an enumerator fot the different Model Types.
+/**
+   MODEL_DISPLAY_LIST means, that a DisplayList will be built out of the model. This model will be STATIC, meaning it cannot be changed after initialisation.
+   MODEL_VERTEX_ARRAY means, that a VertexArray will be built out of the model. This moel will be DYNAMIX, meaning that one can change the properties from outside of the model.
+ * @todo implement this stuff
+*/
+typedef enum MODEL_TYPE {
+  MODEL_DISPLAY_LIST,
+  MODEL_VERTEX_ARRAY
+};
+
+
+// definition of different modes for setting up Faces
+#define VERTEX 0       //!< If Faces are created WITH Vertex-Coordinate
+#define NORMAL 1       //!< If Faces are created WITH Normals (otherwise autocalculate)
+#define TEXCOORD 2     //!< If Faces are created WITH TextureCoordinate
+
+//! an enumerator for VERTEX_FORMAT
+typedef enum VERTEX_FORMAT {
+  VERTEX_ONLY = VERTEX,
+  VERTEX_NORMAL = NORMAL,
+  VERTEX_TEXCOORD = TEXCOORD,
+  VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD
+};
+
+////////////////////
+/// SUB-ELEMENTS ///
+////////////////////
+//! This is the placeholder of one Vertex beloning to a Face.
+class ModelFaceElement
+{
+ public:
+  ModelFaceElement();
+  ~ModelFaceElement();
+
+  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.
+
+  ModelFaceElement*   next;                 //!< Point to the next FaceElement in this List.
+};
+
+//! This is the placeholder of a Face belonging to a Group of Faces.
+class ModelFace
+{
+ public:
+  ModelFace();
+  ~ModelFace();
+
+  unsigned int        vertexCount;     //!< The Count of vertices this Face has.
+  ModelFaceElement*   firstElem;       //!< Points to the first Vertex (FaceElement) of this Face.
+  Material*           material;        //!< The Material to use.
+
+  ModelFace*          next;            //!< Pointer to the next Face.
+};
+
+//! Group to handle multiple Models per obj-file.
+class ModelGroup
+{
+ public:
+  ModelGroup();
+  ~ModelGroup();
+
+  void cleanup();
+
+  char*        name;           //!< the Name of the Group. this is an identifier, that can be accessed via the draw (char* name) function.
+  GLubyte*     indices;        //!< The indices of the Groups. Needed for vertex-arrays
+  GLuint       listNumber;     //!< The number of the GL-List this Group gets.
+  ModelFace*   firstFace;      //!< The first Face in this group.
+  ModelFace*   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.
+
+  ModelGroup*  next;           //!< Pointer to the next Group.
+};
+
+struct ModelMaterial
+{
+  Material* material;
+  bool external;
+};
+
+/////////////
+/// MODEL ///
+/////////////
+//! Class that handles static 3D-Models.
+/**
+ * it can also read them in and display them.
+ * All the objects are rendered with glLists
+ */
+class StaticModel : public Model
+{
+ public:
+  StaticModel(const char* modelName = NULL, MODEL_TYPE type = MODEL_DISPLAY_LIST);
+  virtual ~StaticModel();
+
+  virtual void draw() const;
+  void draw(int groupNumber) const;
+  void draw(char* groupName) const;
+
+  void rebuild();
+
+  /** @returns Count of the Models (Groups) in this File */
+  inline int getGroupCount() const { return this->groupCount; };
+
+  /** @returns a Pointer to the Vertex-Array, if it was deleted it returns NULL */
+  inline const GLfloat* getVertexArray() const { return this->vertices->getArray(); };
+  /** @returns the VertexCount of this Model */
+  inline unsigned int getVertexCount() const { return this->vertexCount; };
+
+  /** @returns a Pointer to the Normals-Array, if it was deleted it returns NULL */
+  inline const GLfloat* getNormalsArray() const { return this->normals->getArray(); };
+  /** @returns the NormalsCount of this Model */
+  inline unsigned int getNormalsCount() const { return this->normalCount; };
+
+  /** @returns a Pointer to the TexCoord-Array, if it was deleted it returns NULL */
+  inline const GLfloat* getTexCoordArray() const { return this->vTexture->getArray(); };
+  /** @returns the TexCoord-Count of this Model */
+  inline unsigned int getTexCoordCount() const { return this->texCoordCount; };
+
+  /** @returns the Count of Faces of this Model */
+  inline unsigned int getFaceCount() const { return this->faceCount; };
+
+
+  Material* addMaterial(Material* material);
+  Material* addMaterial(const char* materialName);
+
+  bool addGroup(const char* groupString);
+  bool addVertex(const char* vertexString);
+  bool addVertex(float x, float y, float z);
+  bool addFace(const char* faceString);
+  bool addFace(int faceElemCount, VERTEX_FORMAT type, ...);
+  bool addVertexNormal(const char* normalString);
+  bool addVertexNormal(float x, float y, float z);
+  bool addVertexTexture(const char* vTextureString);
+  bool addVertexTexture(float u, float v);
+  bool setMaterial(const char* mtlString);
+  bool setMaterial(Material* mtl);
+  void finalize();
+
+
+ protected:
+  void cubeModel();
+
+  Material* findMaterialByName(const char* materialName);
+
+
+ protected:
+  float            scaleFactor;     //!< The Factor with which the Model should be scaled. @todo maybe one wants to scale the Model after Initialisation
+
+ private:
+  bool buildVertexNormals();
+
+  bool importToDisplayList();
+  bool buildTriangleList();
+  bool addGLElement(ModelFaceElement* elem);
+
+  bool importToVertexArray();
+
+  bool deleteArrays();
+  bool cleanup();
+
+ private:
+  MODEL_TYPE                 type;            //!< A type for the Model
+  bool                       finalized;       //!< Sets the Object to be finalized.
+
+  unsigned int               vertexCount;     //!< A modelwide Counter for vertices.
+  unsigned int               normalCount;     //!< A modelwide Counter for the normals.
+  unsigned int               texCoordCount;   //!< A modelwide Counter for the texCoord.
+  unsigned int               faceCount;       //!< A modelwide Counter for the faces
+  unsigned int               triangleCount;   //!< Number of triangles >= faceCount
+  tArray<GLfloat>*           vertices;        //!< The Array that handles the Vertices.
+  tArray<GLfloat>*           normals;         //!< The Array that handles the Normals.
+  tArray<GLfloat>*           vTexture;        //!< The Array that handles the VertexTextureCoordinates.
+  sTriangleExt*              triangles;       //!< The Array of triangles in the model.h style
+
+  ModelGroup*                firstGroup;      //!< The first of all groups.
+  ModelGroup*                currentGroup;    //!< The currentGroup. this is the one we will work with.
+  int                        groupCount;      //!< The Count of Groups.
+
+  std::list<ModelMaterial*>  materialList;    //!< A list for all the Materials in this Model
+};
+
+#endif
Index: trunk/src/lib/graphics/importer/vertex_array_model.h
===================================================================
--- trunk/src/lib/graphics/importer/vertex_array_model.h	(revision 6012)
+++ trunk/src/lib/graphics/importer/vertex_array_model.h	(revision 6022)
@@ -7,5 +7,5 @@
 #define _VERTEX_ARRAY_MODEL_H
 
-#include "abstract_model.h"
+#include "model.h"
 
 #include "glincl.h"
@@ -22,5 +22,5 @@
 /////////////
 //! Class that handles 3D-Models. it can also read them in and display them.
-class VertexArrayModel : public AbstractModel
+class VertexArrayModel : public Model
 {
  public:
Index: trunk/src/lib/graphics/spatial_separation/quadtree.h
===================================================================
--- trunk/src/lib/graphics/spatial_separation/quadtree.h	(revision 6012)
+++ trunk/src/lib/graphics/spatial_separation/quadtree.h	(revision 6022)
@@ -12,5 +12,5 @@
 
 #include "base_object.h"
-#include "abstract_model.h"
+#include "model.h"
 
 
Index: trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
===================================================================
--- trunk/src/lib/graphics/spatial_separation/quadtree_node.cc	(revision 6012)
+++ trunk/src/lib/graphics/spatial_separation/quadtree_node.cc	(revision 6022)
@@ -21,5 +21,5 @@
 #include "quadtree.h"
 #include "material.h"
-#include "abstract_model.h"
+#include "model.h"
 #include "debug.h"
 
@@ -346,5 +346,5 @@
 /**
  *  gets the maximal dimension of a model
- * @return the dimension of the AbstractModel as a Rectangle
+ * @return the dimension of the Model as a Rectangle
 
    The rectangle is x-z axis aligned. ATTENTION: if there are any vertices in the model, that exceed the
Index: trunk/src/lib/graphics/spatial_separation/quadtree_node.h
===================================================================
--- trunk/src/lib/graphics/spatial_separation/quadtree_node.h	(revision 6012)
+++ trunk/src/lib/graphics/spatial_separation/quadtree_node.h	(revision 6022)
@@ -17,5 +17,5 @@
 #include "base_object.h"
 
-#include "abstract_model.h"
+#include "model.h"
 
 // FORWARD DECLARATION
Index: trunk/src/lib/graphics/spatial_separation/spatial_separation.cc
===================================================================
--- trunk/src/lib/graphics/spatial_separation/spatial_separation.cc	(revision 6012)
+++ trunk/src/lib/graphics/spatial_separation/spatial_separation.cc	(revision 6022)
@@ -18,5 +18,5 @@
 #include "spatial_separation.h"
 
-#include "abstract_model.h"
+#include "model.h"
 #include "quadtree.h"
 #include "debug.h"
@@ -34,5 +34,5 @@
 
  */
-SpatialSeparation::SpatialSeparation (AbstractModel* model, float overlapSize)
+SpatialSeparation::SpatialSeparation (Model* model, float overlapSize)
 {
   PRINT(3)("+---------Debug Information SpatialSeparation----------\n");
@@ -52,5 +52,5 @@
    The boxes are overlaping because this makes collision detection a lot simpler
  */
-SpatialSeparation::SpatialSeparation (AbstractModel* model, AbstractModel* playerModel)
+SpatialSeparation::SpatialSeparation (Model* model, Model* playerModel)
 {
   this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
@@ -75,5 +75,5 @@
  * @return the new quadtree
  */
-Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, float minLength)
+Quadtree* SpatialSeparation::createQuadtree(Model* model, float minLength)
 {
   this->minLength = minLength;
@@ -88,5 +88,5 @@
  * @return the new quadtree
  */
-Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, int treeDepth)
+Quadtree* SpatialSeparation::createQuadtree(Model* model, int treeDepth)
 {
   this->treeDepth = treeDepth;
@@ -100,5 +100,5 @@
  * @return the new quadtree
  */
-Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model)
+Quadtree* SpatialSeparation::createQuadtree(Model* model)
 {
   this->quadtree = new Quadtree(model->getModelInfo(), 4);
Index: trunk/src/lib/graphics/spatial_separation/spatial_separation.h
===================================================================
--- trunk/src/lib/graphics/spatial_separation/spatial_separation.h	(revision 6012)
+++ trunk/src/lib/graphics/spatial_separation/spatial_separation.h	(revision 6022)
@@ -9,5 +9,5 @@
 
 
-class AbstractModel;
+class Model;
 class Quadtree;
 
@@ -21,6 +21,6 @@
 
   public:
-    SpatialSeparation(AbstractModel* model, float overlapSize);
-    SpatialSeparation(AbstractModel* model, AbstractModel* playerModel);
+    SpatialSeparation(Model* model, float overlapSize);
+    SpatialSeparation(Model* model, Model* playerModel);
     virtual ~SpatialSeparation();
 
@@ -28,7 +28,7 @@
     void setMinLength(int minLength) { this->minLength = minLength; }
 
-    Quadtree* createQuadtree(AbstractModel* model, float minLength);
-    Quadtree* createQuadtree(AbstractModel* model, int treeDepth);
-    Quadtree* createQuadtree(AbstractModel* model);
+    Quadtree* createQuadtree(Model* model, float minLength);
+    Quadtree* createQuadtree(Model* model, int treeDepth);
+    Quadtree* createQuadtree(Model* model);
 
     inline Quadtree* getQuadtree() { return this->quadtree; }
@@ -41,8 +41,8 @@
 
   private:
-    AbstractModel*             model;        //!< the reference to the model that has to be handled
+    Model*             model;        //!< the reference to the model that has to be handled
     Quadtree*                  quadtree;     //!< the reference to the created quadtree
 
-    AbstractModel*             playerModel;  //!< referece to the player model, if needed for overlap calculations
+    Model*             playerModel;  //!< referece to the player model, if needed for overlap calculations
     float                      overlapSize;  //!< the size of overlaping
 
Index: trunk/src/world_entities/skybox.cc
===================================================================
--- trunk/src/world_entities/skybox.cc	(revision 6012)
+++ trunk/src/world_entities/skybox.cc	(revision 6022)
@@ -20,6 +20,6 @@
 #include "load_param.h"
 #include "factory.h"
-#include "model.h"
-
+#include "static_model.h"
+#include "material.h"
 
 using namespace std;
@@ -170,5 +170,5 @@
 void SkyBox::rebuild()
 {
-  Model* model = new Model();
+  StaticModel* model = new StaticModel();
 
   model->addVertex (-0.5*size, -0.5*size, 0.5*size);
Index: trunk/src/world_entities/terrain.cc
===================================================================
--- trunk/src/world_entities/terrain.cc	(revision 6012)
+++ trunk/src/world_entities/terrain.cc	(revision 6022)
@@ -40,5 +40,5 @@
 
 //  if (this->model != NULL)
-    //this->ssp = new SpatialSeparation((AbstractModel*)this->model, 10.0f);
+    //this->ssp = new SpatialSeparation((Model*)this->model, 10.0f);
 }
 
Index: trunk/src/world_entities/weapons/test_gun.cc
===================================================================
--- trunk/src/world_entities/weapons/test_gun.cc	(revision 6012)
+++ trunk/src/world_entities/weapons/test_gun.cc	(revision 6022)
@@ -24,5 +24,5 @@
 
 #include "world_entity.h"
-#include "model.h"
+#include "static_model.h"
 #include "test_bullet.h"
 #include "weapon_manager.h"
@@ -219,5 +219,5 @@
   if( this->leftRight == W_RIGHT)
     glScalef(1.0, 1.0, -1.0);
-  this->getModel()->draw(1);
+  static_cast<StaticModel*>(this->getModel())->draw(1);
   glPopMatrix();
 
@@ -230,5 +230,5 @@
   tmpRot = this->objectComponent1->getAbsDir().getSpacialAxis();
   glRotatef (this->objectComponent1->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
-  this->getModel()->draw(0);
+  static_cast<StaticModel*>(this->getModel())->draw(0);
   glPopMatrix();
 }
