Index: /branches/new_class_id/src/lib/graphics/importer/material.cc
===================================================================
--- /branches/new_class_id/src/lib/graphics/importer/material.cc	(revision 9784)
+++ /branches/new_class_id/src/lib/graphics/importer/material.cc	(revision 9785)
@@ -25,5 +25,6 @@
 #include "loading/load_param.h"
 
-#include "util/loading/resource_manager.h"
+#include "resource_texture.h"
+//#include "util/loading/resource_manager.h"
 
 ObjectListDefinition(Material);
@@ -91,9 +92,4 @@
 {
   PRINTF(5)("delete Material %s.\n", this->getCName());
-
-  if (this->ambientTexture != NULL)
-    ResourceManager::getInstance()->unload(this->ambientTexture);
-  if (this->specularTexture != NULL)
-    ResourceManager::getInstance()->unload(this->specularTexture);
 
   if (this == Material::selectedMaterial)
@@ -297,5 +293,6 @@
 void Material::addTexturePath(const std::string& pathName)
 {
-  ResourceManager::getInstance()->addImageDir(pathName);
+  printf("HUPS\n");
+  //ResourceManager::getInstance()->addImageDir(pathName);
 }
 
@@ -351,9 +348,10 @@
   if (!dMap.empty())
   {
-    Texture* tex = dynamic_cast<Texture*>(ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target));
-    if (tex != NULL)
-      this->textures[textureNumber] = *tex;
+    this->textures[textureNumber] = ResourceTexture(dMap);
+	//dynamic_cast<Texture*>(ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target));
+/*    if (tex != NULL)
+      this->textures[textureNumber] = tex;
     else
-      this->textures[textureNumber] = Texture();
+      this->textures[textureNumber] = Texture();*/
   }
   else
Index: /branches/new_class_id/src/lib/graphics/importer/resource_texture.cc
===================================================================
--- /branches/new_class_id/src/lib/graphics/importer/resource_texture.cc	(revision 9784)
+++ /branches/new_class_id/src/lib/graphics/importer/resource_texture.cc	(revision 9785)
@@ -6,6 +6,7 @@
 
 ResourceTexture::ResourceTexture(const std::string& imageName, GLenum target)
+    : Resource(&ResourceTexture::type)
 {
-  Resource::Pointer* ptr = this->acquireResource(ResourceTexture::type, imageName + ',' + "TEST");
+  Resource::Pointer* ptr = this->acquireResource(imageName + ',' + "TEST");
 
   if (ptr)
@@ -13,5 +14,7 @@
   else
   {
-    this->loadImage(imageName, target);
+    std::string fileName = this->Resource::locateFile(imageName);
+    this->Texture::loadImage(fileName, target);
+    this->Resource::addResource(new ResourceTexture::TextureResourcePointer(imageName + ',' + "TEST", KeepLevel(), this->Texture::dataPointer()));
   }
 }
@@ -24,8 +27,7 @@
 
 
-ResourceTexture::TextureResourcePointer::TextureResourcePointer(const std::string& loadString, const Resource::KeepLevel& keepLevel, TextureData* data)
+ResourceTexture::TextureResourcePointer::TextureResourcePointer(const std::string& loadString, const Resource::KeepLevel& keepLevel, const TextureData::Pointer& data)
     : Resource::Pointer(loadString, keepLevel) , pointer(data)
