From 438d97714778ebb8728f0ac3808f0b8f98afc1fa Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 25 Jun 2018 16:02:51 -0700 Subject: Adding pause clouds to menu, and throttling expensive visual update on change. --- indra/newview/llenvironment.cpp | 4 +- indra/newview/llviewermenu.cpp | 13 ++++++- indra/newview/llvosky.cpp | 43 +++++++++++++--------- indra/newview/skins/default/xui/en/menu_viewer.xml | 15 +++++++- 4 files changed, 53 insertions(+), 22 deletions(-) (limited to 'indra') diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 94605dc062..ee5eec59a3 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -66,6 +66,7 @@ namespace LLTrace::BlockTimerStatHandle FTM_SHADER_PARAM_UPDATE("Update Shader Parameters"); LLSettingsBase::Seconds DEFAULT_UPDATE_THRESHOLD(10.0); + const LLSettingsBase::Seconds MINIMUM_SPANLENGTH(0.01f); //--------------------------------------------------------------------- inline LLSettingsBase::TrackPosition get_wrapping_distance(LLSettingsBase::TrackPosition begin, LLSettingsBase::TrackPosition end) @@ -221,7 +222,8 @@ namespace LLSettingsBase::Seconds getSpanTime(const LLSettingsDay::TrackBound_t &bounds) const { LLSettingsBase::Seconds span = mCycleLength * get_wrapping_distance((*bounds.first).first, (*bounds.second).first); - llassert(span > 0.01f); + if (span < MINIMUM_SPANLENGTH) // for very short spans set a minimum length. + span = MINIMUM_SPANLENGTH; return span; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index ce6cb78909..3688f6614f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8420,11 +8420,18 @@ class LLWorldEnvSettings : public view_listener_t LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_MIDNIGHT); LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } - else + else if (tod == "region") { LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_LOCAL); LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } + else if (tod == "pauseclouds") + { + if (LLEnvironment::instance().isCloudScrollPaused()) + LLEnvironment::instance().resumeCloudScroll(); + else + LLEnvironment::instance().pauseCloudScroll(); + } LLEnvironment::instance().updateEnvironment(); return true; @@ -8467,6 +8474,10 @@ class LLWorldEnableEnvSettings : public view_listener_t { return false; } + else if (tod == "pauseclouds") + { + return LLEnvironment::instance().isCloudScrollPaused(); + } else { LL_WARNS() << "Unknown time-of-day item: " << tod << LL_ENDL; diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 4c84e40c73..d2247b3b33 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -59,27 +59,31 @@ #undef min #undef max -static const S32 NUM_TILES_X = 8; -static const S32 NUM_TILES_Y = 4; -static const S32 NUM_TILES = NUM_TILES_X * NUM_TILES_Y; +namespace +{ + const S32 NUM_TILES_X = 8; + const S32 NUM_TILES_Y = 4; + const S32 NUM_TILES = NUM_TILES_X * NUM_TILES_Y; -// Heavenly body constants -static const F32 SUN_DISK_RADIUS = 0.5f; -static const F32 MOON_DISK_RADIUS = SUN_DISK_RADIUS * 0.9f; -static const F32 SUN_INTENSITY = 1e5; + // Heavenly body constants + const F32 SUN_DISK_RADIUS = 0.5f; + const F32 MOON_DISK_RADIUS = SUN_DISK_RADIUS * 0.9f; + const F32 SUN_INTENSITY = 1e5; -// Texture coordinates: -static const LLVector2 TEX00 = LLVector2(0.f, 0.f); -static const LLVector2 TEX01 = LLVector2(0.f, 1.f); -static const LLVector2 TEX10 = LLVector2(1.f, 0.f); -static const LLVector2 TEX11 = LLVector2(1.f, 1.f); + // Texture coordinates: + const LLVector2 TEX00 = LLVector2(0.f, 0.f); + const LLVector2 TEX01 = LLVector2(0.f, 1.f); + const LLVector2 TEX10 = LLVector2(1.f, 0.f); + const LLVector2 TEX11 = LLVector2(1.f, 1.f); -static const F32 LIGHT_DIRECTION_THRESHOLD = (F32) cosf(DEG_TO_RAD * 1.f); -static const F32 COLOR_CHANGE_THRESHOLD = 0.01f; + const F32 LIGHT_DIRECTION_THRESHOLD = (F32) cosf(DEG_TO_RAD * 1.f); + const F32 COLOR_CHANGE_THRESHOLD = 0.01f; -static LLTrace::BlockTimerStatHandle FTM_VOSKY_UPDATETIMER("VOSky Update Timer Tick"); -static LLTrace::BlockTimerStatHandle FTM_VOSKY_UPDATEFORCED("VOSky Update Forced"); + LLTrace::BlockTimerStatHandle FTM_VOSKY_UPDATETIMER("VOSky Update Timer Tick"); + LLTrace::BlockTimerStatHandle FTM_VOSKY_UPDATEFORCED("VOSky Update Forced"); + F32Seconds UPDATE_EXPRY(2.0f); +} /*************************************** SkyTex ***************************************/ @@ -590,6 +594,7 @@ void LLVOSky::idleUpdate(LLAgent &agent, const F64 &time) bool LLVOSky::updateSky() { + LLTimer forceupdThrottle; LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); LLColor4 total_ambient = psky->getTotalAmbient(); @@ -647,9 +652,11 @@ bool LLVOSky::updateSky() mForceUpdate = mForceUpdate || color_changed; mForceUpdate = mForceUpdate || !mInitialized; - if (mForceUpdate) + if ((mForceUpdate) && forceupdThrottle.hasExpired() && !LLPipeline::RenderDeferred) { - LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED) + LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED); + + forceupdThrottle.setTimerExpirySec(UPDATE_EXPRY); LLSkyTex::stepCurrent(); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 3cac835961..d4881d3cba 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -639,9 +639,20 @@ + + + + + -- cgit v1.2.3