summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-09-07 23:13:57 +0100
committerGraham Linden <graham@lindenlab.com>2018-09-07 23:13:57 +0100
commiteb1ddbc14256e9321887efa8c5fb29637bd7f5a0 (patch)
tree8c2d2e6e476b5db2bccde572b665b80662e44510 /indra/llinventory
parent1f69a685eb7d403b8ad5b2ebc24978151da49910 (diff)
parent0c599af9173c641ad96db8dc510a5364e93a5a29 (diff)
Merge
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llsettingssky.cpp112
-rw-r--r--indra/llinventory/llsettingssky.h29
2 files changed, 105 insertions, 36 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index bc7f4f2b5a..56449c0598 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -564,36 +564,53 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList()
return validation;
}
+LLSD LLSettingsSky::createDensityProfileLayer(
+ F32 width,
+ F32 exponential_term,
+ F32 exponential_scale_factor,
+ F32 linear_term,
+ F32 constant_term,
+ F32 aniso_factor)
+{
+ LLSD dflt_layer;
+ dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = width; // 0 -> the entire atmosphere
+ dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = exponential_term;
+ dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = exponential_scale_factor;
+ dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = linear_term;
+ dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = constant_term;
+
+ if (aniso_factor != 0.0f)
+ {
+ dflt_layer[SETTING_MIE_ANISOTROPY_FACTOR] = aniso_factor;
+ }
+
+ return dflt_layer;
+}
+
+LLSD LLSettingsSky::createSingleLayerDensityProfile(
+ F32 width,
+ F32 exponential_term,
+ F32 exponential_scale_factor,
+ F32 linear_term,
+ F32 constant_term,
+ F32 aniso_factor)
+{
+ LLSD dflt;
+ LLSD dflt_layer = createDensityProfileLayer(width, exponential_term, exponential_scale_factor, linear_term, constant_term, aniso_factor);
+ dflt.append(dflt_layer);
+ return dflt;
+}
+
LLSD LLSettingsSky::rayleighConfigDefault()
{
- LLSD dflt_rayleigh;
- LLSD dflt_rayleigh_layer;
- dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere
- dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f;
- dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f;
- dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f;
- dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f;
- dflt_rayleigh.append(dflt_rayleigh_layer);
- return dflt_rayleigh;
+ return createSingleLayerDensityProfile(0.0f, 1.0f, -1.0f / 8000.0f, 0.0f, 0.0f);
}
LLSD LLSettingsSky::absorptionConfigDefault()
{
// absorption (ozone) has two linear ramping zones
- LLSD dflt_absorption_layer_a;
- dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere
- dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f;
- dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f;
- dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f;
- dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f;
-
- LLSD dflt_absorption_layer_b;
- dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere
- dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f;
- dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f;
- dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f;
- dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f;
-
+ LLSD dflt_absorption_layer_a = createDensityProfileLayer(25000.0f, 0.0f, 0.0f, -1.0f / 25000.0f, -2.0f / 3.0f);
+ LLSD dflt_absorption_layer_b = createDensityProfileLayer(0.0f, 0.0f, 0.0f, -1.0f / 15000.0f, 8.0f / 3.0f);
LLSD dflt_absorption;
dflt_absorption.append(dflt_absorption_layer_a);
dflt_absorption.append(dflt_absorption_layer_b);
@@ -602,15 +619,7 @@ LLSD LLSettingsSky::absorptionConfigDefault()
LLSD LLSettingsSky::mieConfigDefault()
{
- LLSD dflt_mie;
- LLSD dflt_mie_layer;
- dflt_mie_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere
- dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f;
- dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f;
- dflt_mie_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f;
- dflt_mie_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f;
- dflt_mie_layer[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f;
- dflt_mie.append(dflt_mie_layer);
+ LLSD dflt_mie = createSingleLayerDensityProfile(0.0f, 1.0f, -1.0f / 1200.0f, 0.0f, 0.0f, 0.8f);
return dflt_mie;
}
@@ -661,7 +670,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position)
dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f;
dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f;
dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f;
- dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f;
+ dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00045f;
dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault();
dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault();
@@ -1152,9 +1161,27 @@ F32 LLSettingsSky::getSunArcRadians() const
F32 LLSettingsSky::getMieAnisotropy() const
{
- return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal();
+ return getMieConfig()[SETTING_MIE_ANISOTROPY_FACTOR].asReal();
}
-
+
+LLSD LLSettingsSky::getRayleighConfig() const
+{
+ LLSD copy = *(mSettings[SETTING_RAYLEIGH_CONFIG].beginArray());
+ return copy;
+}
+
+LLSD LLSettingsSky::getMieConfig() const
+{
+ LLSD copy = *(mSettings[SETTING_MIE_CONFIG].beginArray());
+ return copy;
+}
+
+LLSD LLSettingsSky::getAbsorptionConfig() const
+{
+ LLSD copy = *(mSettings[SETTING_ABSORPTION_CONFIG].beginArray());
+ return copy;
+}
+
LLSD LLSettingsSky::getRayleighConfigs() const
{
return mSettings[SETTING_RAYLEIGH_CONFIG];
@@ -1170,6 +1197,21 @@ LLSD LLSettingsSky::getAbsorptionConfigs() const
return mSettings[SETTING_ABSORPTION_CONFIG];
}
+void LLSettingsSky::setRayleighConfigs(const LLSD& rayleighConfig)
+{
+ mSettings[SETTING_RAYLEIGH_CONFIG] = rayleighConfig;
+}
+
+void LLSettingsSky::setMieConfigs(const LLSD& mieConfig)
+{
+ mSettings[SETTING_MIE_CONFIG] = mieConfig;
+}
+
+void LLSettingsSky::setAbsorptionConfigs(const LLSD& absorptionConfig)
+{
+ mSettings[SETTING_ABSORPTION_CONFIG] = absorptionConfig;
+}
+
LLUUID LLSettingsSky::getBloomTextureId() const
{
return mSettings[SETTING_BLOOM_TEXTUREID].asUUID();
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 20b8d01879..a4ea8c98f4 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -116,12 +116,23 @@ public:
F32 getSkyTopRadius() const;
F32 getSunArcRadians() const;
F32 getMieAnisotropy() const;
+
+ // Return first (only) profile layer represented in LLSD
+ LLSD getRayleighConfig() const;
+ LLSD getMieConfig() const;
+ LLSD getAbsorptionConfig() const;
+
+ // Return entire LLSDArray of profile layers represented in LLSD
LLSD getRayleighConfigs() const;
LLSD getMieConfigs() const;
-
LLSD getAbsorptionConfigs() const;
+
LLUUID getBloomTextureId() const;
+ void setRayleighConfigs(const LLSD& rayleighConfig);
+ void setMieConfigs(const LLSD& mieConfig);
+ void setAbsorptionConfigs(const LLSD& absorptionConfig);
+
//---------------------------------------------------------------------
LLColor3 getAmbientColor() const;
void setAmbientColor(const LLColor3 &val);
@@ -248,6 +259,22 @@ public:
static LLUUID GetDefaultCloudNoiseTextureId();
static LLUUID GetDefaultBloomTextureId();
+ static LLSD createDensityProfileLayer(
+ F32 width,
+ F32 exponential_term,
+ F32 exponential_scale_factor,
+ F32 linear_term,
+ F32 constant_term,
+ F32 aniso_factor = 0.0f);
+
+ static LLSD createSingleLayerDensityProfile(
+ F32 width,
+ F32 exponential_term,
+ F32 exponential_scale_factor,
+ F32 linear_term,
+ F32 constant_term,
+ F32 aniso_factor = 0.0f);
+
protected:
static const std::string SETTING_LEGACY_EAST_ANGLE;
static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL;