Index: /trunk/src/lib/graphics/importer/material.cc
===================================================================
--- /trunk/src/lib/graphics/importer/material.cc	(revision 7787)
+++ /trunk/src/lib/graphics/importer/material.cc	(revision 7788)
@@ -22,14 +22,7 @@
 #include "debug.h"
 #include "util/loading/resource_manager.h"
-#include <stdlib.h>
-#include <string.h>
-
-//! @todo check if we are in RESOURCE MANAGER-mode
-#include "util/loading/resource_manager.h"
-
-using namespace std;
-
-/**
- * creates a Material.
+
+/**
+ * @brief creates a Material.
  * @param mtlName Name of the Material to be added to the Material List
  */
@@ -54,16 +47,9 @@
 
 /**
-  *  deletes a Material
-*/
+ * @brief deletes a Material
+ */
 Material::~Material()
 {
   PRINTF(5)("delete Material %s.\n", this->getName());
-
-  while(!this->textures.empty())
-  {
-    if (this->textures.back() != NULL)
-      ResourceManager::getInstance()->unload(this->textures.back());
-    this->textures.pop_back();
-  }
 
   if (this->ambientTexture != NULL)
@@ -115,5 +101,5 @@
 
 /**
- *  sets the material with which the following Faces will be painted
+ * @brief sets the material with which the following Faces will be painted
  */
 bool Material::select() const
@@ -135,5 +121,5 @@
   // setting the transparency
   if (this->transparency < 1.0 ||       /* This allows alpha blending of 2D textures with the scene */
-      (likely(!this->textures.empty() && this->textures[0] != NULL) && this->textures[0]->hasAlpha()))
+      (likely(!this->textures.empty() && this->textures[0].hasAlpha())))
   {
     glEnable(GL_BLEND);
@@ -164,14 +150,11 @@
   for(unsigned int i = 0; i < this->textures.size(); ++i)
   {
-    if (likely(this->textures[i] != NULL))
-    {
       glActiveTexture(Material::glTextureArbs[i]);
       glEnable(GL_TEXTURE_2D);
-      if(this->textures[i]->hasAlpha())
+      if(this->textures[i].hasAlpha())
       {
         glEnable(GL_BLEND);
       }
-      glBindTexture(GL_TEXTURE_2D, this->textures[i]->getTexture());
-    }
+      glBindTexture(GL_TEXTURE_2D, this->textures[i].getTexture());
   }
   Material::selectedMaterial = this;
@@ -333,13 +316,10 @@
 // MAPPING //
 
-void Material::setDiffuseMap(Texture* texture, unsigned int textureNumber)
+void Material::setDiffuseMap(const Texture& texture, unsigned int textureNumber)
 {
   assert(textureNumber < Material::getMaxTextureUnits());
 
-  if (this->textures.size() > textureNumber && this->textures[textureNumber] != NULL)
-    ResourceManager::getInstance()->unload(this->textures[textureNumber]);
-
   if (this->textures.size() <= textureNumber)
-    this->textures.resize(textureNumber+1, NULL);
+    this->textures.resize(textureNumber+1, Texture());
 
   //! @todo check if RESOURCE MANAGER is availiable
@@ -357,9 +337,6 @@
 
   PRINTF(5)("setting Diffuse Map %s\n", dMap.c_str());
-  if (this->textures.size() > textureNumber && this->textures[textureNumber] != NULL)
-    ResourceManager::getInstance()->unload(this->textures[textureNumber]);
-
   if (this->textures.size() <= textureNumber)
-    this->textures.resize(textureNumber+1, NULL);
+    this->textures.resize(textureNumber+1, Texture());
 
   //! @todo check if RESOURCE MANAGER is availiable
@@ -367,14 +344,14 @@
   {
 
-    this->textures[textureNumber] = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target);
+    this->textures[textureNumber] = *(Texture*)ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target);
   }
   else
   {
-    this->textures[textureNumber] = NULL;
-  }
-}
-
-/**
- *  Sets the Materials Diffuse Map
+    this->textures[textureNumber] = Texture();
+  }
+}
+
+/**
+ * @brief Sets the Materials Diffuse Map
  * @param surface pointer to SDL_Surface which shall be used as texture
 */
