diff options
| author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-03-22 23:45:25 +0200 | 
|---|---|---|
| committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-03-23 01:08:38 +0200 | 
| commit | 9fc1b51ae85cbb1a25f4058c0866d29f99724183 (patch) | |
| tree | d513a68f25083068b55a6cb40eded609040ba544 /indra/newview | |
| parent | 9a36df576313e98144deb95b28ed845c768c9960 (diff) | |
SL-14993 Crash accessing mInvBindMatrix
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/llskinningutil.cpp | 34 | ||||
| -rw-r--r-- | indra/newview/llskinningutil.h | 1 | 
2 files changed, 3 insertions, 32 deletions
| diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 1fb63c7444..f325315933 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -309,7 +309,8 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a      if (vol_face.mJointRiggingInfoTab.needsUpdate())      {          S32 num_verts = vol_face.mNumVertices; -        if (num_verts>0 && vol_face.mWeights && (skin->mJointNames.size()>0)) +        S32 num_joints = skin->mJointNames.size(); +        if (num_verts > 0 && vol_face.mWeights && num_joints > 0)          {              initJointNums(const_cast<LLMeshSkinInfo*>(skin), avatar);              if (vol_face.mJointRiggingInfoTab.size()==0) @@ -343,7 +344,7 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a                      for (U32 k=0; k<4; ++k)                      {  						S32 joint_index = idx[k]; -                        if (wght[k] > 0.0f) +                        if (wght[k] > 0.0f && num_joints > joint_index)                          {                              S32 joint_num = skin->mJointNums[joint_index];                              if (joint_num >= 0 && joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS) @@ -394,35 +395,6 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a      }  } -void LLSkinningUtil::updateRiggingInfo_(LLMeshSkinInfo* skin, LLVOAvatar *avatar, S32 num_verts, LLVector4a* weights, LLVector4a* positions, U8* joint_indices, LLJointRiggingInfoTab &rig_info_tab) -{ -    LL_RECORD_BLOCK_TIME(FTM_FACE_RIGGING_INFO); -    for (S32 i=0; i < num_verts; i++) -    { -        LLVector4a& pos  = positions[i]; -        LLVector4a& wght = weights[i]; -        for (U32 k=0; k<4; ++k) -        { -            S32 joint_num = skin->mJointNums[joint_indices[k]]; -            llassert(joint_num >= 0 && joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS); -            { -                rig_info_tab[joint_num].setIsRiggedTo(true); -                LLMatrix4a bind_shape; -                bind_shape.loadu(skin->mBindShapeMatrix); -                LLMatrix4a inv_bind; -                inv_bind.loadu(skin->mInvBindMatrix[joint_indices[k]]); -                LLMatrix4a mat; -                matMul(bind_shape, inv_bind, mat); -                LLVector4a pos_joint_space; -                mat.affineTransform(pos, pos_joint_space); -                pos_joint_space.mul(wght[k]); -                LLVector4a *extents = rig_info_tab[joint_num].getRiggedExtents(); -                update_min_max(extents[0], extents[1], pos_joint_space); -            } -        } -    } -} -  // This is used for extracting rotation from a bind shape matrix that  // already has scales baked in  LLQuaternion LLSkinningUtil::getUnscaledQuaternion(const LLMatrix4& mat4) diff --git a/indra/newview/llskinningutil.h b/indra/newview/llskinningutil.h index 549aa6a29f..efe7c85997 100644 --- a/indra/newview/llskinningutil.h +++ b/indra/newview/llskinningutil.h @@ -67,7 +67,6 @@ namespace LLSkinningUtil      void initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar);      void updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *avatar, LLVolumeFace& vol_face); -    void updateRiggingInfo_(LLMeshSkinInfo* skin, LLVOAvatar *avatar, S32 num_verts, LLVector4a* weights, LLVector4a* positions, U8* joint_indices, LLJointRiggingInfoTab &rig_info_tab);  	LLQuaternion getUnscaledQuaternion(const LLMatrix4& mat4);  }; | 
