Index: orxonox/trunk/src/lib/graphics/importer/material.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/material.cc	(revision 3654)
+++ orxonox/trunk/src/lib/graphics/importer/material.cc	(revision 3655)
@@ -23,4 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
+
+//! \todo check if we are in RESOURCE MANAGER-mode
+#include "resource_manager.h"
 
 using namespace std;
@@ -104,6 +107,4 @@
   this->ambientTextureSet = false;
   this->specularTextureSet = false;
-
-  
 }
 
@@ -333,7 +334,9 @@
 {
   PRINTF(4)("setting Diffuse Map %s\n", dMap);
-  diffuseTexture = new Texture();
-  this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
-
+    diffuseTexture = new Texture();
+    this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
+
+  //! \todo check if RESOURCE MANAGER is availiable
+  //this->diffuseTextureSet = this->diffuseTexture = (Texture*)ResourceManager::load(dMap, IMAGE);
 }
 
Index: orxonox/trunk/src/lib/graphics/importer/objModel.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/objModel.cc	(revision 3654)
+++ orxonox/trunk/src/lib/graphics/importer/objModel.cc	(revision 3655)
@@ -21,19 +21,4 @@
 
 #include "debug.h"
-
-/**
-   \brief Crates a 3D-Model and loads in a File.
-   \param fileName file to parse and load (must be a .obj file)
-*/
-OBJModel::OBJModel(char* fileName)
-{
-  this->initializeOBJ();
-
-  this->importFile (fileName);
-
-  this->importToGL ();
-
-  this->cleanup();
-}
 
 /**
@@ -193,5 +178,5 @@
       else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented
 	{
-	  PRINTF(3)("smoothing groups not supportet yet. line: %s\n", Buffer);
+	  PRINTF(2)("smoothing groups not supportet yet. line: %s\n", Buffer);
 	}
     }
Index: orxonox/trunk/src/lib/graphics/importer/objModel.h
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/objModel.h	(revision 3654)
+++ orxonox/trunk/src/lib/graphics/importer/objModel.h	(revision 3655)
@@ -13,6 +13,5 @@
 {
  public:
-  OBJModel(char* fileName);
-  OBJModel(char* fileName, float scaling);
+  OBJModel(char* fileName, float scaling = 1.0);
   virtual ~OBJModel();
   void initializeOBJ(void);
@@ -28,5 +27,4 @@
   bool readFromObjFile (void);
   bool readMtlLib (char* matFile);
-
 };
 
Index: orxonox/trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/texture.cc	(revision 3654)
+++ orxonox/trunk/src/lib/graphics/importer/texture.cc	(revision 3655)
@@ -131,4 +131,16 @@
 
 /**
+   \brief Constructor for a Texture
+*/
+Texture::Texture(const char* imageName)
+{
+  this->pImage = new Image;
+  this->pImage->data = NULL;
+  this->map = NULL;
+  this->texture = 0;
+  this->loadImage(imageName);
+}  
+
+/**
    \brief Destructor of a Texture
    
@@ -149,5 +161,5 @@
    \returns pathName+texName if texName was found in the pathList. NULL if the Texture is not found.
 */
