From ed5e7b3e758c6b66d29fef38c90d2d4690823eb3 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 1 Mar 2004 10:11:45 +0000 Subject: [PATCH] fix model animation/looping glitches turn backface culling on by default for models --- stepmania/src/Model.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/stepmania/src/Model.cpp b/stepmania/src/Model.cpp index b67464e206..f81642d2ad 100644 --- a/stepmania/src/Model.cpp +++ b/stepmania/src/Model.cpp @@ -29,6 +29,7 @@ Model::Model () { m_bTextureWrapping = true; SetUseZBuffer( true ); + SetUseZBuffer( true ); m_pGeometry = NULL; m_pCurAnimation = NULL; m_bRevertToDefaultAnimation = false; @@ -397,10 +398,13 @@ void Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath ) for ( i = 0; i < (int)Animation.Bones.size(); i++) { msBone& Bone = Animation.Bones[i]; - for( int j=0; j<(int)Bone.PositionKeys.size(); j++ ) { - Animation.nTotalFrames = max( Animation.nTotalFrames, (int)Bone.PositionKeys[j].fTime+1 ); - Animation.nTotalFrames = max( Animation.nTotalFrames, (int)Bone.RotationKeys[j].fTime+1 ); + for( int j=0; j<(int)Bone.PositionKeys.size(); j++ ) + Animation.nTotalFrames = max( Animation.nTotalFrames, (int)Bone.PositionKeys[j].fTime ); + } + { + for( int j=0; j<(int)Bone.RotationKeys.size(); j++ ) + Animation.nTotalFrames = max( Animation.nTotalFrames, (int)Bone.RotationKeys[j].fTime ); } } @@ -676,8 +680,10 @@ Model::AdvanceFrame (float dt) return; // bail early } + LOG->Trace( "m_fCurrFrame = %f", m_fCurrFrame ); + m_fCurrFrame += FRAMES_PER_SECOND * dt * m_fCurAnimationRate; - if (m_fCurrFrame >= (float)m_pCurAnimation->nTotalFrames) + if (m_fCurrFrame >= m_pCurAnimation->nTotalFrames) { if( m_bRevertToDefaultAnimation && m_sDefaultAnimation != "" ) { @@ -687,11 +693,10 @@ Model::AdvanceFrame (float dt) } else { - m_fCurrFrame = 0.0f; + m_fCurrFrame -= m_pCurAnimation->nTotalFrames; } } - int nBoneCount = (int)m_pCurAnimation->Bones.size(); int i, j; for (i = 0; i < nBoneCount; i++)