summaryrefslogtreecommitdiff
path: root/indra/llmath/llvolume.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/llmath/llvolume.cpp
parent129702eef3ab7d6046da1bd2f1a5b460912bdb0e (diff)
SL-366 - more cases where skinned weights can go awry, and a bunch more asserts to verify.
Diffstat (limited to 'indra/llmath/llvolume.cpp')
-rwxr-xr-xindra/llmath/llvolume.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 725e50ee2b..e5b1cf536d 100755
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -2544,7 +2544,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
U16 influence = weights[idx++];
influence |= ((U16) weights[idx++] << 8);
- F32 w = llclamp((F32) influence / 65535.f, 0.f, 0.99999f);
+ F32 w = llclamp((F32) influence / 65535.f, 0.001f, 0.999f);
wght.mV[cur_influence] = w;
joints[cur_influence] = joint;
cur_influence++;
@@ -2561,11 +2561,13 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
F32 wsum = wght.mV[VX] + wght.mV[VY] + wght.mV[VZ] + wght.mV[VW];
if (wsum <= 0.f)
{
- wght = LLVector4(0.99999f,0.f,0.f,0.f);
+ wght = LLVector4(0.999f,0.f,0.f,0.f);
}
- for (U32 k=0; k<4; k++)
+ for (U32 k=0; k<cur_influence; k++)
{
- joints_with_weights[k] = (F32) joints[k] + wght[k];
+ F32 f_combined = (F32) joints[k] + wght[k];
+ llassert(f_combined-(S32)f_combined>0); // If this fails, we have a floating point precision error.
+ joints_with_weights[k] = f_combined;
}
face.mWeights[cur_vertex].loadua(joints_with_weights.mV);