summaryrefslogtreecommitdiff
path: root/indra/newview/llenvironment.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-09-23 11:36:50 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-09-23 11:36:50 -0400
commit8bcff54654f9ec98d166dabd38180be63dc8837c (patch)
tree65d1744531195f7ec3bd8eee000928dcd8ca62a9 /indra/newview/llenvironment.cpp
parent4af7cd51e9cc22d9dc2fe42e378051c55515ac8e (diff)
parentdb013ab0cb7dafb964b149a36b6963770f7427e5 (diff)
Merge remote branch 'develop'into release/luau-scripting
Diffstat (limited to 'indra/newview/llenvironment.cpp')
-rw-r--r--indra/newview/llenvironment.cpp105
1 files changed, 13 insertions, 92 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 0b4630dfc3..05bd704556 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -453,11 +453,11 @@ namespace
void applyInjections(LLSettingsBase::Seconds delta)
{
- this->mSettings = this->mSource->getSettings();
+ LLSD settings = this->mSource->cloneSettings();
for (auto ito = mOverrideValues.beginMap(); ito != mOverrideValues.endMap(); ++ito)
{
- this->mSettings[(*ito).first] = (*ito).second;
+ settings[(*ito).first] = (*ito).second;
}
const LLSettingsBase::stringset_t &slerps = this->getSlerpKeys();
@@ -469,7 +469,7 @@ namespace
{
std::string key_name = (*it)->mKeyName;
- LLSD value = this->mSettings[key_name];
+ LLSD value = settings[key_name];
LLSD target = (*it)->mValue;
if ((*it)->mFirstTime)
@@ -485,11 +485,11 @@ namespace
{
mOverrideValues[key_name] = target;
mOverrideExps[key_name] = (*it)->mExperience;
- this->mSettings[key_name] = target;
+ settings[key_name] = target;
}
else
{
- this->mSettings.erase(key_name);
+ settings.erase(key_name);
}
}
else if (specials.find(key_name) != specials.end())
@@ -500,8 +500,8 @@ namespace
{
if (!(*it)->mBlendIn)
mix = 1.0 - mix;
- (*it)->mLastValue = this->interpolateSDValue(key_name, value, target, this->getParameterMap(), mix, slerps);
- this->mSettings[key_name] = (*it)->mLastValue;
+ (*it)->mLastValue = this->interpolateSDValue(key_name, value, target, this->getParameterMap(), mix, skips, slerps);
+ settings[key_name] = (*it)->mLastValue;
}
}
@@ -520,7 +520,7 @@ namespace
{
mInjections.erase(mInjections.begin(), mInjections.end());
}
-
+ this->setSettings(settings);
}
bool hasInjections() const
@@ -685,7 +685,8 @@ namespace
if (!injection->mBlendIn)
mix = 1.0 - mix;
stringset_t dummy;
- F64 value = this->mSettings[injection->mKeyName].asReal();
+ LLSD settings = this->cloneSettings();
+ F64 value = settings[injection->mKeyName].asReal();
if (this->getCloudNoiseTextureId().isNull())
{
value = 0; // there was no texture so start from zero coverage
@@ -695,7 +696,8 @@ namespace
// with different transitions, don't ignore it
F64 result = lerp((F32)value, (F32)injection->mValue.asReal(), (F32)mix);
injection->mLastValue = LLSD::Real(result);
- this->mSettings[injection->mKeyName] = injection->mLastValue;
+ settings[injection->mKeyName] = injection->mLastValue;
+ this->setSettings(settings);
}
// Unfortunately I don't have a per texture blend factor. We'll just pick the one that is furthest along.
@@ -1740,90 +1742,9 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con
{
uniforms[i].clear();
}
-
- LLShaderUniforms* shader = &uniforms[LLGLSLShader::SG_ANY];
- //_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
- LLSettingsBase::parammapping_t params = psetting->getParameterMap();
- for (auto &it: params)
- {
- LLSD value;
- // legacy first since it contains ambient color and we prioritize value from legacy, see getAmbientColor()
- if (psetting->mSettings.has(LLSettingsSky::SETTING_LEGACY_HAZE) && psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE].has(it.first))
- {
- value = psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE][it.first];
- }
- else if (psetting->mSettings.has(it.first))
- {
- value = psetting->mSettings[it.first];
- }
- else
- {
- // We need to reset shaders, use defaults
- value = it.second.getDefaultValue();
- }
-
- LLSD::Type setting_type = value.type();
- stop_glerror();
- switch (setting_type)
- {
- case LLSD::TypeInteger:
- shader->uniform1i(it.second.getShaderKey(), value.asInteger());
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
- case LLSD::TypeReal:
- shader->uniform1f(it.second.getShaderKey(), (F32)value.asReal());
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
-
- case LLSD::TypeBoolean:
- shader->uniform1i(it.second.getShaderKey(), value.asBoolean() ? 1 : 0);
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
-
- case LLSD::TypeArray:
- {
- LLVector4 vect4(value);
- // always identify as a radiance pass if desaturating irradiance is disabled
- static LLCachedControl<bool> desaturate_irradiance(gSavedSettings, "RenderDesaturateIrradiance", true);
-
- if (desaturate_irradiance && gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass())
- { // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color
- auto max_vec = [](LLVector4 col)
- {
- LLColor3 color(col);
- F32 h, s, l;
- color.calcHSL(&h, &s, &l);
-
- col.mV[0] = col.mV[1] = col.mV[2] = l;
- return col;
- };
-
- switch (it.second.getShaderKey())
- {
- case LLShaderMgr::BLUE_HORIZON:
- case LLShaderMgr::BLUE_DENSITY:
- vect4 = max_vec(vect4);
- break;
- }
- }
-
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL;
- shader->uniform3fv(it.second.getShaderKey(), LLVector3(vect4.mV) );
- break;
- }
-
- // case LLSD::TypeMap:
- // case LLSD::TypeString:
- // case LLSD::TypeUUID:
- // case LLSD::TypeURI:
- // case LLSD::TypeBinary:
- // case LLSD::TypeDate:
- default:
- break;
- }
- }
//_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
+ psetting->applyToUniforms(uniforms);
psetting->applySpecial(uniforms);
}