@@ -384,24 +361,21 @@
 
 
-  if (this->textures.size() > textureNumber && this->textures[textureNumber] != NULL)
-    ResourceManager::getInstance()->unload(this->textures[textureNumber]);
-
   if (this->textures.size() <= textureNumber)
-    this->textures.resize(textureNumber+1, NULL);
+    this->textures.resize(textureNumber+1, Texture());
 
   if(surface != NULL)
   {
-    this->textures[textureNumber] = new Texture(surface, GL_TEXTURE_2D);
+    this->textures[textureNumber] = Texture(surface, GL_TEXTURE_2D);
   }
   else
   {
-    this->textures[textureNumber] = NULL;
-  }
-
-}
-
-
-/**
- *  Sets the Materials Ambient Map
+    this->textures[textureNumber] = Texture();
+  }
+
+}
+
+
+/**
+ * @brief Sets the Materials Ambient Map
  * @param aMap the Name of the Image to Use
    @todo implement this
@@ -414,5 +388,5 @@
 
 /**
- *  Sets the Materials Specular Map
+ * @brief Sets the Materials Specular Map
  * @param sMap the Name of the Image to Use
    @todo implement this
@@ -425,7 +399,7 @@
 
 /**
- *  Sets the Materials Bumpiness
+ * @brief Sets the Materials Bumpiness
  * @param bump the Name of the Image to Use
-   @todo implemet this
+ * @todo implemet this
 */
 void Material::setBump(const std::string& bump)
Index: /trunk/src/lib/graphics/importer/material.h
===================================================================
--- /trunk/src/lib/graphics/importer/material.h	(revision 7787)
+++ /trunk/src/lib/graphics/importer/material.h	(revision 7788)
@@ -53,5 +53,5 @@
 
     // MAPPING //
-    void setDiffuseMap(Texture* texture, unsigned int textureNumber = 0);
+    void setDiffuseMap(const Texture& texture, unsigned int textureNumber = 0);
     void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
     void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
@@ -60,5 +60,5 @@
     void setSpecularMap(const std::string& sMap, GLenum target = GL_TEXTURE_2D);
     void setBump(const std::string& bump);
-    GLuint getDiffuseTexture(unsigned int i = 0) const { return (this->textures.size() > i)? this->textures[i]->getTexture() : 0; };
+    GLuint getDiffuseTexture(unsigned int i = 0) const { return (this->textures.size() > i)? this->textures[i].getTexture() : 0; };
 
     static void addTexturePath(const std::string& pathName);
@@ -81,5 +81,5 @@
     GLenum           tFactor;
 
-    std::vector<Texture*> textures;    //!< An Array of Textures.
+    std::vector<Texture> textures;    //!< An Array of Textures.
 
     Texture*         ambientTexture;   //!< The ambient texture of the Material.
Index: /trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- /trunk/src/lib/graphics/importer/texture.cc	(revision 7787)
+++ /trunk/src/lib/graphics/importer/texture.cc	(revision 7788)
@@ -103,4 +103,10 @@
 
 
+Texture::Texture(const Texture& texture)
+  : data(texture.data)
+{
+  this->setClassID(CL_TEXTURE, "Texture");
+  this->priority = 0.5;
+}
 
 
Index: /trunk/src/lib/graphics/importer/texture.h
===================================================================
--- /trunk/src/lib/graphics/importer/texture.h	(revision 7787)
+++ /trunk/src/lib/graphics/importer/texture.h	(revision 7788)
@@ -30,9 +30,8 @@
     bool loadSurface(SDL_Surface* surface, GLenum target = GL_TEXTURE_2D);
 
-
-
     bool rebuild();
 
     bool setSurface(SDL_Surface* newSurface);
+    /** @returns true if the Surface has an Alpha Value. */
     bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; };
     bool setTexture(GLuint texture);
@@ -49,6 +48,5 @@
 {
 public:
-
-public:
+  Texture(const Texture& texture);
   Texture(GLenum target = GL_TEXTURE_2D);
   Texture(const std::string& imageName, GLenum target = GL_TEXTURE_2D);
