summaryrefslogtreecommitdiff
path: root/indra/newview/llenvmanager.cpp
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-05-17 16:26:55 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-05-17 16:26:55 +0300
commit348218e40f362d386a0175d4b010b639282764b2 (patch)
tree3dcb3d1d5dc8dadee923613cf2b88434f1ec4d75 /indra/newview/llenvmanager.cpp
parent3d0688da9461766d783383d68a990fcf8711228e (diff)
STORM-1245 WIP Restored environment settings interpolation on region crossing.
Also got rid of duplicated region environment settings requests.
Diffstat (limited to 'indra/newview/llenvmanager.cpp')
-rw-r--r--indra/newview/llenvmanager.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp
index 338a1e5f0a..5a04578e26 100644
--- a/indra/newview/llenvmanager.cpp
+++ b/indra/newview/llenvmanager.cpp
@@ -670,7 +670,7 @@ void LLEnvManagerNew::setUseRegionSettings(bool val)
{
mUserPrefs.setUseDefaults(val);
saveUserPrefs();
- updateManagersFromPrefs();
+ updateManagersFromPrefs(false);
}
void LLEnvManagerNew::setUseWaterPreset(const std::string& name)
@@ -683,7 +683,7 @@ void LLEnvManagerNew::setUseWaterPreset(const std::string& name)
mUserPrefs.setUseWaterPreset(name);
saveUserPrefs();
- updateManagersFromPrefs();
+ updateManagersFromPrefs(false);
}
void LLEnvManagerNew::setUseSkyPreset(const std::string& name)
@@ -696,7 +696,7 @@ void LLEnvManagerNew::setUseSkyPreset(const std::string& name)
mUserPrefs.setUseSkyPreset(name);
saveUserPrefs();
- updateManagersFromPrefs();
+ updateManagersFromPrefs(false);
}
void LLEnvManagerNew::setUseDayCycle(const std::string& name)
@@ -709,7 +709,7 @@ void LLEnvManagerNew::setUseDayCycle(const std::string& name)
mUserPrefs.setUseDayCycle(name);
saveUserPrefs();
- updateManagersFromPrefs();
+ updateManagersFromPrefs(true);
}
void LLEnvManagerNew::loadUserPrefs()
@@ -749,12 +749,6 @@ void LLEnvManagerNew::onRegionCrossing()
onRegionChange(true);
}
-void LLEnvManagerNew::onLogin()
-{
- LL_DEBUGS("Windlight") << "Logged in" << LL_ENDL;
- onRegionChange(false);
-}
-
void LLEnvManagerNew::onTeleport()
{
LL_DEBUGS("Windlight") << "Teleported" << LL_ENDL;
@@ -771,15 +765,13 @@ void LLEnvManagerNew::initSingleton()
loadUserPrefs();
}
-void LLEnvManagerNew::updateManagersFromPrefs()
+void LLEnvManagerNew::updateManagersFromPrefs(bool interpolate)
{
- // *TODO: apply region settings if user preferences say to do so.
-
// Apply water settings.
- LLWaterParamManager::instance().applyUserPrefs();
+ LLWaterParamManager::instance().applyUserPrefs(interpolate);
// Apply sky settings.
- LLWLParamManager::instance().applyUserPrefs();
+ LLWLParamManager::instance().applyUserPrefs(interpolate);
}
void LLEnvManagerNew::sendRegionSettingsRequest()
@@ -790,6 +782,18 @@ void LLEnvManagerNew::sendRegionSettingsRequest()
void LLEnvManagerNew::onRegionChange(bool interpolate)
{
+ // Avoid duplicating region setting requests
+ // by checking whether the region is actually changing.
+ LLViewerRegion* regionp = gAgent.getRegion();
+ LLUUID region_uuid = regionp ? regionp->getRegionID() : LLUUID::null;
+ if (region_uuid == mCurRegionUUID)
+ {
+ return;
+ }
+
+ // Request environment settings of the new region.
+ LL_DEBUGS("Windlight") << "New viewer region: " << region_uuid << LL_ENDL;
+ mCurRegionUUID = region_uuid;
mInterpNextChangeMessage = interpolate;
sendRegionSettingsRequest();
}
@@ -805,6 +809,8 @@ void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content)
// 2. If using server settings, update managers.
if (getUseRegionSettings())
{
- updateManagersFromPrefs();
+ updateManagersFromPrefs(mInterpNextChangeMessage);
}
+
+ mInterpNextChangeMessage = false;
}