diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2018-06-05 15:35:21 +0100 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2018-06-05 15:35:21 +0100 |
commit | 3fcf7a32ee7256ef294c6c01c793f63dfdfb6958 (patch) | |
tree | 70f5c2c8e8dbd8cb7440a186d2914a41499c5e36 /indra/newview/llskinningutil.cpp | |
parent | 228525aa27b05cc1aa8be27de4ae59f5ec590ae3 (diff) |
SL-915 - incremental updates to dynamic bounding box, setting to control detail.
Diffstat (limited to 'indra/newview/llskinningutil.cpp')
-rw-r--r-- | indra/newview/llskinningutil.cpp | 58 |
1 files changed, 43 insertions, 15 deletions
diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 7adb2fa8d2..f446c57897 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -31,6 +31,12 @@ #include "llvoavatar.h" #include "llviewercontrol.h" #include "llmeshrepository.h" +#include "llvolume.h" + +#ifndef LL_RELEASE_FOR_DOWNLOAD +// AXON to remove +#pragma optimize("", off) +#endif // static void LLSkinningUtil::initClass() @@ -219,25 +225,47 @@ void LLSkinningUtil::getPerVertexSkinMatrix( //static void LLSkinningUtil::initIsRiggedTo(const LLMeshSkinInfo* skin, LLVOAvatar *avatar, joint_rig_info_tab& rig_info_tab) { - S32 rigged_count = 0; - rig_info_tab.resize(LL_CHARACTER_MAX_ANIMATED_JOINTS); - for (U32 j = 0; j < skin->mJointNames.size(); ++j) + // AXON REMOVE +} + +//static +void LLSkinningUtil::updateRiggedExtents(const LLMeshSkinInfo* skin, LLVOAvatar *avatar, LLVolumeFace& vol_face) +{ + S32 num_verts = vol_face.mNumVertices; + if (num_verts>0 && vol_face.mWeights && (skin->mJointNames.size()>0)) { - LLJoint *joint = NULL; - if (skin->mJointNums[j] == -1) + if (!vol_face.mJointRiggingInfoTabPtr) { - joint = avatar->getJoint(skin->mJointNames[j]); - if (joint) + vol_face.mJointRiggingInfoTabPtr = new joint_rig_info_tab(LL_CHARACTER_MAX_ANIMATED_JOINTS); + joint_rig_info_tab& rig_info_tab = *vol_face.mJointRiggingInfoTabPtr; + for (S32 i=0; i<vol_face.mNumVertices; i++) { - skin->mJointNums[j] = joint->getJointNum(); + LLVector4a& pos = vol_face.mPositions[i]; + F32 *w = vol_face.mWeights[i].getF32ptr(); + for (U32 k=0; k<4; ++k) + { + S32 joint_index = llfloor(w[k]); + S32 joint_num = skin->mJointNums[joint_index]; + if (joint_num != -1) + { + rig_info_tab[joint_num].setIsRiggedTo(true); + + // AXON can precompute that matMuls. + LLMatrix4a bind_shape; + bind_shape.loadu(skin->mBindShapeMatrix); + LLMatrix4a inv_bind; + inv_bind.loadu(skin->mInvBindMatrix[joint_index]); + LLMatrix4a mat; + matMul(bind_shape, inv_bind, mat); + LLVector4a pos_joint_space; + mat.affineTransform(pos, pos_joint_space); + LLVector4a *extents = rig_info_tab[joint_num].getRiggedExtents(); + update_min_max(extents[0], extents[1], pos_joint_space); + } + } } - } - S32 joint_num = skin->mJointNums[j]; - if (joint_num != -1) - { - rig_info_tab[joint_num].setIsRiggedTo(true); - rigged_count++; + LL_DEBUGS("RigSpammish") << "updated rigging info for vf " << &vol_face + << " num_verts " << vol_face.mNumVertices << LL_ENDL; } } - //LL_INFOS() << "rigged_count " << rigged_count << LL_ENDL; } |