diff options
author | Drake Arconis <drake@alchemyviewer.org> | 2015-06-30 10:48:34 -0400 |
---|---|---|
committer | Drake Arconis <drake@alchemyviewer.org> | 2015-06-30 10:48:34 -0400 |
commit | 0dba9289203080fe420d3112a8c3f0a01a2450dd (patch) | |
tree | eaf01a104cbea55d1417d1e1586082da87941185 /indra | |
parent | 1cfa126279f06bf4de7b78af0a2ab09a5a3a9759 (diff) |
Fix impostors.
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/lldrawpoolavatar.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 117 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.h | 3 | ||||
-rwxr-xr-x | indra/newview/pipeline.cpp | 2 |
4 files changed, 76 insertions, 48 deletions
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 706918273f..e58c2c1037 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1244,7 +1244,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) return; } - BOOL impostor = (avatarp->isImpostor() || avatarp->isTooComplex()) && !single_avatar; + BOOL impostor = avatarp->isImpostor() && !single_avatar; if (impostor && pass != 0) { //don't draw anything but the impostor for impostored avatars diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 2037a92464..fcb2f69619 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -771,9 +771,9 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mDebugExistenceTimer.reset(); mLastAppearanceMessageTimer.reset(); - if(LLSceneMonitor::getInstance()->isEnabled()) + if(LLSceneMonitor::getInstance()->isEnabled()) { - LLSceneMonitor::getInstance()->freezeAvatar((LLCharacter*)this); + LLSceneMonitor::getInstance()->freezeAvatar((LLCharacter*)this); } } @@ -3079,7 +3079,30 @@ void LLVOAvatar::slamPosition() bool LLVOAvatar::isVisuallyMuted() const { - return ( mVisuallyMuteSetting == ALWAYS_VISUAL_MUTE ); + bool muted = false; + + // Priority order (highest priority first) + // * own avatar is never visually muted + // * if on the "always draw normally" list, draw them normally + // * if on the "always visually mute" list, mute them + // * check against the render cost and attachment limits + if (!isSelf()) + { + if (mVisuallyMuteSetting == NEVER_VISUAL_MUTE) + { + muted = false; + } + else if (mVisuallyMuteSetting == ALWAYS_VISUAL_MUTE) + { // Always want to see this AV as an impostor + muted = true; + } + else + { + muted = isTooComplex(); + } + } + + return muted; } #if 0 // TBD @@ -3246,18 +3269,18 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { // visually muted avatars update at 16 hz mUpdatePeriod = 16; } - else if ( ! isImpostor() + else if ( ! shouldImpostor() || 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 ( isImpostor(4) ) + else if ( shouldImpostor(4) ) { //background avatars are REALLY slow updating impostors mUpdatePeriod = 16; } - else if ( isImpostor(3) ) + else if ( shouldImpostor(3) ) { //back 25% of max visible avatars are slow updating impostors mUpdatePeriod = 8; } @@ -6433,29 +6456,26 @@ BOOL LLVOAvatar::isFullyLoaded() const bool LLVOAvatar::isTooComplex() const { - static LLCachedControl<U32> max_render_cost(gSavedSettings, "RenderAvatarMaxComplexity", 0); - static LLCachedControl<U32> max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); - static LLCachedControl<F32> max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0.0); - bool too_complex; - - if (isSelf()) - { - too_complex = false; - } - else - { - too_complex = ( (max_render_cost > 0 && mVisualComplexity > max_render_cost) - || (max_attachment_bytes > 0 && mAttachmentGeometryBytes > max_attachment_bytes) - || (max_attachment_area > 0.f && mAttachmentSurfaceArea > max_attachment_area) - ); - } + bool too_complex; + F64 now = LLFrameTimer::getTotalSeconds(); + if (isSelf()) + { + too_complex = false; + } + else + { + // Determine if visually muted or not + static LLCachedControl<U32> max_render_cost(gSavedSettings, "RenderAvatarMaxComplexity", 0U); + static LLCachedControl<U32> max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0U); + static LLCachedControl<F32> max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0.0f); + too_complex = ((max_render_cost > 0 && mVisualComplexity > max_render_cost) + || (max_attachment_bytes > 0 && mAttachmentGeometryBytes > max_attachment_bytes) + || (max_attachment_area > 0.f && mAttachmentSurfaceArea > max_attachment_area) + ); + } - return too_complex; -} + return too_complex; -bool LLVOAvatar::isImpostor(const U32 rank_factor) const -{ - return (!isSelf() && sMaxNonImpostors != 0 && mVisibilityRank > (sMaxNonImpostors * rank_factor)); } //----------------------------------------------------------------------------- @@ -8053,37 +8073,44 @@ U32 LLVOAvatar::getPartitionType() const } //static -void LLVOAvatar::updateImpostors() +void LLVOAvatar::updateImpostors() { - LLCharacter::sAllowInstancesChange = FALSE ; + LLCharacter::sAllowInstancesChange = FALSE; for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* avatar = (LLVOAvatar*) *iter; - if (!avatar->isDead() && avatar->isVisible() - && ( (avatar->isImpostor() && avatar->needsImpostorUpdate()) - || avatar->isTooComplex() - )) + && (avatar->isImpostor() && avatar->needsImpostorUpdate()) + && (avatar->getVisualMuteSettings() != ALWAYS_VISUAL_MUTE)) { gPipeline.generateImpostor(avatar); } - else - { - LL_DEBUGS_ONCE("AvatarRender") << "Avatar " << avatar->getID() - << (avatar->isDead() ? " _is_ " : " is not ") << "dead" - << (avatar->needsImpostorUpdate() ? " needs " : " _does_not_need_ ") << "impostor update" - << (avatar->isVisible() ? " is " : " _is_not_ ") << "visible" - << (avatar->isImpostor() ? " is " : " is not ") << "impostor" - << (avatar->isTooComplex() ? " is " : " is not ") << "too complex" - << LL_ENDL; - } + else + { + LL_DEBUGS_ONCE("AvatarRender") << "Avatar " << avatar->getID() + << (avatar->isDead() ? " _is_ " : " is not ") << "dead" + << (avatar->needsImpostorUpdate() ? " needs " : " _does_not_need_ ") << "impostor update" + << (avatar->isVisible() ? " is " : " _is_not_ ") << "visible" + << (avatar->isImpostor() ? " is " : " is not ") << "impostor" + << (avatar->isTooComplex() ? " is " : " is not ") << "too complex" + << LL_ENDL; + } } - LLCharacter::sAllowInstancesChange = TRUE ; + LLCharacter::sAllowInstancesChange = TRUE; } +BOOL LLVOAvatar::isImpostor() +{ + return sUseImpostors && (isVisuallyMuted() || (mUpdatePeriod >= IMPOSTOR_PERIOD)) ? TRUE : FALSE; +} + +BOOL LLVOAvatar::shouldImpostor(const U32 rank_factor) const +{ + return (!isSelf() && sUseImpostors && mVisibilityRank > (sMaxNonImpostors * rank_factor)); +} BOOL LLVOAvatar::needsImpostorUpdate() const { diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 48f7ea92e1..1b6809f6c7 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -305,7 +305,6 @@ public: public: BOOL isFullyLoaded() const; bool isTooComplex() const; - bool isImpostor(const U32 rank_factor = 1) const; bool visualParamWeightsAreDefault(); virtual bool getIsCloud() const; BOOL isFullyTextured() const; @@ -464,6 +463,8 @@ private: // Impostors //-------------------------------------------------------------------- public: + BOOL isImpostor(); + BOOL shouldImpostor(const U32 rank_factor = 1) const; BOOL needsImpostorUpdate() const; const LLVector3& getImpostorOffset() const; const LLVector2& getImpostorDim() const; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 6aae95967a..4365c28a5e 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -11542,7 +11542,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) LLGLDisable blend(GL_BLEND); - if (too_complex) + if (visually_muted || too_complex) { gGL.setColorMask(true, true); } |