diff options
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 85 |
1 files changed, 69 insertions, 16 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index efa0133a9a..fc22b7c186 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2413,6 +2413,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"); //------------------------------------------------------------------------ @@ -2462,7 +2463,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()) { @@ -2470,6 +2470,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); } @@ -2554,7 +2555,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) @@ -2865,7 +2899,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; @@ -3213,7 +3250,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); @@ -3233,7 +3270,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()) @@ -3241,14 +3278,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; @@ -3340,7 +3377,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) @@ -3349,7 +3386,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(); } @@ -3899,6 +3936,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; @@ -4285,15 +4327,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; @@ -4342,12 +4384,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); } @@ -4375,10 +4422,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; } //----------------------------------------------------------------------------- @@ -10141,7 +10191,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; |