Index: /branches/new_class_id/src/lib/graphics/importer/Makefile.am
===================================================================
--- /branches/new_class_id/src/lib/graphics/importer/Makefile.am	(revision 9823)
+++ /branches/new_class_id/src/lib/graphics/importer/Makefile.am	(revision 9824)
@@ -33,4 +33,5 @@
 		\
 		md2/md2Model.cc \
+		md2/resource_md2.cc \
 		\
 		md3/md3_model.cc \
@@ -77,4 +78,5 @@
 		\
                 md2/md2Model.h \
+		md2/resource_md2.h \
                 \
                 md3/md3_model.h \
Index: /branches/new_class_id/src/lib/graphics/importer/md2/md2Model.cc
===================================================================
--- /branches/new_class_id/src/lib/graphics/importer/md2/md2Model.cc	(revision 9823)
+++ /branches/new_class_id/src/lib/graphics/importer/md2/md2Model.cc	(revision 9824)
@@ -19,5 +19,5 @@
 
 #include "debug.h"
-#include "util/loading/resource_manager.h"
+#include "resource_md2.h"
 
 
@@ -26,11 +26,11 @@
 //! the model anorms
 sVec3D MD2Model::anorms[NUM_VERTEX_NORMALS] = {
- #include "anorms.h"
-};
+#include "anorms.h"
+    };
 
 //! anormal dots, no idea of how this shall work, but it does
 float MD2Model::anormsDots[SHADEDOT_QUANT][256] = {
-  #include "anormtab.h"
-};
+#include "anormtab.h"
+    };
 
 
@@ -42,5 +42,5 @@
 sAnim MD2Model::animationList[22] =
   {
- // begin, end, fps, interruptable
+    // begin, end, fps, interruptable
     {   0,  39,  9, 1 },   //!< STAND
     {  40,  45, 10, 1 },   //!< RUN
@@ -73,28 +73,36 @@
  ********************************************************************************/
 
+MD2Model::MD2Model()
+  : data(new MD2Data())
+{
+  this->init();
+}
+
+#include "resource_md2.h"
 /**
   \brief simple constructor initializing all variables
 */
 MD2Model::MD2Model(const std::string& modelFileName, const std::string& skinFileName, float scale)
-{
-  this->registerObject(this, MD2Model::_objectList);
-  /* this creates the data container via ressource manager */
-  if (!modelFileName.empty())
-    this->data = (MD2Data*)ResourceManager::getInstance()->load(modelFileName, MD2, RP_GAME, skinFileName, scale);
-  if( unlikely(this->data == NULL))
-    PRINTF(0)("The model was not found, MD2Model Loader finished abnormaly. Update the data-repos\n");
-
+    : data(new MD2Data())
+{
+  this->init();
   this->scaleFactor = scale;
-  this->animationSpeed = 1.0f;
-
-  shadeDots = MD2Model::anormsDots[0];
-  /* set the animation stat mannualy */
-  this->animationState.type = STAND;
-  this->animationState.numPlays = 1;
-  this->setAnimation(STAND);
+
+  this->data = ResourceMD2(modelFileName, skinFileName, scale).data;
+  rebuildInfo();
 
   this->debug();
-
-    //write the modelinfo information
+}
+
+MD2Model& MD2Model::operator=(const MD2Model& md2model)
+{
+  this->data = md2model.data;
+  rebuildInfo();
+  return *this;
+}
+
+void MD2Model::rebuildInfo()
+{
+  //write the modelinfo information
   this->pModelInfo.numVertices = this->data->numVertices;
   this->pModelInfo.numTriangles = this->data->numTriangles;
@@ -107,4 +115,6 @@
 
   // triangle conversion
+  if (this->pModelInfo.pTriangles != NULL)
+    delete[] this->pModelInfo.pTriangles;
   this->pModelInfo.pTriangles = new sTriangleExt[this->data->numTriangles];
   for( int i = 0; i < this->data->numTriangles; i++)
@@ -118,4 +128,9 @@
     this->pModelInfo.pTriangles[i].indexToTexCoor[2] = this->data->pTriangles[i].indexToTexCoor[2];
   }
+}
+
+bool MD2Model::load(const std::string& modelFileName, const std::string& skinFileName, float scale)
+{
+  this->data = MD2Data::Pointer(new MD2Data(modelFileName, skinFileName, scale));
 }
 
@@ -132,8 +147,23 @@
   this->pModelInfo.pTexCoor = NULL;
   this->pModelInfo.pTriangles = NULL;
-
-  ResourceManager::getInstance()->unload(this->data);
-}
-
+}
+
+
+void MD2Model::init()
+{
+  this->registerObject(this, MD2Model::_objectList);
+  /* this creates the data container via ressource manager */
+  if( unlikely(this->data.isNull()))
+    PRINTF(0)("The model was not found, MD2Model Loader finished abnormaly. Update the data-repos\n");
+
+  this->scaleFactor = 1.0f;
+  this->animationSpeed = 1.0f;
+
+  shadeDots = MD2Model::anormsDots[0];
+  /* set the animation stat mannualy */
+  this->animationState.type = STAND;
+  this->animationState.numPlays = 1;
+  this->setAnimation(STAND);
+}
 
 /**
@@ -153,9 +183,9 @@
 
   for( int i = 0; i < this->data->numVertices; ++i)
-    {
-      this->verticesList[i][0] = currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0]);
-      this->verticesList[i][1] = currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1]);
-      this->verticesList[i][2] = currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2]);
-    }
+  {
+    this->verticesList[i][0] = currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0]);
+    this->verticesList[i][1] = currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1]);
+    this->verticesList[i][2] = currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2]);
+  }
 }
 
@@ -259,24 +289,24 @@
   /* draw the triangles */
   while( int i = *(pCommands++)) /* strange looking while loop for maximum performance */
