Index: branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc	(revision 8547)
+++ branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc	(revision 8549)
@@ -38,5 +38,6 @@
 {
 
-
+  this->parentTagIndex = -1;
+  this->parent = NULL;
 
   this->loadModel(modelFileName);
@@ -55,4 +56,17 @@
 }
 
+
+/**
+ * link a model at the specified tag position to this model. if the position is allready
+ * occupied, the old submodel will be replaced
+ *
+ *  @param tagIndex: tag to link the submodel to
+ *  @param child: the submodel that should be linked to this model
+ */
+void MD3Data::addLinkedModel(int tagIndex, MD3Data* child)
+{
+  this->sortedMap[tagIndex] = child;
+  child->parentTagIndex = tagIndex;
+}
 
 
Index: branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h	(revision 8547)
+++ branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h	(revision 8549)
@@ -69,4 +69,6 @@
   virtual ~MD3Data();
 
+  void addLinkedModel(int tagIndex, MD3Data* child);
+
 
  private:
@@ -85,7 +87,12 @@
    int readMeshVertices(FILE* pFile, int fileOffset, int mesh);
 
+
  public:
 
   MD3Header*          header;            //!< the header file
+
+  std::map<int, MD3Data*> sortedMap;         //!< map
+  int                 parentTagIndex;    //!< the tag index of the parent model
+  MD3Data*            parent;            //!< the parent model
 
   std::string         filename;          //!< the name of the file as recorded in the .md3 file
@@ -108,9 +115,4 @@
   MD3Mesh**           meshes;            //!< array of meshes in the model. each containing the mesh for each of the animation
 
-  int                 parentTagIndex;    //!< tag index
-
-  //MD3Model*           parent;            //!< reference to the MD3Model
-
-
 };
 
Index: branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc	(revision 8547)
+++ branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc	(revision 8549)
@@ -40,3 +40,91 @@
 
 
+
+  /**
+   * this draws the md3 model
+   */
+  void MD3Model::draw()
+  {
+    //draw current bone frame
+#if 0
+    if( this->bDrawBones)
+    {
+      //get bone frame, interpolate if necessary
+      if( model.interpolationFraction!=0.0 && model.currentFrame!=model.nextFrame)
+        //interpolate bone frame
+        drawBoneFrame(interpolateBoneFrame(model.boneFrames[model.currentFrame], model.boneFrames[model.nextFrame], model.interpolationFraction));
+      else
+        //stick with current bone frame
+        drawBoneFrame(model.boneFrames[model.currentFrame]);
+    }
+
+    //draw all meshes of current frame of this model
+    for (int i=0; i<model.meshNum; i++) {
+      MD3GLMesh mesh = (MD3GLMesh)model.meshes[i];
+
+      gl.glBlendFunc(mesh.GLSrcBlendFunc, mesh.GLDstBlendFunc);
+      gl.glDepthMask(mesh.GLDepthMask);
+      if (mesh.textureNum > 0 && mesh.textures[0]!=null)
+        gl.glBindTexture(GLEnum.GL_TEXTURE_2D, ((MD3GLTexture)mesh.textures[0]).bind);
+      else
+        gl.glBindTexture(GLEnum.GL_TEXTURE_2D, 0);
+
+      //get mesh frame, do interpolation if necessary
+      Vec3[] frame;
+      if (model.interpolationFraction!=0.0 && model.currentFrame!=model.nextFrame)
+        //interpolate mesh frame between the 2 current mesh frames
+        frame=interpolateMeshFrame(mesh.meshFrames[model.currentFrame], mesh.meshFrames[model.nextFrame], model.interpolationFraction);
+      else
+        //no interpolation needed, just draw current frame
+        frame=mesh.meshFrames[model.currentFrame];
+
+      drawMesh(mesh, frame);
+
+      //draw vertex normals
+      if (canvas.showVertexNormals) {
+                                //get vertex normals, interpolate if necessary
+        if (model.interpolationFraction!=0.0 && model.currentFrame!=model.nextFrame)
+                //interpolate vertex normals
+          drawVertexNormals(frame, interpolateVertexNormals(mesh.meshVertexNormals[model.currentFrame], mesh.meshVertexNormals[model.nextFrame], model.interpolationFraction));
+        else
+                //stick with current vertex normals
+          drawVertexNormals(frame, mesh.meshVertexNormals[model.currentFrame]);
+      }
+    }
+
+    //draw all models linked to this model
+
+    Iterator it=model.linkedModels();
+    while (it.hasNext()) {
+      MD3Model child=(MD3Model)it.next();
+
+      //build transformation array m from matrix, interpolate if necessary
+      float[] m=new float[16];
+      MD3Tag currFrameTag=model.boneFrames[model.currentFrame].tags[child.getParentTagIndex()];
+      if (model.interpolationFraction!=0.0f && model.currentFrame!=model.nextFrame) {
+        //we need to interpolate
+        MD3Tag nextFrameTag=model.boneFrames[model.nextFrame].tags[child.getParentTagIndex()];
+        m=interpolateTransformation(currFrameTag, nextFrameTag, model.interpolationFraction);
+      }
+      else {
+        //no interpolation needed, stay with last transformation
+              //OpenGL matrix is in column-major order
+        m[0] = currFrameTag.matrix[0][0]; m[4] = currFrameTag.matrix[0][1]; m[8] = currFrameTag.matrix[0][2]; m[12] = currFrameTag.position.x;
+        m[1] = currFrameTag.matrix[1][0]; m[5] = currFrameTag.matrix[1][1]; m[9] = currFrameTag.matrix[1][2]; m[13] = currFrameTag.position.y;
+        m[2] = currFrameTag.matrix[2][0]; m[6] = currFrameTag.matrix[2][1]; m[10]= currFrameTag.matrix[2][2]; m[14] = currFrameTag.position.z;
+        m[3] = 0.0f;                                              m[7] = 0.0f;                                              m[11]= 0.0f;                            m[15] = 1.0f;
+      }
+
+      //switch to child coord system and draw child
+      gl.glPushMatrix();
+      gl.glMultMatrixf(m);
+      child.accept(this);
+      gl.glPopMatrix();
+    }
+#endif
+  }
+
+
+
+
 }
Index: branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h	(revision 8547)
+++ branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h	(revision 8549)
@@ -26,9 +26,14 @@
     ~MD3Model();
 
+    virtual void setAnimation(int animNum, int playbackMode = 0) {}
+
     virtual void tick(float dt) {}
-    virtual void setAnimation(int animNum, int playbackMode = 0) {}
+
+    virtual void draw();
 
   private:
     MD3Data*            md3Data;           //!< reference to the md3 model data
+
+    bool                bDrawBones;        //!< draws the bone frames too
 };
 
