From 2c81ace766546da0ea11efd4fa27cf1717eb5411 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 28 Sep 2018 19:13:17 +0100 Subject: [PATCH 01/15] SL-1290 - stop animations immediately if avatar is paused --- indra/llcharacter/llmotioncontroller.cpp | 3 ++- indra/newview/llvovolume.cpp | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 3116403616..c48d02b652 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -441,7 +441,8 @@ BOOL LLMotionController::stopMotionLocally(const LLUUID &id, BOOL stop_immediate { // if already inactive, return false LLMotion *motion = findMotion(id); - return stopMotionInstance(motion, stop_immediate); + // SL-1290: always stop immediate if paused + return stopMotionInstance(motion, stop_immediate||mPaused); } BOOL LLMotionController::stopMotionInstance(LLMotion* motion, BOOL stop_immediate) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 913460b3d1..192307dc8b 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4726,7 +4726,6 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons } else { -#if 1 bool is_paused = avatar && avatar->areAnimationsPaused(); if (is_paused) { @@ -4736,7 +4735,6 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons return; } } -#endif } From aacb7eb25fd4caceaafb145ed550e14cebeef665 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 1 Oct 2018 16:11:09 +0100 Subject: [PATCH 02/15] SL-9773 - treat animated object attachments the same as other rigged attachments for purposes of visibility in mouselook. --- indra/newview/llcontrolavatar.cpp | 14 ++++++++++++++ indra/newview/llcontrolavatar.h | 2 ++ indra/newview/lldrawpoolavatar.cpp | 2 +- indra/newview/llvoavatar.cpp | 6 ++++++ indra/newview/llvoavatar.h | 1 + indra/newview/llvoavatarself.cpp | 6 ++++++ indra/newview/llvoavatarself.h | 3 +++ 7 files changed, 33 insertions(+), 1 deletion(-) diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index a620f2abe9..28c02b0434 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -574,3 +574,17 @@ std::string LLControlAvatar::getFullname() const return "AO_no_root_vol"; } } + +// virtual +bool LLControlAvatar::shouldRenderRigged() const +{ + if (mRootVolp && mRootVolp->isAttachment()) + { + LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor(); + if (attached_av) + { + return attached_av->shouldRenderRigged(); + } + } + return true; +} diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index 9924697938..f7f8db2717 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -73,6 +73,8 @@ public: virtual std::string getFullname() const; + /* virtual */ bool shouldRenderRigged() const; + bool mPlaying; F32 mGlobalScale; diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 905428b090..d5e86143f1 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1709,7 +1709,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) { - if (avatar->isSelf() && !gAgent.needsRenderAvatar()) + if (!avatar->shouldRenderRigged()) { return; } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1f72aed5b4..93885a4472 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7464,6 +7464,12 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color) updateMeshTextures(); } +// virtual +bool LLVOAvatar::shouldRenderRigged() const +{ + return true; +} + // FIXME: We have an mVisible member, set in updateVisibility(), but this // function doesn't return it! isVisible() and mVisible are used // different places for different purposes. mVisible seems to be more diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 25c89f96d7..985559f2d6 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -756,6 +756,7 @@ private: //-------------------------------------------------------------------- public: BOOL isVisible() const; + virtual bool shouldRenderRigged() const; void setVisibilityRank(U32 rank); U32 getVisibilityRank() const { return mVisibilityRank; } static S32 sNumVisibleAvatars; // Number of instances of this class diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index b3a2d7951c..dcaade55a6 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2701,6 +2701,12 @@ void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch) } } +// virtual +bool LLVOAvatarSelf::shouldRenderRigged() const +{ + return gAgent.needsRenderAvatar(); +} + // HACK: this will null out the avatar's local texture IDs before the TE message is sent // to ensure local texture IDs are not sent to other clients in the area. // this is a short-term solution. The long term solution will be to not set the texture diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index f9f90bb323..b0fdae9bf0 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -312,6 +312,9 @@ public: //-------------------------------------------------------------------- // Visibility //-------------------------------------------------------------------- + + /* virtual */ bool shouldRenderRigged() const; + public: bool sendAppearanceMessage(LLMessageSystem *mesgsys) const; From 5bb0b393a9ee634db1fbbde2645a6374704e184c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 2 Oct 2018 22:02:42 +0100 Subject: [PATCH 03/15] SL-966 - behavior improvements and visualization, bonus removal of unrelated duplicate code in llappviewer.cpp --- indra/newview/llappviewer.cpp | 6 ------ indra/newview/llcontrolavatar.cpp | 13 +++++++++++-- indra/newview/llspatialpartition.cpp | 17 ++++++++++++++++- indra/newview/llvoavatar.cpp | 2 +- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 03927f2d7c..4374caacdf 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3918,12 +3918,6 @@ void LLAppViewer::requestQuit() gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent. } - // Try to send last batch of avatar rez metrics. - if (!gDisconnected && isAgentAvatarValid()) - { - gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent. - } - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(gAgent.getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 28c02b0434..18d6e6d6e7 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -35,6 +35,8 @@ #include "llviewerregion.h" #include "llskinningutil.h" +//#pragma optimize("", off) + const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f; const F32 LLControlAvatar::MAX_LEGAL_SIZE = 64.0f; @@ -111,9 +113,16 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - else if (offset_dist < max_legal_offset-1 && mPositionConstraintFixup.length()>0.01f) + else if (offset_dist < max_legal_offset-1) { - new_pos_fixup = mPositionConstraintFixup * 0.9; + if (mPositionConstraintFixup.length()>0.01f) + { + new_pos_fixup = mPositionConstraintFixup * 0.9; + } + else + { + new_pos_fixup = LLVector3(); + } LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index ee77556047..f25ab0709b 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -53,6 +53,9 @@ #include "llvolumemgr.h" #include "lltextureatlas.h" #include "llviewershadermgr.h" +#include "llcontrolavatar.h" + +//#pragma optimize("", off) static LLTrace::BlockTimerStatHandle FTM_FRUSTUM_CULL("Frustum Culling"); static LLTrace::BlockTimerStatHandle FTM_CULL_REBOUND("Cull Rebound Partition"); @@ -2170,7 +2173,19 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) gGL.diffuseColor4f(0,0.5f,0,1); // dark green break; default: - gGL.diffuseColor4f(1,0,1,1); // magenta + LLControlAvatar *cav = dynamic_cast(drawable->getVObj()->asAvatar()); + if (cav) + { + bool has_pos_constraint = (cav->mPositionConstraintFixup != LLVector3()); + bool has_scale_constraint = (cav->mScaleConstraintFixup != 1.0f); + F32 r = 1.0f * has_scale_constraint; + F32 g = 1.0f * has_pos_constraint; + gGL.diffuseColor4f(r,g,0,1); + } + else + { + gGL.diffuseColor4f(1,0,1,1); // magenta + } break; } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 93885a4472..b49f22007b 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4169,7 +4169,7 @@ void LLVOAvatar::updateRootPositionAndRotation(LLAgent& agent, F32 speed, bool w if (cav) { // SL-1350: Moved to LLDrawable::updateXform() - //cav->matchVolumeTransform(); + cav->matchVolumeTransform(); } else { From 0fd67838cf011e81f18822f699e8a140d4f761ad Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2018 10:29:11 +0100 Subject: [PATCH 04/15] SL-966 - tweaks to scale/pos constraint logic --- indra/newview/llcontrolavatar.cpp | 24 +++++------------------- indra/newview/llspatialpartition.cpp | 4 ++-- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 18d6e6d6e7..64f8423a66 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -102,34 +102,20 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ // correction to the control avatar position if // needed. const LLVector3 *extents = getLastAnimExtents(); + LLVector unshift_extents; + unshift_extents[0] = extents[0] - mPositionConstraintFixup; + unshift_extents[1] = extents[1] - mPositionConstraintFixup; LLVector3 box_dims = extents[1]-extents[0]; F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, extents); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); F32 offset_dist = pos_box_offset.length(); if (offset_dist > max_legal_offset) { F32 target_dist = (offset_dist - max_legal_offset); - new_pos_fixup = mPositionConstraintFixup + (target_dist/offset_dist)*pos_box_offset; + new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - else if (offset_dist < max_legal_offset-1) - { - if (mPositionConstraintFixup.length()>0.01f) - { - new_pos_fixup = mPositionConstraintFixup * 0.9; - } - else - { - new_pos_fixup = LLVector3(); - } - LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " - << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; - } - else - { - new_pos_fixup = mPositionConstraintFixup; - } if (max_size/mScaleConstraintFixup > max_legal_size) { new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index f25ab0709b..32aa974bf1 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2178,8 +2178,8 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) { bool has_pos_constraint = (cav->mPositionConstraintFixup != LLVector3()); bool has_scale_constraint = (cav->mScaleConstraintFixup != 1.0f); - F32 r = 1.0f * has_scale_constraint; - F32 g = 1.0f * has_pos_constraint; + F32 r = 0.5 + 0.5 * has_scale_constraint; + F32 g = 0.5 + 0.5 * has_pos_constraint; gGL.diffuseColor4f(r,g,0,1); } else From 8078b30574fc0a317b8dc7aadfc09516d3638ab0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2018 13:11:50 +0100 Subject: [PATCH 05/15] SL-966 - bug fixes, added lerp control for algorithm tweaking --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llcontrolavatar.cpp | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3ad8b6cded..bacd2c992b 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2259,6 +2259,17 @@ Value 64.0 + AnimatedObjectsPosLerp + + Comment + How strongly to weight new position vs. previous frame in position constraints. + Persist + 1 + Type + F32 + Value + 1.0 + AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 64f8423a66..96aaab80fa 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -87,6 +87,11 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); } + F32 lerp_weight = 0.5f; // hysteresis. 1.0 = immediately slam to new value, 0.0 = ignore new value + if (gSavedSettings.getControl("AnimatedObjectsPosLerp")) + { + lerp_weight = gSavedSettings.getF32("AnimatedObjectsPosLerp"); + } new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; @@ -102,7 +107,7 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ // correction to the control avatar position if // needed. const LLVector3 *extents = getLastAnimExtents(); - LLVector unshift_extents; + LLVector3 unshift_extents[2]; unshift_extents[0] = extents[0] - mPositionConstraintFixup; unshift_extents[1] = extents[1] - mPositionConstraintFixup; LLVector3 box_dims = extents[1]-extents[0]; @@ -116,6 +121,7 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } + new_pos_fixup = lerp_weight * new_pos_fixup + (1.0f - lerp_weight)*mPositionConstraintFixup; if (max_size/mScaleConstraintFixup > max_legal_size) { new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; From 2fc7dcf22f6c04614a5dfc09104e919220f30525 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2018 20:48:57 +0100 Subject: [PATCH 06/15] SL-966 - added scale constraints for animated object attachments --- indra/newview/app_settings/settings.xml | 11 ----- indra/newview/llcontrolavatar.cpp | 57 +++++++++++++------------ 2 files changed, 29 insertions(+), 39 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index bacd2c992b..3ad8b6cded 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2259,17 +2259,6 @@ Value 64.0 - AnimatedObjectsPosLerp - - Comment - How strongly to weight new position vs. previous frame in position constraints. - Persist - 1 - Type - F32 - Value - 1.0 - AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 96aaab80fa..4b70d625d4 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -87,15 +87,10 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); } - F32 lerp_weight = 0.5f; // hysteresis. 1.0 = immediately slam to new value, 0.0 = ignore new value - if (gSavedSettings.getControl("AnimatedObjectsPosLerp")) - { - lerp_weight = gSavedSettings.getF32("AnimatedObjectsPosLerp"); - } new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; - LLVector3 vol_pos = mRootVolp->getRenderPosition(); + LLVector3 vol_pos = mRootVolp->getRenderPosition(); // Fix up position if needed to prevent visual encroachment if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down @@ -111,22 +106,26 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ unshift_extents[0] = extents[0] - mPositionConstraintFixup; unshift_extents[1] = extents[1] - mPositionConstraintFixup; LLVector3 box_dims = extents[1]-extents[0]; - F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); - F32 offset_dist = pos_box_offset.length(); - if (offset_dist > max_legal_offset) + F32 box_size = llmax(box_dims[0],box_dims[1],box_dims[2]); + + if (!mRootVolp->isAttachment()) + { + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); + F32 offset_dist = pos_box_offset.length(); + if (offset_dist > max_legal_offset || mPositionConstraintFixup != LLVector3()) + { + F32 target_dist = (offset_dist - max_legal_offset); + new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; + LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " + << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; + } + } + if (box_size/mScaleConstraintFixup > max_legal_size) { - F32 target_dist = (offset_dist - max_legal_offset); - new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; - LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " - << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; - } - new_pos_fixup = lerp_weight * new_pos_fixup + (1.0f - lerp_weight)*mPositionConstraintFixup; - if (max_size/mScaleConstraintFixup > max_legal_size) - { - new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; - LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, max_size " << max_size << " fixup " - << mScaleConstraintFixup << " -> " << new_scale_fixup << LL_ENDL; + new_scale_fixup = mScaleConstraintFixup*max_legal_size/box_size; + LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, box_size " << box_size << " fixup " + << mScaleConstraintFixup << " max legal " << max_legal_size + << " -> new scale " << new_scale_fixup << LL_ENDL; } } } @@ -135,6 +134,12 @@ void LLControlAvatar::matchVolumeTransform() { if (mRootVolp) { + LLVector3 new_pos_fixup; + F32 new_scale_fixup; + getNewConstraintFixups(new_pos_fixup, new_scale_fixup); + mPositionConstraintFixup = new_pos_fixup; + mScaleConstraintFixup = new_scale_fixup; + if (mRootVolp->isAttachment()) { LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor(); @@ -151,6 +156,9 @@ void LLControlAvatar::matchVolumeTransform() mRoot->setWorldPosition(obj_pos + joint_pos); mRoot->setWorldRotation(obj_rot * joint_rot); setRotation(mRoot->getRotation()); + + F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale"); + setGlobalScale(global_scale * mScaleConstraintFixup); } else { @@ -161,13 +169,6 @@ void LLControlAvatar::matchVolumeTransform() { LLVector3 vol_pos = mRootVolp->getRenderPosition(); - LLVector3 new_pos_fixup; - F32 new_scale_fixup; - getNewConstraintFixups(new_pos_fixup, new_scale_fixup); - - mPositionConstraintFixup = new_pos_fixup; - mScaleConstraintFixup = new_scale_fixup; - // FIXME: Currently if you're doing something like playing an // animation that moves the pelvis (on an avatar or // animated object), the name tag and debug text will be From 5bb57186350fe00ccdc3f28acc3a55861745e193 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 8 Oct 2018 16:16:56 +0100 Subject: [PATCH 07/15] SL-9805 - optimization for avatar rigging info updates --- indra/newview/llvoavatar.cpp | 33 ++++++++++++++++++++++++--------- indra/newview/llvoavatar.h | 4 +++- 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& volumes) void LLVOAvatar::updateRiggingInfo() { LL_DEBUGS("RigSpammish") << getFullname() << " updating rig tab" << LL_ENDL; - mJointRiggingInfoTab.clear(); std::vector volumes; getAssociatedVolumes(volumes); + + // Get current rigging info key + std::map curr_rigging_info_key; + for (std::vector::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::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 mLastRiggingInfoKey; + std::set mActiveOverrideMeshes; virtual void onActiveOverrideMeshesChanged(); From ae041779ccc83b1acc8a01528918d52aab9f565f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 10 Oct 2018 14:37:49 +0100 Subject: [PATCH 08/15] SL-9849 - debug option for show impostor extents --- indra/newview/llpipelinelistener.cpp | 6 +- indra/newview/llviewermenu.cpp | 10 ++- indra/newview/llviewermenu.h | 2 +- indra/newview/llvoavatar.cpp | 60 ++++++++++---- indra/newview/pipeline.cpp | 4 +- indra/newview/pipeline.h | 79 ++++++++++--------- .../skins/default/xui/en/menu_viewer.xml | 10 +++ 7 files changed, 108 insertions(+), 63 deletions(-) diff --git a/indra/newview/llpipelinelistener.cpp b/indra/newview/llpipelinelistener.cpp index dfbe689f56..f11cdcf876 100644 --- a/indra/newview/llpipelinelistener.cpp +++ b/indra/newview/llpipelinelistener.cpp @@ -87,7 +87,7 @@ namespace { U32 render_feature = feature_from_string( iter->asString() ); if ( render_feature != 0 ) { - LLPipeline::toggleRenderDebugControl( render_feature ); + LLPipeline::toggleRenderDebugFeatureControl( render_feature ); } } } @@ -123,7 +123,7 @@ namespace { iter != request["displays"].endArray(); ++iter) { - U32 info_display = info_display_from_string( iter->asString() ); + U64 info_display = info_display_from_string( iter->asString() ); if ( info_display != 0 ) { LLPipeline::toggleRenderDebug( info_display ); @@ -134,7 +134,7 @@ namespace { void has_info_display_wrapper(LLSD const& request) { LLEventAPI::Response response(LLSD(), request); - U32 info_display = info_display_from_string( request["display"].asString() ); + U64 info_display = info_display_from_string( request["display"].asString() ); if ( info_display != 0 ) { response["value"] = gPipeline.hasRenderDebugMask(info_display); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d2c26dd6e7..6c52f118ad 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -964,7 +964,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t ////////////////// // INFO DISPLAY // ////////////////// -U32 info_display_from_string(std::string info_display) +U64 info_display_from_string(std::string info_display) { if ("verify" == info_display) { @@ -1082,6 +1082,10 @@ U32 info_display_from_string(std::string info_display) { return LLPipeline::RENDER_DEBUG_TRIANGLE_COUNT; } + else if ("impostors" == info_display) + { + return LLPipeline::RENDER_DEBUG_IMPOSTORS; + } else { LL_WARNS() << "unrecognized feature name '" << info_display << "'" << LL_ENDL; @@ -1093,7 +1097,7 @@ class LLAdvancedToggleInfoDisplay : public view_listener_t { bool handleEvent(const LLSD& userdata) { - U32 info_display = info_display_from_string( userdata.asString() ); + U64 info_display = info_display_from_string( userdata.asString() ); LL_INFOS("ViewerMenu") << "toggle " << userdata.asString() << LL_ENDL; @@ -1111,7 +1115,7 @@ class LLAdvancedCheckInfoDisplay : public view_listener_t { bool handleEvent(const LLSD& userdata) { - U32 info_display = info_display_from_string( userdata.asString() ); + U64 info_display = info_display_from_string( userdata.asString() ); bool new_value = false; if ( info_display != 0 ) diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 7abb0c8e74..6882405407 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -143,7 +143,7 @@ void handle_export_selected( void * ); // Convert strings to internal types U32 render_type_from_string(std::string render_type); U32 feature_from_string(std::string feature); -U32 info_display_from_string(std::string info_display); +U64 info_display_from_string(std::string info_display); class LLViewerMenuHolderGL : public LLMenuHolderGL { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 85019d5ae0..34e82d878a 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4943,22 +4943,52 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) left *= mImpostorDim.mV[0]; up *= mImpostorDim.mV[1]; - LLGLEnable test(GL_ALPHA_TEST); - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f); + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_IMPOSTORS)) + { + LLGLEnable blend(GL_BLEND); + gGL.setSceneBlendType(LLRender::BT_ADD); + gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4ubv(color.mV); - gGL.getTexUnit(diffuse_channel)->bind(&mImpostor); - gGL.begin(LLRender::QUADS); - gGL.texCoord2f(0,0); - gGL.vertex3fv((pos+left-up).mV); - gGL.texCoord2f(1,0); - gGL.vertex3fv((pos-left-up).mV); - gGL.texCoord2f(1,1); - gGL.vertex3fv((pos-left+up).mV); - gGL.texCoord2f(0,1); - gGL.vertex3fv((pos+left+up).mV); - gGL.end(); - gGL.flush(); + // gGL.begin(LLRender::QUADS); + // gGL.vertex3fv((pos+left-up).mV); + // gGL.vertex3fv((pos-left-up).mV); + // gGL.vertex3fv((pos-left+up).mV); + // gGL.vertex3fv((pos+left+up).mV); + // gGL.end(); + + + gGL.begin(LLRender::LINES); + gGL.color4f(1.f,1.f,1.f,1.f); + glLineWidth(2.f); + gGL.vertex3fv((pos+left-up).mV); + gGL.vertex3fv((pos-left-up).mV); + gGL.vertex3fv((pos-left-up).mV); + gGL.vertex3fv((pos-left+up).mV); + gGL.vertex3fv((pos-left+up).mV); + gGL.vertex3fv((pos+left+up).mV); + gGL.vertex3fv((pos+left+up).mV); + gGL.vertex3fv((pos+left-up).mV); + gGL.end(); + gGL.flush(); + } + { + LLGLEnable test(GL_ALPHA_TEST); + gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f); + + gGL.color4ubv(color.mV); + gGL.getTexUnit(diffuse_channel)->bind(&mImpostor); + gGL.begin(LLRender::QUADS); + gGL.texCoord2f(0,0); + gGL.vertex3fv((pos+left-up).mV); + gGL.texCoord2f(1,0); + gGL.vertex3fv((pos-left-up).mV); + gGL.texCoord2f(1,1); + gGL.vertex3fv((pos-left+up).mV); + gGL.texCoord2f(0,1); + gGL.vertex3fv((pos+left+up).mV); + gGL.end(); + gGL.flush(); + } return 6; } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 4bfa749d9f..b493219851 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6856,7 +6856,7 @@ bool LLPipeline::toggleRenderTypeControlNegated(S32 type) } //static -void LLPipeline::toggleRenderDebug(U32 bit) +void LLPipeline::toggleRenderDebug(U64 bit) { if (gPipeline.hasRenderDebugMask(bit)) { @@ -6871,7 +6871,7 @@ void LLPipeline::toggleRenderDebug(U32 bit) //static -bool LLPipeline::toggleRenderDebugControl(U32 bit) +bool LLPipeline::toggleRenderDebugControl(U64 bit) { return gPipeline.hasRenderDebugMask(bit); } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 85c13487ee..29fe1cbd33 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -330,10 +330,10 @@ public: void addTrianglesDrawn(S32 index_count, U32 render_type = LLRender::TRIANGLES); bool hasRenderDebugFeatureMask(const U32 mask) const { return bool(mRenderDebugFeatureMask & mask); } - bool hasRenderDebugMask(const U32 mask) const { return bool(mRenderDebugMask & mask); } + bool hasRenderDebugMask(const U64 mask) const { return bool(mRenderDebugMask & mask); } void setAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0xffffffff; } void clearAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0x0; } - void setAllRenderDebugDisplays() { mRenderDebugMask = 0xffffffff; } + void setAllRenderDebugDisplays() { mRenderDebugMask = 0xffffffffffffffff; } void clearAllRenderDebugDisplays() { mRenderDebugMask = 0x0; } bool hasRenderType(const U32 type) const; @@ -357,11 +357,11 @@ public: // For UI control of render features static bool hasRenderTypeControl(U32 data); - static void toggleRenderDebug(U32 data); + static void toggleRenderDebug(U64 data); static void toggleRenderDebugFeature(U32 data); static void toggleRenderTypeControl(U32 data); static bool toggleRenderTypeControlNegated(S32 data); - static bool toggleRenderDebugControl(U32 data); + static bool toggleRenderDebugControl(U64 data); static bool toggleRenderDebugFeatureControl(U32 data); static void setRenderDebugFeatureControl(U32 bit, bool value); @@ -500,40 +500,41 @@ public: RENDER_DEBUG_FEATURE_FOOT_SHADOWS = 0x0100, }; - enum LLRenderDebugMask + enum LLRenderDebugMask: U64 { - RENDER_DEBUG_COMPOSITION = 0x00000001, - RENDER_DEBUG_VERIFY = 0x00000002, - RENDER_DEBUG_BBOXES = 0x00000004, - RENDER_DEBUG_OCTREE = 0x00000008, - RENDER_DEBUG_WIND_VECTORS = 0x00000010, - RENDER_DEBUG_OCCLUSION = 0x00000020, - RENDER_DEBUG_POINTS = 0x00000040, - RENDER_DEBUG_TEXTURE_PRIORITY = 0x00000080, - RENDER_DEBUG_TEXTURE_AREA = 0x00000100, - RENDER_DEBUG_FACE_AREA = 0x00000200, - RENDER_DEBUG_PARTICLES = 0x00000400, - RENDER_DEBUG_GLOW = 0x00000800, // not used - RENDER_DEBUG_TEXTURE_ANIM = 0x00001000, - RENDER_DEBUG_LIGHTS = 0x00002000, - RENDER_DEBUG_BATCH_SIZE = 0x00004000, - RENDER_DEBUG_ALPHA_BINS = 0x00008000, // not used - RENDER_DEBUG_RAYCAST = 0x00010000, - RENDER_DEBUG_AVATAR_DRAW_INFO = 0x00020000, - RENDER_DEBUG_SHADOW_FRUSTA = 0x00040000, - RENDER_DEBUG_SCULPTED = 0x00080000, - RENDER_DEBUG_AVATAR_VOLUME = 0x00100000, - RENDER_DEBUG_AVATAR_JOINTS = 0x00200000, - RENDER_DEBUG_BUILD_QUEUE = 0x00400000, - RENDER_DEBUG_AGENT_TARGET = 0x00800000, - RENDER_DEBUG_UPDATE_TYPE = 0x01000000, - RENDER_DEBUG_PHYSICS_SHAPES = 0x02000000, - RENDER_DEBUG_NORMALS = 0x04000000, - RENDER_DEBUG_LOD_INFO = 0x08000000, - RENDER_DEBUG_RENDER_COMPLEXITY = 0x10000000, - RENDER_DEBUG_ATTACHMENT_BYTES = 0x20000000, // not used - RENDER_DEBUG_TEXEL_DENSITY = 0x40000000, - RENDER_DEBUG_TRIANGLE_COUNT = 0x80000000 + RENDER_DEBUG_COMPOSITION = 0x00000001, + RENDER_DEBUG_VERIFY = 0x00000002, + RENDER_DEBUG_BBOXES = 0x00000004, + RENDER_DEBUG_OCTREE = 0x00000008, + RENDER_DEBUG_WIND_VECTORS = 0x00000010, + RENDER_DEBUG_OCCLUSION = 0x00000020, + RENDER_DEBUG_POINTS = 0x00000040, + RENDER_DEBUG_TEXTURE_PRIORITY = 0x00000080, + RENDER_DEBUG_TEXTURE_AREA = 0x00000100, + RENDER_DEBUG_FACE_AREA = 0x00000200, + RENDER_DEBUG_PARTICLES = 0x00000400, + RENDER_DEBUG_GLOW = 0x00000800, // not used + RENDER_DEBUG_TEXTURE_ANIM = 0x00001000, + RENDER_DEBUG_LIGHTS = 0x00002000, + RENDER_DEBUG_BATCH_SIZE = 0x00004000, + RENDER_DEBUG_ALPHA_BINS = 0x00008000, // not used + RENDER_DEBUG_RAYCAST = 0x00010000, + RENDER_DEBUG_AVATAR_DRAW_INFO = 0x00020000, + RENDER_DEBUG_SHADOW_FRUSTA = 0x00040000, + RENDER_DEBUG_SCULPTED = 0x00080000, + RENDER_DEBUG_AVATAR_VOLUME = 0x00100000, + RENDER_DEBUG_AVATAR_JOINTS = 0x00200000, + RENDER_DEBUG_BUILD_QUEUE = 0x00400000, + RENDER_DEBUG_AGENT_TARGET = 0x00800000, + RENDER_DEBUG_UPDATE_TYPE = 0x01000000, + RENDER_DEBUG_PHYSICS_SHAPES = 0x02000000, + RENDER_DEBUG_NORMALS = 0x04000000, + RENDER_DEBUG_LOD_INFO = 0x08000000, + RENDER_DEBUG_RENDER_COMPLEXITY = 0x10000000, + RENDER_DEBUG_ATTACHMENT_BYTES = 0x20000000, // not used + RENDER_DEBUG_TEXEL_DENSITY = 0x40000000, + RENDER_DEBUG_TRIANGLE_COUNT = 0x80000000, + RENDER_DEBUG_IMPOSTORS = 0x100000000 }; public: @@ -670,10 +671,10 @@ protected: std::stack mRenderTypeEnableStack; U32 mRenderDebugFeatureMask; - U32 mRenderDebugMask; + U64 mRenderDebugMask; + U64 mOldRenderDebugMask; std::stack mRenderDebugFeatureStack; - U32 mOldRenderDebugMask; ///////////////////////////////////////////// // diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 8490d792fa..42744b561f 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3570,6 +3570,16 @@ function="Advanced.ToggleInfoDisplay" parameter="agent target" /> + + + +