Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8894 in orxonox.OLD for trunk/src/lib/graphics/importer/md2


Ignore:
Timestamp:
Jun 29, 2006, 12:19:48 AM (18 years ago)
Author:
patrick
Message:

merged the branche single_player_map with the trunk

Location:
trunk/src/lib/graphics/importer/md2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/md2/md2Model.cc

    r8490 r8894  
    103103  this->pModelInfo.pTexCoor = (float*)this->data->pTexCoor;
    104104
     105  this->animationSpeed = 1.0f;
     106
    105107  // triangle conversion
    106108  this->pModelInfo.pTriangles = new sTriangleExt[this->data->numTriangles];
     
    159161
    160162/**
     163 * sets the animation type
     164 * @param firstFrame: index of the first frame
     165 * @param lastFrame: index of the last frame
     166 * @param fps: frames per second
     167 * @param bStoppable: is 1 if so, 0 else
     168 */
     169void MD2Model::setAnimation(int firstFrame, int lastFrame, int fps, int bStoppable, int animPlayback)
     170{
     171  this->animationState.startFrame = firstFrame;
     172  this->animationState.endFrame = lastFrame;
     173  this->animationState.nextFrame = firstFrame + 1;
     174  this->animationState.fps = fps;
     175  this->animationState.type = 0;
     176  this->animationState.numPlays = 0;
     177  this->animationState.animPlaybackMode = animPlayback;
     178
     179  this->animationState.interpolationState = 0.0f;
     180  this->animationState.localTime = 0.0f;
     181  this->animationState.lastTime = 0.0f;
     182  this->animationState.currentFrame = firstFrame;
     183}
     184
     185/**
    161186  \brief sets the animation type
    162187* @param type: animation type
     
    196221void MD2Model::tick(float time)
    197222{
    198   this->animate(time);
     223  this->animate(time * this->animationSpeed);
    199224  this->processLighting();
    200225  this->interpolate(/*this->verticesList*/);
  • trunk/src/lib/graphics/importer/md2/md2Model.h

    r8724 r8894  
    6969
    7070//! animation names enumeration
    71 typedef enum animType
     71typedef enum MD2animType
    7272  {
    7373    STAND,                       //0
     
    156156  void renderFrameTriangles() const;
    157157
    158 
    159158  virtual void setAnimation(int type, int animPlayback = MD2_ANIM_LOOP);
     159  virtual void setAnimation(int firstFrame, int lastFrame, int fps, int bStoppable, int animPlayback);
    160160  /**  returns the current animation @returns animation type */
    161161  inline int MD2Model::getAnimation() { return this->animationState.type; }
     162  virtual void setAnimationSpeed(float speed) { this->animationSpeed = speed; }
    162163  /**  scales the current model @param scaleFactor: the factor [0..1] to use for scaling */
    163164  void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;}
     
    186187 private:
    187188  float               scaleFactor;                      //!< the scale factor (individual)
     189  float               animationSpeed;                   //!< the speed of the animation (factor for the time)
    188190  sAnimState          animationState;                   //!< animation state of the model
    189191  sVec3D              verticesList[MD2_MAX_VERTICES];   //!< place to temp sav the vert
Note: See TracChangeset for help on using the changeset viewer.