+  {
+    if( i < 0)
     {
-      if( i < 0)
-        {
-          glBegin(GL_TRIANGLE_FAN);
-          i = -i;
-        }
-      else
-        {
-          glBegin(GL_TRIANGLE_STRIP);
-        }
-
-      for(; i > 0; i--, pCommands += 3) /* down counting for loop, next 3 gl commands */
-        {
-          glTexCoord2f( ((float *)pCommands)[0], ((float *)pCommands)[1] );
-          glNormal3fv(anorms[this->data->pLightNormals[pCommands[2]]]);
-          glVertex3fv(this->verticesList[pCommands[2]]);
-        }
-      glEnd();
-
+      glBegin(GL_TRIANGLE_FAN);
+      i = -i;
     }
+    else
+    {
+      glBegin(GL_TRIANGLE_STRIP);
+    }
+
+    for(; i > 0; i--, pCommands += 3) /* down counting for loop, next 3 gl commands */
+    {
+      glTexCoord2f( ((float *)pCommands)[0], ((float *)pCommands)[1] );
+      glNormal3fv(anorms[this->data->pLightNormals[pCommands[2]]]);
+      glVertex3fv(this->verticesList[pCommands[2]]);
+    }
+    glEnd();
+
+  }
   glDisable(GL_CULL_FACE);
   glPopAttrib();
@@ -289,11 +319,11 @@
   int* pCommands = this->data->pGLCommands;
   /* some face culling stuff */
-//   glPushAttrib(GL_POLYGON_BIT);
-//   glFrontFace(GL_CW);
-//   glEnable(GL_CULL_FACE);
-//   glCullFace(GL_BACK);
-//
-//   this->processLighting();
-//   this->interpolate(/*this->verticesList*/);
+  //   glPushAttrib(GL_POLYGON_BIT);
+  //   glFrontFace(GL_CW);
+  //   glEnable(GL_CULL_FACE);
+  //   glCullFace(GL_BACK);
+  //
+  //   this->processLighting();
+  //   this->interpolate(/*this->verticesList*/);
   this->data->material.select();
 