-{
-}
+{}
 
 
Index: /branches/new_class_id/src/lib/graphics/importer/resource_texture.h
===================================================================
--- /branches/new_class_id/src/lib/graphics/importer/resource_texture.h	(revision 9784)
+++ /branches/new_class_id/src/lib/graphics/importer/resource_texture.h	(revision 9785)
@@ -14,12 +14,13 @@
 class ResourceTexture : public Texture, public Resource
 {
+public:
   ResourceTexture(const std::string& imageName, GLenum target = GL_TEXTURE_2D);
 
 
 private:
-  class TextureResourcePointer : public Resource::Pointer
+class TextureResourcePointer : public Resource::Pointer
   {
   public:
-    TextureResourcePointer(const std::string& loadString, const Resource::KeepLevel& keepLevel, TextureData* data);
+    TextureResourcePointer(const std::string& loadString, const Resource::KeepLevel& keepLevel, const TextureData::Pointer& data);
     inline const TextureData::Pointer& ptr() const { return pointer; }
   private:
@@ -27,6 +28,6 @@
   };
 
-  private:
-    static Resource::Type type;
+private:
+  static Resource::Type type;
 };
 
Index: /branches/new_class_id/src/lib/util/filesys/directory.cc
===================================================================
--- /branches/new_class_id/src/lib/util/filesys/directory.cc	(revision 9784)
+++ /branches/new_class_id/src/lib/util/filesys/directory.cc	(revision 9785)
@@ -212,2 +212,7 @@
 
 }
+
+File operator+(const Directory& dir, const File& file)
+{
+   return File(dir.name() + '/' + file.name());
+}
Index: /branches/new_class_id/src/lib/util/filesys/directory.h
===================================================================
--- /branches/new_class_id/src/lib/util/filesys/directory.h	(revision 9784)
+++ /branches/new_class_id/src/lib/util/filesys/directory.h	(revision 9785)
@@ -77,4 +77,6 @@
 };
 
+File operator+(const Directory& dir, const File& file);
+
 #endif /* __DIRECTORY_H_ */
 
Index: /branches/new_class_id/src/lib/util/loading/resource.cc
===================================================================
--- /branches/new_class_id/src/lib/util/loading/resource.cc	(revision 9784)
+++ /branches/new_class_id/src/lib/util/loading/resource.cc	(revision 9785)
@@ -17,6 +17,14 @@
 
 #include "resource.h"
+#include "filesys/file.h"
 
 ObjectListDefinition(Resource);
+
+
+std::vector<Resource::Type*>    Resource::_resourceTypes;
+
+//! GLOBALS
+Directory Resource::_mainGlobalPath;
+std::vector<Directory>        Resource::_globalPaths;
 
 
@@ -24,8 +32,14 @@
  * standard constructor
 */
-Resource::Resource ()
-    : _pointer(NULL)
+Resource::Resource (Resource::Type* type)
+    : _pointer(NULL), _type(type)
 {
   this->registerObject(this, Resource::_objectList);
+
+  if(this->_type->id() == -1)
+  {
+    Resource::_resourceTypes.push_back(this->_type);
+    this->_type->setID(Resource::_resourceTypes.size()-1);
+  }
 
 }
@@ -40,20 +54,49 @@
 
 
+std::string Resource::locateFile(const std::string& fileName)
+{
+  if (File(fileName).exists())
+    return fileName;
+  else if ((Resource::_mainGlobalPath+File(fileName)) . exists() )
+    return (Resource::_mainGlobalPath + File(fileName)).name();
 
-Resource::Pointer* Resource::acquireResource(Resource::Type& resourceType, const std::string& loadString)
+
+  return std::string("/home/bensch/svn/orxonox/data/") + fileName;
+
+}
+
+
+Resource::Pointer* Resource::acquireResource(const std::string& loadString)
 {
-  if(resourceType.id() == -1)
-  {
-    Resource::_resourceTypes.push_back(&resourceType);
-    resourceType.setID(Resource::_resourceTypes.size());
-  }
-  const Resource::Type* const type = Resource::_resourceTypes[resourceType.id()];
+  //const Resource::Type* const type = Resource::_resourceTypes[this->_type->id()];
 
-  for (unsigned int i = 0; i < type->storedResources().size(); ++i)
-    if (type->storedResources()[i]->_pointer->loadString() == loadString)
-      return type->storedResources()[i]->_pointer;
+  for (unsigned int i = 0; i < _type->storedResources().size(); ++i)
+    if (_type->storedResources()[i]->_pointer->loadString() == loadString)
+      return _type->storedResources()[i]->_pointer;
 
   return NULL;
 }
