Index: orxonox/branches/images/importer/framework.cc
===================================================================
--- orxonox/branches/images/importer/framework.cc	(revision 3122)
+++ orxonox/branches/images/importer/framework.cc	(revision 3127)
@@ -1,5 +1,5 @@
 #include "framework.h"
 
-int verbose = 1;
+int verbose = 4;
 
 void DrawGLScene()
@@ -43,5 +43,5 @@
   // Create a new OpenGL window with the title "Cone3D Basecode" at
   // 640x480x32, fullscreen and check for errors along the way
-  if(wHandler.CreateGLWindow("Whandler Basecode", 640, 480, 32, FALSE) == FALSE)
+  if(wHandler.CreateGLWindow("Whandler Basecode", 800, 600, 32, FALSE) == FALSE)
   {
     // If an error is found, display a message, kill the GL and SDL screens (if they were created) and exit
Index: orxonox/branches/images/importer/material.cc
===================================================================
--- orxonox/branches/images/importer/material.cc	(revision 3122)
+++ orxonox/branches/images/importer/material.cc	(revision 3127)
@@ -20,4 +20,64 @@
 #include "material.h"
 
+// headers only for PathList
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <fstream>
+
+using namespace std;
+
+
+PathList::PathList()
+{
+  pathName = NULL;
+  next = NULL;
+}
+PathList::PathList(char* pName)
+{
+  pathName = new char [strlen(pName)+1];
+  strcpy (pathName, pName);
+  next = NULL;
+}
+
+PathList::~PathList()
+{
+  if (pathName)
+    delete []pathName;
+  if (next)
+    delete next;
+}
+
+void PathList::addPath (char* pName)
+{
+  if (pName[0] == '\0')
+    {
+      if (verbose >=3)
+	printf("not Adding empty Path to the List.\n");
+      return;
+    }
+  
+  if (access (pName, F_OK) == 0)
+    {
+      struct stat status;
+      stat(pName, &status);
+      if (status.st_mode & S_IFDIR)
+	{
+	  if (verbose >=2)
+	    printf ("Adding Path %s to the PathList.\n", pName);
+	  PathList* tmpPathList = this;
+	  while (tmpPathList->next)
+	    tmpPathList = tmpPathList->next;
+	  tmpPathList->next = new PathList(pName);
+	}
+      else
+	if (verbose >=1)
+	  printf ("You tried to add non-folder %s to a PathList.\n", pName);
+    }
+  else
+    if (verbose >=1)
+      printf ("You tried to add non-existing folder %s to a PathList.\n", pName);
+}
 
 /**
@@ -67,12 +127,11 @@
   if (verbose >=2)
     printf ("adding Material %s.\n", mtlName);
-  Material* newMat = new Material(mtlName);
-  Material* tmpMat = this;
+   Material* tmpMat = this;
   while (tmpMat->nextMat != NULL)
     {
       tmpMat = tmpMat->nextMat;
     }
-  tmpMat->nextMat = newMat;
-  return newMat;
+  tmpMat->nextMat = new Material(mtlName);
+  return tmpMat->nextMat;
   
 }
@@ -86,5 +145,5 @@
     printf ("initializing new Material.\n");
   nextMat = NULL;
-
+  name ="";
   setIllum(1);
   setDiffuse(0,0,0);
@@ -94,4 +153,8 @@
   setTransparency(0.0);
 
+  if (!pathList)
+    pathList = new PathList("");
+
+
   diffuseTextureSet = false;
   ambientTextureSet = false;
@@ -100,4 +163,6 @@
   
 }
+
+PathList *Material::pathList = NULL;
 
 /**
@@ -166,8 +231,9 @@
 void Material::setName (char* mtlName)
 {
-  if (verbose >= 3)
-    printf("setting Material Name to %s.\n", mtlName);
   name = new char [strlen(mtlName)+1];
   strcpy(name, mtlName);
+  if (verbose >= 3)
+    printf("setting Material Name to %s.\n", name);
+
   //  printf ("adding new Material: %s, %p\n", this->getName(), this);
 
@@ -188,5 +254,5 @@
 {
   if (verbose >= 3)
-    printf("setting illumModel of Material %s to %i", name, illum);
+    printf("setting illumModel of Material %s to %i\n", name, illum);
   illumModel = illum;
   //  printf ("setting illumModel to: %i\n", illumModel);
@@ -317,4 +383,38 @@
 }
 
+void Material::addTexturePath(char* pathName)
+{
+  pathList->addPath (pathName);
+}
+char* Material::searchTextureInPaths(char* texName) const
+{
+  char* tmpName = NULL;
+  PathList* pList = pathList;
+  while (pList)
+    {
+      if (pList->pathName)
+	{
+	  tmpName = new char [strlen(pList->pathName)+strlen(texName)+1];
+	  strcpy(tmpName, pList->pathName);
+	}
+      else
+	{
+	  tmpName = new char [strlen(texName)+1];
+	  tmpName[0]='\0';
+	}
+      strcat(tmpName, texName);
+      printf("%s\n", tmpName);
+      if (access (tmpName, F_OK) == 0)
+	return tmpName;
+      
+      if (tmpName)
+	delete []tmpName;
+      tmpName = NULL;
+      pList = pList->next;
+    }
+  return NULL;
+}
+
+
 // MAPPING //
 
@@ -364,4 +464,6 @@
 bool Material::loadTexToGL (Image* pImage, GLuint* texture)
 {
+  if (verbose >=3)
+    printf ("Loading texture to OpenGL-Environment.\n");
   glGenTextures(1, texture);
   glBindTexture(GL_TEXTURE_2D, *texture);
@@ -381,24 +483,33 @@
 bool Material::loadImage(char* imageName, GLuint* texture)
 {
-  SDL_Surface* map;
-  Image* pImage = new Image;
-  map=IMG_Load(imageName);
-  if(!map)
-    {
-      printf("IMG_Load: %s\n", IMG_GetError());
-      return false;
-    }
-  pImage->height = map->h;
-  pImage->width  = map->w;
-  pImage->data   = (GLubyte*)map->pixels;
-  if( !IMG_isPNG(SDL_RWFromFile(imageName, "rb")) && !IMG_isJPG(SDL_RWFromFile(imageName, "rb")))
-    for (int i=0;i<map->h * map->w *3;i+=3)
-      { 
-	GLuint temp = pImage->data[i];
-	pImage->data[i] = pImage->data[i+2];
-	pImage->data[i+2] = temp;
-      }
-  loadTexToGL (pImage, texture);
-
+  char* imgNameWithPath= searchTextureInPaths(imageName);
+  if (imgNameWithPath)
+    {
+      SDL_Surface* map;
+      Image* pImage = new Image;
+      map=IMG_Load(imgNameWithPath);
+      if(!map)
+	{
+	  printf("IMG_Load: %s\n", IMG_GetError());
+	  return false;
+	}
+      pImage->height = map->h;
+      pImage->width  = map->w;
+      pImage->data   = (GLubyte*)map->pixels;
+      if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb")))
+	for (int i=0;i<map->h * map->w *3;i+=3)
+	  { 
+	    GLuint temp = pImage->data[i];
+	    pImage->data[i] = pImage->data[i+2];
+	    pImage->data[i+2] = temp;
+	  }
+      loadTexToGL (pImage, texture);
+    }
+  else
+    {
+      if (verbose >=2)
+	printf ("Image not Found: %s\n", imageName);
+      return false;
+    }
 }
 #else
Index: orxonox/branches/images/importer/material.h
===================================================================
--- orxonox/branches/images/importer/material.h	(revision 3122)
+++ orxonox/branches/images/importer/material.h	(revision 3127)
@@ -12,6 +12,4 @@
 #include <GL/glu.h>
 #include <SDL/SDL.h>
-#include <stdlib.h>
-#include <fstream>
 
 #if HAVE_CONFIG_H 
@@ -32,4 +30,17 @@
 #endif /* HAVE_PNG_H */
 #endif /* HAVE_SDL_SDL_IMAGE_H */
+
+class PathList
+{
+ public:
+  PathList();
+  PathList(char* pName);
+
+  ~PathList();
+  void addPath (char* pName);
+  char* pathName;
+  PathList* next;
+};
+
 
 //! Class to handle Materials.
@@ -62,12 +73,12 @@
 
 
-
-
-  // MAPPING //
+ 
+  void addTexturePath(char* pathName);
+  char* searchTextureInPaths(char* texName) const;
+ // MAPPING //
   void setDiffuseMap(char* dMap);
   void setAmbientMap(char* aMap);
   void setSpecularMap(char* sMap);
   void setBump(char* bump);
-
 
  private:
@@ -91,4 +102,6 @@
   float transparency;
 
+  static PathList* pathList;
+  
   GLuint diffuseTexture;
   GLuint ambientTexture;
Index: orxonox/branches/images/importer/object.cc
===================================================================
--- orxonox/branches/images/importer/object.cc	(revision 3122)
+++ orxonox/branches/images/importer/object.cc	(revision 3127)
@@ -353,8 +353,12 @@
   if (verbose >=2)
     if (strlen(objPath)> 0)
-      printf("Resolved file %s to folder: %s.\n", name, objPath);
+      {
+	printf("Resolved file %s to folder: %s.\n", name, objPath);
+      }
     else
       printf("Resolved file %s.\n", name);
   
+  if (material)
+    material->addTexturePath(objPath);
   objFileName = new char[strlen(name)+1];
   strcpy (objFileName, name);
