summaryrefslogtreecommitdiff
path: root/indra/newview/llskinningutil.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2016-04-06 16:12:39 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2016-04-06 16:12:39 -0400
commitb138ca8aeec421f6e5b1412e7c7fbcefd87570d0 (patch)
treeee32893aba4b9dd466ca409f41c32cef362467b3 /indra/newview/llskinningutil.cpp
parent129702eef3ab7d6046da1bd2f1a5b460912bdb0e (diff)
SL-366 - more cases where skinned weights can go awry, and a bunch more asserts to verify.
Diffstat (limited to 'indra/newview/llskinningutil.cpp')
-rw-r--r--indra/newview/llskinningutil.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp
index fbe45c8ea6..732afdfa9a 100644
--- a/indra/newview/llskinningutil.cpp
+++ b/indra/newview/llskinningutil.cpp
@@ -291,12 +291,15 @@ void LLSkinningUtil::checkSkinWeights(LLVector4a* weights, U32 num_vertices, con
{
F32 *w = weights[j].getF32ptr();
+ F32 wsum = 0.0;
for (U32 k=0; k<4; ++k)
{
S32 i = llfloor(w[k]);
llassert(i>=0);
llassert(i<max_joints);
+ wsum += w[k]-i;
}
+ llassert(wsum > 0.0f);
}
}
#endif
@@ -310,7 +313,7 @@ void LLSkinningUtil::getPerVertexSkinMatrix(
LLMatrix4a& final_mat,
U32 max_joints)
{
-
+ bool valid_weights = true;
final_mat.clear();
S32 idx[4];
@@ -336,6 +339,7 @@ void LLSkinningUtil::getPerVertexSkinMatrix(
if (handle_bad_scale && scale <= 0.f)
{
wght = LLVector4(1.0f, 0.0f, 0.0f, 0.0f);
+ valid_weights = false;
}
else
{
@@ -353,5 +357,8 @@ void LLSkinningUtil::getPerVertexSkinMatrix(
final_mat.add(src);
}
+ // SL-366 - with weight validation/cleanup code, it should no longer be
+ // possible to hit the bad scale case.
+ llassert(valid_weights);
}