summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatermodelpreview.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/llfloatermodelpreview.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/llfloatermodelpreview.cpp')
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index ceb3566d95..cda704f47b 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -3317,14 +3317,17 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
LLVector3 pos(vf.mPositions[i].getF32ptr());
const LLModel::weight_list& weight_list = base_mdl->getJointInfluences(pos);
+ llassert(weight_list.size()>0 && weight_list.size() <= 4); // LLModel::loadModel() should guarantee this
LLVector4 w(0,0,0,0);
for (U32 i = 0; i < weight_list.size(); ++i)
{
- F32 wght = llmin(weight_list[i].mWeight, 0.999999f);
+ F32 wght = llclamp(weight_list[i].mWeight, 0.001f, 0.999f);
F32 joint = (F32) weight_list[i].mJointIdx;
w.mV[i] = joint + wght;
+ llassert(w.mV[i]-(S32)w.mV[i]>0.0f); // because weights are non-zero, and range of wt values
+ //should not cause floating point precision issues.
}
*(weights_strider++) = w;