summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2020-09-23 20:20:27 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2020-09-23 20:20:27 +0100
commit1cba874abf6f955cf52d68c30c3230ec58528057 (patch)
treeaab7c3a11e440fdb8c1e70f2c625e6f6034cf2c2 /indra/newview/llvoavatar.cpp
parent1049f15c9cbb3d9fdd3f1f8529b7ca46c5f2b7f3 (diff)
parent60ed688026269568a9eef67437dc780f88c92871 (diff)
Merge remote-tracking branch 'origin/master' into DRTVWR-517
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r--indra/newview/llvoavatar.cpp85
1 files changed, 69 insertions, 16 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 318d4359e0..ca5b604cd2 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2456,6 +2456,7 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid)
}
static LLTrace::BlockTimerStatHandle FTM_AVATAR_UPDATE("Avatar Update");
+static LLTrace::BlockTimerStatHandle FTM_AVATAR_UPDATE_COMPLEXITY("Avatar Update Complexity");
static LLTrace::BlockTimerStatHandle FTM_JOINT_UPDATE("Update Joints");
//------------------------------------------------------------------------
@@ -2505,7 +2506,6 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
}
// Update should be happening max once per frame.
- const S32 upd_freq = 4; // force update every upd_freq frames.
if ((mLastAnimExtents[0]==LLVector3())||
(mLastAnimExtents[1])==LLVector3())
{
@@ -2513,6 +2513,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
}
else
{
+ const S32 upd_freq = 4; // force update every upd_freq frames.
mNeedsExtentUpdate = ((LLDrawable::getCurrentFrame()+mID.mData[0])%upd_freq==0);
}
@@ -2597,7 +2598,40 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
}
idleUpdateNameTag( mLastRootPos );
- idleUpdateRenderComplexity();
+
+ // Complexity has stale mechanics, but updates still can be very rapid
+ // so spread avatar complexity calculations over frames to lesen load from
+ // rapid updates and to make sure all avatars are not calculated at once.
+ S32 compl_upd_freq = 20;
+ if (isControlAvatar())
+ {
+ // animeshes do not (or won't) have impostors nor change outfis,
+ // no need for high frequency
+ compl_upd_freq = 100;
+ }
+ else if (mLastRezzedStatus <= 0) //cloud or init
+ {
+ compl_upd_freq = 60;
+ }
+ else if (isSelf())
+ {
+ compl_upd_freq = 5;
+ }
+ else if (mLastRezzedStatus == 1) //'grey', not fully loaded
+ {
+ compl_upd_freq = 40;
+ }
+ else if (isInMuteList()) //cheap, buffers value from search
+ {
+ compl_upd_freq = 100;
+ }
+
+ if ((LLFrameTimer::getFrameCount() + mID.mData[0]) % compl_upd_freq == 0)
+ {
+ LL_RECORD_BLOCK_TIME(FTM_AVATAR_UPDATE_COMPLEXITY);
+ idleUpdateRenderComplexity();
+ }
+ idleUpdateDebugInfo();
}
void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
@@ -2908,7 +2942,10 @@ F32 LLVOAvatar::calcMorphAmount()
void LLVOAvatar::idleUpdateLipSync(bool voice_enabled)
{
// Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync
- if ( voice_enabled && (LLVoiceClient::getInstance()->lipSyncEnabled()) && LLVoiceClient::getInstance()->getIsSpeaking( mID ) )
+ if ( voice_enabled
+ && mLastRezzedStatus > 0 // no point updating lip-sync for clouds
+ && (LLVoiceClient::getInstance()->lipSyncEnabled())
+ && LLVoiceClient::getInstance()->getIsSpeaking( mID ) )
{
F32 ooh_morph_amount = 0.0f;
F32 aah_morph_amount = 0.0f;
@@ -3256,7 +3293,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)
std::string title_str = title->getString();
LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR);
addNameTagLine(title_str, name_tag_color, LLFontGL::NORMAL,
- LLFontGL::getFontSansSerifSmall());
+ LLFontGL::getFontSansSerifSmall(), true);
}
static LLUICachedControl<bool> show_display_names("NameTagShowDisplayNames", true);
@@ -3276,7 +3313,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)
if (show_display_names)
{
addNameTagLine(av_name.getDisplayName(), name_tag_color, LLFontGL::NORMAL,
- LLFontGL::getFontSansSerif());
+ LLFontGL::getFontSansSerif(), true);
}
// Suppress SLID display if display name matches exactly (ugh)
if (show_usernames && !av_name.isDisplayNameDefault())
@@ -3284,14 +3321,14 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)
// *HACK: Desaturate the color
LLColor4 username_color = name_tag_color * 0.83f;
addNameTagLine(av_name.getUserName(), username_color, LLFontGL::NORMAL,
- LLFontGL::getFontSansSerifSmall());
+ LLFontGL::getFontSansSerifSmall(), true);
}
}
else
{
const LLFontGL* font = LLFontGL::getFontSansSerif();
std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() );
- addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font);
+ addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font, true);
}
mNameAway = is_away;
@@ -3383,7 +3420,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)
}
}
-void LLVOAvatar::addNameTagLine(const std::string& line, const LLColor4& color, S32 style, const LLFontGL* font)
+void LLVOAvatar::addNameTagLine(const std::string& line, const LLColor4& color, S32 style, const LLFontGL* font, const bool use_ellipses)
{
llassert(mNameText);
if (mVisibleChat)
@@ -3392,7 +3429,7 @@ void LLVOAvatar::addNameTagLine(const std::string& line, const LLColor4& color,
}
else
{
- mNameText->addLine(line, color, (LLFontGL::StyleFlags)style, font);
+ mNameText->addLine(line, color, (LLFontGL::StyleFlags)style, font, use_ellipses);
}
mNameIsSet |= !line.empty();
}
@@ -3977,6 +4014,11 @@ void LLVOAvatar::computeUpdatePeriod()
{ //background avatars are REALLY slow updating impostors
mUpdatePeriod = 16;
}
+ else if (mLastRezzedStatus <= 0)
+ {
+ // Don't update cloud avatars too often
+ mUpdatePeriod = 8;
+ }
else if ( shouldImpostor(3) )
{ //back 25% of max visible avatars are slow updating impostors
mUpdatePeriod = 8;
@@ -4396,15 +4438,15 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
// Set mUpdatePeriod and visible based on distance and other criteria.
//--------------------------------------------------------------------
computeUpdatePeriod();
- visible = (LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0 ? TRUE : FALSE;
+ bool needs_update = (LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0;
//--------------------------------------------------------------------
- // Early out if not visible and not self
+ // Early out if does not need update and not self
// don't early out for your own avatar, as we rely on your animations playing reliably
// for example, the "turn around" animation when entering customize avatar needs to trigger
// even when your avatar is offscreen
//--------------------------------------------------------------------
- if (!visible && !isSelf())
+ if (!needs_update && !isSelf())
{
updateMotions(LLCharacter::HIDDEN_UPDATE);
return FALSE;
@@ -4459,12 +4501,17 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
mSpeed = speed;
// update animations
- if (mSpecialRenderMode == 1) // Animation Preview
+ if (!visible)
+ {
+ updateMotions(LLCharacter::HIDDEN_UPDATE);
+ }
+ else if (mSpecialRenderMode == 1) // Animation Preview
{
updateMotions(LLCharacter::FORCE_UPDATE);
}
else
{
+ // Might be better to do HIDDEN_UPDATE if cloud
updateMotions(LLCharacter::NORMAL_UPDATE);
}
@@ -4492,10 +4539,13 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
// Update child joints as needed.
mRoot->updateWorldMatrixChildren();
- // System avatar mesh vertices need to be reskinned.
- mNeedsSkin = TRUE;
+ if (visible)
+ {
+ // System avatar mesh vertices need to be reskinned.
+ mNeedsSkin = TRUE;
+ }
- return TRUE;
+ return visible;
}
//-----------------------------------------------------------------------------
@@ -10293,7 +10343,10 @@ void LLVOAvatar::idleUpdateRenderComplexity()
// Render Complexity
calculateUpdateRenderComplexity(); // Update mVisualComplexity if needed
+}
+void LLVOAvatar::idleUpdateDebugInfo()
+{
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO))
{
std::string info_line;