@@ -337,31 +367,31 @@
 
   if( this->animationState.localTime - this->animationState.lastTime > (1.0f / this->animationState.fps))
+  {
+    this->animationState.currentFrame = this->animationState.nextFrame;
+    this->animationState.nextFrame++;
+
+    if( this->animationState.nextFrame > this->animationState.endFrame )
     {
-      this->animationState.currentFrame = this->animationState.nextFrame;
-      this->animationState.nextFrame++;
-
-      if( this->animationState.nextFrame > this->animationState.endFrame )
+      if( this->animationState.animPlaybackMode == MD2_ANIM_LOOP)
       {
-        if( this->animationState.animPlaybackMode == MD2_ANIM_LOOP)
-        {
-          this->animationState.nextFrame = this->animationState.startFrame;
-          this->animationState.numPlays++;
-        }
-        else
-        {
-          this->animationState.nextFrame = this->animationState.endFrame;
-        }
+        this->animationState.nextFrame = this->animationState.startFrame;
+        this->animationState.numPlays++;
       }
-      this->animationState.lastTime = this->animationState.localTime;
+      else
+      {
+        this->animationState.nextFrame = this->animationState.endFrame;
+      }
     }
-
-//     if( this->animationState.currentFrame > (this->data->numFrames - 1) )
-//       this->animationState.currentFrame = 0;
-
-//     if( (this->animationState.nextFrame > (this->data->numFrames - 1)) && this->animationState.animPlaybackMode == MD2_ANIM_LOOP)
-//     this->animationState.nextFrame = 0;
+    this->animationState.lastTime = this->animationState.localTime;
+  }
+
+  //     if( this->animationState.currentFrame > (this->data->numFrames - 1) )
+  //       this->animationState.currentFrame = 0;
+
+  //     if( (this->animationState.nextFrame > (this->data->numFrames - 1)) && this->animationState.animPlaybackMode == MD2_ANIM_LOOP)
+  //     this->animationState.nextFrame = 0;
 
   this->animationState.interpolationState = this->animationState.fps *
-    (this->animationState.localTime - this->animationState.lastTime);
+      (this->animationState.localTime - this->animationState.lastTime);
 }
 
@@ -390,5 +420,5 @@
   PRINT(0)("=  Number of Frames: \t%i\n", this->data->header->numFrames);
   PRINT(0)("=  Height, Width:\t%i, %i\n", this->data->header->skinHeight, this->data->header->skinWidth);
-  PRINT(0)("=  Pointer to the data object: %p\n", this->data);
+  //PRINT(0)("=  Pointer to the data object: %p\n", this->data);
   PRINT(0)("===================================================\n\n");
 }
@@ -399,4 +429,9 @@
  ********************************************************************************/
 
+MD2Data::MD2Data()
+{
+  this->init();
+}
+
 /**
   \brief simple constructor
@@ -404,10 +439,19 @@
 MD2Data::MD2Data(const std::string& modelFileName, const std::string& skinFileName, float scale)
 {
-  scale *= 0.1f;
-
+  this->init();
+  this->scaleFactor = scale;
+
+  this->loadModel(modelFileName);
+  this->loadSkin(skinFileName);
+}
+
+void MD2Data::init()
+{
+  this->scaleFactor = 1.0;
   this->pVertices = NULL;
   this->pGLCommands = NULL;
   this->pLightNormals = NULL;
   this->pTexCoor = NULL;
+  this->header = NULL;
 
   this->numFrames = 0;
@@ -415,14 +459,5 @@
   this->numGLCommands = 0;
   this->numTexCoor = 0;
-
-//   this->scaleFactor = 1.0f;
-  this->scaleFactor = scale;
-
-  this->fileName = "";
-  this->skinFileName = "";
-  this->loadModel(modelFileName);
-  this->loadSkin(skinFileName);
-}
-
+}
 
 /**
@@ -462,16 +497,16 @@
   pFile = fopen(fileName.c_str(), "rb");
   if( unlikely(!pFile))
-    {
-      PRINTF(1)("Couldn't open the MD2 File for loading. Exiting.\n");
-      return false;
-    }
+  {
+    PRINTF(1)("Couldn't open the MD2 File for loading. Exiting.\n");
+    return false;
+  }
   this->header = new MD2Header;
   fread(this->header, 1, sizeof(MD2Header), pFile);
   /* check for the header version: make sure its a md2 file :) */
   if( unlikely(this->header->version != MD2_VERSION) && unlikely(this->header->ident != MD2_IDENT))
