summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2017-10-05 15:40:48 -0700
committerRider Linden <rider@lindenlab.com>2017-10-05 15:40:48 -0700
commite4b035d0cd3eaa76fd82643c17e3631c67387a54 (patch)
tree9147a9993aa7e5b33808fd31fca3950d0f2c950f /indra
parente97c52bdd3cfdf12c3eb2e423b193979de816f34 (diff)
Skys settings object active.
Diffstat (limited to 'indra')
-rw-r--r--indra/llmath/v4color.h11
-rw-r--r--indra/llrender/llshadermgr.h7
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llenvadapters.cpp55
-rw-r--r--indra/newview/llenvadapters.h225
-rw-r--r--indra/newview/llfloatereditsky.cpp539
-rw-r--r--indra/newview/llfloatereditsky.h17
-rw-r--r--indra/newview/llsettingsbase.cpp21
-rw-r--r--indra/newview/llsettingsbase.h3
-rw-r--r--indra/newview/llsettingssky.cpp176
-rw-r--r--indra/newview/llsettingssky.h199
-rw-r--r--indra/newview/llvosky.cpp205
-rw-r--r--indra/newview/llvosky.h49
-rw-r--r--indra/newview/llwlparammanager.cpp34
-rw-r--r--indra/newview/llwlparammanager.h9
15 files changed, 894 insertions, 658 deletions
diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h
index 8f353ead5a..614cdc9f3e 100644
--- a/indra/llmath/v4color.h
+++ b/indra/llmath/v4color.h
@@ -114,9 +114,11 @@ class LLColor4
friend LLColor4 operator-(const LLColor4 &a, const LLColor4 &b); // Return vector a minus b
friend LLColor4 operator*(const LLColor4 &a, const LLColor4 &b); // Return component wise a * b
friend LLColor4 operator*(const LLColor4 &a, F32 k); // Return rgb times scaler k (no alpha change)
+ friend LLColor4 operator/(const LLColor4 &a, F32 k); // Return rgb divided by scalar k (no alpha change)
friend LLColor4 operator*(F32 k, const LLColor4 &a); // Return rgb times scaler k (no alpha change)
friend LLColor4 operator%(const LLColor4 &a, F32 k); // Return alpha times scaler k (no rgb change)
friend LLColor4 operator%(F32 k, const LLColor4 &a); // Return alpha times scaler k (no rgb change)
+
friend bool operator==(const LLColor4 &a, const LLColor4 &b); // Return a == b
friend bool operator!=(const LLColor4 &a, const LLColor4 &b); // Return a != b
@@ -477,6 +479,15 @@ inline LLColor4 operator*(const LLColor4 &a, F32 k)
a.mV[VW]);
}
+inline LLColor4 operator/(const LLColor4 &a, F32 k)
+{
+ return LLColor4(
+ a.mV[VX] / k,
+ a.mV[VY] / k,
+ a.mV[VZ] / k,
+ a.mV[VW]);
+}
+
inline LLColor4 operator*(F32 k, const LLColor4 &a)
{
// only affects rgb (not a!)
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index 394b38f832..7bdd97200d 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -30,6 +30,11 @@
#include "llgl.h"
#include "llglslshader.h"
+/*RIDER: TODO:
+ * This should use the LL Singleton<> template... but not a quick conversion.
+ * (llviewershadermgr derives from this)
+ */
+
class LLShaderMgr
{
public:
@@ -215,7 +220,7 @@ public:
TERRAIN_ALPHARAMP,
SHINY_ORIGIN,
-DISPLAY_GAMMA,
+ DISPLAY_GAMMA,
END_RESERVED_UNIFORMS
} eGLSLReservedUniforms;
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 72339b2f51..d8d1c0b51e 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -181,6 +181,7 @@ set(viewer_SOURCE_FILES
lldrawpoolwlsky.cpp
lldynamictexture.cpp
llemote.cpp
+ llenvadapters.cpp
llenvironment.cpp
llenvmanager.cpp
llestateinfomodel.cpp
@@ -804,6 +805,7 @@ set(viewer_HEADER_FILES
lldrawpoolwlsky.h
lldynamictexture.h
llemote.h
+ llenvadapters.h
llenvironment.h
llenvmanager.h
llestateinfomodel.h
diff --git a/indra/newview/llenvadapters.cpp b/indra/newview/llenvadapters.cpp
new file mode 100644
index 0000000000..8bed0737dd
--- /dev/null
+++ b/indra/newview/llenvadapters.cpp
@@ -0,0 +1,55 @@
+/**
+ * @file llenvadapters.cpp
+ * @brief Declaration of classes managing WindLight and water settings.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llenvadapters.h"
+
+#include "llsettingssky.h"
+//=========================================================================
+
+LLSkySettingsAdapter::LLSkySettingsAdapter():
+ mWLGamma(1.0f, LLSettingsSky::SETTING_GAMMA),
+ mBlueHorizon(LLColor4(0.25f, 0.25f, 1.0f, 1.0f), LLSettingsSky::SETTING_BLUE_HORIZON, "WLBlueHorizon"),
+ mHazeDensity(1.0f, LLSettingsSky::SETTING_HAZE_DENSITY),
+ mBlueDensity(LLColor4(0.25f, 0.25f, 0.25f, 1.0f), LLSettingsSky::SETTING_BLUE_DENSITY, "WLBlueDensity"),
+ mDensityMult(1.0f, LLSettingsSky::SETTING_DENSITY_MULTIPLIER, 1000),
+ mHazeHorizon(1.0f, LLSettingsSky::SETTING_HAZE_HORIZON),
+ mMaxAlt(4000.0f, LLSettingsSky::SETTING_MAX_Y),
+ // Lighting
+ mLightnorm(LLColor4(0.f, 0.707f, -0.707f, 1.f), LLSettingsSky::SETTING_LIGHT_NORMAL),
+ mSunlight(LLColor4(0.5f, 0.5f, 0.5f, 1.0f), LLSettingsSky::SETTING_SUNLIGHT_COLOR, "WLSunlight"),
+ mAmbient(LLColor4(0.5f, 0.75f, 1.0f, 1.19f), LLSettingsSky::SETTING_AMBIENT, "WLAmbient"),
+ mGlow(LLColor4(18.0f, 0.0f, -0.01f, 1.0f), LLSettingsSky::SETTING_GLOW),
+ // Clouds
+ mCloudColor(LLColor4(0.5f, 0.5f, 0.5f, 1.0f), LLSettingsSky::SETTING_CLOUD_COLOR, "WLCloudColor"),
+ mCloudMain(LLColor4(0.5f, 0.5f, 0.125f, 1.0f), LLSettingsSky::SETTING_CLOUD_POS_DENSITY1),
+ mCloudCoverage(0.0f, LLSettingsSky::SETTING_CLOUD_SHADOW),
+ mCloudDetail(LLColor4(0.0f, 0.0f, 0.0f, 1.0f), LLSettingsSky::SETTING_CLOUD_POS_DENSITY2),
+ mDistanceMult(1.0f, LLSettingsSky::SETTING_DISTANCE_MULTIPLIER),
+ mCloudScale(0.42f, LLSettingsSky::SETTING_CLOUD_SCALE)
+{
+
+}
diff --git a/indra/newview/llenvadapters.h b/indra/newview/llenvadapters.h
new file mode 100644
index 0000000000..fc7a47be1b
--- /dev/null
+++ b/indra/newview/llenvadapters.h
@@ -0,0 +1,225 @@
+/**
+ * @file llenvadapters.h
+ * @brief Declaration of classes managing WindLight and water settings.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_ENVADAPTERS_H
+#define LL_ENVADAPTERS_H
+
+#include "v3math.h"
+#include "v3color.h"
+#include "v4math.h"
+#include "llsettingsbase.h"
+
+class WLColorControl
+{
+public:
+ inline WLColorControl(LLColor4 color, const std::string& n, const std::string& slider_name = std::string()):
+ mColor(color),
+ mName(n),
+ mSliderName(slider_name),
+ mHasSliderName(false),
+ mIsSunOrAmbientColor(false),
+ mIsBlueHorizonOrDensity(false)
+ {
+ // if there's a slider name, say we have one
+ mHasSliderName = !mSliderName.empty();
+
+ // if it's the sun controller
+ mIsSunOrAmbientColor = (mSliderName == "WLSunlight" || mSliderName == "WLAmbient");
+ mIsBlueHorizonOrDensity = (mSliderName == "WLBlueHorizon" || mSliderName == "WLBlueDensity");
+ }
+
+ inline WLColorControl & operator = (const LLColor4 & val)
+ {
+ mColor = val;
+ return *this;
+ }
+
+ inline operator LLColor4 (void) const
+ {
+ return mColor;
+ }
+
+ inline operator LLColor3 (void) const
+ {
+ return vec4to3(mColor);
+ }
+
+ inline void update(const LLSettingsBase::ptr_t &psetting) const
+ {
+ psetting->setValue(mName, mColor);
+ }
+
+ inline bool getHasSliderName() const
+ {
+ return mHasSliderName;
+ }
+
+ inline std::string getSliderName() const
+ {
+ return mSliderName;
+ }
+
+ inline bool getIsSunOrAmbientColor() const
+ {
+ return mIsSunOrAmbientColor;
+ }
+
+ inline bool getIsBlueHorizonOrDensity() const
+ {
+ return mIsBlueHorizonOrDensity;
+ }
+
+ inline F32 getRed() const
+ {
+ return mColor[0];
+ }
+
+ inline F32 getGreen() const
+ {
+ return mColor[1];
+ }
+
+ inline F32 getBlue() const
+ {
+ return mColor[2];
+ }
+
+ inline F32 getIntensity() const
+ {
+ return mColor[3];
+ }
+
+ inline void setRed(F32 red)
+ {
+ mColor[0] = red;
+ }
+
+ inline void setGreen(F32 green)
+ {
+ mColor[1] = green;
+ }
+
+ inline void setBlue(F32 blue)
+ {
+ mColor[2] = blue;
+ }
+
+ inline void setIntensity(F32 intensity)
+ {
+ mColor[3] = intensity;
+ }
+
+private:
+ LLColor4 mColor; /// [3] is intensity, not alpha
+ std::string mName; /// name to use to dereference params
+ std::string mSliderName; /// name of the slider in menu
+ bool mHasSliderName; /// only set slider name for true color types
+ bool mIsSunOrAmbientColor; /// flag for if it's the sun or ambient color controller
+ bool mIsBlueHorizonOrDensity; /// flag for if it's the Blue Horizon or Density color controller
+
+};
+
+// float slider control
+class WLFloatControl
+{
+public:
+ inline WLFloatControl(F32 val, const std::string& n, F32 m = 1.0f):
+ x(val),
+ mName(n),
+ mult(m)
+ {
+ }
+
+ inline WLFloatControl &operator = (F32 val)
+ {
+ x = val;
+ return *this;
+ }
+
+ inline operator F32 (void) const
+ {
+ return x;
+ }
+
+ inline void update(const LLSettingsBase::ptr_t &psetting) const
+ {
+ psetting->setValue(mName, x);
+ }
+
+ inline F32 getMult() const
+ {
+ return mult;
+ }
+
+ inline void setValue(F32 val)
+ {
+ x = val;
+ }
+
+private:
+ F32 x;
+ std::string mName;
+ F32 mult;
+};
+
+
+//-------------------------------------------------------------------------
+class LLSkySettingsAdapter
+{
+public:
+ typedef std::shared_ptr<LLSkySettingsAdapter> ptr_t;
+
+ LLSkySettingsAdapter();
+
+ WLFloatControl mWLGamma;
+
+ /// Atmospherics
+ WLColorControl mBlueHorizon;
+ WLFloatControl mHazeDensity;
+ WLColorControl mBlueDensity;
+ WLFloatControl mDensityMult;
+ WLFloatControl mHazeHorizon;
+ WLFloatControl mMaxAlt;
+
+ /// Lighting
+ WLColorControl mLightnorm;
+ WLColorControl mSunlight;
+ WLColorControl mAmbient;
+ WLColorControl mGlow;
+
+ /// Clouds
+ WLColorControl mCloudColor;
+ WLColorControl mCloudMain;
+ WLFloatControl mCloudCoverage;
+ WLColorControl mCloudDetail;
+ WLFloatControl mDistanceMult;
+ WLFloatControl mCloudScale;
+
+
+};
+
+#endif // LL_ENVIRONMENT_H
+
diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp
index d809211ea7..1ca61e758f 100644
--- a/indra/newview/llfloatereditsky.cpp
+++ b/indra/newview/llfloatereditsky.cpp
@@ -28,6 +28,8 @@
#include "llfloatereditsky.h"
+#include <boost/make_shared.hpp>
+
// libs
#include "llbutton.h"
#include "llcheckboxctrl.h"
@@ -45,6 +47,10 @@
#include "llregioninfomodel.h"
#include "llviewerregion.h"
+#include "v3colorutil.h"
+#include "llenvironment.h"
+#include "llenvadapters.h"
+
static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f;
static const F32 WL_BLUE_HORIZON_DENSITY_SCALE = 2.0f;
static const F32 WL_CLOUD_SLIDER_SCALE = 1.0f;
@@ -61,12 +67,13 @@ static F32 time24_to_sun_pos(F32 time24)
return sun_pos;
}
-LLFloaterEditSky::LLFloaterEditSky(const LLSD &key)
-: LLFloater(key)
-, mSkyPresetNameEditor(NULL)
-, mSkyPresetCombo(NULL)
-, mMakeDefaultCheckBox(NULL)
-, mSaveButton(NULL)
+LLFloaterEditSky::LLFloaterEditSky(const LLSD &key):
+ LLFloater(key),
+ mSkyPresetNameEditor(NULL),
+ mSkyPresetCombo(NULL),
+ mMakeDefaultCheckBox(NULL),
+ mSaveButton(NULL),
+ mSkyAdapter()
{
}
@@ -77,6 +84,7 @@ BOOL LLFloaterEditSky::postBuild()
mSkyPresetCombo = getChild<LLComboBox>("sky_preset_combo");
mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb");
mSaveButton = getChild<LLButton>("save");
+ mSkyAdapter = boost::make_shared<LLSkySettingsAdapter>();
initCallbacks();
@@ -115,7 +123,7 @@ void LLFloaterEditSky::onClose(bool app_quitting)
{
if (!app_quitting) // there's no point to change environment if we're quitting
{
- LLEnvManagerNew::instance().usePrefs(); // revert changes made to current environment
+// LLEnvManagerNew::instance().usePrefs(); // revert changes made to current environment
}
}
@@ -137,71 +145,69 @@ void LLFloaterEditSky::initCallbacks(void)
mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnSave, this));
getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnCancel, this));
- LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLFloaterEditSky::onRegionSettingsChange, this));
- LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetListChange, this));
+ // *LAPRAS
+ // TODO:
+// LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLFloaterEditSky::onRegionSettingsChange, this));
+// LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetListChange, this));
// Connect to region info updates.
LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditSky::onRegionInfoUpdate, this));
//-------------------------------------------------------------------------
- LLWLParamManager& param_mgr = LLWLParamManager::instance();
-
// blue horizon
- getChild<LLUICtrl>("WLBlueHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mBlueHorizon));
+ getChild<LLUICtrl>("WLBlueHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mBlueHorizon));
// haze density, horizon, mult, and altitude
- getChild<LLUICtrl>("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mHazeDensity));
- getChild<LLUICtrl>("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mHazeHorizon));
- getChild<LLUICtrl>("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mDensityMult));
- getChild<LLUICtrl>("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mMaxAlt));
+ getChild<LLUICtrl>("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mHazeDensity));
+ getChild<LLUICtrl>("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mHazeHorizon));
+ getChild<LLUICtrl>("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mDensityMult));
+ getChild<LLUICtrl>("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mMaxAlt));
// blue density
- getChild<LLUICtrl>("WLBlueDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mBlueDensity));
+ getChild<LLUICtrl>("WLBlueDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mBlueDensity));
// Lighting
// sunlight
- getChild<LLUICtrl>("WLSunlight")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mSunlight));
+ getChild<LLUICtrl>("WLSunlight")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mSunlight));
// glow
- getChild<LLUICtrl>("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowRMoved, this, _1, &param_mgr.mGlow));
- getChild<LLUICtrl>("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowBMoved, this, _1, &param_mgr.mGlow));
+ getChild<LLUICtrl>("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowRMoved, this, _1, &mSkyAdapter->mGlow));
+ getChild<LLUICtrl>("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowBMoved, this, _1, &mSkyAdapter->mGlow));
// ambient
- getChild<LLUICtrl>("WLAmbient")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mAmbient));
+ getChild<LLUICtrl>("WLAmbient")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mAmbient));
// time of day
- getChild<LLUICtrl>("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &param_mgr.mLightnorm)); // multi-slider
+ getChild<LLUICtrl>("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm)); // multi-slider
getChild<LLTimeCtrl>("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl
- getChild<LLUICtrl>("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &param_mgr.mLightnorm));
+ getChild<LLUICtrl>("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm));
// Clouds
// Cloud Color
- getChild<LLUICtrl>("WLCloudColor")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mCloudColor));
+ getChild<LLUICtrl>("WLCloudColor")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mCloudColor));
// Cloud
- getChild<LLUICtrl>("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &param_mgr.mCloudMain));
- getChild<LLUICtrl>("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &param_mgr.mCloudMain));
- getChild<LLUICtrl>("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &param_mgr.mCloudMain));
+ getChild<LLUICtrl>("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudMain));
+ getChild<LLUICtrl>("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudMain));
+ getChild<LLUICtrl>("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudMain));
// Cloud Detail
- getChild<LLUICtrl>("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &param_mgr.mCloudDetail));
- getChild<LLUICtrl>("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &param_mgr.mCloudDetail));
- getChild<LLUICtrl>("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &param_mgr.mCloudDetail));
+ getChild<LLUICtrl>("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudDetail));
+ getChild<LLUICtrl>("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudDetail));
+ getChild<LLUICtrl>("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudDetail));
// Cloud extras
- getChild<LLUICtrl>("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mCloudCoverage));
- getChild<LLUICtrl>("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mCloudScale));
- getChild<LLUICtrl>("WLCloudLockX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXToggled, this, _1));
- getChild<LLUICtrl>("WLCloudLockY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYToggled, this, _1));
+ getChild<LLUICtrl>("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudCoverage));
+ getChild<LLUICtrl>("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudScale));
getChild<LLUICtrl>("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXMoved, this, _1));
getChild<LLUICtrl>("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYMoved, this, _1));
- getChild<LLUICtrl>("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mDistanceMult));
+ getChild<LLUICtrl>("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mDistanceMult));
// Dome
- getChild<LLUICtrl>("WLGamma")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &param_mgr.mWLGamma));
+ getChild<LLUICtrl>("WLGamma")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mWLGamma));
getChild<LLUICtrl>("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterEditSky::onStarAlphaMoved, this, _1));
}
@@ -209,320 +215,250 @@ void LLFloaterEditSky::initCallbacks(void)
void LLFloaterEditSky::syncControls()
{
- bool err;
+ LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
+ mEditSettings = psky;
- LLWLParamManager * param_mgr = LLWLParamManager::getInstance();
-
- LLWLParamSet& cur_params = param_mgr->mCurParams;
// blue horizon
- param_mgr->mBlueHorizon = cur_params.getVector(param_mgr->mBlueHorizon.mName, err);
- setColorSwatch("WLBlueHorizon", param_mgr->mBlueHorizon, WL_BLUE_HORIZON_DENSITY_SCALE);
+ mSkyAdapter->mBlueHorizon = psky->getBlueHorizon();
+ setColorSwatch("WLBlueHorizon", mSkyAdapter->mBlueHorizon, WL_BLUE_HORIZON_DENSITY_SCALE);
// haze density, horizon, mult, and altitude
- param_mgr->mHazeDensity = cur_params.getFloat(param_mgr->mHazeDensity.mName, err);
- childSetValue("WLHazeDensity", (F32) param_mgr->mHazeDensity);
- param_mgr->mHazeHorizon = cur_params.getFloat(param_mgr->mHazeHorizon.mName, err);
- childSetValue("WLHazeHorizon", (F32) param_mgr->mHazeHorizon);
- param_mgr->mDensityMult = cur_params.getFloat(param_mgr->mDensityMult.mName, err);
- childSetValue("WLDensityMult", ((F32) param_mgr->mDensityMult) * param_mgr->mDensityMult.mult);
- param_mgr->mMaxAlt = cur_params.getFloat(param_mgr->mMaxAlt.mName, err);
- childSetValue("WLMaxAltitude", (F32) param_mgr->mMaxAlt);
+ mSkyAdapter->mHazeDensity = psky->getHazeDensity();
+ childSetValue("WLHazeDensity", (F32) mSkyAdapter->mHazeDensity);
+ mSkyAdapter->mHazeHorizon = psky->getHazeHorizon();
+ childSetValue("WLHazeHorizon", (F32) mSkyAdapter->mHazeHorizon);
+ mSkyAdapter->mDensityMult = psky->getDensityMultiplier();
+ childSetValue("WLDensityMult", ((F32) mSkyAdapter->mDensityMult) * mSkyAdapter->mDensityMult.getMult());
+ mSkyAdapter->mMaxAlt = psky->getMaxY();
+ childSetValue("WLMaxAltitude", (F32) mSkyAdapter->mMaxAlt);
// blue density
- param_mgr->mBlueDensity = cur_params.getVector(param_mgr->mBlueDensity.mName, err);
- setColorSwatch("WLBlueDensity", param_mgr->mBlueDensity, WL_BLUE_HORIZON_DENSITY_SCALE);
+ mSkyAdapter->mBlueDensity = psky->getBlueDensity();
+ setColorSwatch("WLBlueDensity", mSkyAdapter->mBlueDensity, WL_BLUE_HORIZON_DENSITY_SCALE);
// Lighting
// sunlight
- param_mgr->mSunlight = cur_params.getVector(param_mgr->mSunlight.mName, err);
- setColorSwatch("WLSunlight", param_mgr->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE);
+ mSkyAdapter->mSunlight = psky->getSunlightColor();
+ setColorSwatch("WLSunlight", mSkyAdapter->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE);
// glow
- param_mgr->mGlow = cur_params.getVector(param_mgr->mGlow.mName, err);
- childSetValue("WLGlowR", 2 - param_mgr->mGlow.r / 20.0f);
- childSetValue("WLGlowB", -param_mgr->mGlow.b / 5.0f);
+ mSkyAdapter->mGlow = psky->getGlow();
+ childSetValue("WLGlowR", 2 - mSkyAdapter->mGlow.getRed() / 20.0f);
+ childSetValue("WLGlowB", -mSkyAdapter->mGlow.getBlue() / 5.0f);
// ambient
- param_mgr->mAmbient = cur_params.getVector(param_mgr->mAmbient.mName, err);
- setColorSwatch("WLAmbient", param_mgr->mAmbient, WL_SUN_AMBIENT_SLIDER_SCALE);
+ mSkyAdapter->mAmbient = psky->getAmbientColor();
+ setColorSwatch("WLAmbient", mSkyAdapter->mAmbient, WL_SUN_AMBIENT_SLIDER_SCALE);
+
+ LLSettingsSky::azimalt_t azal = psky->getSunRotationAzAl();
- F32 time24 = sun_pos_to_time24(param_mgr->mCurParams.getFloat("sun_angle",err) / F_TWO_PI);
+ F32 time24 = sun_pos_to_time24(azal.second / F_TWO_PI);
getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
getChild<LLTimeCtrl>("WLDayTime")->setTime24(time24);
- childSetValue("WLEastAngle", param_mgr->mCurParams.getFloat("east_angle",err) / F_TWO_PI);
+ childSetValue("WLEastAngle", azal.first / F_TWO_PI);
// Clouds
// Cloud Color
- param_mgr->mCloudColor = cur_params.getVector(param_mgr->mCloudColor.mName, err);
- setColorSwatch("WLCloudColor", param_mgr->mCloudColor, WL_CLOUD_SLIDER_SCALE);
+ mSkyAdapter->mCloudColor = psky->getCloudColor();
+ setColorSwatch("WLCloudColor", mSkyAdapter->mCloudColor, WL_CLOUD_SLIDER_SCALE);
// Cloud
- param_mgr->mCloudMain = cur_params.getVector(param_mgr->mCloudMain.mName, err);
- childSetValue("WLCloudX", param_mgr->mCloudMain.r);
- childSetValue("WLCloudY", param_mgr->mCloudMain.g);
- childSetValue("WLCloudDensity", param_mgr->mCloudMain.b);
+ mSkyAdapter->mCloudMain = psky->getCloudPosDensity1();
+ childSetValue("WLCloudX", mSkyAdapter->mCloudMain.getRed());
+ childSetValue("WLCloudY", mSkyAdapter->mCloudMain.getGreen());
+ childSetValue("WLCloudDensity", mSkyAdapter->mCloudMain.getBlue());
// Cloud Detail
- param_mgr->mCloudDetail = cur_params.getVector(param_mgr->mCloudDetail.mName, err);
- childSetValue("WLCloudDetailX", param_mgr->mCloudDetail.r);
- childSetValue("WLCloudDetailY", param_mgr->mCloudDetail.g);
- childSetValue("WLCloudDetailDensity", param_mgr->mCloudDetail.b);
+ mSkyAdapter->mCloudDetail = psky->getCloudPosDensity2();
+ childSetValue("WLCloudDetailX", mSkyAdapter->mCloudDetail.getRed());
+ childSetValue("WLCloudDetailY", mSkyAdapter->mCloudDetail.getGreen());
+ childSetValue("WLCloudDetailDensity", mSkyAdapter->mCloudDetail.getBlue());
// Cloud extras
- param_mgr->mCloudCoverage = cur_params.getFloat(param_mgr->mCloudCoverage.mName, err);
- param_mgr->mCloudScale = cur_params.getFloat(param_mgr->mCloudScale.mName, err);
- childSetValue("WLCloudCoverage", (F32) param_mgr->mCloudCoverage);
- childSetValue("WLCloudScale", (F32) param_mgr->mCloudScale);
+ mSkyAdapter->mCloudCoverage = psky->getCloudShadow();
+ mSkyAdapter->mCloudScale = psky->getCloudScale();
+ childSetValue("WLCloudCoverage", (F32) mSkyAdapter->mCloudCoverage);
+ childSetValue("WLCloudScale", (F32) mSkyAdapter->mCloudScale);
// cloud scrolling
- bool lockX = !param_mgr->mCurParams.getEnableCloudScrollX();
- bool lockY = !param_mgr->mCurParams.getEnableCloudScrollY();
- childSetValue("WLCloudLockX", lockX);
- childSetValue("WLCloudLockY", lockY);
+ LLVector2 scroll_rate = psky->getCloudScrollRate();
+
+ // LAPRAS: These should go away...
+ childDisable("WLCloudLockX");
+ childDisable("WLCloudLockY");
// disable if locked, enable if not
- if (lockX)
- {
- childDisable("WLCloudScrollX");
- }
- else
- {
- childEnable("WLCloudScrollX");
- }
- if (lockY)
- {
- childDisable("WLCloudScrollY");
- }
- else
- {
- childEnable("WLCloudScrollY");
- }
+ childEnable("WLCloudScrollX");
+ childEnable("WLCloudScrollY");
// *HACK cloud scrolling is off my an additive of 10
- childSetValue("WLCloudScrollX", param_mgr->mCurParams.getCloudScrollX() - 10.0f);
- childSetValue("WLCloudScrollY", param_mgr->mCurParams.getCloudScrollY() - 10.0f);
+ childSetValue("WLCloudScrollX", scroll_rate[0] - 10.0f);
+ childSetValue("WLCloudScrollY", scroll_rate[1] - 10.0f);
- param_mgr->mDistanceMult = cur_params.getFloat(param_mgr->mDistanceMult.mName, err);
- childSetValue("WLDistanceMult", (F32) param_mgr->mDistanceMult);
+ mSkyAdapter->mDistanceMult = psky->getDistanceMultiplier();
+ childSetValue("WLDistanceMult", (F32) mSkyAdapter->mDistanceMult);
// Tweak extras
- param_mgr->mWLGamma = cur_params.getFloat(param_mgr->mWLGamma.mName, err);
- childSetValue("WLGamma", (F32) param_mgr->mWLGamma);
+ mSkyAdapter->mWLGamma = psky->getGamma();
+ childSetValue("WLGamma", (F32) mSkyAdapter->mWLGamma);
- childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness());
+ childSetValue("WLStarAlpha", psky->getStarBrightness());
}
void LLFloaterEditSky::setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k)
{
// Set the value, dividing it by <k> first.
- LLVector4 color_vec = from_ctrl;
- getChild<LLColorSwatchCtrl>(name)->set(LLColor4(color_vec / k));
+ LLColor4 color = from_ctrl;
+ getChild<LLColorSwatchCtrl>(name)->set(color / k);
}
// color control callbacks
void LLFloaterEditSky::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl)
{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
+ //LLWLParamManager::getInstance()->mAnimator.deactivate();
LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
- LLVector4 color_vec(swatch->get().mV);
-
- // Set intensity to maximum of the RGB values.
- color_vec.mV[3] = llmax(color_vec.mV[0], llmax(color_vec.mV[1], color_vec.mV[2]));
+ LLColor4 color_vec(swatch->get().mV);
// Multiply RGB values by the appropriate factor.
F32 k = WL_CLOUD_SLIDER_SCALE;
- if (color_ctrl->isSunOrAmbientColor)
+ if (color_ctrl->getIsSunOrAmbientColor())
{
k = WL_SUN_AMBIENT_SLIDER_SCALE;
}
- if (color_ctrl->isBlueHorizonOrDensity)
+ else if (color_ctrl->getIsBlueHorizonOrDensity())
{
k = WL_BLUE_HORIZON_DENSITY_SCALE;
}
color_vec *= k; // intensity isn't affected by the multiplication
+ // Set intensity to maximum of the RGB values.
+ color_vec.mV[3] = color_max(color_vec);
+
// Apply the new RGBI value.
*color_ctrl = color_vec;
- color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
- LLWLParamManager::getInstance()->propagateParameters();
+ color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onColorControlRMoved(LLUICtrl* ctrl, void* userdata)
{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
-
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
- color_ctrl->r = sldr_ctrl->getValueF32();
- if (color_ctrl->isSunOrAmbientColor)
- {
- color_ctrl->r *= WL_SUN_AMBIENT_SLIDER_SCALE;
- }
- if (color_ctrl->isBlueHorizonOrDensity)
+ F32 red_value = sldr_ctrl->getValueF32();
+ F32 k = 1.0f;
+
+ if (color_ctrl->getIsSunOrAmbientColor())
{
- color_ctrl->r *= WL_BLUE_HORIZON_DENSITY_SCALE;
+ k = WL_SUN_AMBIENT_SLIDER_SCALE;
}
-
- // move i if it's the max
- if (color_ctrl->r >= color_ctrl->g && color_ctrl->r >= color_ctrl->b && color_ctrl->hasSliderName)
+ if (color_ctrl->getIsBlueHorizonOrDensity())
{
- color_ctrl->i = color_ctrl->r;
- std::string name = color_ctrl->mSliderName;
- name.append("I");
-
- if (color_ctrl->isSunOrAmbientColor)
- {
- childSetValue(name, color_ctrl->r / WL_SUN_AMBIENT_SLIDER_SCALE);
- }
- else if (color_ctrl->isBlueHorizonOrDensity)
- {
- childSetValue(name, color_ctrl->r / WL_BLUE_HORIZON_DENSITY_SCALE);
- }
- else
- {
- childSetValue(name, color_ctrl->r);
- }
+ k = WL_BLUE_HORIZON_DENSITY_SCALE;
}
+ color_ctrl->setRed(red_value * k);
- color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
-
- LLWLParamManager::getInstance()->propagateParameters();
+ adjustIntensity(color_ctrl, red_value, k);
+ color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onColorControlGMoved(LLUICtrl* ctrl, void* userdata)
{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
-
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
-
- color_ctrl->g = sldr_ctrl->getValueF32();
- if (color_ctrl->isSunOrAmbientColor)
- {
- color_ctrl->g *= WL_SUN_AMBIENT_SLIDER_SCALE;
- }
- if (color_ctrl->isBlueHorizonOrDensity)
- {
- color_ctrl->g *= WL_BLUE_HORIZON_DENSITY_SCALE;
- }
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
- // move i if it's the max
- if (color_ctrl->g >= color_ctrl->r && color_ctrl->g >= color_ctrl->b && color_ctrl->hasSliderName)
- {
- color_ctrl->i = color_ctrl->g;
- std::string name = color_ctrl->mSliderName;
- name.append("I");
-
- if (color_ctrl->isSunOrAmbientColor)
- {
- childSetValue(name, color_ctrl->g / WL_SUN_AMBIENT_SLIDER_SCALE);
- }
- else if (color_ctrl->isBlueHorizonOrDensity)
- {
- childSetValue(name, color_ctrl->g / WL_BLUE_HORIZON_DENSITY_SCALE);
- }
- else
- {
- childSetValue(name, color_ctrl->g);
- }
- }
+ F32 green_value = sldr_ctrl->getValueF32();
+ F32 k = 1.0f;
- color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
+ if (color_ctrl->getIsSunOrAmbientColor())
+ {
+ k = WL_SUN_AMBIENT_SLIDER_SCALE;
+ }
+ if (color_ctrl->getIsBlueHorizonOrDensity())
+ {
+ k = WL_BLUE_HORIZON_DENSITY_SCALE;
+ }
+ color_ctrl->setGreen(green_value * k);
- LLWLParamManager::getInstance()->propagateParameters();
+ adjustIntensity(color_ctrl, green_value, k);
+ color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onColorControlBMoved(LLUICtrl* ctrl, void* userdata)
{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
+ F32 blue_value = sldr_ctrl->getValueF32();
+ F32 k = 1.0f;
- color_ctrl->b = sldr_ctrl->getValueF32();
- if (color_ctrl->isSunOrAmbientColor)
- {
- color_ctrl->b *= WL_SUN_AMBIENT_SLIDER_SCALE;
- }
- if (color_ctrl->isBlueHorizonOrDensity)
- {
- color_ctrl->b *= WL_BLUE_HORIZON_DENSITY_SCALE;
- }
+ if (color_ctrl->getIsSunOrAmbientColor())
+ {
+ k = WL_SUN_AMBIENT_SLIDER_SCALE;
+ }
+ if (color_ctrl->getIsBlueHorizonOrDensity())
+ {
+ k = WL_BLUE_HORIZON_DENSITY_SCALE;
+ }
+ color_ctrl->setBlue(blue_value * k);
- // move i if it's the max
- if (color_ctrl->b >= color_ctrl->r && color_ctrl->b >= color_ctrl->g && color_ctrl->hasSliderName)
- {
- color_ctrl->i = color_ctrl->b;
- std::string name = color_ctrl->mSliderName;
- name.append("I");
-
- if (color_ctrl->isSunOrAmbientColor)
- {
- childSetValue(name, color_ctrl->b / WL_SUN_AMBIENT_SLIDER_SCALE);
- }
- else if (color_ctrl->isBlueHorizonOrDensity)
- {
- childSetValue(name, color_ctrl->b / WL_BLUE_HORIZON_DENSITY_SCALE);
- }
- else
- {
- childSetValue(name, color_ctrl->b);
- }
- }
+ adjustIntensity(color_ctrl, blue_value, k);
+ color_ctrl->update(mEditSettings);
+}
- color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
+void LLFloaterEditSky::adjustIntensity(WLColorControl *ctrl, F32 val, F32 scale)
+{
+ if (ctrl->getHasSliderName())
+ {
+ LLColor4 color = static_cast<LLColor4>(*ctrl);
+ F32 i = color_max(color) / scale;
+ ctrl->setIntensity(i);
+ std::string name = ctrl->getSliderName();
+ name.append("I");
- LLWLParamManager::getInstance()->propagateParameters();
+ childSetValue(name, i);
+ }
}
+
/// GLOW SPECIFIC CODE
void LLFloaterEditSky::onGlowRMoved(LLUICtrl* ctrl, void* userdata)
{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
// scaled by 20
- color_ctrl->r = (2 - sldr_ctrl->getValueF32()) * 20;
+ color_ctrl->setRed((2 - sldr_ctrl->getValueF32()) * 20);
- color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
- LLWLParamManager::getInstance()->propagateParameters();
+ color_ctrl->update(mEditSettings);
}
/// \NOTE that we want NEGATIVE (-) B
void LLFloaterEditSky::onGlowBMoved(LLUICtrl* ctrl, void* userdata)
{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
-
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
/// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big
- color_ctrl->b = -sldr_ctrl->getValueF32() * 5;
+ color_ctrl->setBlue(-sldr_ctrl->getValueF32() * 5);
- color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
- LLWLParamManager::getInstance()->propagateParameters();
+ color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onFloatControlMoved(LLUICtrl* ctrl, void* userdata)
{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
-
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLFloatControl * floatControl = static_cast<WLFloatControl *>(userdata);
- floatControl->x = sldr_ctrl->getValueF32() / floatControl->mult;
+ floatControl->setValue(sldr_ctrl->getValueF32() / floatControl->getMult());
- floatControl->update(LLWLParamManager::getInstance()->mCurParams);
- LLWLParamManager::getInstance()->propagateParameters();
+ floatControl->update(mEditSettings);
}
@@ -531,8 +467,6 @@ void LLFloaterEditSky::onFloatControlMoved(LLUICtrl* ctrl, void* userdata)
// time of day
void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata)
{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
-
LLMultiSliderCtrl* sun_msldr = getChild<LLMultiSliderCtrl>("WLSunPos");
LLSliderCtrl* east_sldr = getChild<LLSliderCtrl>("WLEastAngle");
LLTimeCtrl* time_ctrl = getChild<LLTimeCtrl>("WLDayTime");
@@ -542,99 +476,44 @@ void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata)
time_ctrl->setTime24(time24); // sync the time ctrl with the new sun position
// get the two angles
- LLWLParamManager * param_mgr = LLWLParamManager::getInstance();
-
- param_mgr->mCurParams.setSunAngle(F_TWO_PI * time24_to_sun_pos(time24));
- param_mgr->mCurParams.setEastAngle(F_TWO_PI * east_sldr->getValueF32());
+ F32 azimuth = F_TWO_PI * east_sldr->getValueF32();
+ F32 altitude = F_TWO_PI * time24_to_sun_pos(time24);
+ mEditSettings->setSunRotation(azimuth, altitude);
+ mEditSettings->setMoonRotation(azimuth + F_PI, -altitude);
- // set the sun vector
- color_ctrl->r = -sin(param_mgr->mCurParams.getEastAngle()) *
- cos(param_mgr->mCurParams.getSunAngle());
- color_ctrl->g = sin(param_mgr->mCurParams.getSunAngle());
- color_ctrl->b = cos(param_mgr->mCurParams.getEastAngle()) *
- cos(param_mgr->mCurParams.getSunAngle());
- color_ctrl->i = 1.f;
+ LLVector4 sunnorm( mEditSettings->getSunDirection(), 1.f );
- color_ctrl->update(param_mgr->mCurParams);
- param_mgr->propagateParameters();
+ color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onTimeChanged()
{
F32 time24 = getChild<LLTimeCtrl>("WLDayTime")->getTime24();
getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
- onSunMoved(getChild<LLUICtrl>("WLSunPos"), &LLWLParamManager::instance().mLightnorm);
+ onSunMoved(getChild<LLUICtrl>("WLSunPos"), &(mSkyAdapter->mLightnorm));
}
void LLFloaterEditSky::onStarAlphaMoved(LLUICtrl* ctrl)
{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
-
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- LLWLParamManager::getInstance()->mCurParams.setStarBrightness(sldr_ctrl->getValueF32());
+ mEditSettings->setStarBrightness(sldr_ctrl->getValueF32());
}
// Clouds
void LLFloaterEditSky::onCloudScrollXMoved(LLUICtrl* ctrl)
{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
-
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
// *HACK all cloud scrolling is off by an additive of 10.
- LLWLParamManager::getInstance()->mCurParams.setCloudScrollX(sldr_ctrl->getValueF32() + 10.0f);
+ mEditSettings->setCloudScrollRateX(sldr_ctrl->getValueF32() + 10.0f);
}
void LLFloaterEditSky::onCloudScrollYMoved(LLUICtrl* ctrl)
{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
-
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
// *HACK all cloud scrolling is off by an additive of 10.
- LLWLParamManager::getInstance()->mCurParams.setCloudScrollY(sldr_ctrl->getValueF32() + 10.0f);
-}
-
-void LLFloaterEditSky::onCloudScrollXToggled(LLUICtrl* ctrl)
-{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
-
- LLCheckBoxCtrl* cb_ctrl = static_cast<LLCheckBoxCtrl*>(ctrl);
-
- bool lock = cb_ctrl->get();
- LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollX(!lock);
-
- LLSliderCtrl* sldr = getChild<LLSliderCtrl>("WLCloudScrollX");
-
- if (cb_ctrl->get())
- {
- sldr->setEnabled(false);
- }
- else
- {
- sldr->setEnabled(true);
- }
-
-}
-
-void LLFloaterEditSky::onCloudScrollYToggled(LLUICtrl* ctrl)
-{
- LLWLParamManager::getInstance()->mAnimator.deactivate();
-
- LLCheckBoxCtrl* cb_ctrl = static_cast<LLCheckBoxCtrl*>(ctrl);
- bool lock = cb_ctrl->get();
- LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollY(!lock);
-
- LLSliderCtrl* sldr = getChild<LLSliderCtrl>("WLCloudScrollY");
-
- if (cb_ctrl->get())
- {
- sldr->setEnabled(false);
- }
- else
- {
- sldr->setEnabled(true);
- }
+ mEditSettings->setCloudScrollRateY(sldr_ctrl->getValueF32() + 10.0f);
}
//=================================================================================================
@@ -662,6 +541,7 @@ bool LLFloaterEditSky::isNewPreset() const
void LLFloaterEditSky::refreshSkyPresetsList()
{
+#if 0
mSkyPresetCombo->removeall();
LLWLParamManager::preset_name_list_t region_presets, user_presets, sys_presets;
@@ -698,6 +578,7 @@ void LLFloaterEditSky::refreshSkyPresetsList()
}
mSkyPresetCombo->setLabel(getString("combo_label"));
+#endif
}
void LLFloaterEditSky::enableEditing(bool enable)
@@ -718,6 +599,7 @@ void LLFloaterEditSky::enableEditing(bool enable)
void LLFloaterEditSky::saveRegionSky()
{
+#if 0
LLWLParamKey key(getSelectedSkyPreset());
llassert(key.scope == LLEnvKey::SCOPE_REGION);
@@ -728,44 +610,48 @@ void LLFloaterEditSky::saveRegionSky()
// *TODO: save to cached region settings.
LL_WARNS("Windlight") << "Saving region sky is not fully implemented yet" << LL_ENDL;
+#endif
}
-LLWLParamKey LLFloaterEditSky::getSelectedSkyPreset()
-{
- LLWLParamKey key;
-
- if (mSkyPresetNameEditor->getVisible())
- {
- key.name = mSkyPresetNameEditor->getText();
- key.scope = LLEnvKey::SCOPE_LOCAL;
- }
- else
- {
- LLSD combo_val = mSkyPresetCombo->getValue();
-
- if (!combo_val.isArray()) // manually typed text
- {
- key.name = combo_val.asString();
- key.scope = LLEnvKey::SCOPE_LOCAL;
- }
- else
- {
- key.fromLLSD(combo_val);
- }
- }
-
- return key;
-}
+// LLWLParamKey LLFloaterEditSky::getSelectedSkyPreset()
+// {
+// LLWLParamKey key;
+//
+// if (mSkyPresetNameEditor->getVisible())
+// {
+// key.name = mSkyPresetNameEditor->getText();
+// key.scope = LLEnvKey::SCOPE_LOCAL;
+// }
+// else
+// {
+// LLSD combo_val = mSkyPresetCombo->getValue();
+//
+// if (!combo_val.isArray()) // manually typed text
+// {
+// key.name = combo_val.asString();
+// key.scope = LLEnvKey::SCOPE_LOCAL;
+// }
+// else
+// {
+// key.fromLLSD(combo_val);
+// }
+// }
+//
+// return key;
+// }
void LLFloaterEditSky::onSkyPresetNameEdited()
{
+#if 0
// Disable saving a sky preset having empty name.
LLWLParamKey key = getSelectedSkyPreset();
mSaveButton->setEnabled(!key.name.empty());
+#endif
}
void LLFloaterEditSky::onSkyPresetSelected()
{
+#if 0
LLWLParamKey key = getSelectedSkyPreset();
LLWLParamSet sky_params;
@@ -783,6 +669,7 @@ void LLFloaterEditSky::onSkyPresetSelected()
enableEditing(can_edit);
mMakeDefaultCheckBox->setEnabled(key.scope == LLEnvKey::SCOPE_LOCAL);
+#endif
}
bool LLFloaterEditSky::onSaveAnswer(const LLSD& notification, const LLSD& response)
@@ -800,6 +687,7 @@ bool LLFloaterEditSky::onSaveAnswer(const LLSD& notification, const LLSD& respon
void LLFloaterEditSky::onSaveConfirmed()
{
+#if 0
// Save current params to the selected preset.
LLWLParamKey key(getSelectedSkyPreset());
@@ -824,10 +712,12 @@ void LLFloaterEditSky::onSaveConfirmed()
}
closeFloater();
+#endif
}
void LLFloaterEditSky::onBtnSave()
{
+#if 0
LLWLParamKey selected_sky = getSelectedSkyPreset();
LLWLParamManager& wl_mgr = LLWLParamManager::instance();
@@ -863,6 +753,7 @@ void LLFloaterEditSky::onBtnSave()
// new preset, hence no confirmation needed
onSaveConfirmed();
}
+#endif
}
void LLFloaterEditSky::onBtnCancel()
@@ -872,6 +763,7 @@ void LLFloaterEditSky::onBtnCancel()
void LLFloaterEditSky::onSkyPresetListChange()
{
+#if 0
LLWLParamKey key = getSelectedSkyPreset(); // preset being edited
if (!LLWLParamManager::instance().hasParamSet(key))
{
@@ -884,10 +776,12 @@ void LLFloaterEditSky::onSkyPresetListChange()
// Refresh the presets list, though it may not make sense as the floater is about to be closed.
refreshSkyPresetsList();
}
+#endif
}
void LLFloaterEditSky::onRegionSettingsChange()
{
+#if 0
// If creating a new sky, don't bother.
if (isNewPreset())
{
@@ -905,10 +799,12 @@ void LLFloaterEditSky::onRegionSettingsChange()
{
refreshSkyPresetsList();
}
+#endif
}
void LLFloaterEditSky::onRegionInfoUpdate()
{
+#if 0
bool can_edit = true;
// If we've selected a region sky preset for editing.
@@ -919,4 +815,5 @@ void LLFloaterEditSky::onRegionInfoUpdate()
}
enableEditing(can_edit);
+#endif
}
diff --git a/indra/newview/llfloatereditsky.h b/indra/newview/llfloatereditsky.h
index a06c4fc5fa..6aec87014d 100644
--- a/indra/newview/llfloatereditsky.h
+++ b/indra/newview/llfloatereditsky.h
@@ -28,12 +28,17 @@
#define LL_LLFLOATEREDITSKY_H
#include "llfloater.h"
-#include "llwlparammanager.h"
+#include "llsettingssky.h"
class LLButton;
class LLCheckBoxCtrl;
class LLComboBox;
class LLLineEditor;
+class WLColorControl;
+class LLSkySettingsAdapter;
+
+typedef boost::shared_ptr<LLSkySettingsAdapter> LLSkySettingsAdapterPtr;
+
/**
* Floater for creating or editing a sky preset.
@@ -66,6 +71,8 @@ private:
void onColorControlBMoved(LLUICtrl* ctrl, void* userdata);
void onFloatControlMoved(LLUICtrl* ctrl, void* userdata);
+ void adjustIntensity(WLColorControl *ctrl, F32 color, F32 scale);
+
// lighting callbacks for glow
void onGlowRMoved(LLUICtrl* ctrl, void* userdata);
void onGlowBMoved(LLUICtrl* ctrl, void* userdata);
@@ -80,8 +87,6 @@ private:
// handle cloud scrolling
void onCloudScrollXMoved(LLUICtrl* ctrl);
void onCloudScrollYMoved(LLUICtrl* ctrl);
- void onCloudScrollXToggled(LLUICtrl* ctrl);
- void onCloudScrollYToggled(LLUICtrl* ctrl);
//-- WL stuff ends --------------------------------------------------------
@@ -90,7 +95,7 @@ private:
void refreshSkyPresetsList();
void enableEditing(bool enable);
void saveRegionSky();
- LLWLParamKey getSelectedSkyPreset();
+// LLWLParamKey getSelectedSkyPreset();
void onSkyPresetNameEdited();
void onSkyPresetSelected();
@@ -104,10 +109,14 @@ private:
void onRegionSettingsChange();
void onRegionInfoUpdate();
+ LLSettingsSky::ptr_t mEditSettings;
+
LLLineEditor* mSkyPresetNameEditor;
LLComboBox* mSkyPresetCombo;
LLCheckBoxCtrl* mMakeDefaultCheckBox;
LLButton* mSaveButton;
+ LLSkySettingsAdapterPtr mSkyAdapter;
+
};
#endif // LL_LLFLOATEREDITSKY_H
diff --git a/indra/newview/llsettingsbase.cpp b/indra/newview/llsettingsbase.cpp
index 1aafacae45..71ec240214 100644
--- a/indra/newview/llsettingsbase.cpp
+++ b/indra/newview/llsettingsbase.cpp
@@ -80,6 +80,14 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons
newSettings[key_name].append(*ita);
}
break;
+ //case LLSD::TypeInteger:
+ //case LLSD::TypeReal:
+ //case LLSD::TypeBoolean:
+ //case LLSD::TypeString:
+ //case LLSD::TypeUUID:
+ //case LLSD::TypeURI:
+ //case LLSD::TypeDate:
+ //case LLSD::TypeBinary:
default:
newSettings[key_name] = value;
break;
@@ -106,6 +114,14 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons
newSettings[key_name].append(*ita);
}
break;
+ //case LLSD::TypeInteger:
+ //case LLSD::TypeReal:
+ //case LLSD::TypeBoolean:
+ //case LLSD::TypeString:
+ //case LLSD::TypeUUID:
+ //case LLSD::TypeURI:
+ //case LLSD::TypeDate:
+ //case LLSD::TypeBinary:
default:
newSettings[key_name] = value;
break;
@@ -219,6 +235,11 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F
return newSettings;
}
+LLSD LLSettingsBase::cloneSettings() const
+{
+ return combineSDMaps(mSettings, LLSD());
+}
+
void LLSettingsBase::exportSettings(std::string name) const
{
diff --git a/indra/newview/llsettingsbase.h b/indra/newview/llsettingsbase.h
index 142b74caf9..02f5ffc8af 100644
--- a/indra/newview/llsettingsbase.h
+++ b/indra/newview/llsettingsbase.h
@@ -124,7 +124,6 @@ protected:
typedef std::set<std::string> stringset_t;
-
// combining settings objects. Customize for specific setting types
virtual void lerpSettings(const LLSettingsBase &other, F32 mix);
@@ -147,6 +146,8 @@ protected:
LLSD mSettings;
+ LLSD cloneSettings() const;
+
private:
bool mDirty;
diff --git a/indra/newview/llsettingssky.cpp b/indra/newview/llsettingssky.cpp
index d4d9172a75..898cdad7be 100644
--- a/indra/newview/llsettingssky.cpp
+++ b/indra/newview/llsettingssky.cpp
@@ -44,12 +44,14 @@
namespace
{
const LLVector3 DUE_EAST(0.0f, 0.0f, 1.0);
+ const LLVector3 VECT_ZENITH(0.f, 1.f, 0.f);
+ const LLVector3 VECT_NORTHSOUTH(1.f, 0.f, 0.f);
LLTrace::BlockTimerStatHandle FTM_BLEND_ENVIRONMENT("Blending Environment Params");
LLTrace::BlockTimerStatHandle FTM_UPDATE_ENVIRONMENT("Update Environment Params");
LLQuaternion body_position_from_angles(F32 azimuth, F32 altitude);
-
+ void angles_from_rotation(LLQuaternion quat, F32 &azimuth, F32 &altitude);
}
const F32 LLSettingsSky::DOME_OFFSET(0.96f);
@@ -101,6 +103,32 @@ LLSettingsSky::LLSettingsSky():
{
}
+void LLSettingsSky::setMoonRotation(F32 azimuth, F32 altitude)
+{
+ setValue(SETTING_MOON_ROTATION, ::body_position_from_angles(azimuth, altitude));
+}
+
+LLSettingsSky::azimalt_t LLSettingsSky::getMoonRotationAzAl() const
+{
+ azimalt_t res;
+ ::angles_from_rotation(getMoonRotation(), res.first, res.second);
+
+ return res;
+}
+
+void LLSettingsSky::setSunRotation(F32 azimuth, F32 altitude)
+{
+ setValue(SETTING_SUN_ROTATION, ::body_position_from_angles(azimuth, altitude));
+}
+
+LLSettingsSky::azimalt_t LLSettingsSky::getSunRotationAzAl() const
+{
+ azimalt_t res;
+ ::angles_from_rotation(getSunRotation(), res.first, res.second);
+
+ return res;
+}
+
LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const
{
static stringset_t slepSet;
@@ -124,27 +152,27 @@ LLSettingsSky::ptr_t LLSettingsSky::buildFromLegacyPreset(const std::string &nam
if (oldsettings.has(SETTING_AMBIENT))
{
- newsettings[SETTING_AMBIENT] = LLColor4(oldsettings[SETTING_AMBIENT]).getValue();
+ newsettings[SETTING_AMBIENT] = LLColor3(oldsettings[SETTING_AMBIENT]).getValue();
}
if (oldsettings.has(SETTING_BLUE_DENSITY))
{
- newsettings[SETTING_BLUE_DENSITY] = LLColor4(oldsettings[SETTING_BLUE_DENSITY]).getValue();
+ newsettings[SETTING_BLUE_DENSITY] = LLColor3(oldsettings[SETTING_BLUE_DENSITY]).getValue();
}
if (oldsettings.has(SETTING_BLUE_HORIZON))
{
- newsettings[SETTING_BLUE_HORIZON] = LLColor4(oldsettings[SETTING_BLUE_HORIZON]).getValue();
+ newsettings[SETTING_BLUE_HORIZON] = LLColor3(oldsettings[SETTING_BLUE_HORIZON]).getValue();
}
if (oldsettings.has(SETTING_CLOUD_COLOR))
{
- newsettings[SETTING_CLOUD_COLOR] = LLColor4(oldsettings[SETTING_CLOUD_COLOR]).getValue();
+ newsettings[SETTING_CLOUD_COLOR] = LLColor3(oldsettings[SETTING_CLOUD_COLOR]).getValue();
}
if (oldsettings.has(SETTING_CLOUD_POS_DENSITY1))
{
- newsettings[SETTING_CLOUD_POS_DENSITY1] = LLColor4(oldsettings[SETTING_CLOUD_POS_DENSITY1]).getValue();
+ newsettings[SETTING_CLOUD_POS_DENSITY1] = LLColor3(oldsettings[SETTING_CLOUD_POS_DENSITY1]).getValue();
}
if (oldsettings.has(SETTING_CLOUD_POS_DENSITY2))
{
- newsettings[SETTING_CLOUD_POS_DENSITY2] = LLColor4(oldsettings[SETTING_CLOUD_POS_DENSITY2]).getValue();
+ newsettings[SETTING_CLOUD_POS_DENSITY2] = LLColor3(oldsettings[SETTING_CLOUD_POS_DENSITY2]).getValue();
}
if (oldsettings.has(SETTING_CLOUD_SCALE))
{
@@ -179,11 +207,11 @@ LLSettingsSky::ptr_t LLSettingsSky::buildFromLegacyPreset(const std::string &nam
}
if (oldsettings.has(SETTING_GAMMA))
{
- newsettings[SETTING_GAMMA] = LLVector4(oldsettings[SETTING_GAMMA]).getValue();
+ newsettings[SETTING_GAMMA] = oldsettings[SETTING_GAMMA][0].asReal();
}
if (oldsettings.has(SETTING_GLOW))
{
- newsettings[SETTING_GLOW] = LLColor4(oldsettings[SETTING_GLOW]).getValue();
+ newsettings[SETTING_GLOW] = LLColor3(oldsettings[SETTING_GLOW]).getValue();
}
if (oldsettings.has(SETTING_HAZE_DENSITY))
{
@@ -230,6 +258,9 @@ LLSettingsSky::ptr_t LLSettingsSky::buildFromLegacyPreset(const std::string &nam
LLQuaternion sunquat = ::body_position_from_angles(azimuth, altitude);
LLQuaternion moonquat = ::body_position_from_angles(azimuth + F_PI, -altitude);
+ F32 az(0), al(0);
+ ::angles_from_rotation(sunquat, az, al);
+
newsettings[SETTING_SUN_ROTATION] = sunquat.getValue();
newsettings[SETTING_MOON_ROTATION] = moonquat.getValue();
}
@@ -245,11 +276,18 @@ LLSettingsSky::ptr_t LLSettingsSky::buildDefaultSky()
LLSD settings = LLSettingsSky::defaults();
LLSettingsSky::ptr_t skyp = boost::make_shared<LLSettingsSky>(settings);
- //skyp->update();
return skyp;
}
+LLSettingsSky::ptr_t LLSettingsSky::buildClone()
+{
+ LLSD settings = cloneSettings();
+
+ LLSettingsSky::ptr_t skyp = boost::make_shared<LLSettingsSky>(settings);
+
+ return skyp;
+}
// Settings status
@@ -278,11 +316,11 @@ LLSD LLSettingsSky::defaults()
// Magic constants copied form dfltsetting.xml
dfltsetting[SETTING_AMBIENT] = LLColor4::white.getValue();
- dfltsetting[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 1.0).getValue();
- dfltsetting[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 1.0).getValue();
- dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 1.0).getValue();
- dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 1.0).getValue();
- dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 1.0).getValue();
+ dfltsetting[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 0.0).getValue();
+ dfltsetting[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 0.0).getValue();
+ dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue();
+ dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue();
+ dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue();
dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199);
dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109);
dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699);
@@ -290,7 +328,7 @@ LLSD LLSettingsSky::defaults()
dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000);
dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f);
dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f);
- dfltsetting[SETTING_GAMMA] = LLVector4(1.0, 0.0, 0.0, 1.0).getValue();
+ dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0);
dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); // *RIDER: This is really weird for a color... TODO: check if right.
dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999);
dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899);
@@ -299,7 +337,7 @@ LLSD LLSettingsSky::defaults()
dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue();
dfltsetting[SETTING_NAME] = std::string("_default_");
dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000);
- dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 1.0).getValue();
+ dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue();
dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue();
dfltsetting[SETTING_BLOOM_TEXTUREID] = LLUUID::null;
@@ -367,29 +405,26 @@ void LLSettingsSky::calculateHeavnlyBodyPositions()
void LLSettingsSky::calculateLightSettings()
{
-#if 0
LLColor3 vary_HazeColor;
LLColor3 vary_SunlightColor;
LLColor3 vary_AmbientColor;
{
// Initialize temp variables
- LLColor3 sunlight = getSunlightColor();
-
- // Fetch these once...
- F32 haze_density = getHazeDensity();
- F32 haze_horizon = getHazeHorizon();
- F32 density_multiplier = getDensityMultiplier();
- F32 max_y = getMaxY();
- F32 gamma = getGama();
- F32 cloud_shadow = getCloudShadow();
- LLColor3 blue_density = getBlueDensity();
- LLColor3 blue_horizon = getBlueHorizon();
- LLColor3 ambient = getAmbientColor();
-
+ LLColor3 sunlight = getSunlightColor();
+ LLColor3 ambient = getAmbientColor();
+ F32 gamma = getGamma();
+ LLColor3 blue_density = getBlueDensity();
+ LLColor3 blue_horizon = getBlueHorizon();
+ F32 haze_density = getHazeDensity();
+ F32 haze_horizon = getHazeHorizon();
+ F32 density_multiplier = getDensityMultiplier();
+ F32 max_y = getMaxY();
+ F32 cloud_shadow = getCloudShadow();
+ LLVector3 lightnorm = getLightDirection();
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
- LLColor3 light_atten =
+ LLColor3 light_atten =
(blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y);
// Calculate relative weights
@@ -403,14 +438,14 @@ void LLSettingsSky::calculateLightSettings()
// temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] );
// and vary_sunlight will work properly with moon light
- F32 lighty = mLightDirection[1];
+ F32 lighty = lightnorm[1];
if (lighty < LLSky::NIGHTTIME_ELEVATION_COS)
{
lighty = -lighty;
}
temp2.mV[1] = llmax(0.f, lighty);
- if (temp2.mV[1] > 0.f)
+ if(temp2.mV[1] > 0.f)
{
temp2.mV[1] = 1.f / temp2.mV[1];
}
@@ -429,9 +464,9 @@ void LLSettingsSky::calculateLightSettings()
//haze color
vary_HazeColor =
- (blue_horizon * blue_weight * (sunlight*(1.f - cloud_shadow) + tmpAmbient)
+ (blue_horizon * blue_weight * (sunlight*(1.f - cloud_shadow) + tmpAmbient)
+ componentMult(haze_horizon * haze_weight, sunlight*(1.f - cloud_shadow) * temp2.mV[0] + tmpAmbient)
- );
+ );
//brightness of surface both sunlight and ambient
vary_SunlightColor = componentMult(sunlight, temp1) * 1.f;
@@ -449,7 +484,16 @@ void LLSettingsSky::calculateLightSettings()
}
- float dp = getSunDirection() * LLVector3(0, 0, 1.f); // a dot b
+#if 0
+ mSun.setColor(vary_SunlightColor);
+ mMoon.setColor(LLColor3(1.0f, 1.0f, 1.0f));
+
+ mSun.renewDirection();
+ mSun.renewColor();
+ mMoon.renewDirection();
+ mMoon.renewColor();
+
+ float dp = getToSunLast() * LLVector3(0,0,1.f);
if (dp < 0)
{
dp = 0;
@@ -457,21 +501,19 @@ void LLSettingsSky::calculateLightSettings()
// Since WL scales everything by 2, there should always be at least a 2:1 brightness ratio
// between sunlight and point lights in windlight to normalize point lights.
- F32 sun_dynamic_range = std::max(gSavedSettings.getF32("RenderSunDynamicRange"), 0.0001f);
-
+ F32 sun_dynamic_range = llmax(gSavedSettings.getF32("RenderSunDynamicRange"), 0.0001f);
LLEnvironment::instance().setSceneLightStrength(2.0f * (1.0f + sun_dynamic_range * dp));
+#endif
mSunDiffuse = vary_SunlightColor;
mSunAmbient = vary_AmbientColor;
mMoonDiffuse = vary_SunlightColor;
mMoonAmbient = vary_AmbientColor;
- mTotalAmbient = vary_AmbientColor;
- mTotalAmbient.setAlpha(1);
+ mTotalAmbient = LLColor4(vary_AmbientColor, 1.0f);
mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f;
- mFadeColor.setAlpha(1);
-#endif
+ mFadeColor.setAlpha(0);
}
LLSettingsSky::parammapping_t LLSettingsSky::getParameterMap() const
@@ -490,7 +532,6 @@ LLSettingsSky::parammapping_t LLSettingsSky::getParameterMap() const
param_map[SETTING_CLOUD_SHADOW] = LLShaderMgr::CLOUD_SHADOW;
param_map[SETTING_DENSITY_MULTIPLIER] = LLShaderMgr::DENSITY_MULTIPLIER;
param_map[SETTING_DISTANCE_MULTIPLIER] = LLShaderMgr::DISTANCE_MULTIPLIER;
- param_map[SETTING_GAMMA] = LLShaderMgr::GAMMA;
param_map[SETTING_GLOW] = LLShaderMgr::GLOW;
param_map[SETTING_HAZE_DENSITY] = LLShaderMgr::HAZE_DENSITY;
param_map[SETTING_HAZE_HORIZON] = LLShaderMgr::HAZE_HORIZON;
@@ -507,7 +548,7 @@ void LLSettingsSky::applySpecial(void *ptarget)
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mClampedLightDirection.mV);
- shader->uniform4f(LLShaderMgr::GAMMA, getGama(), 0.0, 0.0, 1.0);
+ shader->uniform4f(LLShaderMgr::GAMMA, getGamma(), 0.0, 0.0, 1.0);
{
//LLEnvironment::instance().getCloudDelta();
@@ -515,23 +556,6 @@ void LLSettingsSky::applySpecial(void *ptarget)
vect_c_p_d1 += LLVector4(LLEnvironment::instance().getCloudScrollDelta());
shader->uniform4fv(LLShaderMgr::CLOUD_POS_DENSITY1, 1, vect_c_p_d1.mV);
}
-
-// {
-// LLVector4 val(mSettings[ ];
-// val.mV[0] = F32(i->second[0].asReal()) + mCloudScrollXOffset;
-// val.mV[1] = F32(i->second[1].asReal()) + mCloudScrollYOffset;
-// val.mV[2] = (F32)i->second[2].asReal();
-// val.mV[3] = (F32)i->second[3].asReal();
-//
-// stop_glerror();
-// //_WARNS("RIDER") << "pushing '" << param.String() << "' as " << val << LL_ENDL;
-// shader->uniform4fv(param, 1, val.mV);
-// stop_glerror();
-//
-// }
-
- //param_map[SETTING_CLOUD_POS_DENSITY1] = LLShaderMgr::CLOUD_POS_DENSITY1;
-
}
//=========================================================================
@@ -539,9 +563,6 @@ namespace
{
LLQuaternion body_position_from_angles(F32 azimuth, F32 altitude)
{
- static const LLVector3 VECT_ZENITH(0.f, 1.f, 0.f);
- static const LLVector3 VECT_NORTHSOUTH(1.f, 0.f, 0.f);
-
// Azimuth is traditionally calculated from North, we are going from East.
LLQuaternion rot_azi;
LLQuaternion rot_alt;
@@ -552,11 +573,26 @@ namespace
LLQuaternion body_quat = rot_alt * rot_azi;
body_quat.normalize();
- LLVector3 sun_vector = (DUE_EAST * body_quat);
-
-
- LL_WARNS("RIDER") << "Azimuth=" << azimuth << " Altitude=" << altitude << " Body Vector=" << sun_vector.getValue() << LL_ENDL;
-
+ //LLVector3 sun_vector = (DUE_EAST * body_quat);
+ //_WARNS("RIDER") << "Azimuth=" << azimuth << " Altitude=" << altitude << " Body Vector=" << sun_vector.getValue() << LL_ENDL;
return body_quat;
}
+
+ void angles_from_rotation(LLQuaternion quat, F32 &azimuth, F32 &altitude)
+ {
+ LLVector3 body_vector = (DUE_EAST * quat);
+
+ LLVector3 body_az(body_vector[0], 0.f, body_vector[2]);
+ LLVector3 body_al(0.f, body_vector[1], body_vector[2]);
+
+ if (fabs(body_az.normalize()) > 0.001)
+ azimuth = angle_between(DUE_EAST, body_az);
+ else
+ azimuth = 0.0f;
+
+ if (fabs(body_al.normalize()) > 0.001)
+ altitude = angle_between(DUE_EAST, body_al);
+ else
+ altitude = 0.0f;
+ }
}
diff --git a/indra/newview/llsettingssky.h b/indra/newview/llsettingssky.h
index 0274661643..012244d1f9 100644
--- a/indra/newview/llsettingssky.h
+++ b/indra/newview/llsettingssky.h
@@ -67,13 +67,15 @@ public:
static const std::string SETTING_LEGACY_SUN_ANGLE;
typedef boost::shared_ptr<LLSettingsSky> ptr_t;
+ typedef std::pair<F32, F32> azimalt_t;
//---------------------------------------------------------------------
LLSettingsSky(const LLSD &data);
virtual ~LLSettingsSky() { };
- static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings);
- static ptr_t buildDefaultSky();
+ static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings);
+ static ptr_t buildDefaultSky();
+ ptr_t buildClone();
//---------------------------------------------------------------------
virtual std::string getSettingType() const { return std::string("sky"); }
@@ -89,6 +91,11 @@ public:
return LLColor3(mSettings[SETTING_AMBIENT]);
}
+ void setAmbientColor(const LLColor3 &val)
+ {
+ setValue(SETTING_AMBIENT, val);
+ }
+
LLUUID getBloomTextureId() const
{
return mSettings[SETTING_BLOOM_TEXTUREID].asUUID();
@@ -99,16 +106,31 @@ public:
return LLColor3(mSettings[SETTING_BLUE_DENSITY]);
}
+ void setBlueDensity(const LLColor3 &val)
+ {
+ setValue(SETTING_BLUE_DENSITY, val);
+ }
+
LLColor3 getBlueHorizon() const
{
return LLColor3(mSettings[SETTING_BLUE_HORIZON]);
}
+ void setBlueHorizon(const LLColor3 &val)
+ {
+ setValue(SETTING_BLUE_HORIZON, val);
+ }
+
LLColor3 getCloudColor() const
{
return LLColor3(mSettings[SETTING_CLOUD_COLOR]);
}
+ void setCloudColor(const LLColor3 &val)
+ {
+ setValue(SETTING_CLOUD_COLOR, val);
+ }
+
LLUUID getCloudNoiseTextureId() const
{
return mSettings[SETTING_CLOUD_TEXTUREID].asUUID();
@@ -119,36 +141,83 @@ public:
return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]);
}
+ void setCloudPosDensity1(const LLColor3 &val)
+ {
+ setValue(SETTING_CLOUD_POS_DENSITY1, val);
+ }
+
LLColor3 getCloudPosDensity2() const
{
return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY2]);
}
+ void setCloudPosDensity2(const LLColor3 &val)
+ {
+ setValue(SETTING_CLOUD_POS_DENSITY2, val);
+ }
+
F32 getCloudScale() const
{
return mSettings[SETTING_CLOUD_SCALE].asReal();
}
+ void setCloudScale(F32 val)
+ {
+ setValue(SETTING_CLOUD_SCALE, val);
+ }
+
LLVector2 getCloudScrollRate() const
{
return LLVector2(mSettings[SETTING_CLOUD_SCROLL_RATE]);
}
+ void setCloudScrollRate(const LLVector2 &val)
+ {
+ setValue(SETTING_CLOUD_SCROLL_RATE, val);
+ }
+
+ void setCloudScrollRateX(F32 val)
+ {
+ mSettings[SETTING_CLOUD_SCROLL_RATE][0] = val;
+ setDirtyFlag(true);
+ }
+
+ void setCloudScrollRateY(F32 val)
+ {
+ mSettings[SETTING_CLOUD_SCROLL_RATE][1] = val;
+ setDirtyFlag(true);
+ }
+
F32 getCloudShadow() const
{
return mSettings[SETTING_CLOUD_SHADOW].asReal();
}
+ void setCloudShadow(F32 val)
+ {
+ setValue(SETTING_CLOUD_SHADOW, val);
+ }
+
F32 getDensityMultiplier() const
{
return mSettings[SETTING_DENSITY_MULTIPLIER].asReal();
}
+ void setDensityMultiplier(F32 val)
+ {
+ setValue(SETTING_DENSITY_MULTIPLIER, val);
+ }
+
F32 getDistanceMultiplier() const
{
return mSettings[SETTING_DISTANCE_MULTIPLIER].asReal();
}
+ void setDistanceMultiplier(F32 val)
+ {
+ setValue(SETTING_DISTANCE_MULTIPLIER, val);
+ }
+
F32 getDomeOffset() const
{
return DOME_OFFSET;
@@ -161,9 +230,15 @@ public:
//return mSettings[SETTING_DOME_RADIUS].asReal();
}
- F32 getGama() const
+ F32 getGamma() const
+ {
+ return mSettings[SETTING_GAMMA].asReal();
+ }
+
+ void setGamma(F32 val)
{
- return mSettings[SETTING_GAMMA][0].asReal();
+ mSettings[SETTING_GAMMA] = LLSD::Real(val);
+ setDirtyFlag(true);
}
LLColor3 getGlow() const
@@ -171,21 +246,41 @@ public:
return LLColor3(mSettings[SETTING_GLOW]);
}
+ void setGlow(const LLColor3 &val)
+ {
+ setValue(SETTING_GLOW, val);
+ }
+
F32 getHazeDensity() const
{
return mSettings[SETTING_HAZE_DENSITY].asReal();
}
+ void setHazeDensity(F32 val)
+ {
+ setValue(SETTING_HAZE_DENSITY, val);
+ }
+
F32 getHazeHorizon() const
{
return mSettings[SETTING_HAZE_HORIZON].asReal();
}
+ void setHazeHorizon(F32 val)
+ {
+ setValue(SETTING_HAZE_HORIZON, val);
+ }
+
LLVector3 getLightNormal() const
{
return LLVector3(mSettings[SETTING_LIGHT_NORMAL]);
}
+ void setLightNormal(const LLVector3 &val)
+ {
+ setValue(SETTING_LIGHT_NORMAL, val);
+ }
+
F32 getMaxY() const
{
return mSettings[SETTING_MAX_Y].asReal();
@@ -196,6 +291,20 @@ public:
return LLQuaternion(mSettings[SETTING_MOON_ROTATION]);
}
+ void setMoonRotation(const LLQuaternion &val)
+ {
+ setValue(SETTING_MOON_ROTATION, val);
+ }
+
+ azimalt_t getMoonRotationAzAl() const;
+
+ void setMoonRotation(F32 azimuth, F32 altitude);
+
+ void setMoonRotation(const azimalt_t &azialt)
+ {
+ setMoonRotation(azialt.first, azialt.second);
+ }
+
LLUUID getMoonTextureId() const
{
return mSettings[SETTING_MOON_TEXTUREID].asUUID();
@@ -206,58 +315,56 @@ public:
return mSettings[SETTING_STAR_BRIGHTNESS].asReal();
}
+ void setStarBrightness(F32 val)
+ {
+ setValue(SETTING_STAR_BRIGHTNESS, val);
+ }
+
LLColor3 getSunlightColor() const
{
return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]);
}
- LLQuaternion getSunRotation() const
+ void setSunlightColor(const LLColor3 &val)
{
- return LLQuaternion(mSettings[SETTING_SUN_ROTATION]);
+ setValue(SETTING_SUNLIGHT_COLOR, val);
}
- LLUUID getSunTextureId() const
+ LLQuaternion getSunRotation() const
{
- return mSettings[SETTING_SUN_TEXUTUREID].asUUID();
+ return LLQuaternion(mSettings[SETTING_SUN_ROTATION]);
}
- // Internal/calculated settings
- LLVector3 getLightDirection() const
- {
- update();
- return mLightDirection;
- };
+ azimalt_t getSunRotationAzAl() const;
- LLVector3 getClampedLightDirection() const
+ void setSunRotation(const LLQuaternion &val)
{
- update();
- return mClampedLightDirection;
- };
+ setValue(SETTING_SUN_ROTATION, val);
+ }
- LLVector3 getSunDirection() const
+ void setSunRotation(F32 azimuth, F32 altitude);
+
+ void setSunRotation(const azimalt_t & azimalt)
{
- update();
- return mSunDirection;
+ setSunRotation(azimalt.first, azimalt.second);
}
- LLVector3 getMoonDirection() const
+ LLUUID getSunTextureId() const
{
- update();
- return mMoonDirection;
+ return mSettings[SETTING_SUN_TEXUTUREID].asUUID();
}
-
-#if 0
+ // Internal/calculated settings
LLVector3 getLightDirection() const
{
update();
return mLightDirection;
};
- LLVector3 getLightDirectionClamped() const
+ LLVector3 getClampedLightDirection() const
{
update();
- return mLightDirectionClamped;
+ return mClampedLightDirection;
};
LLVector3 getSunDirection() const
@@ -272,16 +379,16 @@ public:
return mMoonDirection;
}
- LLColor3 getSunDiffuse() const
+ LLColor4U getFadeColor() const
{
update();
- return mSunDiffuse;
+ return mFadeColor;
}
- LLColor3 getSunAmbient() const
+ LLColor4 getMoonAmbient() const
{
update();
- return mSunAmbient;
+ return mMoonAmbient;
}
LLColor3 getMoonDiffuse() const
@@ -290,24 +397,23 @@ public:
return mMoonDiffuse;
}
- LLColor3 getMoonAmbient() const
+ LLColor4 getSunAmbient() const
{
update();
- return mMoonAmbient;
+ return mSunAmbient;
}
- LLColor4 getTotalAmbient() const
+ LLColor3 getSunDiffuse() const
{
update();
- return mTotalAmbient;
+ return mSunDiffuse;
}
- LLColor4 getFadeColor() const
+ LLColor4 getTotalAmbient() const
{
update();
- return mFadeColor;
+ return mTotalAmbient;
}
-#endif
protected:
LLSettingsSky();
@@ -320,6 +426,7 @@ protected:
virtual void applySpecial(void *);
+
private:
void calculateHeavnlyBodyPositions();
void calculateLightSettings();
@@ -332,13 +439,13 @@ private:
static const F32 DOME_RADIUS;
static const F32 DOME_OFFSET;
-// LLColor3 mSunDiffuse;
-// LLColor3 mSunAmbient;
-// LLColor3 mMoonDiffuse;
-// LLColor3 mMoonAmbient;
-//
-// LLColor4 mTotalAmbient;
-// LLColor4 mFadeColor;
+ LLColor4U mFadeColor;
+ LLColor4 mMoonAmbient;
+ LLColor3 mMoonDiffuse;
+ LLColor4 mSunAmbient;
+ LLColor3 mSunDiffuse;
+
+ LLColor4 mTotalAmbient;
typedef std::map<std::string, S32> mapNameToUniformId_t;
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 71abad79b6..93ca7945ba 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -331,24 +331,6 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
mBumpSunDir(0.f, 0.f, 1.f)
{
/// WL PARAMS
-// dome_radius = 1.f;
-// dome_offset_ratio = 0.f;
-// sunlight_color = LLColor3();
-// ambient = LLColor3();
-// gamma = 1.f;
-// lightnorm = LLVector4();
-// blue_density = LLColor3();
-// blue_horizon = LLColor3();
-// haze_density = 0.f;
-// haze_horizon = 1.f;
-// density_multiplier = 0.f;
-// max_y = 0.f;
-// glow = LLColor3();
-// cloud_shadow = 0.f;
-// cloud_color = LLColor3();
-// cloud_scale = 0.f;
-// cloud_pos_density1 = LLColor3();
-// cloud_pos_density2 = LLColor3();
mInitialized = FALSE;
mbCanSelect = FALSE;
@@ -565,48 +547,6 @@ void LLVOSky::createSkyTexture(const S32 side, const S32 tile)
}
}
-void LLVOSky::initAtmospherics(void)
-{
-
- // *LAPRAS
- // uniform parameters for convenience
- LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
-
-// dome_radius = psky->getDomeRadius();
-// dome_offset_ratio = psky->getDomeOffset();
-// sunlight_color = psky->getSunlightColor();
-// ambient = psky->getAmbientColor();
-// gamma = psky->getGama();
-// blue_density = psky->getBlueDensity();
-// blue_horizon = psky->getBlueHorizon();
-// haze_density = psky->getHazeDensity();
-// haze_horizon = psky->getHazeHorizon();
-// density_multiplier = psky->getDensityMultiplier();
-// max_y = psky->getMaxY();
-// glow = psky->getGlow();
-// cloud_shadow = psky->getCloudShadow();
-// cloud_color = psky->getCloudColor();
-// cloud_scale = psky->getCloudScale();
-// cloud_pos_density1 = psky->getCloudPosDensity1();
-// cloud_pos_density2 = psky->getCloudPosDensity2();
-
- // light norm is different. We need the sun's direction, not the light direction
- // which could be from the moon. And we need to clamp it
- // just like for the gpu
-// LLVector3 sunDir = gSky.getSunDirection();
- LLVector3 sunDir = psky->getSunDirection();
-
- // CFR_TO_OGL
-// lightnorm = LLVector4(sunDir.mV[1], sunDir.mV[2], sunDir.mV[0], 0);
- lightnorm = LLVector4(sunDir, 0);
- unclamped_lightnorm = lightnorm;
- if(lightnorm.mV[1] < -0.1f)
- {
- lightnorm.mV[1] = -0.1f;
- }
-
-}
-
LLColor4 LLVOSky::calcSkyColorInDir(const LLVector3 &dir, bool isShiny)
{
F32 saturation = 0.3f;
@@ -681,8 +621,9 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
{
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- LLColor3 blue_density = psky->getBlueDensity();
- F32 max_y = psky->getMaxY();
+ LLColor3 blue_density = psky->getBlueDensity();
+ F32 max_y = psky->getMaxY();
+ LLVector3 lightnorm = psky->getLightNormal();
// project the direction ray onto the sky dome.
F32 phi = acos(Pn[1]);
@@ -692,7 +633,6 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
sinA = 0.01f;
}
-// F32 Plen = dome_radius * sin(F_PI + phi + asin(dome_offset_ratio * sinA)) / sinA;
F32 Plen = psky->getDomeRadius() * sin(F_PI + phi + asin(psky->getDomeOffset() * sinA)) / sinA;
Pn *= Plen;
@@ -748,7 +688,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
// Compute haze glow
- temp2.mV[0] = Pn * LLVector3(lightnorm);
+ temp2.mV[0] = Pn * lightnorm;
temp2.mV[0] = 1.f - temp2.mV[0];
// temp2.x is 0 at the sun and increases away from sun
@@ -824,7 +764,7 @@ LLColor3 LLVOSky::calcSkyColorWLFrag(LLVector3 & Pn, LLColor3 & vary_HazeColor,
LLVector2 vary_HorizontalProjection[2])
{
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- F32 gamma = psky->getGama();
+ F32 gamma = psky->getGamma();
LLColor3 res;
LLColor3 color0 = vary_HazeColor;
@@ -893,87 +833,8 @@ LLColor3 LLVOSky::createAmbientFromWL(LLColor3 ambient, LLColor3 sundiffuse, LLC
void LLVOSky::calcAtmospherics(void)
{
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- initAtmospherics();
-
- LLColor3 vary_HazeColor;
- LLColor3 vary_SunlightColor;
- LLColor3 vary_AmbientColor;
- {
- // Initialize temp variables
- LLColor3 sunlight = psky->getSunlightColor();
- LLColor3 ambient = psky->getAmbientColor();
- F32 gamma = psky->getGama();
- LLColor3 blue_density = psky->getBlueDensity();
- LLColor3 blue_horizon = psky->getBlueHorizon();
- F32 haze_density = psky->getHazeDensity();
- F32 haze_horizon = psky->getHazeHorizon();
- F32 density_multiplier = psky->getDensityMultiplier();
- F32 max_y = psky->getMaxY();
- F32 cloud_shadow = psky->getCloudShadow();
-
- // 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);
-
- // Calculate relative weights
- LLColor3 temp2(0.f, 0.f, 0.f);
- LLColor3 temp1 = blue_density + smear(haze_density);
- LLColor3 blue_weight = componentDiv(blue_density, temp1);
- LLColor3 haze_weight = componentDiv(smear(haze_density), temp1);
-
- // Compute sunlight from P & lightnorm (for long rays like sky)
- /// USE only lightnorm.
- // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] );
-
- // and vary_sunlight will work properly with moon light
- F32 lighty = unclamped_lightnorm[1];
- if(lighty < LLSky::NIGHTTIME_ELEVATION_COS)
- {
- lighty = -lighty;
- }
-
- temp2.mV[1] = llmax(0.f, lighty);
- if(temp2.mV[1] > 0.f)
- {
- temp2.mV[1] = 1.f / temp2.mV[1];
- }
- componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1]));
-
- // Distance
- temp2.mV[2] = density_multiplier;
-
- // Transparency (-> temp1)
- temp1 = componentExp((temp1 * -1.f) * temp2.mV[2]);
-
- // vary_AtmosAttenuation = temp1;
-
- //increase ambient when there are more clouds
- LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f;
-
- //haze color
- vary_HazeColor =
- (blue_horizon * blue_weight * (sunlight*(1.f - cloud_shadow) + tmpAmbient)
- + componentMult(haze_horizon * haze_weight, sunlight*(1.f - cloud_shadow) * temp2.mV[0] + tmpAmbient)
- );
-
- //brightness of surface both sunlight and ambient
- vary_SunlightColor = componentMult(sunlight, temp1) * 1.f;
- vary_SunlightColor.clamp();
- vary_SunlightColor = smear(1.0f) - vary_SunlightColor;
- vary_SunlightColor = componentPow(vary_SunlightColor, gamma);
- vary_SunlightColor = smear(1.0f) - vary_SunlightColor;
- vary_AmbientColor = componentMult(tmpAmbient, temp1) * 0.5;
- vary_AmbientColor.clamp();
- vary_AmbientColor = smear(1.0f) - vary_AmbientColor;
- vary_AmbientColor = componentPow(vary_AmbientColor, gamma);
- vary_AmbientColor = smear(1.0f) - vary_AmbientColor;
-
- componentMultBy(vary_HazeColor, LLColor3(1.f, 1.f, 1.f) - temp1);
- }
-
- mSun.setColor(vary_SunlightColor);
+ mSun.setColor(psky->getSunlightColor());
mMoon.setColor(LLColor3(1.0f, 1.0f, 1.0f));
mSun.renewDirection();
@@ -992,16 +853,6 @@ void LLVOSky::calcAtmospherics(void)
F32 sun_dynamic_range = llmax(gSavedSettings.getF32("RenderSunDynamicRange"), 0.0001f);
LLEnvironment::instance().setSceneLightStrength(2.0f * (1.0f + sun_dynamic_range * dp));
- mSunDiffuse = vary_SunlightColor;
- mSunAmbient = vary_AmbientColor;
- mMoonDiffuse = vary_SunlightColor;
- mMoonAmbient = vary_AmbientColor;
-
- mTotalAmbient = vary_AmbientColor;
- mTotalAmbient.setAlpha(1);
-
- mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f;
- mFadeColor.setAlpha(0);
}
void LLVOSky::idleUpdate(LLAgent &agent, const F64 &time)
@@ -1010,6 +861,10 @@ void LLVOSky::idleUpdate(LLAgent &agent, const F64 &time)
BOOL LLVOSky::updateSky()
{
+ LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
+
+ LLColor4 total_ambient = psky->getTotalAmbient();
+
if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)))
{
return TRUE;
@@ -1055,9 +910,9 @@ BOOL LLVOSky::updateSky()
const F32 dot_lighting = direction * mLastLightingDirection;
LLColor3 delta_color;
- delta_color.setVec(mLastTotalAmbient.mV[0] - mTotalAmbient.mV[0],
- mLastTotalAmbient.mV[1] - mTotalAmbient.mV[1],
- mLastTotalAmbient.mV[2] - mTotalAmbient.mV[2]);
+ delta_color.setVec(mLastTotalAmbient.mV[0] - total_ambient.mV[0],
+ mLastTotalAmbient.mV[1] - total_ambient.mV[1],
+ mLastTotalAmbient.mV[2] - total_ambient.mV[2]);
if ( mForceUpdate
|| (((dot_lighting < LIGHT_DIRECTION_THRESHOLD)
@@ -1066,7 +921,7 @@ BOOL LLVOSky::updateSky()
&& !direction.isExactlyZero()))
{
mLastLightingDirection = direction;
- mLastTotalAmbient = mTotalAmbient;
+ mLastTotalAmbient = total_ambient;
mInitialized = TRUE;
if (mCubeMap)
@@ -2039,7 +1894,6 @@ void LLVOSky::updateFog(const F32 distance)
tosun_45.normalize();
// Sky colors, just slightly above the horizon in the direction of the sun, perpendicular to the sun, and at a 45 degree angle to the sun.
- initAtmospherics();
res_color[0] = calcSkyColorInDir(tosun);
res_color[1] = calcSkyColorInDir(perp_tosun);
res_color[2] = calcSkyColorInDir(tosun_45);
@@ -2240,3 +2094,34 @@ void LLVOSky::setSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang
mForceUpdate = TRUE;
}
}
+
+
+LLColor4U LLVOSky::getFadeColor() const
+{
+ return LLEnvironment::instance().getCurrentSky()->getFadeColor();
+}
+
+LLColor3 LLVOSky::getSunDiffuseColor() const
+{
+ return LLEnvironment::instance().getCurrentSky()->getSunDiffuse();
+}
+
+LLColor3 LLVOSky::getMoonDiffuseColor() const
+{
+ return LLEnvironment::instance().getCurrentSky()->getMoonDiffuse();
+}
+
+LLColor4 LLVOSky::getSunAmbientColor() const
+{
+ return LLEnvironment::instance().getCurrentSky()->getSunAmbient();
+}
+
+LLColor4 LLVOSky::getMoonAmbientColor() const
+{
+ return LLEnvironment::instance().getCurrentSky()->getMoonAmbient();
+}
+
+LLColor4 LLVOSky::getTotalAmbientColor() const
+{
+ return LLEnvironment::instance().getCurrentSky()->getTotalAmbient();
+}
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index 32b5a7eba8..fe2d85df02 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -379,30 +379,8 @@ class LLCubeMap;
class LLVOSky : public LLStaticViewerObject
{
-public:
- /// WL PARAMS
-// F32 dome_radius;
-// F32 dome_offset_ratio;
-// LLColor3 sunlight_color;
-// LLColor3 ambient;
-// F32 gamma;
- LLVector4 lightnorm;
- LLVector4 unclamped_lightnorm;
-// LLColor3 blue_density;
-// LLColor3 blue_horizon;
-// F32 haze_density;
-// F32 haze_horizon;
-// F32 density_multiplier;
-// F32 max_y;
-// LLColor3 glow;
-// F32 cloud_shadow;
-// LLColor3 cloud_color;
-// F32 cloud_scale;
-// LLColor3 cloud_pos_density1;
-// LLColor3 cloud_pos_density2;
public:
- void initAtmospherics(void);
void calcAtmospherics(void);
LLColor3 createDiffuseFromWL(LLColor3 diffuse, LLColor3 ambient, LLColor3 sundiffuse, LLColor3 sunambient);
LLColor3 createAmbientFromWL(LLColor3 ambient, LLColor3 sundiffuse, LLColor3 sunambient);
@@ -470,13 +448,12 @@ public:
const LLVector3& getToMoon() const { return mMoon.getDirection(); }
const LLVector3& getToMoonLast() const { return mMoon.getDirectionCached(); }
BOOL isSunUp() const { return mSun.getDirectionCached().mV[2] > -0.05f; }
- void calculateColors();
- LLColor3 getSunDiffuseColor() const { return mSunDiffuse; }
- LLColor3 getMoonDiffuseColor() const { return mMoonDiffuse; }
- LLColor4 getSunAmbientColor() const { return mSunAmbient; }
- LLColor4 getMoonAmbientColor() const { return mMoonAmbient; }
- const LLColor4& getTotalAmbientColor() const { return mTotalAmbient; }
+ LLColor3 getSunDiffuseColor() const;
+ LLColor3 getMoonDiffuseColor() const;
+ LLColor4 getSunAmbientColor() const;
+ LLColor4 getMoonAmbientColor() const;
+ LLColor4 getTotalAmbientColor() const;
LLColor4 getFogColor() const { return mFogColor; }
LLColor4 getGLFogColor() const { return mGLFogCol; }
@@ -508,8 +485,8 @@ public:
void setWorldScale(const F32 s) { mWorldScale = s; }
void updateFog(const F32 distance);
void setFogRatio(const F32 fog_ratio) { mFogRatio = fog_ratio; }
- LLColor4U getFadeColor() const { return mFadeColor; }
- F32 getFogRatio() const { return mFogRatio; }
+ LLColor4U getFadeColor() const;
+ F32 getFogRatio() const { return mFogRatio; }
void setCloudDensity(F32 cloud_density) { mCloudDensity = cloud_density; }
void setWind ( const LLVector3& wind ) { mWind = wind.length(); }
@@ -576,12 +553,12 @@ protected:
F32 mFogRatio;
F32 mWorldScale;
- LLColor4 mSunAmbient;
- LLColor4 mMoonAmbient;
- LLColor4 mTotalAmbient;
- LLColor3 mSunDiffuse;
- LLColor3 mMoonDiffuse;
- LLColor4U mFadeColor; // Color to fade in from
+// LLColor4 mSunAmbient;
+// LLColor4 mMoonAmbient;
+// LLColor4 mTotalAmbient;
+// LLColor3 mSunDiffuse;
+// LLColor3 mMoonDiffuse;
+// LLColor4U mFadeColor; // Color to fade in from
LLPointer<LLCubeMap> mCubeMap; // Cube map for the environment
S32 mDrawRefl;
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index b6e1c36a33..a6dc2b343b 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -68,28 +68,28 @@ LLWLParamManager::LLWLParamManager() :
/// Sun Delta Terrain tweak variables.
mSunDeltaYaw(180.0f),
mSceneLightStrength(2.0f),
- mWLGamma(1.0f, "gamma"),
+// mWLGamma(1.0f, "gamma"),
- mBlueHorizon(0.25f, 0.25f, 1.0f, 1.0f, "blue_horizon", "WLBlueHorizon"),
- mHazeDensity(1.0f, "haze_density"),
- mBlueDensity(0.25f, 0.25f, 0.25f, 1.0f, "blue_density", "WLBlueDensity"),
- mDensityMult(1.0f, "density_multiplier", 1000),
- mHazeHorizon(1.0f, "haze_horizon"),
- mMaxAlt(4000.0f, "max_y"),
+// mBlueHorizon(0.25f, 0.25f, 1.0f, 1.0f, "blue_horizon", "WLBlueHorizon"),
+// mHazeDensity(1.0f, "haze_density"),
+// mBlueDensity(0.25f, 0.25f, 0.25f, 1.0f, "blue_density", "WLBlueDensity"),
+// mDensityMult(1.0f, "density_multiplier", 1000),
+// mHazeHorizon(1.0f, "haze_horizon"),
+// mMaxAlt(4000.0f, "max_y"),
// Lighting
- mLightnorm(0.f, 0.707f, -0.707f, 1.f, "lightnorm"),
- mSunlight(0.5f, 0.5f, 0.5f, 1.0f, "sunlight_color", "WLSunlight"),
- mAmbient(0.5f, 0.75f, 1.0f, 1.19f, "ambient", "WLAmbient"),
- mGlow(18.0f, 0.0f, -0.01f, 1.0f, "glow"),
+// mLightnorm(0.f, 0.707f, -0.707f, 1.f, "lightnorm"),
+// mSunlight(0.5f, 0.5f, 0.5f, 1.0f, "sunlight_color", "WLSunlight"),
+// mAmbient(0.5f, 0.75f, 1.0f, 1.19f, "ambient", "WLAmbient"),
+// mGlow(18.0f, 0.0f, -0.01f, 1.0f, "glow"),
// Clouds
- mCloudColor(0.5f, 0.5f, 0.5f, 1.0f, "cloud_color", "WLCloudColor"),
- mCloudMain(0.5f, 0.5f, 0.125f, 1.0f, "cloud_pos_density1"),
- mCloudCoverage(0.0f, "cloud_shadow"),
- mCloudDetail(0.0f, 0.0f, 0.0f, 1.0f, "cloud_pos_density2"),
- mDistanceMult(1.0f, "distance_multiplier"),
- mCloudScale(0.42f, "cloud_scale"),
+// mCloudColor(0.5f, 0.5f, 0.5f, 1.0f, "cloud_color", "WLCloudColor"),
+// mCloudMain(0.5f, 0.5f, 0.125f, 1.0f, "cloud_pos_density1"),
+// mCloudCoverage(0.0f, "cloud_shadow"),
+// mCloudDetail(0.0f, 0.0f, 0.0f, 1.0f, "cloud_pos_density2"),
+// mDistanceMult(1.0f, "distance_multiplier"),
+// mCloudScale(0.42f, "cloud_scale"),
// sky dome
mDomeOffset(0.96f),
diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h
index 61f86b747f..f7f4baee12 100644
--- a/indra/newview/llwlparammanager.h
+++ b/indra/newview/llwlparammanager.h
@@ -37,6 +37,7 @@
class LLGLSLShader;
+#if 0
// color control
struct WLColorControl {
@@ -115,6 +116,8 @@ struct WLFloatControl {
}
};
+#endif
+
/// WindLight parameter manager class - what controls all the wind light shaders
class LLWLParamManager : public LLSingleton<LLWLParamManager>
{
@@ -245,10 +248,12 @@ public:
/// Sun Delta Terrain tweak variables.
F32 mSunDeltaYaw;
+#if 0
WLFloatControl mWLGamma;
-
+#endif
F32 mSceneLightStrength;
+#if 0
/// Atmospherics
WLColorControl mBlueHorizon;
WLFloatControl mHazeDensity;
@@ -270,7 +275,7 @@ public:
WLColorControl mCloudDetail;
WLFloatControl mDistanceMult;
WLFloatControl mCloudScale;
-
+#endif
/// sky dome
F32 mDomeOffset;
F32 mDomeRadius;