Index: /orxonox/branches/importer/src/array.cc
===================================================================
--- /orxonox/branches/importer/src/array.cc	(revision 2809)
+++ /orxonox/branches/importer/src/array.cc	(revision 2810)
@@ -3,36 +3,32 @@
 Array::Array ()
 {
-  createArray (2000);
-}
-Array::Array (unsigned int arraySize)
-{
-  createArray (arraySize);
+  createArray ();
 }
 
-void Array::createArray (unsigned int newArraySize)
+void Array::createArray ()
 {
-  array = new GLfloat [newArraySize];
-  entryCount = -1; //0 means one entry
-  arraySize = newArraySize;
+  if (verbose >= 2)
+    printf ("crating new Array\n");
+  firstEntry = new Entry;
+  firstEntry->next =NULL;
+  currentEntry=firstEntry;
+  finalized = false;
+  entryCount = 0; //0 means one entry
   return;
 }
 
-void Array::resizeArray (unsigned int newSize)
-{
-  GLfloat* newArray = new GLfloat [newSize];
-  
-  for (int i=0; i<=entryCount; i++)
-      newArray[i] = array[i];
-
-  delete [] array;
-  array = newArray;
-  arraySize = newSize;
-
-  return;
-}
-  
 void Array::finalizeArray (void)
 {
-  resizeArray (entryCount+1);
+  if (verbose >= 3)
+    printf ("Finalizing array.\n");  
+  if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL)
+    printf ("could not allocate %i data Blocks\n", entryCount);
+  Entry* walker = firstEntry;
+  for (int i=0; i<entryCount; i++)
+    {
+      array[i] = walker->value;
+      walker = walker->next;
+    }
+  finalized = true;
   return;
 }
@@ -41,11 +37,18 @@
 void Array::addEntry (GLfloat entry)
 {
-  entryCount++;
-
-  if (entryCount > arraySize)
-    resizeArray(arraySize+2000);
-  
-  array[entryCount] = entry;
-
+  if (!finalized)
+    {
+      if (verbose >= 3)
+	printf ("adding new Entry to Array: %f\n", entry);
+      
+      entryCount++;
+      currentEntry->value = entry;
+      currentEntry->next = new Entry;
+      currentEntry = currentEntry->next;
+      currentEntry->next = NULL;
+    }
+  else 
+    if (verbose >= 1)
+      printf ("adding failed, because list has been finalized\n");
 }
 
@@ -72,4 +75,4 @@
 void Array::debug ()
 {
-  printf ("arraySize=%i, entryCount=%i, address=%p\n", arraySize, entryCount, array);
+  printf ("entryCount=%i, address=%p\n", entryCount, array);
 }
Index: /orxonox/branches/importer/src/array.h
===================================================================
--- /orxonox/branches/importer/src/array.h	(revision 2809)
+++ /orxonox/branches/importer/src/array.h	(revision 2810)
@@ -1,4 +1,6 @@
 #ifndef _ARRAY_H
 #define _ARRAY_H
+
+extern int verbose;
 
 #include <GL/gl.h>
@@ -9,8 +11,6 @@
  public:
   Array ();
-  Array (unsigned int arraySize);
 
-  void createArray (unsigned int newArraySize);
-  void resizeArray (unsigned int newSize);
+  void createArray ();
   void finalizeArray (void);
   void addEntry (GLfloat entry);
@@ -21,8 +21,17 @@
   void debug(void);
  private:
+  struct Entry
+  {
+    GLfloat value;
+    Entry* next;
+  };
+
   GLfloat* array;
-  unsigned int arraySize;
-  unsigned int entryCount;
-
+  int entryCount;
+  bool finalized;
+  Entry* firstEntry;
+  Entry* currentEntry;
+  
+  
 };
 