-char* Texture::searchTextureInPaths(char* texName) const
+char* Texture::searchTextureInPaths(const char* texName) const
 {
   char* tmpName = NULL;
@@ -215,5 +227,5 @@
 
 #ifdef HAVE_SDL_SDL_IMAGE_H
-bool Texture::loadImage(char* imageName)
+bool Texture::loadImage(const char* imageName)
 {
   if (GraphicsEngine::texturesEnabled)
@@ -269,5 +281,5 @@
    \todo Checks where to find the Image
 */
-bool Texture::loadImage(char* imageName)
+bool Texture::loadImage(const char* imageName)
 {
   if (GraphicsEngine::texturesEnabled)
Index: orxonox/trunk/src/lib/graphics/importer/texture.h
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/texture.h	(revision 3654)
+++ orxonox/trunk/src/lib/graphics/importer/texture.h	(revision 3655)
@@ -70,8 +70,9 @@
   GLuint texture;   //!< The Texture-ID of opengl from this Texture.
   SDL_Surface* map; //!< The map SDL initializes for this element.
-  char* searchTextureInPaths(char* texName) const;
+  char* searchTextureInPaths(const char* texName) const;
   inline void swap(unsigned char &a, unsigned char &b);
  public:
   Texture(void);
+  Texture(const char* imageName);
   ~Texture(void);
   /** \returns The textureID of this texture.  */
@@ -79,5 +80,5 @@
   bool loadTexToGL (Image* pImage);
 
-  bool loadImage(char* imageName);
+  bool loadImage(const char* imageName);
 #ifndef HAVE_SDL_SDL_IMAGE_H
 
Index: orxonox/trunk/src/lib/util/resource_manager.cc
===================================================================
--- orxonox/trunk/src/lib/util/resource_manager.cc	(revision 3655)
+++ orxonox/trunk/src/lib/util/resource_manager.cc	(revision 3655)
@@ -0,0 +1,166 @@
+/* 
+   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: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
+
+#include "resource_manager.h"
+
+// different resource Types
+#include "objModel.h"
+#include "texture.h"
+
+// File Handling Includes
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+*/
+ResourceManager::ResourceManager () 
+{
+   this->setClassName ("ResourceManager");
+   this->dataDir = NULL;
+}
+
+ResourceManager* ResourceManager::getInstance(void)
+{
+  if (!ResourceManager::singletonRef)
+    ResourceManager::singletonRef = new ResourceManager();
+  return ResourceManager::singletonRef;
+}
+
+ResourceManager* ResourceManager::singletonRef = NULL;
+
+/**
+   \brief standard deconstructor
+*/
+ResourceManager::~ResourceManager (void) 
+{
+  ResourceManager::singletonRef = NULL;
+}
+
+
+
+/**
+   \brief sets the data main directory
+   \param dataDir the DataDirectory.
+*/
+bool ResourceManager::setDataDir(char* dataDir)
+{
+  if (isDir(dataDir))
+    {
+      this->dataDir = new char[strlen(dataDir)+1];
+      strcpy(this->dataDir, dataDir);
+    }
+  else
+    {
+      PRINTF(1)("%s is not a Directory, and can not be the Data Directory\n", dataDir);
+    }
+}
+
+/**
+   \brief loads resources
+   \param fileName The fileName of the resource to load
+   \returns a pointer to a desired Resource.
+*/
+void* ResourceManager::load(const char* fileName)
+{
+  ResourceType tmpType;
+  if (!strncmp(fileName+(strlen(fileName)-4), ".obj", 4))
+    tmpType = OBJ;
+
+  return ResourceManager::load(fileName, tmpType);
+}
+
+/**
+   \brief loads resources
+   \param fileName The fileName of the resource to load
+   \param type The Type of Resource to load (\see ResourceType)
+   \returns a pointer to a desired Resource.
+*/
+void* ResourceManager::load(const char* fileName, ResourceType type)
+{
+  void* tmpResource = NULL;
+  char* tmpName = new char[strlen(fileName)+1];
+  strcpy(tmpName, fileName);
+  // Checking for the type of resource \see ResourceType
+  switch(type)
+    {
+    case OBJ:
+      if(isFile(tmpName))
+	tmpResource = new OBJModel(tmpName);
+      else
+	{
+	  PRINTF(2)("Sorry, %s does not exist. Loading a cube-Model instead\n", tmpName);
+	  tmpResource = new Model(CUBE);
+	}
+      break;
+    case IMAGE:
+      if(isFile(tmpName))
+	{
+	  tmpResource = new Texture(tmpName);
+	}
+      else
+	PRINTF(1)("!!Texture %s not Found!!\n", tmpName);
+      break;
+    default:
+      tmpResource = NULL;
+      PRINTF(2)("No type found for %s.\n   !!This should not happen unless the Type is not supported yet.!!\n", tmpName);
+      break;
+    }
+
+  // checking if the File really exists.
+  if(!isFile(tmpName))
+    {
+      PRINTF(2)("Sorry, %s is not a regular file.\n", tmpName);
+      tmpResource = NULL;
+    }
+  return tmpResource;
+}
+
+/**
+   \brief Checks if it is a Directory
+   \param directoryName the Directory to check for
+   \returns true if it is a directory/symlink false otherwise
+*/
+bool ResourceManager::isDir(const char* directoryName)
+{
+  struct stat status;
+  stat(directoryName, &status);
+  if (status.st_mode & (S_IFDIR | S_IFLNK))
+    return true;
+  else 
+    return false;
+}
+
+/**
+   \brief Checks if the file is either a Regular file or a Symlink
+   \param fileName the File to check for
+   \returns true if it is a regular file/symlink, false otherwise
+*/
+bool ResourceManager::isFile(const char* fileName)
+{
+  struct stat status;
+  stat(fileName, &status);
+  if (status.st_mode & (S_IFREG | S_IFLNK))
+    return true;
+  else
+    return false;
+}
Index: orxonox/trunk/src/lib/util/resource_manager.h
===================================================================
--- orxonox/trunk/src/lib/util/resource_manager.h	(revision 3655)
+++ orxonox/trunk/src/lib/util/resource_manager.h	(revision 3655)
@@ -0,0 +1,64 @@
+/*! 
+    \file resource_manager.h
+    \brief The Resource Manager checks if a file/resource is loaded.
+
+    If a file/resource was already loaded the resourceManager will 
+    return a void pointer to the desired resource.
+    Otherwise it will instruct the coresponding resource-loader to load,
+    and receive a pointer to it.
+*/
+
+#ifndef _RESOURCE_MANAGER_H
+#define _RESOURCE_MANAGER_H
+
+#include "base_object.h"
+
+// FORWARD DEFINITION \\
+
+
+enum ResourceType {OBJ, WAV, MP3, OGG, IMAGE};
+
+//! The ResourceManager is a class, that decides if a file/resource should be loaded
+/**
+   If a file/resource was already loaded the resourceManager will 
+   return a void pointer to the desired resource.
+   Otherwise it will instruct the corresponding resource-loader to load,
+   and receive the pointer to it.
+
+   It does it by looking, if a desired file has already been loaded.
+*/
+class ResourceManager : public BaseObject 
+{
+ public:
+  static ResourceManager* getInstance();
+  virtual ~ResourceManager();
+
+  bool setDataDir(char* dataDir);
+  static void* load(const char* fileName);
+  static void* load(const char* fileName, ResourceType type);
+
+ private:
+  ResourceManager();
+  static ResourceManager* singletonRef;
+
+
+  struct file;
+  struct folder
+  {
+    char* name;
+    folder** subfolders;             //!< 
+    file** files;                    //!< Files in the directory
+  };
+  struct file
+  {
+    char* name;                      //!< exact Name of a file
+    void* pointer;
+  };
+
+  char* dataDir;                     //!< The main data directory
+
+  static bool isDir(const char* directory);
+  static bool isFile(const char* directory);  
+};
+
+#endif /* _RESOURCE_MANAGER_H */
