Changeset 8894 in orxonox.OLD for trunk/src/lib/graphics/importer/md2
- Timestamp:
- Jun 29, 2006, 12:19:48 AM (19 years ago)
- Location:
- trunk/src/lib/graphics/importer/md2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/md2/md2Model.cc
r8490 r8894 103 103 this->pModelInfo.pTexCoor = (float*)this->data->pTexCoor; 104 104 105 this->animationSpeed = 1.0f; 106 105 107 // triangle conversion 106 108 this->pModelInfo.pTriangles = new sTriangleExt[this->data->numTriangles]; … … 159 161 160 162 /** 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 */ 169 void 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 /** 161 186 \brief sets the animation type 162 187 * @param type: animation type … … 196 221 void MD2Model::tick(float time) 197 222 { 198 this->animate(time );223 this->animate(time * this->animationSpeed); 199 224 this->processLighting(); 200 225 this->interpolate(/*this->verticesList*/); -
trunk/src/lib/graphics/importer/md2/md2Model.h
r8724 r8894 69 69 70 70 //! animation names enumeration 71 typedef enum animType71 typedef enum MD2animType 72 72 { 73 73 STAND, //0 … … 156 156 void renderFrameTriangles() const; 157 157 158 159 158 virtual void setAnimation(int type, int animPlayback = MD2_ANIM_LOOP); 159 virtual void setAnimation(int firstFrame, int lastFrame, int fps, int bStoppable, int animPlayback); 160 160 /** returns the current animation @returns animation type */ 161 161 inline int MD2Model::getAnimation() { return this->animationState.type; } 162 virtual void setAnimationSpeed(float speed) { this->animationSpeed = speed; } 162 163 /** scales the current model @param scaleFactor: the factor [0..1] to use for scaling */ 163 164 void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;} … … 186 187 private: 187 188 float scaleFactor; //!< the scale factor (individual) 189 float animationSpeed; //!< the speed of the animation (factor for the time) 188 190 sAnimState animationState; //!< animation state of the model 189 191 sVec3D verticesList[MD2_MAX_VERTICES]; //!< place to temp sav the vert
Note: See TracChangeset
for help on using the changeset viewer.