Index: orxonox/branches/importer/importer/Makefile.am
===================================================================
--- orxonox/branches/importer/importer/Makefile.am	(revision 2775)
+++ orxonox/branches/importer/importer/Makefile.am	(revision 2776)
@@ -6,7 +6,7 @@
 
 bin_PROGRAMS=importer
-importer_SOURCES=framework.cc windowHandler.cc object.cc array.cc 
+importer_SOURCES=framework.cc windowHandler.cc object.cc array.cc material.cc
 
-noinst_HEADERS=windowHandler.h object.h array.h
+noinst_HEADERS=windowHandler.h object.h array.h material.h
 
 
Index: orxonox/branches/importer/importer/Makefile.in
===================================================================
--- orxonox/branches/importer/importer/Makefile.in	(revision 2775)
+++ orxonox/branches/importer/importer/Makefile.in	(revision 2776)
@@ -53,5 +53,5 @@
 PROGRAMS = $(bin_PROGRAMS)
 am_importer_OBJECTS = framework.$(OBJEXT) windowHandler.$(OBJEXT) \
-	object.$(OBJEXT) array.$(OBJEXT)
+	object.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT)
 importer_OBJECTS = $(am_importer_OBJECTS)
 importer_LDADD = $(LDADD)
@@ -60,5 +60,6 @@
 am__depfiles_maybe = depfiles
 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po ./$(DEPDIR)/framework.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/object.Po ./$(DEPDIR)/windowHandler.Po
+@AMDEP_TRUE@	./$(DEPDIR)/material.Po ./$(DEPDIR)/object.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/windowHandler.Po
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
@@ -150,6 +151,6 @@
 AM_CXXFLAGS = "-I/usr/X11R6/include"
 AM_LDFLAGS = "-L/usr/Mesa-6.0.1/lib  -L/usr/X11R6/lib -lXt -lX11" $(MWINDOWS)
-importer_SOURCES = framework.cc windowHandler.cc object.cc array.cc 
-noinst_HEADERS = windowHandler.h object.h array.h
+importer_SOURCES = framework.cc windowHandler.cc object.cc array.cc material.cc
+noinst_HEADERS = windowHandler.h object.h array.h material.h
 all: all-am
 
@@ -220,4 +221,5 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/framework.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windowHandler.Po@am__quote@
Index: orxonox/branches/importer/importer/array.h
===================================================================
--- orxonox/branches/importer/importer/array.h	(revision 2775)
+++ orxonox/branches/importer/importer/array.h	(revision 2776)
@@ -1,3 +1,5 @@
-//#include "windowHandler.h"
+#ifndef _ARRAY_H
+#define _ARRAY_H
+
 #include <GL/gl.h>
 #include <GL/glu.h>
@@ -24,2 +26,4 @@
 
 };
+
+#endif
Index: orxonox/branches/importer/importer/material.cc
===================================================================
--- orxonox/branches/importer/importer/material.cc	(revision 2776)
+++ orxonox/branches/importer/importer/material.cc	(revision 2776)
@@ -0,0 +1,99 @@
+#include "material.h"
+
+Material* Material::firstMat = NULL;
+Material* Material::currentMat = NULL;
+
+Material::Material()
+{
+  init();
+}
+
+Material::Material (char* mtlName)
+{
+  init();
+  
+  setName (mtlName);
+}
+
+void Material::init(void)
+{
+  if (firstMat == NULL)
+    firstMat = this;
+  else 
+    currentMat->nextMat = this;
+  currentMat = this;
+  nextMat = NULL;
+}
+
+
+void Material::setName (char* mtlName)
+{
+  name = mtlName;
+  //printf ("adding new Material: %s, %p\n", firstMat->name, firstMat);
+
+}
+
+
+void Material::setIllum (int illum)
+{
+  illumModel = illum;
+  //  printf ("setting illumModel to: %i\n", illumModel);
+}
+void Material::setIllum (char* illum)
+{
+  setIllum (atoi(illum));
+}
+
+void Material::setDiffuse (float r, float g, float b)
+{
+  diffuse[0] = r;
+  diffuse[1] = g;
+  diffuse[2] = b;
+  printf ("setting Diffuse Color to r=%f g=%f b=%f\n", r, g, b);
+}
+void Material::setDiffuse (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setDiffuse (atof(r), atof(g), atof(b));
+}
+
+void Material::setAmbient (float r, float g, float b)
+{
+  ambient[0] = r;
+  ambient[1] = g;
+  ambient[2] = b;
+  printf ("setting Ambient Color to r=%f g=%f b=%f\n", r, g, b);
+}
+void Material::setAmbient (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setAmbient (atof(r), atof(g), atof(b));
+}
+
+void Material::setSpecular (float r, float g, float b)
+{
+  specular[0] = r;
+  specular[1] = g;
+  specular[2] = b;
+  printf ("setting Specular Color to r=%f g=%f b=%f\n", r, g, b);
+}
+void Material::setSpecular (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setSpecular (atof(r), atof(g), atof(b));
+}
+
+
+void Material::setTransparency (float trans)
+{
+  transparency = trans;
+}
+void Material::setTransparency (char* trans)
+{
+  char tr[20];
+  sscanf (trans, "%s", tr);
+  setTransparency (atof(tr));
+}
Index: orxonox/branches/importer/importer/material.h
===================================================================
--- orxonox/branches/importer/importer/material.h	(revision 2776)
+++ orxonox/branches/importer/importer/material.h	(revision 2776)
@@ -0,0 +1,43 @@
+#ifndef _MATERIAL_H
+#define _MATERIAL_H
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include <stdlib.h>
+#include <fstream.h>
+
+class Material
+{
+ public:
+  Material ();
+  Material (char* mtlName);
+  void init(void);
+  ~Material ();
+  
+  void setName (char* mtlName);
+  void setIllum (int illum);
+  void setIllum (char* illum);
+  void setDiffuse (float r, float g, float b);
+  void setDiffuse (char* rgb);
+  void setAmbient (float r, float g, float b);
+  void setAmbient (char* rgb);
+  void setSpecular (float r, float g, float b);
+  void setSpecular (char* rgb);
+  void setTransparency (float trans);
+  void setTransparency (char* trans);
+
+
+  bool select (void);
+
+ private:
+  char* name;
+  int illumModel;
+  float diffuse [3];
+  float ambient [3];
+  float specular [3];
+  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 2775)
+++ orxonox/branches/importer/importer/object.cc	(revision 2776)
@@ -1,3 +1,4 @@
 #include "object.h"
