From 6bf8fb58dee419cf2a15d6bdbd5acbcbd65dc033 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Jun 2018 22:10:33 +0100 Subject: SL-915 - timers, ignore zero weights, log joint boxes in dumpXML output --- indra/newview/llskinningutil.cpp | 53 ++++++++++++++++++-------------- indra/newview/llvoavatar.cpp | 66 +++++++++++++++++++++++++++++++++++++--- indra/newview/llvovolume.cpp | 3 ++ 3 files changed, 95 insertions(+), 27 deletions(-) (limited to 'indra') diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 49d0526245..8a499f77cd 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -225,8 +225,12 @@ void LLSkinningUtil::initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar) } } +static LLTrace::BlockTimerStatHandle FTM_FACE_RIGGING_INFO("Face Rigging Info"); + void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *avatar, LLVolumeFace& vol_face) { + LL_RECORD_BLOCK_TIME(FTM_FACE_RIGGING_INFO); + if (vol_face.mJointRiggingInfoTab.needsUpdate()) { S32 num_verts = vol_face.mNumVertices; @@ -235,8 +239,8 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a initJointNums(const_cast(skin), avatar); if (vol_face.mJointRiggingInfoTab.size()==0) { - std::set active_joints; - S32 active_verts = 0; + //std::set active_joints; + //S32 active_verts = 0; vol_face.mJointRiggingInfoTab.resize(LL_CHARACTER_MAX_ANIMATED_JOINTS); LLJointRiggingInfoTab &rig_info_tab = vol_face.mJointRiggingInfoTab; for (S32 i=0; imJointNums[joint_index]; - if (joint_num >= 0 && joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS) + if (w[k]-joint_index > 0.0f) { - rig_info_tab[joint_num].setIsRiggedTo(true); - active_joints.insert(joint_num); - active_verts++; + 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); + //active_joints.insert(joint_num); + //active_verts++; - // AXON can precompute these 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); + // AXON can precompute these 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); + } } } } - LL_DEBUGS("RigSpammish") << "built rigging info for vf " << &vol_face - << " num_verts " << vol_face.mNumVertices - << " active joints " << active_joints.size() - << " active verts " << active_verts - << LL_ENDL; + //LL_DEBUGS("RigSpammish") << "built rigging info for vf " << &vol_face + // << " num_verts " << vol_face.mNumVertices + // << " active joints " << active_joints.size() + // << " active verts " << active_verts + // << LL_ENDL; vol_face.mJointRiggingInfoTab.setNeedsUpdate(false); } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8a457e1e53..9848a568da 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1292,8 +1292,6 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) newMin.setSub(pos, buffer); newMax.setAdd(pos, buffer); - float max_attachment_span = get_default_max_prim_scale() * 5.0f; - //stretch bounding box by joint positions if (box_detail>=1) { @@ -1321,6 +1319,8 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) //stretch bounding box by static attachments if (box_detail >= 2) { + float max_attachment_span = get_default_max_prim_scale() * 5.0f; + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) @@ -1333,9 +1333,15 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) { + // AXON is this right? Don't we need to look at children of attached_object as well? const LLViewerObject* attached_object = (*attachment_iter); if (attached_object && !attached_object->isHUDAttachment()) { + const LLVOVolume *vol = dynamic_cast(attached_object); + if (vol && vol->isRiggedMesh()) + { + continue; + } LLDrawable* drawable = attached_object->mDrawable; if (drawable && !drawable->isState(LLDrawable::RIGGED)) { @@ -5806,6 +5812,18 @@ bool LLVOAvatar::getRiggedMeshID(LLViewerObject* pVO, LLUUID& mesh_id) // AXON update to use LLRiggingInfo bool LLVOAvatar::jointIsRiggedTo(const std::string& joint_name) { + LLJoint *joint = getJoint(joint_name); + if (joint) + { + LLJointRiggingInfoTab& tab = mJointRiggingInfoTab; + S32 joint_num = joint->getJointNum(); + if (joint_num < tab.size() && tab[joint_num].isRiggedTo()) + { + return true; + } + } + return false; +#if 0 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) @@ -5823,6 +5841,7 @@ bool LLVOAvatar::jointIsRiggedTo(const std::string& joint_name) } } return false; +#endif } // AXON update to use LLRiggingInfo @@ -9233,8 +9252,43 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara pelvis_fixup, mesh_id.asString().c_str()); } - apr_file_printf( file, "\t\n" ); - apr_file_printf( file, "\n\n" ); + LLVector3 rp = getRootJoint()->getWorldPosition(); + LLVector4a rpv; + rpv.load3(rp.mV); + + for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++) + { + LLJoint *joint = getJoint(joint_num); + if (joint_num < mJointRiggingInfoTab.size()) + { + LLJointRiggingInfo& rig_info = mJointRiggingInfoTab[joint_num]; + if (rig_info.isRiggedTo()) + { + LLMatrix4a mat; + LLVector4a new_extents[2]; + mat.loadu(joint->getWorldMatrix()); + matMulBoundBox(mat, rig_info.getRiggedExtents(), new_extents); + LLVector4a rrp[2]; + rrp[0].setSub(new_extents[0],rpv); + rrp[1].setSub(new_extents[1],rpv); + apr_file_printf( file, "\t\t\n", + joint_num, + joint->getName().c_str(), + rig_info.getRiggedExtents()[0][0], + rig_info.getRiggedExtents()[0][1], + rig_info.getRiggedExtents()[0][2], + rig_info.getRiggedExtents()[1][0], + rig_info.getRiggedExtents()[1][1], + rig_info.getRiggedExtents()[1][2], + rrp[0][0], + rrp[0][1], + rrp[0][2], + rrp[1][0], + rrp[1][1], + rrp[1][2] ); + } + } + } bool ultra_verbose = false; if (isSelf() && ultra_verbose) @@ -9242,6 +9296,10 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara // show the cloned params inside the wearables as well. gAgentAvatarp->dumpWearableInfo(outfile); } + + apr_file_printf( file, "\t\n" ); + apr_file_printf( file, "\n\n" ); + LLSD args; args["PATH"] = fullpath; LLNotificationsUtil::add("AppearanceToXMLSaved", args); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 70c4efb5b8..3387f718df 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3591,8 +3591,11 @@ void LLVOVolume::afterReparent() } //---------------------------------------------------------------------------- +static LLTrace::BlockTimerStatHandle FTM_VOVOL_RIGGING_INFO("VOVol Rigging Info"); + void LLVOVolume::updateRiggingInfo() { + LL_RECORD_BLOCK_TIME(FTM_VOVOL_RIGGING_INFO); if (isRiggedMesh()) { const LLMeshSkinInfo* skin = getSkinInfo(); -- cgit v1.2.3