summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
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 fb34d6f588..19d61f6e33 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4175,7 +4175,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;
@@ -4195,12 +4195,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)
@@ -4240,21 +4234,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++)
{
@@ -4263,7 +4245,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);
}