- Bugfix again: SkeletonMeshBuilder avoids validation warning for empty bones now.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@199 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
ulfjorensen 2008-10-27 22:22:05 +00:00
parent 093fa3377f
commit d618a57428
1 changed files with 26 additions and 23 deletions

View File

@ -162,6 +162,9 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode)
mFaces.push_back( Face( vertexStartIndex + 21, vertexStartIndex + 22, vertexStartIndex + 23)); mFaces.push_back( Face( vertexStartIndex + 21, vertexStartIndex + 22, vertexStartIndex + 23));
} }
unsigned int numVertices = mVertices.size() - vertexStartIndex;
if( numVertices > 0)
{
// create a bone affecting all the newly created vertices // create a bone affecting all the newly created vertices
aiBone* bone = new aiBone; aiBone* bone = new aiBone;
mBones.push_back( bone); mBones.push_back( bone);
@ -173,7 +176,6 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode)
bone->mOffsetMatrix = aiMatrix4x4( parent->mTransformation).Inverse() * bone->mOffsetMatrix; bone->mOffsetMatrix = aiMatrix4x4( parent->mTransformation).Inverse() * bone->mOffsetMatrix;
// add all the vertices to the bone's influences // add all the vertices to the bone's influences
unsigned int numVertices = mVertices.size() - vertexStartIndex;
bone->mNumWeights = numVertices; bone->mNumWeights = numVertices;
bone->mWeights = new aiVertexWeight[numVertices]; bone->mWeights = new aiVertexWeight[numVertices];
for( unsigned int a = 0; a < numVertices; a++) for( unsigned int a = 0; a < numVertices; a++)
@ -184,6 +186,7 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode)
aiMatrix4x4 boneToMeshTransform = aiMatrix4x4( bone->mOffsetMatrix).Inverse(); aiMatrix4x4 boneToMeshTransform = aiMatrix4x4( bone->mOffsetMatrix).Inverse();
for( unsigned int a = vertexStartIndex; a < mVertices.size(); a++) for( unsigned int a = vertexStartIndex; a < mVertices.size(); a++)
mVertices[a] = boneToMeshTransform * mVertices[a]; mVertices[a] = boneToMeshTransform * mVertices[a];
}
// and finally recurse into the children list // and finally recurse into the children list
for( unsigned int a = 0; a < pNode->mNumChildren; a++) for( unsigned int a = 0; a < pNode->mNumChildren; a++)