Render animationless skeletal meshes in their bind pose at their current position, instead of rendering at the world's origin.

This was SVN commit r9182.
This commit is contained in:
Ykkrosh
2011-04-06 13:49:05 +00:00
parent a751a2d6f6
commit df4b74ccf6
+15 -2
View File
@@ -275,8 +275,21 @@ void CModel::ValidatePosition()
m_Anim->m_AnimDef->BuildBoneMatrices(m_AnimTime, m_BoneMatrices, !(m_Flags & MODELFLAG_NOLOOPANIMATION));
const CMatrix3D& transform=GetTransform();
for (size_t i=0;i<m_pModelDef->GetNumBones();i++) {
const CMatrix3D& transform = GetTransform();
for (size_t i = 0; i < m_pModelDef->GetNumBones(); i++)
m_BoneMatrices[i].Concatenate(transform);
}
else if (m_BoneMatrices)
{
// Bones but no animation - probably a buggy actor forgot to set up the animation,
// so just render it in its bind pose
const CMatrix3D& transform = GetTransform();
for (size_t i = 0; i < m_pModelDef->GetNumBones(); i++)
{
m_BoneMatrices[i].SetIdentity();
m_BoneMatrices[i].Rotate(m_pModelDef->GetBones()[i].m_Rotation);
m_BoneMatrices[i].Translate(m_pModelDef->GetBones()[i].m_Translation);
m_BoneMatrices[i].Concatenate(transform);
}
}