This commit is contained in:
Glenn Maynard
2004-05-15 01:31:34 +00:00
parent 0da668cfc8
commit c8e2173282
+9 -9
View File
@@ -672,8 +672,7 @@ void Model::SetFrame( float fNewFrame )
m_fCurrFrame = fNewFrame; m_fCurrFrame = fNewFrame;
} }
void void Model::AdvanceFrame (float dt)
Model::AdvanceFrame (float dt)
{ {
if( m_pGeometry == NULL || if( m_pGeometry == NULL ||
m_pGeometry->m_Meshes.empty() || m_pGeometry->m_Meshes.empty() ||
@@ -714,13 +713,14 @@ Model::AdvanceFrame (float dt)
{ {
RageVector3 vPos; RageVector3 vPos;
RageVector3 vRot; RageVector3 vRot;
// //
// search for the adjacent position keys // search for the adjacent position keys
// //
msPositionKey *pLastPositionKey = 0, *pThisPositionKey = 0; const msPositionKey *pLastPositionKey = NULL, *pThisPositionKey = NULL;
for (j = 0; j < nPositionKeyCount; j++) for (j = 0; j < nPositionKeyCount; j++)
{ {
msPositionKey *pPositionKey = &pBone->PositionKeys[j]; const msPositionKey *pPositionKey = &pBone->PositionKeys[j];
if (pPositionKey->fTime >= m_fCurrFrame) if (pPositionKey->fTime >= m_fCurrFrame)
{ {
pThisPositionKey = pPositionKey; pThisPositionKey = pPositionKey;
@@ -728,7 +728,7 @@ Model::AdvanceFrame (float dt)
} }
pLastPositionKey = pPositionKey; pLastPositionKey = pPositionKey;
} }
if (pLastPositionKey != 0 && pThisPositionKey != 0) if( pLastPositionKey != NULL && pThisPositionKey != NULL )
{ {
float d = pThisPositionKey->fTime - pLastPositionKey->fTime; float d = pThisPositionKey->fTime - pLastPositionKey->fTime;
float s = (m_fCurrFrame - pLastPositionKey->fTime) / d; float s = (m_fCurrFrame - pLastPositionKey->fTime) / d;
@@ -736,11 +736,11 @@ Model::AdvanceFrame (float dt)
vPos[1] = pLastPositionKey->Position[1] + (pThisPositionKey->Position[1] - pLastPositionKey->Position[1]) * s; vPos[1] = pLastPositionKey->Position[1] + (pThisPositionKey->Position[1] - pLastPositionKey->Position[1]) * s;
vPos[2] = pLastPositionKey->Position[2] + (pThisPositionKey->Position[2] - pLastPositionKey->Position[2]) * s; vPos[2] = pLastPositionKey->Position[2] + (pThisPositionKey->Position[2] - pLastPositionKey->Position[2]) * s;
} }
else if (pLastPositionKey == 0) else if( pLastPositionKey == NULL )
{ {
vPos = pThisPositionKey->Position; vPos = pThisPositionKey->Position;
} }
else if (pThisPositionKey == 0) else if( pThisPositionKey == NULL )
{ {
vPos = pLastPositionKey->Position; vPos = pLastPositionKey->Position;
} }
@@ -749,10 +749,10 @@ Model::AdvanceFrame (float dt)
// //
RageMatrix m; RageMatrix m;
RageMatrixIdentity( &m ); RageMatrixIdentity( &m );
msRotationKey *pLastRotationKey = 0, *pThisRotationKey = 0; const msRotationKey *pLastRotationKey = NULL, *pThisRotationKey = NULL;
for (j = 0; j < nRotationKeyCount; j++) for (j = 0; j < nRotationKeyCount; j++)
{ {
msRotationKey *pRotationKey = &pBone->RotationKeys[j]; const msRotationKey *pRotationKey = &pBone->RotationKeys[j];
if (pRotationKey->fTime >= m_fCurrFrame) if (pRotationKey->fTime >= m_fCurrFrame)
{ {
pThisRotationKey = pRotationKey; pThisRotationKey = pRotationKey;