summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-03-03 00:53:39 +0000
committerGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-03-03 00:53:39 +0000
commit98862a53a77cd1ce9a2cae596a743669cc32a2af (patch)
tree09838f73b2b7ecaabb88a9839b343ac0f6b68aa7 /indra/newview
parentacdead96cd194040f586c5a6e976beca7bb999c4 (diff)
Fix 16F enum for compat w/ SL gl headers on Mac.
Make density profile/layer parsing handle when LLSD heard you liked arrays so it put an array in your array.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llenvadapters.h54
-rw-r--r--indra/newview/llenvironment.cpp10
-rw-r--r--indra/newview/llsettingsvo.cpp18
-rw-r--r--indra/newview/llsettingsvo.h8
-rw-r--r--indra/newview/llvosky.cpp14
5 files changed, 83 insertions, 21 deletions
diff --git a/indra/newview/llenvadapters.h b/indra/newview/llenvadapters.h
index 1547e38b1d..c53423c5ae 100644
--- a/indra/newview/llenvadapters.h
+++ b/indra/newview/llenvadapters.h
@@ -354,6 +354,60 @@ private:
std::string mName;
};
+class LLDensityProfileSettingsAdapter
+{
+public:
+ LLDensityProfileSettingsAdapter(const std::string& config, int layerIndex = 0)
+ : mConfig(config)
+ , mLayerIndex(layerIndex)
+ , mLayerWidth(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH)
+ , mExpTerm(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM)
+ , mExpScale(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR)
+ , mLinTerm(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM)
+ , mConstantTerm(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM)
+ {}
+
+protected:
+ std::string mConfig;
+ int mLayerIndex;
+ WLFloatControl mLayerWidth; // 0.0 -> to top of atmosphere, however big that may be.
+ WLFloatControl mExpTerm;
+ WLFloatControl mExpScale;
+ WLFloatControl mLinTerm;
+ WLFloatControl mConstantTerm;
+};
+
+class LLRayleighDensityProfileSettingsAdapter : public LLDensityProfileSettingsAdapter
+{
+public:
+ LLRayleighDensityProfileSettingsAdapter(int layerIndex = 0)
+ : LLDensityProfileSettingsAdapter(LLSettingsSky::SETTING_RAYLEIGH_CONFIG, layerIndex)
+ {
+ }
+};
+
+class LLMieDensityProfileSettingsAdapter : public LLDensityProfileSettingsAdapter
+{
+public:
+ LLMieDensityProfileSettingsAdapter(int layerIndex = 0)
+ : LLDensityProfileSettingsAdapter(LLSettingsSky::SETTING_MIE_CONFIG, layerIndex)
+ , mAnisotropy(0.8f, LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR)
+ {
+ }
+
+protected:
+ WLFloatControl mAnisotropy;
+};
+
+class LLAbsorptionDensityProfileSettingsAdapter : public LLDensityProfileSettingsAdapter
+{
+public:
+ LLAbsorptionDensityProfileSettingsAdapter(int layerIndex = 0)
+ : LLDensityProfileSettingsAdapter(LLSettingsSky::SETTING_ABSORPTION_CONFIG, layerIndex)
+ {
+ }
+};
+
//-------------------------------------------------------------------------
class LLSkySettingsAdapter
{
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index c67fcf880e..1936a67a18 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -1157,7 +1157,15 @@ void LLEnvironment::legacyLoadAllPresets()
std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPreset(name, data);
- LLEnvironment::instance().addDayCycle(day);
+ if (day->validate())
+ {
+ LL_INFOS() << "Adding Day Cycle " << name << "." << LL_ENDL;
+ LLEnvironment::instance().addDayCycle(day);
+ }
+ else
+ {
+ LL_WARNS() << "Day Cycle " << name << " was not valid. Ignoring." << LL_ENDL;
+ }
#ifdef EXPORT_PRESETS
std::string exportfile = LLURI::escape(name) + "(new).xml";
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index f57de011f8..4c10017a57 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -331,13 +331,15 @@ LLSettingsBase::ptr_t LLSettingsVOBase::importFile(const std::string &filename)
//=========================================================================
-LLSettingsVOSky::LLSettingsVOSky(const LLSD &data):
- LLSettingsSky(data)
+LLSettingsVOSky::LLSettingsVOSky(const LLSD &data, bool isAdvanced)
+: LLSettingsSky(data)
+, m_isAdvanced(isAdvanced)
{
}
-LLSettingsVOSky::LLSettingsVOSky():
- LLSettingsSky()
+LLSettingsVOSky::LLSettingsVOSky()
+: LLSettingsSky()
+, m_isAdvanced(false)
{
}
@@ -354,7 +356,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildSky(LLSD settings)
LLSettingsSky::ptr_t();
}
- return std::make_shared<LLSettingsVOSky>(settings);
+ return std::make_shared<LLSettingsVOSky>(settings, true);
}
@@ -376,7 +378,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n
LLSettingsSky::ptr_t skyp = std::make_shared<LLSettingsVOSky>(newsettings);
#ifdef VERIFY_LEGACY_CONVERSION
- LLSD oldsettings = LLSettingsVOSky::convertToLegacy(skyp);
+ LLSD oldsettings = LLSettingsVOSky::convertToLegacy(skyp, isAdvanced());
if (!llsd_equals(legacy, oldsettings))
{
@@ -423,7 +425,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()
return skyp;
}
-LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky)
+LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isAdvanced)
{
LLSD legacy(LLSD::emptyMap());
LLSD settings = psky->getSettings();
@@ -940,7 +942,7 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday)
for (std::map<std::string, LLSettingsSky::ptr_t>::iterator its = skys.begin(); its != skys.end(); ++its)
{
- LLSD llsdsky = LLSettingsVOSky::convertToLegacy((*its).second);
+ LLSD llsdsky = LLSettingsVOSky::convertToLegacy((*its).second, false);
llsdsky[SETTING_NAME] = (*its).first;
llsdskylist[(*its).first] = llsdsky;
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index 7f8dc40c36..48b5cad168 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -79,7 +79,7 @@ private:
class LLSettingsVOSky : public LLSettingsSky
{
public:
- LLSettingsVOSky(const LLSD &data);
+ LLSettingsVOSky(const LLSD &data, bool advanced = false);
static ptr_t buildSky(LLSD settings);
@@ -87,7 +87,10 @@ public:
static ptr_t buildDefaultSky();
virtual ptr_t buildClone() override;
- static LLSD convertToLegacy(const ptr_t &);
+ static LLSD convertToLegacy(const ptr_t &, bool isAdvanced);
+
+ bool isAdvanced() const { return m_isAdvanced; }
+
protected:
LLSettingsVOSky();
@@ -97,6 +100,7 @@ protected:
virtual parammapping_t getParameterMap() const override;
+ bool m_isAdvanced = false;
};
//=========================================================================
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index f27bfcb959..61500aebfe 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -665,8 +665,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
- LLColor3 light_atten =
- (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y);
+ LLColor3 light_atten = (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y);
// Calculate relative weights
LLColor3 temp2(0.f, 0.f, 0.f);
@@ -704,9 +703,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
// Haze color above cloud
- vary_HazeColor = (blue_horizon * blue_weight * (sunlight + ambient)
- + componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + ambient)
- );
+ vary_HazeColor = (blue_horizon * blue_weight * (sunlight + ambient) + componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + ambient));
// Increase ambient when there are more clouds
LLColor3 tmpAmbient = ambient + (LLColor3::white - ambient) * cloud_shadow * 0.5f;
@@ -715,9 +712,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
sunlight *= (1.f - cloud_shadow);
// Haze color below cloud
- LLColor3 additiveColorBelowCloud = (blue_horizon * blue_weight * (sunlight + tmpAmbient)
- + componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + tmpAmbient)
- );
+ LLColor3 additiveColorBelowCloud = (blue_horizon * blue_weight * (sunlight + tmpAmbient) + componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + tmpAmbient));
// Final atmosphere additive
componentMultBy(vary_HazeColor, LLColor3::white - temp1);
@@ -731,8 +726,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
temp1 = componentSqrt(temp1); //less atmos opacity (more transparency) below clouds
// At horizon, blend high altitude sky color towards the darker color below the clouds
- vary_HazeColor +=
- componentMult(additiveColorBelowCloud - vary_HazeColor, LLColor3::white - componentSqrt(temp1));
+ vary_HazeColor += componentMult(additiveColorBelowCloud - vary_HazeColor, LLColor3::white - componentSqrt(temp1));
if (Pn[1] < 0.f)
{