+
 Object::Object ()
 {
@@ -80,4 +81,9 @@
 	{
 	  readFace (Buffer+2);
+	}
+      
+      else if (!strncmp(Buffer, "mtllib", 6))
+	{
+	  readMtlLib (Buffer+7);
 	}
 
@@ -173,4 +179,54 @@
 }
 
+bool Object::readMtlLib (char* mtlFile)
+{
+  MTL_FILE = new ifstream (mtlFile);
+  if (!MTL_FILE->is_open())
+    {
+      printf ("unable to open file: %s\n", mtlFile);
+      return false;
+    }
+  
+  char Buffer[500];
+  vertices = new Array();
+  faces = new Array();
+  
+  while(!MTL_FILE->eof())
+    {
+      MTL_FILE->getline(Buffer, 500);
+      //      printf("%s\n", Buffer);
+      
+
+      // create new Material
+      if (!strncmp(Buffer, "newmtl ", 2))
+	{
+	  material = new Material(Buffer+7);
+	}
+      // setting a illumMode
+      else if (!strncmp(Buffer, "illum", 5))
+	{
+	  material->setIllum(Buffer+6);
+	}
+      // setting Diffuse Color
+      else if (!strncmp(Buffer, "Kd", 2))
+	{
+	  material->setDiffuse(Buffer+3);
+	}
+      // setting Ambient Color
+      else if (!strncmp(Buffer, "Ka", 2))
+	{
+	  material->setAmbient(Buffer+3);
+	}
+      // setting Specular Color
+      else if (!strncmp(Buffer, "Ks", 2))
+	{
+	  material->setSpecular(Buffer+3);
+	}
+     
+
+
+    }
+  return true;
+}
 
 bool Object::readUseMtl (char* matString)
@@ -178,5 +234,8 @@
   if (faceMode != -1)
     glEnd();
-  faceMode = 1;
+  faceMode = 0;
+  //printf ("%s\n", matString);
   glColor3f((float)rand()/2000000000.0,(float)rand()/2000000000.0,(float)rand()/2000000000.0);
 }
+
+
Index: orxonox/branches/importer/importer/object.h
===================================================================
--- orxonox/branches/importer/importer/object.h	(revision 2775)
+++ orxonox/branches/importer/importer/object.h	(revision 2776)
@@ -1,4 +1,4 @@
-#ifndef OBJECT_H
-#define OBJECT_H
+#ifndef _OBJECT_H
+#define _OBJECT_H
 
 #include <GL/gl.h>
@@ -6,4 +6,5 @@
 
 #include "array.h"
+#include "material.h"
 #include <fstream.h>
 
@@ -32,4 +33,5 @@
   int faceMode;
   bool readVertices;
+  Material* material;
 
   ifstream* OBJ_FILE;
@@ -39,5 +41,6 @@
   bool readFace (char* faceString);
   bool readVT (char* vtString);
-  bool readUseMtl (char* matString);
+  bool readMtlLib (char* matFile);
+  bool readUseMtl (char* mtlString);
 
   bool addGLElement (char* elementString);
