From bd09297b8ec465a52f294092998812745ec6c566 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 3 Jun 2016 08:08:41 -0400 Subject: SL-220 - handle case that a weighted vertex includes no skin weights --- indra/llmath/llvolume.cpp | 6 ++++-- indra/newview/llskinningutil.cpp | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 2918e2e272..ac6f77b5ab 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2563,11 +2563,13 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) { wght = LLVector4(0.999f,0.f,0.f,0.f); } - for (U32 k=0; k0); // If this fails, we have a floating point precision error. joints_with_weights[k] = f_combined; + // Any weights we added above should wind up non-zero and applied to a specific bone. + // A failure here would indicate a floating point precision error in the math. + llassert((k >= cur_influence) || (f_combined - S32(f_combined) > 0.0f)); } face.mWeights[cur_vertex].loadua(joints_with_weights.mV); diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 732afdfa9a..b36bfc870f 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -262,6 +262,7 @@ void LLSkinningUtil::initSkinningMatrixPalette( // static void LLSkinningUtil::remapSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin) { + checkSkinWeights(weights, num_vertices, skin); llassert(skin->mJointRemap.size()>0); // Must call remapSkinInfoJoints() first, which this checks for. const U32* remap = &skin->mJointRemap[0]; const S32 max_joints = skin->mJointRemap.size(); @@ -277,6 +278,7 @@ void LLSkinningUtil::remapSkinWeights(LLVector4a* weights, U32 num_vertices, con w[k] = remap[i] + f; } } + checkSkinWeights(weights, num_vertices, skin); } // static -- cgit v1.2.3