Index: branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc	(revision 8636)
+++ branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc	(revision 8637)
@@ -308,9 +308,11 @@
 
       //switch to child coord system
-//       glPushMatrix();
-//       glMultMatrixf(this->tmpMatrix[i]);
+      glPushMatrix();
+      glMultMatrixf(data->tmpMatrix[i]);
+
       // and draw child
       this->draw(child);
-//       glPopMatrix();
+
+      glPopMatrix();
 
       i++;
@@ -534,3 +536,119 @@
 
 
+
+
+  /**
+   * Create a new visitor to apply an animation operation (NEXT, REWIND, ...)
+   * to a MD3 model. The operation is executed in the context of the specified
+   * animation.
+   *
+   * @param anim The animation that provides the context for the operation.
+   * @param op The operation to apply.
+   * @param interpolate Should interpolation be done?
+   */
+  void MD3Model::interpolate(MD3Data* data, MD3Animation* anim, int op, bool interpolate)
+  {
+
+// //     data->
+//     this.anim=anim;
+//     if( op == NEXT || op == PREVIOUS || op == REWIND)
+//       this.op=op;
+//
+//     this.interpolate=interpolate;
+  }
+
+
+  /**
+   * calc next frame number
+   */
+  int MD3Model::next(int nr)
+  {
+#if 0
+    if( nr < (upperBound-1))
+      return nr+1;
+    else
+    { //rewind needed
+      if( anim.num < 0)
+        return anim.first;
+      else {
+        nr = (anim.looping != 0)?(anim.num - anim.looping):0;
+        return anim.first + nr;
+      }
+    }
+#endif
+  }
+
+
+  /**
+   * calc prev frame number
+   */
+  int MD3Model::prev(int nr)
+  {
+#if 0
+    if( nr == anim.first)
+      return upperBound-1;
+    else
+      return nr-1;
+#endif
+  }
+
+
+  /**
+   * apply the specified operation to the animation state data members of the model
+   * taking the specified animation into account
+   */
+  void MD3Model::doOp(MD3Data* data)
+  {
+#if 0
+    //anim to be applied could have illegal data with respect to this model,
+    //ignore anim in this case
+    if( anim.first >= model.boneFrameNum || anim.first < 0)
+      return;
+
+                //calc upper bound for animation frames in this model
+    if( anim.num < 0)
+      upperBound=model.boneFrameNum; //use all available frames
+    else
+      upperBound=model.boneFrameNum<(anim.first+anim.num)?model.boneFrameNum:(anim.first+anim.num);
+
+    switch (op) {
+      case NEXT:
+        if (interpolate) {
+          model.interpolationFraction+=FRACTION;
+          if (model.interpolationFraction>=1.0f) {
+            model.currentFrame=model.nextFrame;
+            model.nextFrame=next(model.nextFrame);
+            model.interpolationFraction=0.0f;
+          }
+        }
+        else {
+          model.currentFrame=model.nextFrame;
+          model.nextFrame=next(model.nextFrame);
+        }
+        break;
+      case PREVIOUS:
+        if (interpolate) {
+          model.interpolationFraction-=FRACTION;
+          if (model.interpolationFraction<0.0f) {
+            model.nextFrame=model.currentFrame;
+            model.currentFrame=prev(model.currentFrame);
+            model.interpolationFraction=0.8f;
+          }
+        }
+        else {
+          model.nextFrame=model.currentFrame;
+          model.currentFrame=prev(model.currentFrame);
+        }
+        break;
+      case REWIND:
+        model.currentFrame=anim.first;
+        model.nextFrame=next(model.currentFrame);
+        model.interpolationFraction=0.0f;
+        break;
+    }
+#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 8636)
+++ branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h	(revision 8637)
@@ -22,4 +22,5 @@
 class MD3Tag;
 class MD3AnimationCfg;
+class MD3Animation;
 
 struct MD3Normal;
@@ -55,4 +56,10 @@
     float* interpolateTransformation(MD3Data* data, MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac, int i);
 
+    void interpolate(MD3Data* data, MD3Animation* anim, int op, bool interpolate);
+    int next(int nr);
+    int prev(int nr);
+    void doOp(MD3Data* data);
+
+
   private:
     MD3Data*            md3Data;           //!< reference to the md3 model data
