Index: /branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc	(revision 8563)
+++ /branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc	(revision 8564)
@@ -48,4 +48,8 @@
 
     this->tmpNormal = new MD3Normal[2048];                    //!< the temporary normals
+
+    this->tmpMatrix = new float*[this->md3Data->tagNum];
+    for( int i = 0; i < this->md3Data->tagNum; i++)
+      this->tmpMatrix[i] = new float[16];
   }
 
@@ -55,5 +59,8 @@
   {
     delete this->tmpBoneFrame;
-    delete [] this->tmpMesh;
+//     delete [] this->tmpMesh;
+
+    ///TODO deleting mesh
+    ///TODO deleting matrices
   }
 
@@ -124,4 +131,5 @@
     // draw all models linked to this model
     std::map<int, MD3Data*>::iterator it = data->sortedMap.begin();
+    int i = 0;
     while( it != data->sortedMap.end())
     {
@@ -137,5 +145,5 @@
         //we need to interpolate
         MD3Tag* nextFrameTag = data->boneFrames[data->animationState.nextFrame]->tags[child->parentTagIndex];
-        m = this->interpolateTransformation(currFrameTag, nextFrameTag, data->animationState.interpolationFraction);
+        m = this->interpolateTransformation(currFrameTag, nextFrameTag, data->animationState.interpolationFraction, i);
           }
           else {
@@ -168,4 +176,5 @@
 
           glPopMatrix();
+          i++;
     }
   }
@@ -232,4 +241,5 @@
       }
 
+
       // draw vertex normals if needed
       if( this->bDrawNormals) {
@@ -261,5 +271,5 @@
         //we need to interpolate
         MD3Tag* nextFrameTag = data->boneFrames[data->animationState.nextFrame]->tags[child->parentTagIndex];
-        m = this->interpolateTransformation(currFrameTag, nextFrameTag, data->animationState.interpolationFraction);
+//         m = this->interpolateTransformation(currFrameTag, nextFrameTag, data->animationState.interpolationFraction);
       }
       else {
@@ -464,5 +474,5 @@
    * interpolate transformation
    */
-  float* MD3Model::interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac)
+  float* MD3Model::interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac, int i)
   {
     // interpolate position
@@ -481,22 +491,22 @@
 
     // quaternion code is column based, so use transposed matrix when spitting out to gl
-    this->tmpMatrix[0] = interpolatedMatrix[0][0];
-    this->tmpMatrix[4] = interpolatedMatrix[1][0];
-    this->tmpMatrix[8] = interpolatedMatrix[2][0];
-    this->tmpMatrix[12] = interpolatedPosition.x;
-    this->tmpMatrix[1] = interpolatedMatrix[0][1];
-    this->tmpMatrix[5] = interpolatedMatrix[1][1];
-    this->tmpMatrix[9] = interpolatedMatrix[2][1];
-    this->tmpMatrix[13] = interpolatedPosition.y;
-    this->tmpMatrix[2] = interpolatedMatrix[0][2];
-    this->tmpMatrix[6] = interpolatedMatrix[1][2];
-    this->tmpMatrix[10]= interpolatedMatrix[2][2];
-    this->tmpMatrix[14] = interpolatedPosition.z;
-    this->tmpMatrix[3] = 0.0f;
-    this->tmpMatrix[7] = 0.0f;
-    this->tmpMatrix[11]= 0.0f;
-    this->tmpMatrix[15] = 1.0f;
-
-    return this->tmpMatrix;
+    this->tmpMatrix[i][0] = interpolatedMatrix[0][0];
+    this->tmpMatrix[i][4] = interpolatedMatrix[1][0];
+    this->tmpMatrix[i][8] = interpolatedMatrix[2][0];
+    this->tmpMatrix[i][12] = interpolatedPosition.x;
+    this->tmpMatrix[i][1] = interpolatedMatrix[0][1];
+    this->tmpMatrix[i][5] = interpolatedMatrix[1][1];
+    this->tmpMatrix[i][9] = interpolatedMatrix[2][1];
+    this->tmpMatrix[i][13] = interpolatedPosition.y;
+    this->tmpMatrix[i][2] = interpolatedMatrix[0][2];
+    this->tmpMatrix[i][6] = interpolatedMatrix[1][2];
+    this->tmpMatrix[i][10]= interpolatedMatrix[2][2];
+    this->tmpMatrix[i][14] = interpolatedPosition.z;
+    this->tmpMatrix[i][3] = 0.0f;
+    this->tmpMatrix[i][7] = 0.0f;
+    this->tmpMatrix[i][11]= 0.0f;
+    this->tmpMatrix[i][15] = 1.0f;
+
+    return this->tmpMatrix[i];
 
   }
Index: /branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h	(revision 8563)
+++ /branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h	(revision 8564)
@@ -49,5 +49,5 @@
     sVec3D* interpolateMeshFrame(sVec3D* currMeshFrame, sVec3D* nextMeshFrame, float frac, MD3Mesh* mesh, int i);
     MD3Normal* interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac, MD3Mesh* mesh);
-    float* interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac);
+    float* interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac, int i);
 
   private:
@@ -60,5 +60,5 @@
     sVec3D**            tmpMesh;           //!< a temporary mesh frame
     MD3Normal*          tmpNormal;         //!< a temporary normals frame
-    float               tmpMatrix[16];     //!< a temporary matrix
+    float**             tmpMatrix;         //!< a temporary matrix
     Vector              tmpVec1;
     Vector              tmpVec2;
