specifying specific keyframes in animation
I am using Brett Porter's code for loading, and animating a milkshape model. The problem is, the model contains different animations at specific keyframe intervals. For example, the model can "walk" ( keyframe 1 - 24 ), "run" ( keyframe 25 - 50 ) etc.
Any good ideas on a draw method that I could use to specify a specific range of keyframes to animate?
Right now I have it set up according to time. Is this the best way? Or should I specify the specific keyframe somehow? Here is what I have:
void MilkshapeModel::draw(){
float time = glutGet(GLUT_ELAPSED_TIME) - m_pTimer;
if( time > endTime - startTime ){
if(m_looping){
time = 0.0;
restart();
}
else time = endTime - startTime - 1; //m_totalTime - 1;
}
for(int i = 0; i < m_totalFrames - 1; i++){
if(frameTimes <= time + startTime && time + startTime < frameTimes[i+1]){
glCallList(framesList1 + i);
return;
}
}
if(frameTimes[m_totalFrames - 1] <= time && time <= m_totalTime){
glCallList(framesList1 + (m_totalFrames - 1));
}
}
void MilkshapeModel::setRange( float start, float end )
{
startTime = start; endTime = end;
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement