Changeset 8640 in orxonox.OLD for branches/bsp_model
- Timestamp:
- Jun 20, 2006, 5:20:25 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc
r8638 r8640 582 582 int MD3Model::prev(MD3Data* data, int nr) 583 583 { 584 #if 0 585 if( nr == anim.first) 586 return upperBound-1; 584 if( nr == data->animation->first) 585 return data->upperBound - 1; 587 586 else 588 return nr-1; 589 #endif 587 return nr - 1; 590 588 } 591 589 … … 599 597 void MD3Model::doOp(MD3Data* data) 600 598 { 601 #if 0 602 //anim to be applied could have illegal data with respect to this model, 603 //ignore anim in this case 604 if( anim.first >= model.boneFrameNum || anim.first < 0) 599 // animation to be applied could have illegal data with respect to this model, 600 // ignore anim in this case 601 if( data->animation->first >= data->header->boneFrameNum || data->animation->first < 0) 605 602 return; 606 603 607 608 if( anim.num< 0)609 upperBound=model.boneFrameNum; //use all available frames604 //calc upper bound for animation frames in this model 605 if( data->animation->numFrames < 0) 606 data->upperBound = data->header->boneFrameNum; //use all available frames 610 607 else 611 upperBound=model.boneFrameNum<(anim.first+anim.num)?model.boneFrameNum:(anim.first+anim.num); 612 613 switch (op) { 608 data->upperBound = data->header->boneFrameNum < 609 (data->animation->first + data->animation->numFrames)?data->header->boneFrameNum:(data->animation->first + 610 data->animation->numFrames); 611 612 switch( data->op) { 613 614 614 case NEXT: 615 if (interpolate) { 616 model.interpolationFraction+=FRACTION; 617 if (model.interpolationFraction>=1.0f) { 618 model.currentFrame=model.nextFrame; 619 model.nextFrame=next(model.nextFrame); 620 model.interpolationFraction=0.0f; 615 if( data->bInterpolate) 616 { 617 data->animationState.interpolationFraction += FRACTION; 618 if( data->animationState.interpolationFraction >= 1.0f) 619 { 620 data->animationState.currentFrame = data->animationState.nextFrame; 621 data->animationState.nextFrame = next(data, data->animationState.nextFrame); 622 data->animationState.interpolationFraction = 0.0f; 621 623 } 622 624 } 623 625 else { 624 model.currentFrame=model.nextFrame;625 model.nextFrame=next(model.nextFrame);626 data->animationState.currentFrame = data->animationState.nextFrame; 627 data->animationState.nextFrame = next(data, data->animationState.nextFrame); 626 628 } 627 629 break; 630 628 631 case PREVIOUS: 629 if (interpolate) { 630 model.interpolationFraction-=FRACTION; 631 if (model.interpolationFraction<0.0f) { 632 model.nextFrame=model.currentFrame; 633 model.currentFrame=prev(model.currentFrame); 634 model.interpolationFraction=0.8f; 632 if( data->bInterpolate) 633 { 634 data->animationState.interpolationFraction -= FRACTION; 635 if( data->animationState.interpolationFraction < 0.0f) 636 { 637 data->animationState.nextFrame = data->animationState.currentFrame; 638 data->animationState.currentFrame = prev(data, data->animationState.currentFrame); 639 data->animationState.interpolationFraction = 0.8f; 635 640 } 636 641 } 637 else { 638 model.nextFrame=model.currentFrame; 639 model.currentFrame=prev(model.currentFrame); 642 else 643 { 644 data->animationState.nextFrame = data->animationState.currentFrame; 645 data->animationState.currentFrame = prev(data, data->animationState.currentFrame); 640 646 } 641 647 break; 648 642 649 case REWIND: 643 model.currentFrame=anim.first;644 model.nextFrame=next(model.currentFrame);645 model.interpolationFraction=0.0f;650 data->animationState.currentFrame = data->animation->first; 651 data->animationState.nextFrame = next(data, data->animationState.currentFrame); 652 data->animationState.interpolationFraction = 0.0f; 646 653 break; 647 654 } 648 #endif 649 } 650 655 } 651 656 652 657
Note: See TracChangeset
for help on using the changeset viewer.