From 24c353a1ad00366b9f4ce57492059ce8caf84ba0 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 22 Feb 2011 17:29:38 -0500 Subject: first pass at clouding avatars that are too complex --- indra/newview/llviewercontrol.cpp | 6 ++++++ indra/newview/llvoavatar.cpp | 16 ++++++++++++++++ indra/newview/llvoavatar.h | 2 ++ indra/newview/llvovolume.cpp | 10 +++++----- 4 files changed, 29 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index e319eba0ee..d99f3b6c88 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -165,6 +165,11 @@ static bool handleRenderPerfTestChanged(const LLSD& newvalue) return true; } +bool handleRenderAvatarComplexityLimitChanged(const LLSD& newvalue) +{ + return true; +} + bool handleRenderTransparentWaterChanged(const LLSD& newvalue) { LLWorld::getInstance()->updateWaterObjects(); @@ -586,6 +591,7 @@ void settings_setup_listeners() gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderGammaFull")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderAvatarMaxVisible")->getSignal()->connect(boost::bind(&handleAvatarMaxVisibleChanged, _2)); + gSavedSettings.getControl("RenderAvatarComplexityLimit")->getSignal()->connect(boost::bind(&handleRenderAvatarComplexityLimitChanged, _2)); gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _2)); gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _2)); gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _2)); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 856c068a44..be65af1e71 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6307,6 +6307,11 @@ BOOL LLVOAvatar::getIsCloud() { return TRUE; } + + if (isTooComplex()) + { + return TRUE; + } return FALSE; } @@ -6401,6 +6406,16 @@ BOOL LLVOAvatar::isFullyLoaded() const return mFullyLoaded; } +bool LLVOAvatar::isTooComplex() const +{ + if (gSavedSettings.getS32("RenderAvatarComplexityLimit") > 0 && mVisualComplexity >= gSavedSettings.getS32("RenderAvatarComplexityLimit")) + { + return true; + } + + return false; +} + //----------------------------------------------------------------------------- // findMotion() @@ -8338,6 +8353,7 @@ void LLVOAvatar::idleUpdateRenderCost() } setDebugText(llformat("%d", cost)); + mVisualComplexity = cost; F32 green = 1.f-llclamp(((F32) cost-(F32)ARC_LIMIT)/(F32)ARC_LIMIT, 0.f, 1.f); F32 red = llmin((F32) cost/(F32)ARC_LIMIT, 1.f); mText->setColor(LLColor4(red,green,0,1)); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 1152475383..f41c385894 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -263,6 +263,7 @@ public: //-------------------------------------------------------------------- public: BOOL isFullyLoaded() const; + bool isTooComplex() const; bool visualParamWeightsAreDefault(); protected: virtual BOOL getIsCloud(); @@ -275,6 +276,7 @@ private: BOOL mPreviousFullyLoaded; BOOL mFullyLoadedInitialized; S32 mFullyLoadedFrameCounter; + S32 mVisualComplexity; LLFrameTimer mFullyLoadedTimer; LLFrameTimer mRuthTimer; protected: diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index e3dea5c788..f5b31d25ac 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2943,9 +2943,9 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const U32 num_triangles = 0; // per-prim costs - static const U32 ARC_PARTICLE_COST = 1; - static const U32 ARC_PARTICLE_MAX = 2048; - static const U32 ARC_TEXTURE_COST = 32; + static const U32 ARC_PARTICLE_COST = 1; // determined experimentally + static const U32 ARC_PARTICLE_MAX = 2048; // default values + static const U32 ARC_TEXTURE_COST = 32; // multiplier for texture resolution - performance tested // per-prim multipliers static const F32 ARC_GLOW_MULT = 1.5f; // tested based on performance @@ -2955,9 +2955,9 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const static const F32 ARC_INVISI_COST = 1.2f; // tested based on performance static const F32 ARC_WEIGHTED_MESH = 1.2f; - static const F32 ARC_PLANAR_COST = 1.2f; // 1.2x max + static const F32 ARC_PLANAR_COST = 1.0f; // tested based on performance to have negligible impact static const F32 ARC_ANIM_TEX_COST = 1.4f; // 1.4x max - static const F32 ARC_ALPHA_COST = 4.f; // 4x max + static const F32 ARC_ALPHA_COST = 4.f; // 4x max - based on performance F32 shame = 0; -- cgit v1.2.3