Index: orxonox/branches/importer/importer/material.cc
===================================================================
--- orxonox/branches/importer/importer/material.cc	(revision 2777)
+++ orxonox/branches/importer/importer/material.cc	(revision 2778)
@@ -1,10 +1,9 @@
 #include "material.h"
-
-Material* Material::firstMat = NULL;
-Material* Material::currentMat = NULL;
 
 Material::Material()
 {
   init();
+  
+  setName ("");
 }
 
@@ -16,12 +15,26 @@
 }
 
+Material* Material::addMaterial(char* mtlName)
+{
+  Material* newMat = new Material(mtlName);
+  Material* tmpMat = this;
+  while (tmpMat->nextMat != NULL)
+    {
+      tmpMat = tmpMat->nextMat;
+    }
+      tmpMat->nextMat = newMat;
+      return newMat;
+  
+}
+
 void Material::init(void)
 {
-  if (firstMat == NULL)
-    firstMat = this;
-  else 
-    currentMat->nextMat = this;
-  currentMat = this;
   nextMat = NULL;
+
+  setIllum(1);
+  setDiffuse(0,0,0);
+  setAmbient(0,0,0);
+  setSpecular(0,0,0);
+  setTransparency(0.0);
 }
 
@@ -29,7 +42,11 @@
 void Material::setName (char* mtlName)
 {
-  name = mtlName;
-  //printf ("adding new Material: %s, %p\n", firstMat->name, firstMat);
+  strcpy(name, mtlName);
+  //  printf ("adding new Material: %s, %p\n", this->getName(), this);
 
+}
+char* Material::getName (void)
+{
+  return name;
 }
 
@@ -50,5 +67,5 @@
   diffuse[1] = g;
   diffuse[2] = b;
-  printf ("setting Diffuse Color to r=%f g=%f b=%f\n", r, g, b);
+  //  printf ("setting Diffuse Color to r=%f g=%f b=%f\n", r, g, b);
 }
 void Material::setDiffuse (char* rgb)
@@ -64,5 +81,5 @@
   ambient[1] = g;
   ambient[2] = b;
-  printf ("setting Ambient Color to r=%f g=%f b=%f\n", r, g, b);
+  //  printf ("setting Ambient Color to r=%f g=%f b=%f\n", r, g, b);
 }
 void Material::setAmbient (char* rgb)
@@ -78,5 +95,5 @@
   specular[1] = g;
   specular[2] = b;
-  printf ("setting Specular Color to r=%f g=%f b=%f\n", r, g, b);
+  //printf ("setting Specular Color to r=%f g=%f b=%f\n", r, g, b);
 }
 void Material::setSpecular (char* rgb)
@@ -98,2 +115,20 @@
   setTransparency (atof(tr));
 }
+
+
+Material* Material::search (char* mtlName)
+{
+  Material* searcher = this;
+  while (searcher != NULL)
+    {
+      if (!strcmp (searcher->getName(), mtlName))
+	return searcher;
+      searcher = searcher->nextMat;
+    }
+  return NULL;
+}
+
+bool Material::select (void)
+{
+  glColor3f (diffuse[0], diffuse[1], diffuse[2]);
+}
Index: orxonox/branches/importer/importer/material.h
===================================================================
--- orxonox/branches/importer/importer/material.h	(revision 2777)
+++ orxonox/branches/importer/importer/material.h	(revision 2778)
@@ -11,8 +11,12 @@
   Material ();
   Material (char* mtlName);
+  Material* addMaterial(char* mtlName);
+
   void init(void);
   ~Material ();
-  
+
+
   void setName (char* mtlName);
+  char* getName (void);
   void setIllum (int illum);
   void setIllum (char* illum);
@@ -26,9 +30,12 @@
   void setTransparency (char* trans);
 
+  Material* search (char* mtlName);
 
   bool select (void);
 
+  Material* nextMat;
+
  private:
-  char* name;
+  char name [50];
   int illumModel;
   float diffuse [3];
@@ -37,7 +44,4 @@
   float transparency;
 
-  Material* nextMat;
-  static Material* firstMat;
-  static Material* currentMat;
 };
 #endif
Index: orxonox/branches/importer/importer/object.cc
===================================================================
--- orxonox/branches/importer/importer/object.cc	(revision 2777)
+++ orxonox/branches/importer/importer/object.cc	(revision 2778)
@@ -191,5 +191,6 @@
   vertices = new Array();
   faces = new Array();
-  
+  material = new Material();
+  Material* tmpMat = material;
   while(!MTL_FILE->eof())
     {
@@ -201,29 +202,28 @@
       if (!strncmp(Buffer, "newmtl ", 2))
 	{
-	  material = new Material(Buffer+7);
+	  tmpMat = tmpMat->addMaterial(Buffer+7);
+	  printf ("%s, %p\n", tmpMat->getName(), tmpMat);
 	}
       // setting a illumMode
       else if (!strncmp(Buffer, "illum", 5))
 	{
-	  material->setIllum(Buffer+6);
+	  tmpMat->setIllum(Buffer+6);
+
 	}
       // setting Diffuse Color
       else if (!strncmp(Buffer, "Kd", 2))
 	{
-	  material->setDiffuse(Buffer+3);
+	  tmpMat->setDiffuse(Buffer+3);
 	}
       // setting Ambient Color
       else if (!strncmp(Buffer, "Ka", 2))
 	{
-	  material->setAmbient(Buffer+3);
+	  tmpMat->setAmbient(Buffer+3);
 	}
       // setting Specular Color
       else if (!strncmp(Buffer, "Ks", 2))
 	{
-	  material->setSpecular(Buffer+3);
-	}
-     
-
-
+	  tmpMat->setSpecular(Buffer+3);
+	}
     }
   return true;
