Fix (more) character model rendering artifacts when a freeze segment
lies on beat 0: m_pTempGeometry was not being set up
This commit is contained in:
+16
-14
@@ -512,6 +512,7 @@ void Model::PlayAnimation( CString sAniName, float fPlayRate )
|
|||||||
|
|
||||||
/* Set up m_vpBones, just in case we're drawn without being Update()d. */
|
/* Set up m_vpBones, just in case we're drawn without being Update()d. */
|
||||||
SetBones( m_pCurAnimation, m_fCurFrame, m_vpBones );
|
SetBones( m_pCurAnimation, m_fCurFrame, m_vpBones );
|
||||||
|
UpdateTempGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model::AdvanceFrame( float fDeltaTime )
|
void Model::AdvanceFrame( float fDeltaTime )
|
||||||
@@ -539,6 +540,7 @@ void Model::AdvanceFrame( float fDeltaTime )
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetBones( m_pCurAnimation, m_fCurFrame, m_vpBones );
|
SetBones( m_pCurAnimation, m_fCurFrame, m_vpBones );
|
||||||
|
UpdateTempGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model::SetBones( const msAnimation* pAnimation, float fFrame, vector<myBone_t> &vpBones )
|
void Model::SetBones( const msAnimation* pAnimation, float fFrame, vector<myBone_t> &vpBones )
|
||||||
@@ -635,22 +637,11 @@ void Model::SetBones( const msAnimation* pAnimation, float fFrame, vector<myBone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model::Update( float fDelta )
|
void Model::UpdateTempGeometry()
|
||||||
{
|
{
|
||||||
Actor::Update( fDelta );
|
if( m_pGeometry == NULL || m_pTempGeometry == NULL )
|
||||||
AdvanceFrame( fDelta );
|
return;
|
||||||
|
|
||||||
for( unsigned i = 0; i < m_Materials.size(); ++i )
|
|
||||||
{
|
|
||||||
m_Materials[i].diffuse.Update( fDelta );
|
|
||||||
m_Materials[i].alpha.Update( fDelta );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// process per-vertex bones
|
|
||||||
//
|
|
||||||
if( m_pGeometry && m_pTempGeometry )
|
|
||||||
{
|
|
||||||
for( unsigned i = 0; i < m_pGeometry->m_Meshes.size(); ++i )
|
for( unsigned i = 0; i < m_pGeometry->m_Meshes.size(); ++i )
|
||||||
{
|
{
|
||||||
const msMesh &origMesh = m_pGeometry->m_Meshes[i];
|
const msMesh &origMesh = m_pGeometry->m_Meshes[i];
|
||||||
@@ -681,6 +672,17 @@ void Model::Update( float fDelta )
|
|||||||
// send the new vertices to the graphics card
|
// send the new vertices to the graphics card
|
||||||
m_pTempGeometry->Change( m_vTempMeshes );
|
m_pTempGeometry->Change( m_vTempMeshes );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Model::Update( float fDelta )
|
||||||
|
{
|
||||||
|
Actor::Update( fDelta );
|
||||||
|
AdvanceFrame( fDelta );
|
||||||
|
|
||||||
|
for( unsigned i = 0; i < m_Materials.size(); ++i )
|
||||||
|
{
|
||||||
|
m_Materials[i].diffuse.Update( fDelta );
|
||||||
|
m_Materials[i].alpha.Update( fDelta );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Model::GetNumStates() const
|
int Model::GetNumStates() const
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ private:
|
|||||||
// If any vertex has a bone weight, then then render from m_pTempGeometry.
|
// If any vertex has a bone weight, then then render from m_pTempGeometry.
|
||||||
// Otherwise, render directly from m_pGeometry.
|
// Otherwise, render directly from m_pGeometry.
|
||||||
RageCompiledGeometry* m_pTempGeometry;
|
RageCompiledGeometry* m_pTempGeometry;
|
||||||
|
void UpdateTempGeometry();
|
||||||
|
|
||||||
/* Keep a copy of the mesh data only if m_pTempGeometry is in use. The normal and
|
/* Keep a copy of the mesh data only if m_pTempGeometry is in use. The normal and
|
||||||
* position data will be changed; the rest is static and kept only to prevent making
|
* position data will be changed; the rest is static and kept only to prevent making
|
||||||
|
|||||||
Reference in New Issue
Block a user