Changeset 4211 in orxonox.OLD for orxonox/branches/md2_loader/src/lib
- Timestamp:
- May 18, 2005, 1:43:15 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc
r4191 r4211 640 640 641 641 642 void MD2Model2::setAnim(int type) 643 { 644 if( (type < 0) || (type > MAX_ANIMATIONS) ) 645 type = 0; 646 647 this->animationState.startFrame = animationList[type].firstFrame; 648 this->animationState.endFrame = animationList[type].lastFrame; 649 this->animationState.nextFrame = animationList[type].firstFrame + 1; 650 this->animationState.fps = animationList[type].fps; 651 this->animationState.type = type; 652 653 } 654 655 656 void MD2Model2::animate(float time) 657 { 658 this->animationState.localTime += time; 659 660 if( this->animationState.localTime - this->animationState.lastTime > (1.0f / this->animationState.fps)) 661 { 662 this->animationState.currentFrame = this->animationState.nextFrame; 663 this->animationState.nextFrame++; 664 665 if( this->animationState.nextFrame > this->animationState.endFrame) 666 this->animationState.nextFrame = this->animationState.startFrame; 667 this->animationState.lastTime = this->animationState.localTime; 668 } 669 670 if( this->animationState.currentFrame > (this->numFrames - 1) ) 671 this->animationState.currentFrame = 0; 672 if( this->animationState.nextFrame > (this->numFrames - 1) ) 673 this->animationState.nextFrame = 0; 674 675 this->animationState.interpolationState = this->animationState.fps * 676 (this->animationState.localTime - this->animationState.lastTime); 677 } 678 679 642 680 /* hhmmm... id used a very different way to do lightning...*/ 643 681 void MD2Model2::processLighting()
Note: See TracChangeset
for help on using the changeset viewer.