summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2016-05-21 08:15:28 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2016-05-21 08:15:28 -0400
commitf47ceb47bbcfd3466813d1653992e1ea418964b5 (patch)
treef3b1c26e835c8ddf40587783095a8b8954717d7b /indra/llmath
parentc2ef3b4c7186dbbd95b16520f281b7d58364fb52 (diff)
parenta46fdc10c76ebbf76b4976f0cbb36b649fe4fdd2 (diff)
merged jelly-doll viewer-release into bento
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llvolume.cpp13
-rw-r--r--indra/llmath/llvolume.h4
2 files changed, 13 insertions, 4 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index d932eb53a0..2918e2e272 100644
--- 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);
@@ -4568,6 +4570,7 @@ LLVolumeFace::LLVolumeFace() :
mTexCoords(NULL),
mIndices(NULL),
mWeights(NULL),
+ mWeightsRemapped(FALSE),
mOctree(NULL),
mOptimized(FALSE)
{
@@ -4593,6 +4596,7 @@ LLVolumeFace::LLVolumeFace(const LLVolumeFace& src)
mTexCoords(NULL),
mIndices(NULL),
mWeights(NULL),
+ mWeightsRemapped(FALSE),
mOctree(NULL)
{
mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3);
@@ -4664,6 +4668,7 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src)
ll_aligned_free_16(mWeights);
mWeights = NULL;
}
+ mWeightsRemapped = src.mWeightsRemapped;
}
if (mNumIndices)
diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h
index 1da2d0c6b1..33e1403a14 100644
--- a/indra/llmath/llvolume.h
+++ b/indra/llmath/llvolume.h
@@ -953,6 +953,10 @@ public:
// mWeights.size() should be empty or match mVertices.size()
LLVector4a* mWeights;
+ // Whether or not the weights have been cleaned up and remapped
+ // based on currently supported joints.
+ mutable BOOL mWeightsRemapped;
+
LLOctreeNode<LLVolumeTriangle>* mOctree;
//whether or not face has been cache optimized