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
+9 -12
View File
@@ -23,26 +23,23 @@ 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++)
{
for (unsigned j = 1; j < mesh.Vertices.size(); j++)
if( mesh.Vertices[j].bone != nBoneIndex )
{
if( mesh.Vertices[j].bone != nBoneIndex )
{
bAllVertsUseSameBone = false;
break;
}
bAllVertsUseSameBone = false;
break;
}
}
if( bAllVertsUseSameBone )
{
mesh.nBoneIndex = nBoneIndex;