Index: /orxonox/branches/importer/src/material.cc
===================================================================
--- /orxonox/branches/importer/src/material.cc	(revision 2809)
+++ /orxonox/branches/importer/src/material.cc	(revision 2810)
@@ -17,4 +17,6 @@
 Material* Material::addMaterial(char* mtlName)
 {
+  if (verbose >=2)
+    printf ("adding Material %s\n", mtlName);
   Material* newMat = new Material(mtlName);
   Material* tmpMat = this;
@@ -30,4 +32,6 @@
 void Material::init(void)
 {
+  if (verbose >= 3)
+    printf ("initializing new Material\n");
   nextMat = NULL;
 
@@ -42,4 +46,6 @@
 void Material::setName (char* mtlName)
 {
+  if (verbose >= 3)
+    printf("setting Material Name to %s", mtlName);
   strcpy(name, mtlName);
   //  printf ("adding new Material: %s, %p\n", this->getName(), this);
@@ -54,4 +60,6 @@
 void Material::setIllum (int illum)
 {
+  if (verbose >= 3)
+    printf("setting illumModel of Material %s to %i", name, illum);
   illumModel = illum;
   //  printf ("setting illumModel to: %i\n", illumModel);
@@ -64,4 +72,6 @@
 void Material::setDiffuse (float r, float g, float b)
 {
+  if (verbose >= 3)
+    printf ("setting Diffuse Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
   diffuse[0] = r;
   diffuse[1] = g;
@@ -69,5 +79,4 @@
   diffuse[3] = 1.0;
 
-  //  printf ("setting Diffuse Color to r=%f g=%f b=%f\n", r, g, b);
 }
 void Material::setDiffuse (char* rgb)
@@ -80,9 +89,10 @@
 void Material::setAmbient (float r, float g, float b)
 {
+  if (verbose >=3)
+    printf ("setting Ambient Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
   ambient[0] = r;
   ambient[1] = g;
   ambient[2] = b;
   ambient[3] = 1.0;
-  //  printf ("setting Ambient Color to r=%f g=%f b=%f\n", r, g, b);
 }
 void Material::setAmbient (char* rgb)
@@ -95,10 +105,11 @@
 void Material::setSpecular (float r, float g, float b)
 {
+  if (verbose >= 3)
+    printf ("setting Specular Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
   specular[0] = r;
   specular[1] = g;
   specular[2] = b;
   specular[3] = 1.0;
-  //printf ("setting Specular Color to r=%f g=%f b=%f\n", r, g, b);
-}
+ }
 void Material::setSpecular (char* rgb)
 {
@@ -111,4 +122,6 @@
 void Material::setTransparency (float trans)
 {
+  if (verbose >= 3)
+    printf ("setting Transparency of Material %s to %f\n", name, trans);
   transparency = trans;
 }
@@ -123,9 +136,17 @@
 Material* Material::search (char* mtlName)
 {
+  if (verbose >=3)
+    printf ("Searching for material %s", mtlName);
   Material* searcher = this;
   while (searcher != NULL)
     {
+      if (verbose >= 3)
+	printf (".");
       if (!strcmp (searcher->getName(), mtlName))
-	return searcher;
+	{
+	  if (verbose >= 3)
+	    printf ("found.\n");
+	  return searcher;
+	}
       searcher = searcher->nextMat;
     }
Index: /orxonox/branches/importer/src/material.h
===================================================================
--- /orxonox/branches/importer/src/material.h	(revision 2809)
+++ /orxonox/branches/importer/src/material.h	(revision 2810)
@@ -1,4 +1,7 @@
 #ifndef _MATERIAL_H
 #define _MATERIAL_H
+
+extern int verbose;
+
 #include <GL/gl.h>
 #include <GL/glu.h>
Index: /orxonox/branches/importer/src/object.cc
===================================================================
--- /orxonox/branches/importer/src/object.cc	(revision 2809)
+++ /orxonox/branches/importer/src/object.cc	(revision 2810)
@@ -1,4 +1,5 @@
 #include "object.h"
 
+int verbose = 1;
 Object::Object ()
 {
@@ -22,6 +23,8 @@
 bool Object::importFile (char* fileName)
 {
-  objFile = fileName;
-  this->readFromObjFile (objFile);
+  if (verbose >=3)
+    printf("preparing to read in file: %s\n", fileName);   
+  objFileName = fileName;
+  this->readFromObjFile (objFileName);
   return true;
 }
@@ -29,4 +32,6 @@
 bool Object::initialize (void)
 {
+  if (verbose >=3)
+    printf("new 3D-Object is being created\n"); 
   faceMode = -1;
   if ( (listNumber = glGenLists(1)) == 0 )
@@ -45,4 +50,6 @@
 bool Object::finalize(void)
 {
+  if (verbose >=3)
+    printf("finalizing the 3D-Object\n"); 
   glEndList();
   return true;
@@ -51,4 +58,6 @@
 void Object::draw (void)
 {
+  if (verbose >=3)
+    printf("drawing the 3D-Object\n"); 
   glCallList (listNumber);
 }
@@ -60,8 +69,9 @@
   if (!OBJ_FILE->is_open())
     {
-      printf ("unable to open file: %s\n", fileName);
+      if (verbose >=1)
+	printf ("unable to open .OBJ file: %s\n", fileName);
       return false;
     }
-  
+  objFileName = fileName;
   char Buffer[500];
   vertices = new Array();
@@ -70,5 +80,6 @@
     {
       OBJ_FILE->getline(Buffer, 500);
-      //      printf("%s\n", Buffer);
+      if (verbose >=4)
+	printf ("Read input line: %s\n",Buffer);
       
 
@@ -125,4 +136,6 @@
   char subbuffer3[20];
   sscanf (vertexString, "%s %s %s", subbuffer1, subbuffer2, subbuffer3);
+  if (verbose >= 3)
+    printf ("reading in a vertex: %s %s %s\n", subbuffer1, subbuffer2, subbuffer3);
   vertices->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3));
   return true;
@@ -145,5 +158,4 @@
   char subbuffer4[20] ="";
   sscanf (faceString, "%s %s %s %s", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
-  //  printf("%s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3);
   if (!strcmp(subbuffer4, ""))
     {
@@ -156,5 +168,6 @@
       
       faceMode = 3;
-      //printf ("triag: %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3);
+      if (verbose >=3)
+	printf ("found triag: %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3);
       addGLElement(subbuffer1);
       addGLElement(subbuffer2);
@@ -171,5 +184,6 @@
 	}
       faceMode = 4;
-      //      printf ("quad: %s, %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
+      if (verbose >=3 )
+	printf ("found quad: %s, %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
       addGLElement(subbuffer1);
       addGLElement(subbuffer2);
@@ -191,5 +205,6 @@
   normal[0] = '\0';
   normal ++;
-  
+  if (verbose >= 4)
+    printf ("importing grafical Element.... including to openGL\n");
   glNormal3fv(normals->getArray() +(atoi(normal)-1)*3);
   glArrayElement(atoi(vertex)-1); //  glVertex3fv(vertices->getArray() +(atoi(vertex)-1)*3);
@@ -204,5 +219,6 @@
   char subbuffer3[20];
   sscanf (normalString, "%s %s %s", subbuffer1, subbuffer2, subbuffer3);
-  //  printf("%s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3);
+  if (verbose >=3 )
+    printf("found vertex-Normal %s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3);
   normals->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3));
   return true;
@@ -214,8 +230,11 @@
   if (!MTL_FILE->is_open())
     {
-      printf ("unable to open file: %s\n", mtlFile);
+      if (verbose >= 1)
+	printf ("unable to open file: %s\n", mtlFile);
       return false;
     }
-  
+  mtlFileName = mtlFile;
+  if (verbose >=2)
+    printf ("Opening mtlFile: %s\n", mtlFileName);
   char Buffer[500];
   vertices = new Array();
@@ -225,5 +244,6 @@
     {
       MTL_FILE->getline(Buffer, 500);
-      //      printf("%s\n", Buffer);
+      if (verbose >= 4)
+	printf("found line in mtlFile: %s\n", Buffer);
       
 
@@ -264,6 +284,6 @@
     glEnd();
   faceMode = 0;
-  //printf ("%s\n", matString);
-  //  glColor3f((float)rand()/2000000000.0,(float)rand()/2000000000.0,(float)rand()/2000000000.0);
+  if (verbose >= 2)
+    printf ("using material %s for coming Faces.\n", matString);
   material->search(matString)->select();
 }
Index: /orxonox/branches/importer/src/object.h
===================================================================
--- /orxonox/branches/importer/src/object.h	(revision 2809)
+++ /orxonox/branches/importer/src/object.h	(revision 2810)
@@ -30,5 +30,6 @@
   Array* colors;
   Array* normals;
-  char* objFile;
+  char* objFileName;
+  char* mtlFileName;
   int faceMode;
   bool readVertices;
