From ce9cf1027f733560e29f77c4a883bd9b5338f9d8 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 22 Apr 2019 16:02:53 +0300 Subject: SL-10982 [EEP] Personal Lighting - Add options to select water maps / cloud textures --- indra/newview/llfloaterenvironmentadjust.cpp | 38 +++++++++++++++- indra/newview/llfloaterenvironmentadjust.h | 4 ++ .../default/xui/en/floater_adjust_environment.xml | 50 ++++++++++++++++------ 3 files changed, 79 insertions(+), 13 deletions(-) diff --git a/indra/newview/llfloaterenvironmentadjust.cpp b/indra/newview/llfloaterenvironmentadjust.cpp index 2c646799ff..3d19d560d6 100644 --- a/indra/newview/llfloaterenvironmentadjust.cpp +++ b/indra/newview/llfloaterenvironmentadjust.cpp @@ -32,8 +32,10 @@ #include "llslider.h" #include "llsliderctrl.h" #include "llcolorswatch.h" +#include "lltexturectrl.h" #include "llvirtualtrackball.h" #include "llenvironment.h" +#include "llviewercontrol.h" //========================================================================= namespace @@ -46,6 +48,8 @@ namespace const std::string FIELD_SKY_HAZE_HORIZON("haze_horizon"); const std::string FIELD_SKY_HAZE_DENSITY("haze_density"); const std::string FIELD_SKY_CLOUD_COVERAGE("cloud_coverage"); + const std::string FIELD_SKY_CLOUD_MAP("cloud_map"); + const std::string FIELD_WATER_NORMAL_MAP("water_normal_map"); const std::string FIELD_SKY_CLOUD_SCALE("cloud_scale"); const std::string FIELD_SKY_SCENE_GAMMA("scene_gamma"); const std::string FIELD_SKY_SUN_ROTATION("sun_rotation"); @@ -97,6 +101,14 @@ BOOL LLFloaterEnvironmentAdjust::postBuild() getChild(FIELD_SKY_MOON_ROTATION)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonRotationChanged(); }); getChild(BTN_RESET)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onButtonReset(); }); + getChild(FIELD_SKY_CLOUD_MAP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudMapChanged(); }); + getChild(FIELD_SKY_CLOUD_MAP)->setDefaultImageAssetID(LLSettingsSky::GetDefaultCloudNoiseTextureId()); + getChild(FIELD_SKY_CLOUD_MAP)->setAllowNoTexture(TRUE); + + getChild(FIELD_WATER_NORMAL_MAP)->setDefaultImageAssetID(LLSettingsWater::GetDefaultWaterNormalAssetId()); + getChild(FIELD_WATER_NORMAL_MAP)->setBlankImageAssetID(LLUUID(gSavedSettings.getString("DefaultBlankNormalTexture"))); + getChild(FIELD_WATER_NORMAL_MAP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onWaterMapChanged(); }); + refresh(); return TRUE; } @@ -115,6 +127,7 @@ void LLFloaterEnvironmentAdjust::onClose(bool app_quitting) { mEventConnection.disconnect(); mLiveSky.reset(); + mLiveWater.reset(); LLFloater::onClose(app_quitting); } @@ -122,7 +135,7 @@ void LLFloaterEnvironmentAdjust::onClose(bool app_quitting) //------------------------------------------------------------------------- void LLFloaterEnvironmentAdjust::refresh() { - if (!mLiveSky) + if (!mLiveSky || !mLiveWater) { setAllChildrenEnabled(FALSE); return; @@ -142,6 +155,9 @@ void LLFloaterEnvironmentAdjust::refresh() getChild(FIELD_SKY_CLOUD_SCALE)->setValue(mLiveSky->getCloudScale()); getChild(FIELD_SKY_SUN_COLOR)->set(mLiveSky->getSunlightColor() / SLIDER_SCALE_SUN_AMBIENT); + getChild(FIELD_SKY_CLOUD_MAP)->setValue(mLiveSky->getCloudNoiseTextureId()); + getChild(FIELD_WATER_NORMAL_MAP)->setValue(mLiveWater->getNormalMapID()); + LLColor3 glow(mLiveSky->getGlow()); // takes 40 - 0.2 range -> 0 - 1.99 UI range @@ -165,22 +181,26 @@ void LLFloaterEnvironmentAdjust::captureCurrentEnvironment() if (environment.getEnvironmentDay(LLEnvironment::ENV_LOCAL)) { // We have a full day cycle in the local environment. Freeze the sky mLiveSky = environment.getEnvironmentFixedSky(LLEnvironment::ENV_LOCAL)->buildClone(); + mLiveWater = environment.getEnvironmentFixedWater(LLEnvironment::ENV_LOCAL)->buildClone(); updatelocal = true; } else { // otherwise we can just use the sky. mLiveSky = environment.getEnvironmentFixedSky(LLEnvironment::ENV_LOCAL); + mLiveWater = environment.getEnvironmentFixedWater(LLEnvironment::ENV_LOCAL); } } else { mLiveSky = environment.getEnvironmentFixedSky(LLEnvironment::ENV_PARCEL, true)->buildClone(); + mLiveWater = environment.getEnvironmentFixedWater(LLEnvironment::ENV_PARCEL, true)->buildClone(); updatelocal = true; } if (updatelocal) { environment.setEnvironment(LLEnvironment::ENV_LOCAL, mLiveSky, FLOATER_ENVIRONMENT_UPDATE); + environment.setEnvironment(LLEnvironment::ENV_LOCAL, mLiveWater, FLOATER_ENVIRONMENT_UPDATE); } environment.setSelectedEnvironment(LLEnvironment::ENV_LOCAL); environment.updateEnvironment(LLEnvironment::TRANSITION_INSTANT); @@ -322,6 +342,22 @@ void LLFloaterEnvironmentAdjust::onMoonRotationChanged() mLiveSky->update(); } +void LLFloaterEnvironmentAdjust::onCloudMapChanged() +{ + if (!mLiveSky) + return; + mLiveSky->setCloudNoiseTextureId(getChild(FIELD_SKY_CLOUD_MAP)->getValue().asUUID()); + mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onWaterMapChanged() +{ + if (!mLiveWater) + return; + mLiveWater->setNormalMapID(getChild(FIELD_WATER_NORMAL_MAP)->getValue().asUUID()); + mLiveWater->update(); +} + void LLFloaterEnvironmentAdjust::onSunColorChanged() { if (!mLiveSky) diff --git a/indra/newview/llfloaterenvironmentadjust.h b/indra/newview/llfloaterenvironmentadjust.h index 4876c45065..cb38dbcfa8 100644 --- a/indra/newview/llfloaterenvironmentadjust.h +++ b/indra/newview/llfloaterenvironmentadjust.h @@ -77,11 +77,15 @@ private: void onMoonRotationChanged(); + void onCloudMapChanged(); + void onWaterMapChanged(); + void onButtonReset(); void onEnvironmentUpdated(LLEnvironment::EnvSelection_t env, S32 version); LLSettingsSky::ptr_t mLiveSky; + LLSettingsWater::ptr_t mLiveWater; LLEnvironment::connection_t mEventConnection; }; diff --git a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml index fc356c10c7..59589e3665 100644 --- a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml +++ b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml @@ -5,14 +5,14 @@ save_rect="false" title="Personal Lighting" width="845" - height="230" + height="240" min_width="500" - min_height="225" + min_height="235" single_instance="true" can_resize="false"> Ambient: Blue Horizon: Blue Density: Sun Color: Cloud Color: + Cloud Image: + + Water Image: + -- cgit v1.2.3