-    {
-      PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str());
-      return false;
-    }
+  {
+    PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str());
+    return false;
+  }
 
   this->fileName =fileName;
@@ -506,22 +541,22 @@
 
   for(int i = 0; i < this->numFrames; ++i)
+  {
+    frame = (sFrame*)(buffer + this->header->frameSize * i);
+    pVertex = this->pVertices + this->numVertices  * i;
+    pNormals = this->pLightNormals + this->numVertices * i;
+
+    for(int j = 0; j < this->numVertices; ++j)
     {
-      frame = (sFrame*)(buffer + this->header->frameSize * i);
-      pVertex = this->pVertices + this->numVertices  * i;
-      pNormals = this->pLightNormals + this->numVertices * i;
-
-      for(int j = 0; j < this->numVertices; ++j)
-        {
-          /* SPEEDUP: *(pVerts + i + 0) = (*(frame->pVertices + i + 0)...  */
-           pVertex[j][0] = ((frame->pVertices[j].v[0] * frame->scale[0] ) + frame->translate[0] )* this->scaleFactor;
-           pVertex[j][1] = ((frame->pVertices[j].v[2] * frame->scale[2]) + frame->translate[2]) * this->scaleFactor;
-           pVertex[j][2] = (-1.0 * (frame->pVertices[j].v[1] * frame->scale[1] + frame->translate[1])) * this->scaleFactor;
-
-          //printf("vertex %i/%i: (%f, %f, %f)\n", j, this->numVertices, pVertex[j][0], pVertex[j][1], pVertex[j][2]);
-
-          pNormals[j] = frame->pVertices[j].lightNormalIndex;
-        }
+      /* SPEEDUP: *(pVerts + i + 0) = (*(frame->pVertices + i + 0)...  */
+      pVertex[j][0] = ((frame->pVertices[j].v[0] * frame->scale[0] ) + frame->translate[0] )* this->scaleFactor;
+      pVertex[j][1] = ((frame->pVertices[j].v[2] * frame->scale[2]) + frame->translate[2]) * this->scaleFactor;
+      pVertex[j][2] = (-1.0 * (frame->pVertices[j].v[1] * frame->scale[1] + frame->translate[1])) * this->scaleFactor;
+
+      //printf("vertex %i/%i: (%f, %f, %f)\n", j, this->numVertices, pVertex[j][0], pVertex[j][1], pVertex[j][2]);
+
+      pNormals[j] = frame->pVertices[j].lightNormalIndex;
     }
-    PRINTF(4)("Finished loading the md2 file\n");
+  }
+  PRINTF(4)("Finished loading the md2 file\n");
 
   delete [] buffer;
