From d6551990433264e029b476455db90d1d889e461c Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 19 Jul 2014 16:22:15 +0200 Subject: [PATCH] bugfix: fix stupid test introduced by myself. Signed-off-by: Kim Kulling --- code/LimitBoneWeightsProcess.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/code/LimitBoneWeightsProcess.cpp b/code/LimitBoneWeightsProcess.cpp index 32a1b47c0..f7a83a970 100644 --- a/code/LimitBoneWeightsProcess.cpp +++ b/code/LimitBoneWeightsProcess.cpp @@ -131,10 +131,11 @@ void LimitBoneWeightsProcess::ProcessMesh( aiMesh* pMesh) // and renormalize the weights float sum = 0.0f; - for( std::vector::const_iterator it = vit->begin(); it != vit->end(); ++it) - sum += it->mWeight; - const float invSum = 1.0f/sum; + for( std::vector::const_iterator it = vit->begin(); it != vit->end(); ++it ) { + sum += it->mWeight; + } if( 0.0f != sum ) { + const float invSum = 1.0f / sum; for( std::vector::iterator it = vit->begin(); it != vit->end(); ++it ) { it->mWeight *= invSum; } @@ -161,18 +162,6 @@ void LimitBoneWeightsProcess::ProcessMesh( aiMesh* pMesh) const std::vector& bw = boneWeights[a]; aiBone* bone = pMesh->mBones[a]; - // ignore the bone if no vertex weights were removed there - - // FIX (Aramis, 07|22|08) - // NO! we can't ignore it in this case ... it is possible that - // the number of weights did not change, but the weight values did. - - // if( bw.size() == bone->mNumWeights) - // continue; - - // FIX (Aramis, 07|21|08) - // It is possible that all weights of a bone have been removed. - // This would naturally cause an exception in &bw[0]. if ( bw.empty() ) { abNoNeed[a] = bChanged = true;