fix broken bone optimization if some verts in a mesh aren't associated with a bone

This commit is contained in:
Chris Danford
2004-12-27 03:12:14 +00:00
parent bd3b4cbc9d
commit 81bc59321f
+5 -8
View File
@@ -23,17 +23,14 @@ void RageModelGeometry::OptimizeBones()
{
msMesh& mesh = m_Meshes[i];
if( mesh.Vertices.empty() )
continue; // nothing to optimize
// check to see if all vertices have the same bone index
bool bAllVertsUseSameBone = true;
char nBoneIndex;
if( !mesh.Vertices.empty() )
nBoneIndex = mesh.Vertices[0].bone;
else
nBoneIndex = (char)-1;
char nBoneIndex = mesh.Vertices[0].bone;
if( nBoneIndex != -1 )
{
for (unsigned j = 1; j < mesh.Vertices.size(); j++)
{
if( mesh.Vertices[j].bone != nBoneIndex )
@@ -42,7 +39,7 @@ void RageModelGeometry::OptimizeBones()
break;
}
}
}
if( bAllVertsUseSameBone )
{
mesh.nBoneIndex = nBoneIndex;