summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-05-21 19:39:52 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-05-21 19:39:52 +0300
commitc2c8753d2565c9fba41f0d5dd390e14d72cd40b9 (patch)
treee0db4dce241e3527e98fb5ae84f4d926420e40b5
parent401868c440fb77b101845f1efc6ec1b1f2ef3352 (diff)
SL-11012 Ambient setting can be missing from llsd
-rw-r--r--indra/newview/llvosky.cpp2
-rw-r--r--indra/newview/llwlparamset.cpp18
-rw-r--r--indra/newview/llwlparamset.h8
3 files changed, 27 insertions, 1 deletions
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index c131cb886f..1e631a2272 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -630,7 +630,7 @@ void LLVOSky::initAtmospherics(void)
dome_radius = LLWLParamManager::getInstance()->getDomeRadius();
dome_offset_ratio = LLWLParamManager::getInstance()->getDomeOffset();
sunlight_color = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("sunlight_color", error));
- ambient = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("ambient", error));
+ ambient = LLColor3(LLWLParamManager::getInstance()->mCurParams.getAmbient());
//lightnorm = LLWLParamManager::getInstance()->mCurParams.getVector("lightnorm", error);
gamma = LLWLParamManager::getInstance()->mCurParams.getFloat("gamma", error);
blue_density = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("blue_density", error));
diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp
index 066cb9a0ac..cd7a32abdd 100644
--- a/indra/newview/llwlparamset.cpp
+++ b/indra/newview/llwlparamset.cpp
@@ -284,6 +284,11 @@ void LLWLParamSet::setEastAngle(float val)
mParamValues["east_angle"] = val;
}
+void LLWLParamSet::setAmbient(const LLVector4& val)
+{
+ set("ambient", val);
+}
+
void LLWLParamSet::mix(LLWLParamSet& src, LLWLParamSet& dest, F32 weight)
{
// set up the iterators
@@ -379,6 +384,19 @@ void LLWLParamSet::mix(LLWLParamSet& src, LLWLParamSet& dest, F32 weight)
setSunAngle((1 - weight) * srcSunAngle + weight * destSunAngle);
setEastAngle((1 - weight) * srcEastAngle + weight * destEastAngle);
+
+ // ambient
+
+ LLVector4 srcAmbient = src.getAmbient();
+ LLVector4 destAmbient = dest.getAmbient();
+ LLVector4 rsltAmbient;
+
+ for (int i = 0; i < LENGTHOFVECTOR4; ++i)
+ {
+ rsltAmbient.mV[i] = srcAmbient.mV[i] + ((destAmbient.mV[i] - srcAmbient.mV[i]) * weight);
+ }
+
+ setAmbient(rsltAmbient);
// now setup the sun properly
diff --git a/indra/newview/llwlparamset.h b/indra/newview/llwlparamset.h
index 6e5f1d3a4b..9874f0f2e0 100644
--- a/indra/newview/llwlparamset.h
+++ b/indra/newview/llwlparamset.h
@@ -136,6 +136,9 @@ public:
void setEastAngle(F32 val);
F32 getEastAngle();
+
+ void setAmbient(const LLVector4& val);
+ LLVector4 getAmbient();
@@ -207,6 +210,11 @@ inline F32 LLWLParamSet::getEastAngle() {
return (F32) mParamValues["east_angle"].asReal();
}
+inline LLVector4 LLWLParamSet::getAmbient() {
+ bool error;
+ return mParamValues.has("ambient") ? getVector("ambient", error) : LLVector4(0.5f, 0.75f, 1.0f, 1.19f);
+}
+
inline void LLWLParamSet::setEnableCloudScrollX(bool val) {
mParamValues["enable_cloud_scroll"][0] = val;