+
+void Resource::setMainGlobalPath(const Directory& directory)
+{
+  Resource::_mainGlobalPath = directory;
+  Resource::_mainGlobalPath.open();
+}
+
+void Resource::addGlobalPath(const Directory& directory)
+{
+  std::vector<Directory>::const_iterator it = std::find(Resource::_globalPaths.begin(), Resource::_globalPaths.end(), directory);
+  if (it == Resource::_globalPaths.end())
+    Resource::_globalPaths.push_back(directory);
+}
+
+
+
+void Resource::addResource(Resource::Pointer* pointer)
+{}
+
+
+
+
 
 
@@ -68,2 +111,20 @@
   _keepLevelName[level] = name;
 }
+
+
+
+
+
+
+
+
+
+
+Resource::Pointer::Pointer(const std::string& loadString, const Resource::KeepLevel& keeplevel)
+{
+}
+
+void Resource::Type::setID(int id)
+{
+  this->_id = id;
+}
Index: /branches/new_class_id/src/lib/util/loading/resource.h
===================================================================
--- /branches/new_class_id/src/lib/util/loading/resource.h	(revision 9784)
+++ /branches/new_class_id/src/lib/util/loading/resource.h	(revision 9785)
@@ -12,4 +12,6 @@
 #include <vector>
 #include <set>
+
+#include "filesys/directory.h"
 
 //! A Resource is an Object, that can be loaded from Disk
@@ -48,4 +50,5 @@
 
     void setID(int id);
+    void addResource(Resource* resource);
 
   private:
@@ -73,15 +76,25 @@
 
 public:
-  Resource();
+  Resource(Resource::Type* type);
   virtual ~Resource();
 
-  virtual bool reload();
-  virtual bool unload();
+  virtual bool reload() { return false; };
+  virtual bool unload() { return false; };
+
+  std::string locateFile(const std::string& fileName);
+
+
+  public:
+    static void setMainGlobalPath(const Directory& directory);
+    static void addGlobalPath(const Directory& directory);
+
 
 protected:
-  Resource::Pointer* acquireResource(Resource::Type& resourceType, const std::string& loadString);
+  Resource::Pointer* acquireResource(const std::string& loadString);
+  void addResource(Resource::Pointer* pointer);
 
 private:
   Resource::Pointer*       _pointer;                //!< Virtual Pointer to the ResourceData.
+  Resource::Type*          _type;                   //!< Type of the Resource.
 
 
@@ -89,6 +102,6 @@
 
   //! GLOBALS
-  static std::string                     _mainGlobalPath;
-  static std::vector<std::string>        _globalPaths;
+  static Directory                       _mainGlobalPath;
+  static std::vector<Directory>          _globalPaths;
 };
 
Index: /branches/new_class_id/src/world_entities/WorldEntities.am
===================================================================
--- /branches/new_class_id/src/world_entities/WorldEntities.am	(revision 9784)
+++ /branches/new_class_id/src/world_entities/WorldEntities.am	(revision 9785)
@@ -91,4 +91,5 @@
 		world_entities/weather_effects/atmospheric_engine.cc \
 		world_entities/weather_effects/weather_effect.cc \
+		world_entities/weather_effects/cloud_effect.cc \
 		world_entities/weather_effects/sun_effect.cc \
 		world_entities/weather_effects/fog_effect.cc \
@@ -96,5 +97,4 @@
 		world_entities/weather_effects/rain_effect.cc \
 		world_entities/weather_effects/snow_effect.cc \
-		world_entities/weather_effects/cloud_effect.cc \
 		world_entities/weather_effects/lightning_effect.cc \
 		world_entities/weather_effects/lense_flare.cc
