summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2018-06-11 22:10:33 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2018-06-11 22:10:33 +0100
commit6bf8fb58dee419cf2a15d6bdbd5acbcbd65dc033 (patch)
treec987bd7368821e59045405814c56b2de5543bace /indra/newview
parent887638c4d274d067f44d97128b34fde837ab69a9 (diff)
SL-915 - timers, ignore zero weights, log joint boxes in dumpXML output
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llskinningutil.cpp53
-rw-r--r--indra/newview/llvoavatar.cpp66
-rw-r--r--indra/newview/llvovolume.cpp3
3 files changed, 95 insertions, 27 deletions
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<LLMeshSkinInfo*>(skin), avatar);
if (vol_face.mJointRiggingInfoTab.size()==0)
{
- std::set<S32> active_joints;
- S32 active_verts = 0;
+ //std::set<S32> 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; i<vol_face.mNumVertices; i++)
@@ -246,32 +250,35 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
for (U32 k=0; k<4; ++k)
{
S32 joint_index = llfloor(w[k]);
- S32 joint_num = skin->mJointNums[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<const LLVOVolume*>(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</archetype>\n" );
- apr_file_printf( file, "\n</linden_genepool>\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<joint_rig_info num=\"%d\" name=\"%s\" min=\"%f %f %f\" max=\"%f %f %f\" tmin=\"%f %f %f\" tmax=\"%f %f %f\"/>\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</archetype>\n" );
+ apr_file_printf( file, "\n</linden_genepool>\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();