diff options
author | Oz Linden <oz@lindenlab.com> | 2015-02-21 15:08:40 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2015-02-21 15:08:40 -0500 |
commit | d12f3d15d986231cbd2e3714ce39247b2b6bc30f (patch) | |
tree | eedcbca5622e39b2a9fc65c07005b7d3963387c8 /indra/newview/llvoavatar.cpp | |
parent | c598094d153c36b7b1c5504c460e3e4a750e947e (diff) | |
parent | 3cf8a1ce6e81c30cf7231a5ab045bbc45c6757e2 (diff) |
merge impostor and visual muting changes
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 68 |
1 files changed, 48 insertions, 20 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0a35b2bb00..85c60a74cc 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -613,7 +613,7 @@ private: //----------------------------------------------------------------------------- LLAvatarAppearanceDictionary *LLVOAvatar::sAvatarDictionary = NULL; S32 LLVOAvatar::sFreezeCounter = 0; -U32 LLVOAvatar::sMaxVisible = 12; +U32 LLVOAvatar::sMaxNonImpostors = 12; // overridden based on graphics setting F32 LLVOAvatar::sRenderDistance = 256.f; S32 LLVOAvatar::sNumVisibleAvatars = 0; S32 LLVOAvatar::sNumLODChangesThisFrame = 0; @@ -640,7 +640,7 @@ BOOL LLVOAvatar::sShowFootPlane = FALSE; BOOL LLVOAvatar::sVisibleInFirstPerson = FALSE; F32 LLVOAvatar::sLODFactor = 1.f; F32 LLVOAvatar::sPhysicsLODFactor = 1.f; -BOOL LLVOAvatar::sUseImpostors = FALSE; +bool LLVOAvatar::sUseImpostors = false; BOOL LLVOAvatar::sJointDebug = FALSE; F32 LLVOAvatar::sUnbakedTime = 0.f; F32 LLVOAvatar::sUnbakedUpdateTime = 0.f; @@ -2135,7 +2135,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) } idleUpdateNameTag( root_pos_last ); - idleUpdateRenderCost(); + idleUpdateRenderComplexity(); } void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) @@ -3079,7 +3079,7 @@ bool LLVOAvatar::isVisuallyMuted() const { static LLCachedControl<U32> max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); static LLCachedControl<F32> max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0.0); - static LLCachedControl<U32> max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); + static LLCachedControl<U32> max_render_cost(gSavedSettings, "RenderAvatarMaxComplexity", 0); if (mVisuallyMuteSetting == ALWAYS_VISUAL_MUTE) { // Always want to see this AV as an impostor @@ -3234,18 +3234,18 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { // visually muted avatars update at 16 hz mUpdatePeriod = 16; } - else if (mVisibilityRank <= LLVOAvatar::sMaxVisible || - mDrawable->mDistanceWRTCamera < 1.f + mag) - { //first 25% of max visible avatars are not impostored - //also, don't impostor avatars whose bounding box may be penetrating the - //impostor camera near clip plane + else if ( mVisibilityRank <= LLVOAvatar::sMaxNonImpostors + || mDrawable->mDistanceWRTCamera < 1.f + mag) + { // first 25% of max visible avatars are not impostored + // also, don't impostor avatars whose bounding box may be penetrating the + // impostor camera near clip plane mUpdatePeriod = 1; } - else if (mVisibilityRank > LLVOAvatar::sMaxVisible * 4) + else if (mVisibilityRank > LLVOAvatar::sMaxNonImpostors * 4) { //background avatars are REALLY slow updating impostors mUpdatePeriod = 16; } - else if (mVisibilityRank > LLVOAvatar::sMaxVisible * 3) + else if (mVisibilityRank > LLVOAvatar::sMaxNonImpostors * 3) { //back 25% of max visible avatars are slow updating impostors mUpdatePeriod = 8; } @@ -8019,7 +8019,35 @@ void LLVOAvatar::getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& d angle.mV[2] = da; } -void LLVOAvatar::idleUpdateRenderCost() +// static +const U32 LLVOAvatar::IMPOSTORS_OFF = 66; /* Must equal the maximum allowed the RenderAvatarMaxNonImpostors + * slider in panel_preferences_graphics1.xml */ + +// static +void LLVOAvatar::updateImpostorRendering(U32 newMaxNonImpostorsValue) +{ + U32 oldmax = sMaxNonImpostors; + bool oldflg = sUseImpostors; + + if (IMPOSTORS_OFF <= newMaxNonImpostorsValue) + { + sMaxNonImpostors = 0; + } + else + { + sMaxNonImpostors = newMaxNonImpostorsValue; + } + // the sUseImpostors flag depends on whether or not sMaxNonImpostors is set to the no-limit value (0) + sUseImpostors = (0 != sMaxNonImpostors); + + LL_DEBUGS("AvatarRender") + << "was " << (oldflg ? "use" : "don't use" ) << " impostors (max " << oldmax << "); " + << "now " << (sUseImpostors ? "use" : "don't use" ) << " impostors (max " << sMaxNonImpostors << "); " + << LL_ENDL; +} + + +void LLVOAvatar::idleUpdateRenderComplexity() { if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO)) { @@ -8044,11 +8072,11 @@ void LLVOAvatar::idleUpdateRenderCost() * controls muting MUST match that in the isVisuallyMuted method. */ - // Render Cost (ARC) - calculateUpdateRenderCost(); // Update mVisualComplexity if needed + // Render Complexity + calculateUpdateRenderComplexity(); // Update mVisualComplexity if needed - static LLCachedControl<U32> max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); - info_line = llformat("%d ARC", mVisualComplexity); + static LLCachedControl<U32> max_render_cost(gSavedSettings, "RenderAvatarMaxComplexity", 0); + info_line = llformat("%d Complexity", mVisualComplexity); if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this { @@ -8068,7 +8096,7 @@ void LLVOAvatar::idleUpdateRenderCost() // Visual rank info_line = llformat("%d rank", mVisibilityRank); // Use grey for imposters, white for normal rendering or no impostors - info_color.set((sMaxVisible > 0 && mVisibilityRank > sMaxVisible) ? LLColor4::grey : LLColor4::white); + info_color.set((sMaxNonImpostors > 0 && mVisibilityRank > sMaxNonImpostors) ? LLColor4::grey : LLColor4::white); info_style = LLFontGL::NORMAL; mText->addLine(info_line, info_color, info_style); @@ -8116,9 +8144,9 @@ void LLVOAvatar::idleUpdateRenderCost() // Calculations for mVisualComplexity value -void LLVOAvatar::calculateUpdateRenderCost() +void LLVOAvatar::calculateUpdateRenderComplexity() { - static const U32 ARC_BODY_PART_COST = 200; + static const U32 COMPLEXITY_BODY_PART_COST = 200; // Diagnostic list of all textures on our avatar static std::set<LLUUID> all_textures; @@ -8138,7 +8166,7 @@ void LLVOAvatar::calculateUpdateRenderCost() { if (isTextureVisible(tex_index)) { - cost +=ARC_BODY_PART_COST; + cost +=COMPLEXITY_BODY_PART_COST; } } } |