diff options
author | Rider Linden <rider@lindenlab.com> | 2017-10-16 11:13:45 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2017-10-16 11:13:45 -0700 |
commit | b4d1b1c43b4cf046a4a9df1911b5edc2d92d0a7b (patch) | |
tree | 6d48ed401b0c50db22436d2387f60bacd6ed48c9 | |
parent | cc22ffc6d799544e8f2a9dfed6813081d908c88d (diff) |
Removed conversions from WLColor Control in favor of setter/getter
-rw-r--r-- | indra/newview/llenvadapters.h | 12 | ||||
-rw-r--r-- | indra/newview/llfloatereditsky.cpp | 22 | ||||
-rw-r--r-- | indra/newview/llfloatereditwater.cpp | 2 |
3 files changed, 20 insertions, 16 deletions
diff --git a/indra/newview/llenvadapters.h b/indra/newview/llenvadapters.h index 3241e43191..8b93bbbe9f 100644 --- a/indra/newview/llenvadapters.h +++ b/indra/newview/llenvadapters.h @@ -51,18 +51,22 @@ public: mIsBlueHorizonOrDensity = (mSliderName == "WLBlueHorizon" || mSliderName == "WLBlueDensity"); } - inline WLColorControl & operator = (const LLColor4 & val) + inline void setColor4(const LLColor4 & val) + { + mColor = val; + } + + inline void setColor3(const LLColor3 & val) { mColor = val; - return *this; } - inline operator LLColor4 (void) const + inline LLColor4 getColor4() const { return mColor; } - inline operator LLColor3 (void) const + inline LLColor3 getColor3(void) const { return vec4to3(mColor); } diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp index 40f86e3778..a6f3f1ebe7 100644 --- a/indra/newview/llfloatereditsky.cpp +++ b/indra/newview/llfloatereditsky.cpp @@ -215,7 +215,7 @@ void LLFloaterEditSky::syncControls() // blue horizon - mSkyAdapter->mBlueHorizon = psky->getBlueHorizon(); + mSkyAdapter->mBlueHorizon.setColor3( psky->getBlueHorizon() ); setColorSwatch("WLBlueHorizon", mSkyAdapter->mBlueHorizon, WL_BLUE_HORIZON_DENSITY_SCALE); // haze density, horizon, mult, and altitude @@ -229,22 +229,22 @@ void LLFloaterEditSky::syncControls() childSetValue("WLMaxAltitude", (F32) mSkyAdapter->mMaxAlt); // blue density - mSkyAdapter->mBlueDensity = psky->getBlueDensity(); + mSkyAdapter->mBlueDensity.setColor3( psky->getBlueDensity() ); setColorSwatch("WLBlueDensity", mSkyAdapter->mBlueDensity, WL_BLUE_HORIZON_DENSITY_SCALE); // Lighting // sunlight - mSkyAdapter->mSunlight = psky->getSunlightColor(); + mSkyAdapter->mSunlight.setColor3( psky->getSunlightColor() ); setColorSwatch("WLSunlight", mSkyAdapter->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE); // glow - mSkyAdapter->mGlow = psky->getGlow(); + mSkyAdapter->mGlow.setColor3( psky->getGlow() ); childSetValue("WLGlowR", 2 - mSkyAdapter->mGlow.getRed() / 20.0f); childSetValue("WLGlowB", -mSkyAdapter->mGlow.getBlue() / 5.0f); // ambient - mSkyAdapter->mAmbient = psky->getAmbientColor(); + mSkyAdapter->mAmbient.setColor3( psky->getAmbientColor() ); setColorSwatch("WLAmbient", mSkyAdapter->mAmbient, WL_SUN_AMBIENT_SLIDER_SCALE); LLSettingsSky::azimalt_t azal = psky->getSunRotationAzAl(); @@ -257,17 +257,17 @@ void LLFloaterEditSky::syncControls() // Clouds // Cloud Color - mSkyAdapter->mCloudColor = psky->getCloudColor(); + mSkyAdapter->mCloudColor.setColor3( psky->getCloudColor() ); setColorSwatch("WLCloudColor", mSkyAdapter->mCloudColor, WL_CLOUD_SLIDER_SCALE); // Cloud - mSkyAdapter->mCloudMain = psky->getCloudPosDensity1(); + mSkyAdapter->mCloudMain.setColor3( psky->getCloudPosDensity1() ); childSetValue("WLCloudX", mSkyAdapter->mCloudMain.getRed()); childSetValue("WLCloudY", mSkyAdapter->mCloudMain.getGreen()); childSetValue("WLCloudDensity", mSkyAdapter->mCloudMain.getBlue()); // Cloud Detail - mSkyAdapter->mCloudDetail = psky->getCloudPosDensity2(); + mSkyAdapter->mCloudDetail.setColor3( psky->getCloudPosDensity2() ); childSetValue("WLCloudDetailX", mSkyAdapter->mCloudDetail.getRed()); childSetValue("WLCloudDetailY", mSkyAdapter->mCloudDetail.getGreen()); childSetValue("WLCloudDetailDensity", mSkyAdapter->mCloudDetail.getBlue()); @@ -307,7 +307,7 @@ void LLFloaterEditSky::syncControls() void LLFloaterEditSky::setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k) { // Set the value, dividing it by <k> first. - LLColor4 color = from_ctrl; + LLColor4 color = from_ctrl.getColor4(); getChild<LLColorSwatchCtrl>(name)->set(color / k); } @@ -336,7 +336,7 @@ void LLFloaterEditSky::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color color_vec.mV[3] = color_max(color_vec); // Apply the new RGBI value. - *color_ctrl = color_vec; + color_ctrl->setColor4(color_vec); color_ctrl->update(mEditSettings); } @@ -410,7 +410,7 @@ void LLFloaterEditSky::adjustIntensity(WLColorControl *ctrl, F32 val, F32 scale) { if (ctrl->getHasSliderName()) { - LLColor4 color = static_cast<LLColor4>(*ctrl); + LLColor4 color = ctrl->getColor4(); F32 i = color_max(color) / scale; ctrl->setIntensity(i); std::string name = ctrl->getSliderName(); diff --git a/indra/newview/llfloatereditwater.cpp b/indra/newview/llfloatereditwater.cpp index 41180b5da8..b025680da1 100644 --- a/indra/newview/llfloatereditwater.cpp +++ b/indra/newview/llfloatereditwater.cpp @@ -286,7 +286,7 @@ void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl* void LLFloaterEditWater::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl) { LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl); - *color_ctrl = swatch->get(); + color_ctrl->setColor4( swatch->get() ); color_ctrl->update(mEditSettings); } |