summaryrefslogtreecommitdiff
path: root/indra/newview/llenvironment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llenvironment.cpp')
-rw-r--r--indra/newview/llenvironment.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index b14fbefeb9..d73a486877 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -168,6 +168,9 @@ namespace
// Find normalized track position of given time along full length of cycle
inline LLSettingsBase::TrackPosition convert_time_to_position(const LLSettingsBase::Seconds& time, const LLSettingsBase::Seconds& len)
{
+ // early out to avoid divide by zero. if len is zero then jump to end position
+ if (len == 0.f) return 1.f;
+
LLSettingsBase::TrackPosition position = LLSettingsBase::TrackPosition(fmod((F64)time, (F64)len) / (F64)len);
return llclamp(position, 0.0f, 1.0f);
}
@@ -1179,13 +1182,14 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironm
return;
}
- DayInstance::ptr_t environment = getEnvironmentInstance(env, true);
+ bool reset_probes = false;
+ DayInstance::ptr_t environment = getEnvironmentInstance(env, true);
if (fixed.first)
{
logEnvironment(env, fixed.first, env_version);
- environment->setSky(fixed.first);
+ reset_probes = environment->setSky(fixed.first);
environment->setFlags(DayInstance::NO_ANIMATE_SKY);
}
else if (!environment->getSky())
@@ -1196,7 +1200,7 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironm
// and then add water/sky on top
// This looks like it will result in sky using single keyframe instead of whole day if day is present
// when setting static water without static sky
- environment->setSky(mCurrentEnvironment->getSky());
+ reset_probes = environment->setSky(mCurrentEnvironment->getSky());
environment->setFlags(DayInstance::NO_ANIMATE_SKY);
}
else
@@ -1214,7 +1218,7 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironm
if (substitute && substitute->getSky())
{
- environment->setSky(substitute->getSky());
+ reset_probes = environment->setSky(substitute->getSky());
environment->setFlags(DayInstance::NO_ANIMATE_SKY);
}
else
@@ -1266,7 +1270,10 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironm
}
}
- gPipeline.mReflectionMapManager.reset();
+ if (reset_probes)
+ { // the sky changed in a way that merits a reset of reflection probes
+ gPipeline.mReflectionMapManager.reset();
+ }
if (!mSignalEnvChanged.empty())
mSignalEnvChanged(env, env_version);
@@ -1741,19 +1748,8 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con
//_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
break;
case LLSD::TypeReal:
- {
- F32 v = value.asReal();
- switch (it.second.getShaderKey())
- { // convert to linear color space if this is a color parameter
- case LLShaderMgr::HAZE_HORIZON:
- case LLShaderMgr::HAZE_DENSITY:
- case LLShaderMgr::CLOUD_SHADOW:
- //v = sRGBtoLinear(v);
- break;
- }
- shader->uniform1f(it.second.getShaderKey(), v);
+ shader->uniform1f(it.second.getShaderKey(), value.asReal());
//_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- }
break;
case LLSD::TypeBoolean:
@@ -2788,10 +2784,12 @@ void LLEnvironment::DayInstance::setDay(const LLSettingsDay::ptr_t &pday, LLSett
}
-void LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky)
+bool LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky)
{
mInitialized = false;
+ bool changed = psky == nullptr || mSky == nullptr || mSky->getHash() != psky->getHash();
+
bool different_sky = mSky != psky;
mSky = psky;
@@ -2805,6 +2803,8 @@ void LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky)
LLEnvironment::getAtmosphericModelSettings(settings, psky);
gAtmosphere->configureAtmosphericModel(settings);
}
+
+ return changed;
}
void LLEnvironment::DayInstance::setWater(const LLSettingsWater::ptr_t &pwater)