@@ -538,8 +573,8 @@
 {
   if( fileName.empty())
-    {
-      this->skinFileName = "";
-      return false;
-    }
+  {
+    this->skinFileName = "";
+    return false;
+  }
 
   this->skinFileName = fileName;
Index: /branches/new_class_id/src/lib/graphics/importer/md2/md2Model.h
===================================================================
--- /branches/new_class_id/src/lib/graphics/importer/md2/md2Model.h	(revision 9823)
+++ /branches/new_class_id/src/lib/graphics/importer/md2/md2Model.h	(revision 9824)
@@ -20,4 +20,5 @@
 
 #include "base_object.h"
+#include "count_pointer.h"
 
 #include "interactive_model.h"
@@ -45,24 +46,24 @@
 struct MD2Header
 {
-   int ident;                           //!< This is used to identify the file
-   int version;                         //!< The version number of the file (Must be 8)
-
-   int skinWidth;                       //!< The skin width in pixels
-   int skinHeight;                      //!< The skin height in pixels
-   int frameSize;                       //!< The size in bytes the frames are
-
-   int numSkins;                        //!< The number of skins associated with the model
-   int numVertices;                     //!< The number of vertices (constant for each frame)
-   int numTexCoords;                    //!< The number of texture coordinates
-   int numTriangles;                    //!< The number of faces (polygons)
-   int numGlCommands;                   //!< The number of gl commands
-   int numFrames;                       //!< The number of animation frames
-
-   int offsetSkins;                     //!< The offset in the file for the skin data
-   int offsetTexCoords;                 //!< The offset in the file for the texture data
-   int offsetTriangles;                 //!< The offset in the file for the face data
-   int offsetFrames;                    //!< The offset in the file for the frames data
-   int offsetGlCommands;                //!< The offset in the file for the gl commands data
-   int offsetEnd;                       //!< The end of the file offset
+  int ident;                           //!< This is used to identify the file
+  int version;                         //!< The version number of the file (Must be 8)
+
+  int skinWidth;                       //!< The skin width in pixels
+  int skinHeight;                      //!< The skin height in pixels
+  int frameSize;                       //!< The size in bytes the frames are
+
+  int numSkins;                        //!< The number of skins associated with the model
+  int numVertices;                     //!< The number of vertices (constant for each frame)
+  int numTexCoords;                    //!< The number of texture coordinates
+  int numTriangles;                    //!< The number of faces (polygons)
+  int numGlCommands;                   //!< The number of gl commands
+  int numFrames;                       //!< The number of animation frames
+
+  int offsetSkins;                     //!< The offset in the file for the skin data
+  int offsetTexCoords;                 //!< The offset in the file for the texture data
+  int offsetTriangles;                 //!< The offset in the file for the face data
+  int offsetFrames;                    //!< The offset in the file for the frames data
+  int offsetGlCommands;                //!< The offset in the file for the gl commands data
+  int offsetEnd;                       //!< The end of the file offset
 };
 
@@ -70,30 +71,30 @@
 //! animation names enumeration
 typedef enum MD2animType
-  {
-    STAND,                       //0
-    RUN,                         //1
-    ATTACK,                      //2
-    PAIN_A,                      //3
-    PAIN_B,                      //4
-    PAIN_C,          //5
-    JUMP,            //6
-    FLIP,            //7
-    SALUTE,          //8
-    FALLBACK,        //9
-    WAVE,            //10
-    POINT,           //11
-    CROUCH_STAND,
-    CROUCH_WALK,
-    CROUCH_ATTACK,
-    CROUCH_PAIN,
-    CROUCH_DEATH,
-    DEATH_FALLBACK,
-    DEATH_FALLFORWARD,
-    DEATH_FALLBACKSLOW,
-    BOOM,
-    WALK,
-
-    MAX_ANIMATIONS
-  };
+{
+  STAND,                       //0
+  RUN,                         //1
+  ATTACK,                      //2
+  PAIN_A,                      //3
+  PAIN_B,                      //4
+  PAIN_C,          //5
+  JUMP,            //6
+  FLIP,            //7
+  SALUTE,          //8
+  FALLBACK,        //9
+  WAVE,            //10
+  POINT,           //11
+  CROUCH_STAND,
+  CROUCH_WALK,
+  CROUCH_ATTACK,
+  CROUCH_PAIN,
+  CROUCH_DEATH,
+  DEATH_FALLBACK,
+  DEATH_FALLFORWARD,
+  DEATH_FALLBACKSLOW,
+  BOOM,
+  WALK,
+
+  MAX_ANIMATIONS
+};
 
 
@@ -116,13 +117,17 @@
 class MD2Data : public BaseObject
 {
- public:
-   MD2Data(const std::string& modelFileName, const std::string& skinFileName, float scale = 1.0f);
+public:
+  typedef CountPointer<MD2Data>    Pointer;
+public:
+  MD2Data();
+  MD2Data(const std::string& modelFileName, const std::string& skinFileName, float scale = 1.0f);
   virtual ~MD2Data();
 
- private:
-   bool loadModel(const std::string& fileName);
-   bool loadSkin(const std::string& fileName = "");
-
- public:
+private:
+  void init();
+  bool loadModel(const std::string& fileName);
+  bool loadSkin(const std::string& fileName = "");
+
+public:
   int                numFrames;             //!< number of frames
   int                numVertices;           //!< number of vertices
@@ -148,9 +153,15 @@
 
 //! This is a MD2 Model class
-class MD2Model : public InteractiveModel {
+class MD2Model : public InteractiveModel
+{
   ObjectListDeclaration(MD2Model);
 public:
+  MD2Model();
   MD2Model(const std::string& modelFileName, const std::string& skinFileName = "", float scale = 1.0f);
   virtual ~MD2Model();
+
+  MD2Model& operator=(const MD2Model& md2model);
+
+  bool load(const std::string& modelFileName, const std::string& skinFileName = "", float scale = 1.0f);
 
   virtual void draw() const;
@@ -162,8 +173,11 @@
   inline int getAnimation() { return this->animationState.type; }
   virtual void setAnimationSpeed(float speed) { this->animationSpeed = speed; }
-  virtual bool isAnimationFinished() { return (this->animationState.currentFrame == this->animationState.endFrame )?true:false; }
+virtual bool isAnimationFinished() { return (this->animationState.currentFrame == this->animationState.endFrame )?true:false; }
   /**  scales the current model @param scaleFactor: the factor [0..1] to use for scaling */
   void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;}
 
+
+  void acquireData(const MD2Data::Pointer& data) { this->data = data; rebuildInfo(); };
+  const MD2Data::Pointer& dataPointer() const { return this->data; };
   virtual void tick(float dtS);
   void debug();
@@ -171,4 +185,7 @@
 
 private:
+  void init();
+  void rebuildInfo();
+
   void animate(float time);
   void processLighting();
@@ -177,19 +194,19 @@
 
 
- public:
+public:
   /* these variables are static, because they are all the same for every model */
-  static sVec3D       anorms[NUM_VERTEX_NORMALS];       //!< the anormals
-  static float        anormsDots[SHADEDOT_QUANT][256];  //!< the anormals dot products
-  static sAnim        animationList[22];                //!< the anomation list
-   //! again one of these strange id software parts
-  float*              shadeDots;
-
-  MD2Data*            data;                             //!< the md2 data pointer
-
- private:
-  float               scaleFactor;                      //!< the scale factor (individual)
-  float               animationSpeed;                   //!< the speed of the animation (factor for the time)
-  sAnimState          animationState;                   //!< animation state of the model
-  sVec3D              verticesList[MD2_MAX_VERTICES];   //!< place to temp sav the vert
+  static sVec3D         anorms[NUM_VERTEX_NORMALS];       //!< the anormals
+  static float          anormsDots[SHADEDOT_QUANT][256];  //!< the anormals dot products
+  static sAnim          animationList[22];                //!< the anomation list
+  //! again one of these strange id software parts
+  float*                shadeDots;
+
+  CountPointer<MD2Data> data;                           //!< the md2 data pointer
+
+private:
+  float                 scaleFactor;                      //!< the scale factor (individual)
+  float                 animationSpeed;                   //!< the speed of the animation (factor for the time)
+  sAnimState            animationState;                   //!< animation state of the model
+  sVec3D                verticesList[MD2_MAX_VERTICES];   //!< place to temp sav the vert
 };
 
Index: /branches/new_class_id/src/lib/graphics/importer/md2/resource_md2.cc
===================================================================
--- /branches/new_class_id/src/lib/graphics/importer/md2/resource_md2.cc	(revision 9824)
+++ /branches/new_class_id/src/lib/graphics/importer/md2/resource_md2.cc	(revision 9824)
@@ -0,0 +1,61 @@
+
+#include "resource_md2.h"
+#include "substring.h"
+#include "multi_type.h"
+#include "debug.h"
+
+
+ResourceMD2::ResourceMD2(const std::string& modelName, const std::string& skinName, float scale)
+    : NewResource(&ResourceMD2::type)
+{
+  Resources::StorePointer* ptr = this->acquireResource(loadString(modelName, skinName, scale));
+
+  if (ptr)
+  {
+    PRINTF(5)("FOUND MD2: %s\n", modelName.c_str());
+    this->acquireData(static_cast<ResourceMD2::MD2ResourcePointer*>(ptr)->ptr());
+  }
+  else
+  {
+    PRINTF(5)("NOT FOUND MD2: %s\n", modelName.c_str());
+    std::string modelFileName = this->NewResource::locateFile(modelName);
+    std::string skinFileName = this->NewResource::locateFile(skinName);
+    this->MD2Model::load(modelFileName, skinFileName, scale);
+    this->NewResource::addResource(new ResourceMD2::MD2ResourcePointer(loadString(modelName, skinName, scale), Resources::KeepLevel(0), this->MD2Model::dataPointer()));
+  }
+
+}
+
+ResourceMD2 ResourceMD2::createFromString(const std::string& loadString)
+{
+  SubString loadValues(loadString, ',');
+  std::string modelName;
+  std::string skinName;
+  float scale = 1.0f;
+  if (loadValues.size() > 0)
+    modelName = loadValues[0];
+  if (loadValues.size() > 1)
+    skinName = loadValues[1];
+  if (loadValues.size() > 2)
+    scale = MultiType(loadValues[2]).getFloat();
+
+  return ResourceMD2(modelName, skinName, scale);
+}
+
+std::string ResourceMD2::loadString(const std::string& modelName, const std::string& skinName, float scale)
+{
+  return modelName + ',' + skinName + ',' + MultiType(scale).getString();
+}
+
+
+Resources::tType<ResourceMD2> ResourceMD2::type("MD2");
+
+
+
+
+
+ResourceMD2::MD2ResourcePointer::MD2ResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const MD2Data::Pointer& data)
+    : Resources::StorePointer(loadString, keepLevel) , pointer(data)
+{}
+
+
Index: /branches/new_class_id/src/lib/graphics/importer/md2/resource_md2.h
===================================================================
--- /branches/new_class_id/src/lib/graphics/importer/md2/resource_md2.h	(revision 9824)
+++ /branches/new_class_id/src/lib/graphics/importer/md2/resource_md2.h	(revision 9824)
@@ -0,0 +1,36 @@
+/*!
+ * @file resource_md2.h
+ * @brief Contains the ResourceMD2 class, that handles the Resource-specific loading part of the MD2.
+ *
+ */
+
+#ifndef _RESOURCE_MD2_H
+#define _RESOURCE_MD2_H
+
+#include "util/loading/resource.h"
+#include "md2Model.h"
+
+
+class ResourceMD2 : public MD2Model, public Resources::NewResource
+{
+public:
+  ResourceMD2(const std::string& modelName, const std::string& skinName = "", float scale = 1.0f);
+  static ResourceMD2 createFromString(const std::string& loadString);
+  static std::string loadString(const std::string& modelName, const std::string& skinName = "", float scale = 1.0f);
+
+private:
+class MD2ResourcePointer : public Resources::StorePointer
+  {
+  public:
+    MD2ResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const MD2Data::Pointer& data);
+    inline const MD2Data::Pointer& ptr() const { return pointer; }
+private:
+    MD2Data::Pointer pointer;
+  };
+
+private:
+  static Resources::tType<ResourceMD2> type;
+};
+
+
+#endif /* _RESOURCE_MD2_H */
