Lazy micro opt.

This commit is contained in:
Shyotl
2019-03-19 13:20:28 -05:00
parent e0194d4d06
commit c19ef521b3

View File

@@ -257,6 +257,10 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
//S32 active_verts = 0;
vol_face.mJointRiggingInfoTab.resize(LL_CHARACTER_MAX_ANIMATED_JOINTS);
LLJointRiggingInfoTab &rig_info_tab = vol_face.mJointRiggingInfoTab;
LLMatrix4a bind_shape;
bind_shape.loadu(skin->mBindShapeMatrix);
for (S32 i=0; i<vol_face.mNumVertices; i++)
{
LLVector4a& pos = vol_face.mPositions[i];
@@ -282,25 +286,23 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
for (U32 k=0; k<4; ++k)
{
S32 joint_index = idx[k];
// FIXME could precompute these matMuls.
LLMatrix4a inv_bind;
inv_bind.loadu(skin->mInvBindMatrix[joint_index]);
LLMatrix4a mat;
mat.setMul(bind_shape, inv_bind);
LLVector4a pos_joint_space;
mat.affineTransform(pos, pos_joint_space);
if (wght[k] > 0.0f)
{
S32 joint_num = skin->mJointNums[joint_index];
if (joint_num >= 0 && joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS)
{
rig_info_tab[joint_num].setIsRiggedTo(true);
// FIXME could precompute these matMuls.
LLMatrix4a bind_shape;
bind_shape.loadu(skin->mBindShapeMatrix);
LLMatrix4a inv_bind;
inv_bind.loadu(skin->mInvBindMatrix[joint_index]);
LLMatrix4a mat;
mat.setMul(bind_shape, inv_bind);
LLVector4a pos_joint_space;
mat.affineTransform(pos, pos_joint_space);
pos_joint_space.mul(wght[k]);
LLVector4a final_pos;
final_pos.setMul(pos_joint_space, wght[k]);
LLVector4a *extents = rig_info_tab[joint_num].getRiggedExtents();
update_min_max(extents[0], extents[1], pos_joint_space);
update_min_max(extents[0], extents[1], final_pos);
}
}
}