summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2015-09-14 11:01:22 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2015-09-14 11:01:22 -0400
commit6b2c1d5f104047af8aa71d01b7d8fbe9a0ad3493 (patch)
treeb55ac6318a92aea45323dded844af0d6593deb4d /indra/newview/llvovolume.cpp
parent98166af9c711e63b5fedbf2227d3eb2e5fca8600 (diff)
SL-133 WIP, SL-134 WIP - more extra joint handling
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rwxr-xr-xindra/newview/llvovolume.cpp29
1 files changed, 6 insertions, 23 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 1f07d93cc7..dabf6acecf 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4163,7 +4163,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
}
//build matrix palette
- static const size_t kMaxJoints = 64;
+ static const size_t kMaxJoints = 52;
LLMatrix4a mp[kMaxJoints];
LLMatrix4* mat = (LLMatrix4*) mp;
@@ -4183,12 +4183,6 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
mat[j] = skin->mInvBindMatrix[j];
mat[j] *= joint->getWorldMatrix();
}
- else
- {
- // This shouldn't be possible unless the avatar skeleton
- // is corrupt.
- llassert(false);
- }
}
for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
@@ -4228,21 +4222,9 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
wght[k] = w - floorf(w);
scale += wght[k];
}
- if (scale > 0.f)
- {
- wght *= 1.f / scale;
- }
- else
- {
- // Complete weighting fail - all zeroes. Just
- // pick some values that add up to 1.0 so we
- // don't wind up with garbage vertices
- // pointing off at (0,0,0)
- wght[0] = 1.f;
- wght[1] = 0.f;
- wght[2] = 0.f;
- wght[3] = 0.f;
- }
+ // This is enforced in unpackVolumeFaces()
+ llassert(scale>0.f);
+ wght *= 1.f / scale;
for (U32 k = 0; k < 4; k++)
{
@@ -4251,7 +4233,8 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
LLMatrix4a src;
// Insure ref'd bone is in our clamped array of mats
// clamp idx to maxJoints to avoid reading garbage off stack in release
- src.setMul(mp[(idx[k]<maxJoints)?idx[k]:0], w);
+ S32 index = llclamp((S32)idx[k],(S32)0,(S32)kMaxJoints-1);
+ src.setMul(mp[index], w);
final_mat.add(src);
}