summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2018-10-08 16:16:56 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2018-10-08 16:16:56 +0100
commit5bb57186350fe00ccdc3f28acc3a55861745e193 (patch)
treeb29b0e4d6b48f24d8f154871b4a26c3fe4eac2c2
parent2fc7dcf22f6c04614a5dfc09104e919220f30525 (diff)
SL-9805 - optimization for avatar rigging info updates
-rw-r--r--indra/newview/llvoavatar.cpp33
-rw-r--r--indra/newview/llvoavatar.h4
2 files changed, 27 insertions, 10 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index b49f22007b..85019d5ae0 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -1418,14 +1418,7 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
// Stretch bounding box by rigged mesh joint boxes
if (box_detail>=3)
{
- // FIXME could try to cache unless something has changed about attached rigged meshes,
- // but needs more logic based on volume states.
-
- //if (mRiggingInfoTab.needsUpdate())
- {
- updateRiggingInfo();
- //mJointRiggingInfoTab.setNeedsUpdate(false);
- }
+ updateRiggingInfo();
for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++)
{
LLJoint *joint = getJoint(joint_num);
@@ -9624,9 +9617,31 @@ void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes)
void LLVOAvatar::updateRiggingInfo()
{
LL_DEBUGS("RigSpammish") << getFullname() << " updating rig tab" << LL_ENDL;
- mJointRiggingInfoTab.clear();
std::vector<LLVOVolume*> volumes;
getAssociatedVolumes(volumes);
+
+ // Get current rigging info key
+ std::map<LLUUID,S32> curr_rigging_info_key;
+ for (std::vector<LLVOVolume*>::iterator it = volumes.begin(); it != volumes.end(); ++it)
+ {
+ LLVOVolume *vol = *it;
+ if (vol->isMesh() && vol->getVolume())
+ {
+ const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID();
+ S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD);
+ curr_rigging_info_key[mesh_id] = max_lod;
+ }
+ }
+
+ // Check for key change, which indicates some change in volume composition or LOD.
+ if (curr_rigging_info_key == mLastRiggingInfoKey)
+ {
+ return;
+ }
+
+ // Something changed. Update.
+ mLastRiggingInfoKey = curr_rigging_info_key;
+ mJointRiggingInfoTab.clear();
for (std::vector<LLVOVolume*>::iterator it = volumes.begin(); it != volumes.end(); ++it)
{
LLVOVolume *vol = *it;
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 985559f2d6..e6b1477758 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -220,7 +220,9 @@ public:
// virtual
void updateRiggingInfo();
-
+ // This encodes mesh id and LOD, so we can see whether display is up-to-date.
+ std::map<LLUUID,S32> mLastRiggingInfoKey;
+
std::set<LLUUID> mActiveOverrideMeshes;
virtual void onActiveOverrideMeshesChanged();