diff options
-rw-r--r-- | indra/newview/llenvmanager.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llwaterparammanager.cpp | 22 | ||||
-rw-r--r-- | indra/newview/llwaterparammanager.h | 1 | ||||
-rw-r--r-- | indra/newview/llwlparammanager.cpp | 43 | ||||
-rw-r--r-- | indra/newview/llwlparammanager.h | 6 |
5 files changed, 57 insertions, 17 deletions
diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index bc1e0f8b14..b670c730a7 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -821,7 +821,7 @@ void LLEnvManagerNew::onRegionChange(bool interpolate) void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content) { // 1. Refresh cached region settings. - LL_DEBUGS("Windlight") << "Caching region environment settings" << LL_ENDL; + LL_DEBUGS("Windlight") << "Caching region environment settings: " << content << LL_ENDL; F32 sun_hour = 0; // *TODO LLEnvironmentSettings new_settings(content[1], content[2], content[3], sun_hour); mCachedRegionPrefs = new_settings; diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 3f4a88688e..81d2b92647 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -264,11 +264,27 @@ void LLWaterParamManager::applyUserPrefs(bool interpolate) LLSD target_water_params; // Determine new water settings based on user prefs. + + { + // Fall back to default water. + LLWaterParamSet default_water; + getParamSet("Default", default_water); + target_water_params = default_water.getAll(); + } + if (LLEnvManagerNew::instance().getUseRegionSettings()) { // *TODO: make sure whether region settings belong to the current region? - LL_DEBUGS("Windlight") << "Applying region water" << LL_ENDL; - target_water_params = LLEnvManagerNew::instance().getRegionSettings().getWaterParams(); + const LLSD& region_water_params = LLEnvManagerNew::instance().getRegionSettings().getWaterParams(); + if (region_water_params.size() != 0) // region has no water settings + { + LL_DEBUGS("Windlight") << "Applying region water" << LL_ENDL; + target_water_params = region_water_params; + } + else + { + LL_DEBUGS("Windlight") << "Applying default water" << LL_ENDL; + } } else { @@ -280,7 +296,7 @@ void LLWaterParamManager::applyUserPrefs(bool interpolate) } // Apply them with or without interpolation. - if (target_water_params.isUndefined()) + if (target_water_params.size() == 0) { llwarns << "Undefined target water params" << llendl; return; diff --git a/indra/newview/llwaterparammanager.h b/indra/newview/llwaterparammanager.h index 5fadd8d66e..fcf1f8e23d 100644 --- a/indra/newview/llwaterparammanager.h +++ b/indra/newview/llwaterparammanager.h @@ -214,6 +214,7 @@ struct WaterExpFloatControl /// WindLight parameter manager class - what controls all the wind light shaders class LLWaterParamManager : public LLSingleton<LLWaterParamManager> { + LOG_CLASS(LLWaterParamManager); public: /// load a preset file diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index 562e6c9018..d64e2420e4 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -585,30 +585,35 @@ void LLWLParamManager::update(LLViewerCamera * cam) void LLWLParamManager::applyUserPrefs(bool interpolate) { - LL_DEBUGS("Windlight") << "Applying sky prefs" << LL_ENDL; + // Remove all region sky presets because they may belong to a previously visited region. clearParamSetsOfScope(LLEnvKey::SCOPE_REGION); if (LLEnvManagerNew::instance().getUseRegionSettings()) // apply region-wide settings { - // *TODO: Support fixed sky from region. - LL_DEBUGS("Windlight") << "Applying region sky" << LL_ENDL; - const LLEnvironmentSettings& region_settings = LLEnvManagerNew::instance().getRegionSettings(); - addAllSkies(LLEnvKey::SCOPE_REGION, region_settings.getSkyMap()); - mDay.loadDayCycle(region_settings.getWLDayCycle(), LLEnvKey::SCOPE_REGION); - LL_DEBUGS("Windlight") << "Applying region time: " << region_settings.getDayTime() - << " = " << region_settings.getDayTime() * 24.0f << " h" << LL_ENDL; - resetAnimator(region_settings.getDayTime(), true); + if (region_settings.getSkyMap().size() == 0) + { + applyDefaults(); + } + else + { + // *TODO: Support fixed sky from region. + LL_DEBUGS("Windlight") << "Applying region sky" << LL_ENDL; + + // Add all sky presets belonging to the current region. + addAllSkies(LLEnvKey::SCOPE_REGION, region_settings.getSkyMap()); + + // Apply region day cycle. + mDay.loadDayCycle(region_settings.getWLDayCycle(), LLEnvKey::SCOPE_REGION); + resetAnimator(region_settings.getDayTime(), true); + } } else // apply user-specified settings { if (LLEnvManagerNew::instance().getUseDayCycle()) { - std::string day_cycle = LLEnvManagerNew::instance().getDayCycleName(); - LL_DEBUGS("Windlight") << "Applying day cycle [" << day_cycle << "]" << LL_ENDL; - mDay.loadDayCycleFromFile(day_cycle + ".xml"); - resetAnimator(0.5, true); // set to noon and start animator + applyDayCycle(LLEnvManagerNew::instance().getDayCycleName()); } else { @@ -620,6 +625,18 @@ void LLWLParamManager::applyUserPrefs(bool interpolate) } } +void LLWLParamManager::applyDefaults() +{ + applyDayCycle("Default"); +} + +void LLWLParamManager::applyDayCycle(const std::string& day_cycle) +{ + LL_DEBUGS("Windlight") << "Applying day cycle [" << day_cycle << "]" << LL_ENDL; + mDay.loadDayCycleFromFile(day_cycle + ".xml"); + resetAnimator(0.5, true); // set to noon and start animator +} + void LLWLParamManager::resetAnimator(F32 curTime, bool run) { mAnimator.setTrack(mDay.mTimeMap, mDay.mDayRate, diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h index 8a852e043b..2f1edce8fc 100644 --- a/indra/newview/llwlparammanager.h +++ b/indra/newview/llwlparammanager.h @@ -238,6 +238,12 @@ public: /// apply specified params void applyUserPrefs(bool interpolate); + /// apply default sky params + void applyDefaults(); + + /// apply default sky params + void applyDayCycle(const std::string& day); + // get where the light is pointing inline LLVector4 getLightDir(void) const; |