From cf0e4f79f52b4fb24769aa6e355ec8c95c6d2afc Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 27 Apr 2018 17:12:13 -0700 Subject: Adding fixed water edit dialog. --- indra/newview/llviewermenu.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 456c080f8a..9f25890917 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8476,12 +8476,14 @@ class LLWorldEnvPreset : public view_listener_t if (item == "new_water") { - LLFloaterReg::showInstance("env_edit_water", "new"); + //LLFloaterReg::showInstance("env_edit_water", "new"); + LLFloaterReg::showInstance("env_fixed_environmentent_water", "new"); } else if (item == "edit_water") { - LLFloaterReg::showInstance("env_edit_water", "edit"); - } + //LLFloaterReg::showInstance("env_edit_water", "edit"); + LLFloaterReg::showInstance("env_fixed_environmentent_water", "edit"); + } else if (item == "new_sky") { LLFloaterReg::showInstance("env_edit_sky", "new"); -- cgit v1.3 From 03da2bc1a1c7674514c967b0e7408258dba25d77 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 2 May 2018 17:07:06 -0700 Subject: Fixed sky editing floater. --- indra/llinventory/llsettingssky.h | 20 ++ indra/newview/CMakeLists.txt | 2 + indra/newview/llfloaterfixedenvironment.cpp | 91 +++++ indra/newview/llfloaterfixedenvironment.h | 22 ++ indra/newview/llpaneleditsky.cpp | 388 +++++++++++++++++++++ indra/newview/llpaneleditsky.h | 124 +++++++ indra/newview/llviewerfloaterreg.cpp | 1 + indra/newview/llviewermenu.cpp | 10 +- .../default/xui/en/floater_fixedenvironment.xml | 7 +- .../default/xui/en/panel_settings_sky_atmos.xml | 240 +++++++++++++ .../default/xui/en/panel_settings_sky_clouds.xml | 255 ++++++++++++++ .../default/xui/en/panel_settings_sky_sunmoon.xml | 234 +++++++++++++ 12 files changed, 1386 insertions(+), 8 deletions(-) create mode 100644 indra/newview/llpaneleditsky.cpp create mode 100644 indra/newview/llpaneleditsky.h create mode 100644 indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml create mode 100644 indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml create mode 100644 indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index d08e2bbd03..1451162744 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -189,6 +189,11 @@ public: return mSettings[SETTING_CLOUD_TEXTUREID].asUUID(); } + void setCloudNoiseTextureId(const LLUUID &id) + { + setValue(SETTING_CLOUD_TEXTUREID, id); + } + LLColor3 getCloudPosDensity1() const { return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]); @@ -300,6 +305,11 @@ public: return mSettings[SETTING_MAX_Y].asReal(); } + void setMaxY(F32 val) + { + setValue(SETTING_MAX_Y, val); + } + LLQuaternion getMoonRotation() const { return LLQuaternion(mSettings[SETTING_MOON_ROTATION]); @@ -324,6 +334,11 @@ public: return mSettings[SETTING_MOON_TEXTUREID].asUUID(); } + void setMoonTextureId(LLUUID id) + { + setValue(SETTING_MOON_TEXTUREID, id); + } + F32 getStarBrightness() const { return mSettings[SETTING_STAR_BRIGHTNESS].asReal(); @@ -368,6 +383,11 @@ public: return mSettings[SETTING_SUN_TEXTUREID].asUUID(); } + void setSunTextureId(LLUUID id) + { + setValue(SETTING_SUN_TEXTUREID, id); + } + // Internal/calculated settings LLVector3 getLightDirection() const { diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 109001f82e..654487b8fb 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -421,6 +421,7 @@ set(viewer_SOURCE_FILES llpanelblockedlist.cpp llpanelclassified.cpp llpanelcontents.cpp + llpaneleditsky.cpp llpaneleditwater.cpp llpaneleditwearable.cpp llpanelenvironment.cpp @@ -1031,6 +1032,7 @@ set(viewer_HEADER_FILES llpanelblockedlist.h llpanelclassified.h llpanelcontents.h + llpaneleditsky.h llpaneleditwater.h llpaneleditwearable.h llpanelenvironment.h diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 6c883b2534..ec8e2c8965 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -40,6 +40,7 @@ // newview #include "llpaneleditwater.h" +#include "llpaneleditsky.h" #include "llsettingssky.h" #include "llsettingswater.h" @@ -246,6 +247,96 @@ void LLFloaterFixedEnvironmentWater::doApplyFixedSettings() } +//========================================================================= +LLFloaterFixedEnvironmentSky::LLFloaterFixedEnvironmentSky(const LLSD &key) : + LLFloaterFixedEnvironment(key) +{} + +BOOL LLFloaterFixedEnvironmentSky::postBuild() +{ + if (!LLFloaterFixedEnvironment::postBuild()) + return FALSE; + + LLPanelSettingsSky * panel; + panel = new LLPanelSettingsSkyAtmosTab; + panel->buildFromFile("panel_settings_sky_atmos.xml"); + panel->setSky(std::static_pointer_cast(mSettings)); + mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true)); + + panel = new LLPanelSettingsSkyCloudTab; + panel->buildFromFile("panel_settings_sky_clouds.xml"); + panel->setSky(std::static_pointer_cast(mSettings)); + mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); + + panel = new LLPanelSettingsSkySunMoonTab; + panel->buildFromFile("panel_settings_sky_sunmoon.xml"); + panel->setSky(std::static_pointer_cast(mSettings)); + mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); + + return TRUE; +} + +void LLFloaterFixedEnvironmentSky::updateEditEnvironment(void) +{ + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, + std::static_pointer_cast(mSettings)); +} + +void LLFloaterFixedEnvironmentSky::onOpen(const LLSD& key) +{ + if (!mSettings) + { + // Initialize the settings, take a snapshot of the current water. + mSettings = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_CURRENT)->buildClone(); + mSettings->setName("Snapshot sky (new)"); + + // TODO: Should we grab sky and keep it around for reference? + } + + updateEditEnvironment(); + syncronizeTabs(); + refresh(); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); +} + +void LLFloaterFixedEnvironmentSky::onClose(bool app_quitting) +{ + mSettings.reset(); + syncronizeTabs(); +} + +void LLFloaterFixedEnvironmentSky::doLoadFromInventory() +{ + +} + +void LLFloaterFixedEnvironmentSky::doImportFromDisk() +{ // Load a a legacy Windlight XML from disk. + + LLFilePicker& picker = LLFilePicker::instance(); + if (picker.getOpenFile(LLFilePicker::FFLOAD_XML)) + { + std::string filename = picker.getFirstFile(); + + LL_WARNS("LAPRAS") << "Selected file: " << filename << LL_ENDL; + LLSettingsSky::ptr_t legacysky = LLEnvironment::createSkyFromLegacyPreset(filename); + + if (!legacysky) + { // *TODO* Put up error dialog here. Could not create water from filename + return; + } + + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, legacysky); + this->setEditSettings(legacysky); + LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST, true); + } +} + +void LLFloaterFixedEnvironmentSky::doApplyFixedSettings() +{ + LLSettingsVOBase::createInventoryItem(mSettings); +} + //========================================================================= #if 0 diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index be1ba4a58b..590be08169 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -171,6 +171,28 @@ protected: private: }; +class LLFloaterFixedEnvironmentSky : public LLFloaterFixedEnvironment +{ + LOG_CLASS(LLFloaterFixedEnvironmentSky); + +public: + LLFloaterFixedEnvironmentSky(const LLSD &key); + + BOOL postBuild() override; + + virtual void onOpen(const LLSD& key) override; + virtual void onClose(bool app_quitting) override; + +protected: + virtual void updateEditEnvironment() override; + + virtual void doLoadFromInventory() override; + virtual void doImportFromDisk() override; + virtual void doApplyFixedSettings() override; + +private: +}; + class LLSettingsEditPanel : public LLPanel { public: diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp new file mode 100644 index 0000000000..e10af29e82 --- /dev/null +++ b/indra/newview/llpaneleditsky.cpp @@ -0,0 +1,388 @@ +/** +* @file llpaneleditsky.cpp +* @brief Floaters to create and edit fixed settings for sky and water. +* +* $LicenseInfo:firstyear=2011&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 "llpaneleditsky.h" + +#include "llslider.h" +#include "lltexturectrl.h" +#include "llcolorswatch.h" +#include "lljoystickbutton.h" + +namespace +{ + // Atmosphere Tab + const std::string FIELD_SKY_AMBIENT_LIGHT("ambient_light"); + const std::string FIELD_SKY_BLUE_HORIZON("blue_horizon"); + const std::string FIELD_SKY_BLUE_DENSITY("blue_density"); + const std::string FIELD_SKY_HAZE_HORIZON("haze_horizon"); + const std::string FIELD_SKY_HAZE_DENSITY("haze_density"); + const std::string FIELD_SKY_SCENE_GAMMA("scene_gamma"); + const std::string FIELD_SKY_DENSITY_MULTIP("density_multip"); + const std::string FIELD_SKY_DISTANCE_MULTIP("distance_multip"); + const std::string FIELD_SKY_MAX_ALT("max_alt"); + + const std::string FIELD_SKY_CLOUD_COLOR("cloud_color"); + const std::string FIELD_SKY_CLOUD_COVERAGE("cloud_coverage"); + const std::string FIELD_SKY_CLOUD_SCALE("cloud_scale"); + const std::string FIELD_SKY_CLOUD_SCROLL_X("cloud_scroll_x"); + const std::string FIELD_SKY_CLOUD_SCROLL_Y("cloud_scroll_y"); + const std::string FIELD_SKY_CLOUD_MAP("cloud_map"); + const std::string FIELD_SKY_CLOUD_DENSITY_X("cloud_density_x"); + const std::string FIELD_SKY_CLOUD_DENSITY_Y("cloud_density_y"); + const std::string FIELD_SKY_CLOUD_DENSITY_D("cloud_density_d"); + const std::string FIELD_SKY_CLOUD_DETAIL_X("cloud_detail_x"); + const std::string FIELD_SKY_CLOUD_DETAIL_Y("cloud_detail_y"); + const std::string FIELD_SKY_CLOUD_DETAIL_D("cloud_detail_d"); + + const std::string FIELD_SKY_SUN_MOON_COLOR("sun_moon_color"); + const std::string FIELD_SKY_GLOW_FOCUS("glow_focus"); + const std::string FIELD_SKY_GLOW_SIZE("glow_size"); + const std::string FIELD_SKY_STAR_BRIGHTNESS("star_brightness"); + const std::string FIELD_SKY_SUN_ROTATION("sun_rotation"); + const std::string FIELD_SKY_SUN_IMAGE("sun_image"); + const std::string FIELD_SKY_MOON_ROTATION("moon_rotation"); + const std::string FIELD_SKY_MOON_IMAGE("moon_image"); + + const F32 SLIDER_SCALE_SUN_AMBIENT(3.0f); + const F32 SLIDER_SCALE_BLUE_HORIZON_DENSITY(2.0f); + const F32 SLIDER_SCALE_GLOW_R(20.0f); + const F32 SLIDER_SCALE_GLOW_B(-5.0f); +} + +//========================================================================== +LLPanelSettingsSky::LLPanelSettingsSky() : + LLSettingsEditPanel(), + mSkySettings() +{ + +} + + +//========================================================================== +LLPanelSettingsSkyAtmosTab::LLPanelSettingsSkyAtmosTab() : + LLPanelSettingsSky() +{ +} + + +BOOL LLPanelSettingsSkyAtmosTab::postBuild() +{ + getChild(FIELD_SKY_AMBIENT_LIGHT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAmbientLightChanged(); }); + getChild(FIELD_SKY_BLUE_HORIZON)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onBlueHorizonChanged(); }); + getChild(FIELD_SKY_BLUE_DENSITY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onBlueDensityChanged(); }); + getChild(FIELD_SKY_HAZE_HORIZON)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onHazeHorizonChanged(); }); + getChild(FIELD_SKY_HAZE_DENSITY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onHazeDensityChanged(); }); + getChild(FIELD_SKY_SCENE_GAMMA)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSceneGammaChanged(); }); + getChild(FIELD_SKY_DENSITY_MULTIP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onDensityMultipChanged(); }); + getChild(FIELD_SKY_DISTANCE_MULTIP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onDistanceMultipChanged(); }); + getChild(FIELD_SKY_MAX_ALT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMaxAltChanged(); }); + + refresh(); + + return TRUE; +} + +void LLPanelSettingsSkyAtmosTab::refresh() +{ + if (!mSkySettings) + { + setAllChildrenEnabled(FALSE); + setEnabled(FALSE); + return; + } + + setEnabled(TRUE); + setAllChildrenEnabled(TRUE); + + getChild(FIELD_SKY_AMBIENT_LIGHT)->set(mSkySettings->getAmbientColor() / SLIDER_SCALE_SUN_AMBIENT); + getChild(FIELD_SKY_BLUE_HORIZON)->set(mSkySettings->getBlueHorizon() / SLIDER_SCALE_BLUE_HORIZON_DENSITY); + getChild(FIELD_SKY_BLUE_DENSITY)->set(mSkySettings->getBlueDensity() / SLIDER_SCALE_BLUE_HORIZON_DENSITY); + + getChild(FIELD_SKY_HAZE_HORIZON)->setValue(mSkySettings->getHazeHorizon()); + getChild(FIELD_SKY_HAZE_DENSITY)->setValue(mSkySettings->getHazeDensity()); + getChild(FIELD_SKY_SCENE_GAMMA)->setValue(mSkySettings->getGamma()); + getChild(FIELD_SKY_DENSITY_MULTIP)->setValue(mSkySettings->getDensityMultiplier()); + getChild(FIELD_SKY_DISTANCE_MULTIP)->setValue(mSkySettings->getDistanceMultiplier()); + getChild(FIELD_SKY_MAX_ALT)->setValue(mSkySettings->getMaxY()); + +} + +//------------------------------------------------------------------------- +void LLPanelSettingsSkyAtmosTab::onAmbientLightChanged() +{ + mSkySettings->setAmbientColor(LLColor3(getChild(FIELD_SKY_AMBIENT_LIGHT)->get() * SLIDER_SCALE_SUN_AMBIENT)); +} + +void LLPanelSettingsSkyAtmosTab::onBlueHorizonChanged() +{ + mSkySettings->setBlueHorizon(LLColor3(getChild(FIELD_SKY_BLUE_HORIZON)->get() * SLIDER_SCALE_BLUE_HORIZON_DENSITY)); +} + +void LLPanelSettingsSkyAtmosTab::onBlueDensityChanged() +{ + mSkySettings->setBlueDensity(LLColor3(getChild(FIELD_SKY_BLUE_DENSITY)->get() * SLIDER_SCALE_BLUE_HORIZON_DENSITY)); +} + +void LLPanelSettingsSkyAtmosTab::onHazeHorizonChanged() +{ + mSkySettings->setHazeHorizon(getChild(FIELD_SKY_HAZE_HORIZON)->getValue().asReal()); +} + +void LLPanelSettingsSkyAtmosTab::onHazeDensityChanged() +{ + mSkySettings->setHazeDensity(getChild(FIELD_SKY_HAZE_DENSITY)->getValue().asReal()); +} + +void LLPanelSettingsSkyAtmosTab::onSceneGammaChanged() +{ + mSkySettings->setGamma(getChild(FIELD_SKY_SCENE_GAMMA)->getValue().asReal()); +} + +void LLPanelSettingsSkyAtmosTab::onDensityMultipChanged() +{ + mSkySettings->setDensityMultiplier(getChild(FIELD_SKY_DENSITY_MULTIP)->getValue().asReal()); +} + +void LLPanelSettingsSkyAtmosTab::onDistanceMultipChanged() +{ + mSkySettings->setDistanceMultiplier(getChild(FIELD_SKY_DISTANCE_MULTIP)->getValue().asReal()); +} + +void LLPanelSettingsSkyAtmosTab::onMaxAltChanged() +{ + mSkySettings->setMaxY(getChild(FIELD_SKY_MAX_ALT)->getValue().asReal()); +} + +//========================================================================== +LLPanelSettingsSkyCloudTab::LLPanelSettingsSkyCloudTab() : + LLPanelSettingsSky() +{ +} + + +BOOL LLPanelSettingsSkyCloudTab::postBuild() +{ + getChild(FIELD_SKY_CLOUD_COLOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudColorChanged(); }); + getChild(FIELD_SKY_CLOUD_COVERAGE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudCoverageChanged(); }); + getChild(FIELD_SKY_CLOUD_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudScaleChanged(); }); + getChild(FIELD_SKY_CLOUD_SCROLL_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudScrollChanged(); }); + getChild(FIELD_SKY_CLOUD_SCROLL_Y)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudScrollChanged(); }); + getChild(FIELD_SKY_CLOUD_MAP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudMapChanged(); }); +// getChild(FIELD_SKY_CLOUD_MAP)->setDefaultImageAssetID(LLSettingsSky::DEFAULT_CLOUD_TEXTURE_ID); + + getChild(FIELD_SKY_CLOUD_DENSITY_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDensityChanged(); }); + getChild(FIELD_SKY_CLOUD_DENSITY_Y)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDensityChanged(); }); + getChild(FIELD_SKY_CLOUD_DENSITY_D)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDensityChanged(); }); + getChild(FIELD_SKY_CLOUD_DETAIL_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDetailChanged(); }); + getChild(FIELD_SKY_CLOUD_DETAIL_Y)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDetailChanged(); }); + getChild(FIELD_SKY_CLOUD_DETAIL_D)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDetailChanged(); }); + + refresh(); + + return TRUE; +} + +void LLPanelSettingsSkyCloudTab::refresh() +{ + if (!mSkySettings) + { + setAllChildrenEnabled(FALSE); + setEnabled(FALSE); + return; + } + + setEnabled(TRUE); + setAllChildrenEnabled(TRUE); + + getChild(FIELD_SKY_CLOUD_COLOR)->set(mSkySettings->getCloudColor()); + getChild(FIELD_SKY_CLOUD_COVERAGE)->setValue(mSkySettings->getCloudShadow()); + getChild(FIELD_SKY_CLOUD_SCALE)->setValue(mSkySettings->getCloudScale()); + + LLVector2 cloudScroll(mSkySettings->getCloudScrollRate()); + getChild(FIELD_SKY_CLOUD_SCROLL_X)->setValue(cloudScroll[0]); + getChild(FIELD_SKY_CLOUD_SCROLL_Y)->setValue(cloudScroll[1]); + + getChild(FIELD_SKY_CLOUD_MAP)->setValue(mSkySettings->getCloudNoiseTextureId()); + + LLVector3 cloudDensity(mSkySettings->getCloudPosDensity1().getValue()); + getChild(FIELD_SKY_CLOUD_DENSITY_X)->setValue(cloudDensity[0]); + getChild(FIELD_SKY_CLOUD_DENSITY_Y)->setValue(cloudDensity[1]); + getChild(FIELD_SKY_CLOUD_DENSITY_D)->setValue(cloudDensity[2]); + + LLVector3 cloudDetail(mSkySettings->getCloudPosDensity1().getValue()); + getChild(FIELD_SKY_CLOUD_DETAIL_X)->setValue(cloudDetail[0]); + getChild(FIELD_SKY_CLOUD_DETAIL_Y)->setValue(cloudDetail[1]); + getChild(FIELD_SKY_CLOUD_DETAIL_D)->setValue(cloudDetail[2]); +} + +//------------------------------------------------------------------------- +void LLPanelSettingsSkyCloudTab::onCloudColorChanged() +{ + mSkySettings->setCloudColor(LLColor3(getChild(FIELD_SKY_CLOUD_COLOR)->get())); +} + +void LLPanelSettingsSkyCloudTab::onCloudCoverageChanged() +{ + mSkySettings->setCloudShadow(getChild(FIELD_SKY_CLOUD_COVERAGE)->getValue().asReal()); +} + +void LLPanelSettingsSkyCloudTab::onCloudScaleChanged() +{ + mSkySettings->setCloudScale(getChild(FIELD_SKY_CLOUD_SCALE)->getValue().asReal()); +} + +void LLPanelSettingsSkyCloudTab::onCloudScrollChanged() +{ + LLVector2 scroll(getChild(FIELD_SKY_CLOUD_SCROLL_X)->getValue().asReal(), + getChild(FIELD_SKY_CLOUD_SCROLL_Y)->getValue().asReal()); + + mSkySettings->setCloudScrollRate(scroll); +} + +void LLPanelSettingsSkyCloudTab::onCloudMapChanged() +{ + mSkySettings->setCloudNoiseTextureId(getChild(FIELD_SKY_CLOUD_MAP)->getValue().asUUID()); +} + +void LLPanelSettingsSkyCloudTab::onCloudDensityChanged() +{ + LLColor3 density(getChild(FIELD_SKY_CLOUD_DENSITY_X)->getValue().asReal(), + getChild(FIELD_SKY_CLOUD_DENSITY_Y)->getValue().asReal(), + getChild(FIELD_SKY_CLOUD_DENSITY_D)->getValue().asReal()); + + mSkySettings->setCloudPosDensity1(density); +} + +void LLPanelSettingsSkyCloudTab::onCloudDetailChanged() +{ + LLColor3 detail(getChild(FIELD_SKY_CLOUD_DETAIL_X)->getValue().asReal(), + getChild(FIELD_SKY_CLOUD_DETAIL_Y)->getValue().asReal(), + getChild(FIELD_SKY_CLOUD_DETAIL_D)->getValue().asReal()); + + mSkySettings->setCloudPosDensity2(detail); +} + +//========================================================================== +LLPanelSettingsSkySunMoonTab::LLPanelSettingsSkySunMoonTab() : + LLPanelSettingsSky() +{ +} + + +BOOL LLPanelSettingsSkySunMoonTab::postBuild() +{ + getChild(FIELD_SKY_SUN_MOON_COLOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunMoonColorChanged(); }); + getChild(FIELD_SKY_GLOW_FOCUS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onGlowChanged(); }); + getChild(FIELD_SKY_GLOW_SIZE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onGlowChanged(); }); + getChild(FIELD_SKY_STAR_BRIGHTNESS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onStarBrightnessChanged(); }); + getChild(FIELD_SKY_SUN_ROTATION)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunRotationChanged(); }); + getChild(FIELD_SKY_SUN_IMAGE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunImageChanged(); }); +// getChild(FIELD_SKY_SUN_IMAGE)->setDefaultImageAssetID(LLSettingsSky:: ); + getChild(FIELD_SKY_MOON_ROTATION)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonRotationChanged(); }); + getChild(FIELD_SKY_MOON_IMAGE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonImageChanged(); }); +// getChild(FIELD_SKY_MOON_IMAGE)->setDefaultImageAssetID(LLSettingsSky:: ); + + refresh(); + + return TRUE; +} + +void LLPanelSettingsSkySunMoonTab::refresh() +{ + if (!mSkySettings) + { + setAllChildrenEnabled(FALSE); + setEnabled(FALSE); + return; + } + + setEnabled(TRUE); + setAllChildrenEnabled(TRUE); + + getChild(FIELD_SKY_SUN_MOON_COLOR)->set(mSkySettings->getSunlightColor() / SLIDER_SCALE_SUN_AMBIENT); + + LLColor3 glow(mSkySettings->getGlow()); + + glow.mV[0] = 2 - (glow.mV[0] / SLIDER_SCALE_GLOW_R); + glow.mV[2] /= SLIDER_SCALE_GLOW_B; + + getChild(FIELD_SKY_GLOW_FOCUS)->setValue(glow.mV[0]); + getChild(FIELD_SKY_GLOW_SIZE)->setValue(glow.mV[2]); + + getChild(FIELD_SKY_STAR_BRIGHTNESS)->setValue(mSkySettings->getStarBrightness()); + getChild(FIELD_SKY_SUN_ROTATION)->setRotation(mSkySettings->getSunRotation()); + getChild(FIELD_SKY_SUN_IMAGE)->setValue(mSkySettings->getSunTextureId()); + getChild(FIELD_SKY_MOON_ROTATION)->setRotation(mSkySettings->getMoonRotation()); + getChild(FIELD_SKY_MOON_IMAGE)->setValue(mSkySettings->getMoonTextureId()); +} + +//------------------------------------------------------------------------- +void LLPanelSettingsSkySunMoonTab::onSunMoonColorChanged() +{ + LLColor3 color(getChild(FIELD_SKY_SUN_MOON_COLOR)->get()); + + color *= SLIDER_SCALE_SUN_AMBIENT; + + mSkySettings->setSunlightColor(color); +} + +void LLPanelSettingsSkySunMoonTab::onGlowChanged() +{ + LLColor3 glow(getChild(FIELD_SKY_GLOW_FOCUS)->getValue().asReal(), 0.0f, + getChild(FIELD_SKY_GLOW_SIZE)->getValue().asReal()); + + glow.mV[0] = (2 - glow.mV[0]) * SLIDER_SCALE_GLOW_R; + glow.mV[2] *= SLIDER_SCALE_GLOW_B; + + mSkySettings->setGlow(glow); +} + +void LLPanelSettingsSkySunMoonTab::onStarBrightnessChanged() +{ + mSkySettings->setStarBrightness(getChild(FIELD_SKY_STAR_BRIGHTNESS)->getValue().asReal()); +} + +void LLPanelSettingsSkySunMoonTab::onSunRotationChanged() +{ + mSkySettings->setSunRotation(getChild(FIELD_SKY_SUN_ROTATION)->getRotation()); +} + +void LLPanelSettingsSkySunMoonTab::onSunImageChanged() +{ + mSkySettings->setSunTextureId(getChild(FIELD_SKY_SUN_IMAGE)->getValue().asUUID()); +} + +void LLPanelSettingsSkySunMoonTab::onMoonRotationChanged() +{ + mSkySettings->setMoonRotation(getChild(FIELD_SKY_MOON_ROTATION)->getRotation()); +} + +void LLPanelSettingsSkySunMoonTab::onMoonImageChanged() +{ + mSkySettings->setMoonTextureId(getChild(FIELD_SKY_MOON_IMAGE)->getValue().asUUID()); +} diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h new file mode 100644 index 0000000000..497c98af1f --- /dev/null +++ b/indra/newview/llpaneleditsky.h @@ -0,0 +1,124 @@ +/** +* @file llpaneleditsky.h +* @brief Panels for sky settings +* +* $LicenseInfo:firstyear=2011&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 LLPANEL_EDIT_SKY_H +#define LLPANEL_EDIT_SKY_H + +#include "llpanel.h" +#include "llsettingssky.h" + +#include "llfloaterfixedenvironment.h" + +//========================================================================= +class LLSlider; +class LLColorSwatchCtrl; +class LLTextureCtrl; + +//========================================================================= +class LLPanelSettingsSky : public LLSettingsEditPanel +{ + LOG_CLASS(LLPanelSettingsSky); + +public: + LLPanelSettingsSky(); + + virtual void setSettings(LLSettingsBase::ptr_t &settings) override { setSky(std::static_pointer_cast(settings)); } + + LLSettingsSky::ptr_t getSky() const { return mSkySettings; } + void setSky(const LLSettingsSky::ptr_t &sky) { mSkySettings = sky; refresh(); } + +protected: + LLSettingsSky::ptr_t mSkySettings; +}; + +class LLPanelSettingsSkyAtmosTab : public LLPanelSettingsSky +{ + LOG_CLASS(LLPanelSettingsSkyAtmosTab); + +public: + LLPanelSettingsSkyAtmosTab(); + + virtual BOOL postBuild() override; + +protected: + virtual void refresh() override; + +private: + void onAmbientLightChanged(); + void onBlueHorizonChanged(); + void onBlueDensityChanged(); + void onHazeHorizonChanged(); + void onHazeDensityChanged(); + void onSceneGammaChanged(); + void onDensityMultipChanged(); + void onDistanceMultipChanged(); + void onMaxAltChanged(); +}; + +class LLPanelSettingsSkyCloudTab : public LLPanelSettingsSky +{ + LOG_CLASS(LLPanelSettingsSkyCloudTab); + +public: + LLPanelSettingsSkyCloudTab(); + + virtual BOOL postBuild() override; + +protected: + virtual void refresh() override; + +private: + void onCloudColorChanged(); + void onCloudCoverageChanged(); + void onCloudScaleChanged(); + void onCloudScrollChanged(); + void onCloudMapChanged(); + void onCloudDensityChanged(); + void onCloudDetailChanged(); +}; + +class LLPanelSettingsSkySunMoonTab : public LLPanelSettingsSky +{ + LOG_CLASS(LLPanelSettingsSkySunMoonTab); + +public: + LLPanelSettingsSkySunMoonTab(); + + virtual BOOL postBuild() override; + +protected: + virtual void refresh() override; + +private: + void onSunMoonColorChanged(); + void onGlowChanged(); + void onStarBrightnessChanged(); + void onSunRotationChanged(); + void onSunImageChanged(); + void onMoonRotationChanged(); + void onMoonImageChanged(); +}; +#endif // LLPANEL_EDIT_SKY_H diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 1af6ecb8b6..7e0a3a5fd8 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -228,6 +228,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("env_edit_day_cycle", "floater_edit_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_fixed_environmentent_water", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_fixed_environmentent_sky", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); //LLFloaterReg::add("env_fixed_environmentent", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_edit_extdaycycle", "floater_edit_ext_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9f25890917..6bc28ad284 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8476,22 +8476,20 @@ class LLWorldEnvPreset : public view_listener_t if (item == "new_water") { - //LLFloaterReg::showInstance("env_edit_water", "new"); LLFloaterReg::showInstance("env_fixed_environmentent_water", "new"); } else if (item == "edit_water") { - //LLFloaterReg::showInstance("env_edit_water", "edit"); LLFloaterReg::showInstance("env_fixed_environmentent_water", "edit"); } else if (item == "new_sky") { - LLFloaterReg::showInstance("env_edit_sky", "new"); - } + LLFloaterReg::showInstance("env_fixed_environmentent_sky", "new"); + } else if (item == "edit_sky") { - LLFloaterReg::showInstance("env_edit_sky", "edit"); - } + LLFloaterReg::showInstance("env_fixed_environmentent_sky", "edit"); + } else if (item == "new_day_cycle") { LLFloaterReg::showInstance("env_edit_day_cycle", "new"); diff --git a/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml b/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml index 03bbc05dad..2590bb3410 100644 --- a/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml +++ b/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml @@ -26,7 +26,6 @@ - + + + + + + + + + + + Ambient Color: + + + + Blue Horizon: + + + + Blue Density: + + + + + + + + Haze Horizon: + + + + Haze Density: + + + + Scene Gamma: + + + + + + Density Multiplier: + + + + Distance Multiplier: + + + + Maximum Altitude: + + + + + + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml new file mode 100644 index 0000000000..2a52f1a96e --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml @@ -0,0 +1,255 @@ + + + + + + Cloud Color: + + + + Cloud Coverage: + + + + Cloud Scale: + + + + Cloud Scroll: + + + + placeholder + + + + + + Cloud Image: + + + + + + Cloud Density: + + + + + + Cloud Detail: + + + + + + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml new file mode 100644 index 0000000000..c0bd123fbc --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml @@ -0,0 +1,234 @@ + + + + + + Sun Color: + + + + Glow Focus: + + + + Glow Size: + + + + Star Brightness: + + + + + + + + Sun + + + Position: + + + + Image: + + + + + + Moon + + + Position: + + + + Image: + + + + + + + -- cgit v1.3 From 834498d1717baa69e55b6609d602026248dfacc1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 11 May 2018 10:46:15 -0700 Subject: Remove the old sky and water edit dialogs. --- indra/newview/CMakeLists.txt | 6 - indra/newview/llenvadapters.cpp | 77 -- indra/newview/llenvadapters.h | 470 ---------- indra/newview/llfloatereditsky.cpp | 740 ---------------- indra/newview/llfloatereditsky.h | 125 --- indra/newview/llfloatereditwater.cpp | 526 ----------- indra/newview/llfloatereditwater.h | 116 --- indra/newview/llviewerfloaterreg.cpp | 4 - indra/newview/llviewermenu.cpp | 1 + .../default/xui/en/floater_edit_sky_preset.xml | 980 --------------------- .../default/xui/en/floater_edit_water_preset.xml | 448 ---------- indra/newview/skins/default/xui/en/menu_viewer.xml | 5 +- 12 files changed, 5 insertions(+), 3493 deletions(-) delete mode 100644 indra/newview/llenvadapters.cpp delete mode 100644 indra/newview/llenvadapters.h delete mode 100644 indra/newview/llfloatereditsky.cpp delete mode 100644 indra/newview/llfloatereditsky.h delete mode 100644 indra/newview/llfloatereditwater.cpp delete mode 100644 indra/newview/llfloatereditwater.h delete mode 100644 indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml delete mode 100644 indra/newview/skins/default/xui/en/floater_edit_water_preset.xml (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 1a08bb6d74..4de304ff66 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -181,7 +181,6 @@ set(viewer_SOURCE_FILES lldrawpoolwlsky.cpp lldynamictexture.cpp llemote.cpp - llenvadapters.cpp llenvironment.cpp llestateinfomodel.cpp lleventnotifier.cpp @@ -226,8 +225,6 @@ set(viewer_SOURCE_FILES llfloaterdestinations.cpp llfloatereditdaycycle.cpp llfloatereditextdaycycle.cpp - llfloatereditsky.cpp - llfloatereditwater.cpp llfloaterenvironmentsettings.cpp llfloaterevent.cpp llfloaterexperiencepicker.cpp @@ -801,7 +798,6 @@ set(viewer_HEADER_FILES lldrawpoolwlsky.h lldynamictexture.h llemote.h - llenvadapters.h llenvironment.h llestateinfomodel.h lleventnotifier.h @@ -845,8 +841,6 @@ set(viewer_HEADER_FILES llfloaterdeleteprefpreset.h llfloaterdestinations.h llfloatereditextdaycycle.h - llfloatereditsky.h - llfloatereditwater.h llfloaterenvironmentsettings.h llfloaterevent.h llfloaterexperiencepicker.h diff --git a/indra/newview/llenvadapters.cpp b/indra/newview/llenvadapters.cpp deleted file mode 100644 index 57c7a75d52..0000000000 --- a/indra/newview/llenvadapters.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @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" -#include "llsettingswater.h" -//========================================================================= - -LLSkySettingsAdapter::LLSkySettingsAdapter(): - mWLGamma(1.0f, LLSettingsSky::SETTING_GAMMA), - -// LEGACY_ATMOSPHERICS - mAmbient(LLColor4(0.5f, 0.75f, 1.0f, 1.19f), LLSettingsSky::SETTING_AMBIENT, "WLAmbient"), - mBlueHorizon(LLColor4(0.25f, 0.25f, 1.0f, 1.0f), LLSettingsSky::SETTING_BLUE_HORIZON, "WLBlueHorizon"), - mBlueDensity(LLColor4(0.25f, 0.25f, 0.25f, 1.0f), LLSettingsSky::SETTING_BLUE_DENSITY, "WLBlueDensity"), - mHazeDensity(1.0f, LLSettingsSky::SETTING_HAZE_DENSITY), - mHazeHorizon(1.0f, LLSettingsSky::SETTING_HAZE_HORIZON), - mDensityMult(1.0f, LLSettingsSky::SETTING_DENSITY_MULTIPLIER, 1000), - mDistanceMult(1.0f, LLSettingsSky::SETTING_DISTANCE_MULTIPLIER), - 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"), - - 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), - mCloudScale(0.42f, LLSettingsSky::SETTING_CLOUD_SCALE) -{ - -} - -LLWatterSettingsAdapter::LLWatterSettingsAdapter(): - mFogColor(LLColor4((22.f / 255.f), (43.f / 255.f), (54.f / 255.f), (0.0f)), LLSettingsWater::SETTING_FOG_COLOR, "WaterFogColor"), - mFogDensity(4, LLSettingsWater::SETTING_FOG_DENSITY, 2), - mUnderWaterFogMod(0.25, LLSettingsWater::SETTING_FOG_MOD), - mNormalScale(LLVector3(2.f, 2.f, 2.f), LLSettingsWater::SETTING_NORMAL_SCALE), - mFresnelScale(0.5f, LLSettingsWater::SETTING_FRESNEL_SCALE), - mFresnelOffset(0.4f, LLSettingsWater::SETTING_FRESNEL_OFFSET), - mScaleAbove(0.025f, LLSettingsWater::SETTING_SCALE_ABOVE), - mScaleBelow(0.2f, LLSettingsWater::SETTING_SCALE_BELOW), - mBlurMultiplier(0.1f, LLSettingsWater::SETTING_BLUR_MULTIPILER), - mWave1Dir(LLVector2(0.5f, 0.5f), LLSettingsWater::SETTING_WAVE1_DIR), - mWave2Dir(LLVector2(0.5f, 0.5f), LLSettingsWater::SETTING_WAVE2_DIR) - -{ - -} diff --git a/indra/newview/llenvadapters.h b/indra/newview/llenvadapters.h deleted file mode 100644 index c53423c5ae..0000000000 --- a/indra/newview/llenvadapters.h +++ /dev/null @@ -1,470 +0,0 @@ -/** - * @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" -#include "llsettingssky.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 void setColor4(const LLColor4 & val) - { - mColor = val; - } - - inline void setColor3(const LLColor3 & val) - { - mColor = val; - } - - inline LLColor4 getColor4() const - { - return mColor; - } - - inline LLColor3 getColor3(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 WLXFloatControl -{ -public: - inline WLXFloatControl(F32 val, const std::string& n, F32 b): - mExp(val), - mBase(b), - mName(n) - { - } - - inline WLXFloatControl & operator = (F32 val) - { - mExp = log(val) / log(mBase); - - return *this; - } - - inline operator F32 (void) const - { - return pow(mBase, mExp); - } - - inline void update(const LLSettingsBase::ptr_t &psetting) const - { - psetting->setValue(mName, pow(mBase, mExp)); - } - - inline F32 getExp() const - { - return mExp; - } - - inline void setExp(F32 val) - { - mExp = val; - } - - inline F32 getBase() const - { - return mBase; - } - - inline void setBase(F32 val) - { - mBase = val; - } - -private: - F32 mExp; - F32 mBase; - std::string mName; -}; - -class WLVect2Control -{ -public: - inline WLVect2Control(LLVector2 val, const std::string& n): - mU(val.mV[0]), - mV(val.mV[1]), - mName(n) - { - } - - inline WLVect2Control & operator = (const LLVector2 & val) - { - mU = val.mV[0]; - mV = val.mV[1]; - - return *this; - } - - inline void update(const LLSettingsBase::ptr_t &psetting) const - { - psetting->setValue(mName, LLVector2(mU, mV)); - } - - inline F32 getU() const - { - return mU; - } - - inline void setU(F32 val) - { - mU = val; - } - - inline F32 getV() const - { - return mV; - } - - inline void setV(F32 val) - { - mV = val; - } - -private: - F32 mU; - F32 mV; - std::string mName; -}; - -class WLVect3Control -{ -public: - inline WLVect3Control(LLVector3 val, const std::string& n): - mX(val.mV[0]), - mY(val.mV[1]), - mZ(val.mV[2]), - mName(n) - { - } - - inline WLVect3Control & operator = (const LLVector3 & val) - { - mX = val.mV[0]; - mY = val.mV[1]; - mZ = val.mV[2]; - - return *this; - } - - inline void update(const LLSettingsBase::ptr_t &psetting) const - { - psetting->setValue(mName, LLVector3(mX, mY, mZ)); - } - - inline F32 getX() const - { - return mX; - } - - inline void setX(F32 val) - { - mX = val; - } - - inline F32 getY() const - { - return mY; - } - - inline void setY(F32 val) - { - mY = val; - } - - inline F32 getZ() const - { - return mZ; - } - - inline void setZ(F32 val) - { - mZ = val; - } - -private: - F32 mX; - F32 mY; - F32 mZ; - std::string mName; -}; - -class LLDensityProfileSettingsAdapter -{ -public: - LLDensityProfileSettingsAdapter(const std::string& config, int layerIndex = 0) - : mConfig(config) - , mLayerIndex(layerIndex) - , mLayerWidth(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH) - , mExpTerm(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM) - , mExpScale(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR) - , mLinTerm(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM) - , mConstantTerm(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM) - {} - -protected: - std::string mConfig; - int mLayerIndex; - WLFloatControl mLayerWidth; // 0.0 -> to top of atmosphere, however big that may be. - WLFloatControl mExpTerm; - WLFloatControl mExpScale; - WLFloatControl mLinTerm; - WLFloatControl mConstantTerm; -}; - -class LLRayleighDensityProfileSettingsAdapter : public LLDensityProfileSettingsAdapter -{ -public: - LLRayleighDensityProfileSettingsAdapter(int layerIndex = 0) - : LLDensityProfileSettingsAdapter(LLSettingsSky::SETTING_RAYLEIGH_CONFIG, layerIndex) - { - } -}; - -class LLMieDensityProfileSettingsAdapter : public LLDensityProfileSettingsAdapter -{ -public: - LLMieDensityProfileSettingsAdapter(int layerIndex = 0) - : LLDensityProfileSettingsAdapter(LLSettingsSky::SETTING_MIE_CONFIG, layerIndex) - , mAnisotropy(0.8f, LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR) - { - } - -protected: - WLFloatControl mAnisotropy; -}; - -class LLAbsorptionDensityProfileSettingsAdapter : public LLDensityProfileSettingsAdapter -{ -public: - LLAbsorptionDensityProfileSettingsAdapter(int layerIndex = 0) - : LLDensityProfileSettingsAdapter(LLSettingsSky::SETTING_ABSORPTION_CONFIG, layerIndex) - { - } -}; - -//------------------------------------------------------------------------- -class LLSkySettingsAdapter -{ -public: - typedef std::shared_ptr ptr_t; - - LLSkySettingsAdapter(); - - WLFloatControl mWLGamma; - - /// Atmospherics -// LEGACY_ATMOSPHERICS - WLColorControl mAmbient; - WLColorControl mBlueHorizon; - WLFloatControl mHazeDensity; - WLColorControl mBlueDensity; - WLFloatControl mDensityMult; - WLFloatControl mDistanceMult; - WLFloatControl mHazeHorizon; - WLFloatControl mMaxAlt; - - /// Lighting - WLColorControl mLightnorm; - WLColorControl mSunlight; - WLColorControl mGlow; - - /// Clouds - WLColorControl mCloudColor; - WLColorControl mCloudMain; - WLFloatControl mCloudCoverage; - WLColorControl mCloudDetail; - WLFloatControl mCloudScale; -}; - -class LLWatterSettingsAdapter -{ -public: - typedef std::shared_ptr ptr_t; - - LLWatterSettingsAdapter(); - - WLColorControl mFogColor; - WLXFloatControl mFogDensity; - WLFloatControl mUnderWaterFogMod; - - /// wavelet scales and directions - WLVect3Control mNormalScale; - WLVect2Control mWave1Dir; - WLVect2Control mWave2Dir; - - // controls how water is reflected and refracted - WLFloatControl mFresnelScale; - WLFloatControl mFresnelOffset; - WLFloatControl mScaleAbove; - WLFloatControl mScaleBelow; - WLFloatControl mBlurMultiplier; - -}; - -#endif // LL_ENVIRONMENT_H diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp deleted file mode 100644 index 763f9e4d5a..0000000000 --- a/indra/newview/llfloatereditsky.cpp +++ /dev/null @@ -1,740 +0,0 @@ -/** - * @file llfloatereditsky.cpp - * @brief Floater to create or edit a sky preset - * - * $LicenseInfo:firstyear=2011&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 "llfloatereditsky.h" - -#include - -// libs -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llcombobox.h" -#include "llmultisliderctrl.h" -#include "llnotifications.h" -#include "llnotificationsutil.h" -#include "llsliderctrl.h" -#include "lltabcontainer.h" -#include "lltimectrl.h" -#include "lljoystickbutton.h" - -// newview -#include "llagent.h" -#include "llcolorswatch.h" -#include "llregioninfomodel.h" -#include "llviewerregion.h" - -#include "v3colorutil.h" -#include "llenvironment.h" -#include "llenvadapters.h" - -namespace -{ - const F32 WL_SUN_AMBIENT_SLIDER_SCALE(3.0f); - const F32 WL_BLUE_HORIZON_DENSITY_SCALE(2.0f); - const F32 WL_CLOUD_SLIDER_SCALE(1.0f); -} - - -static F32 time24_to_sun_pos(F32 time24) -{ - F32 sun_pos = fmodf((time24 - 6) / 24.0f, 1.0f); - if (sun_pos < 0) ++sun_pos; - return sun_pos; -} - -LLFloaterEditSky::LLFloaterEditSky(const LLSD &key): - LLFloater(key), - mSkyPresetNameEditor(NULL), - mSkyPresetCombo(NULL), - mMakeDefaultCheckBox(NULL), - mSaveButton(NULL), - mSkyAdapter() -{ -} - -// virtual -BOOL LLFloaterEditSky::postBuild() -{ - mSkyPresetNameEditor = getChild("sky_preset_name"); - mSkyPresetCombo = getChild("sky_preset_combo"); - mMakeDefaultCheckBox = getChild("make_default_cb"); - mSaveButton = getChild("save"); - mSkyAdapter = boost::make_shared(); - - LLEnvironment::instance().setSkyListChange(boost::bind(&LLFloaterEditSky::onSkyPresetListChange, this)); - - initCallbacks(); - -// // Create the sun position scrubber on the slider. -// getChild("WLSunPos")->addSlider(12.f); - - return TRUE; -} - -// virtual -void LLFloaterEditSky::onOpen(const LLSD& key) -{ - bool new_preset = isNewPreset(); - std::string param = key.asString(); - std::string floater_title = getString(std::string("title_") + param); - std::string hint = getString(std::string("hint_" + param)); - - // Update floater title. - setTitle(floater_title); - - // Update the hint at the top. - getChild("hint")->setValue(hint); - - // Hide the hint to the right of the combo if we're invoked to create a new preset. - getChildView("note")->setVisible(!new_preset); - - // Switch between the sky presets combobox and preset name input field. - mSkyPresetCombo->setVisible(!new_preset); - mSkyPresetNameEditor->setVisible(new_preset); - - reset(); -} - -// virtual -void LLFloaterEditSky::onClose(bool app_quitting) -{ - if (!app_quitting) // there's no point to change environment if we're quitting - { - LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); - } -} - -// virtual -void LLFloaterEditSky::draw() -{ - syncControls(); - LLFloater::draw(); -} - -void LLFloaterEditSky::initCallbacks(void) -{ - // *TODO: warn user if a region environment update comes while we're editing a region sky preset. - - mSkyPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this), NULL); - mSkyPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditSky::onSkyPresetSelected, this)); - mSkyPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this)); - - mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnSave, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnCancel, this)); - - // Connect to region info updates. - LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditSky::onRegionInfoUpdate, this)); - - //------------------------------------------------------------------------- -// LEGACY_ATMOSPHERICS - // ambient - getChild("WLAmbient")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mAmbient)); - - // blue horizon/density - getChild("WLBlueHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mBlueHorizon)); - getChild("WLBlueDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mBlueDensity)); - - // haze density, horizon, mult, and altitude - getChild("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mHazeDensity)); - getChild("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mHazeHorizon)); - getChild("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mDensityMult)); - getChild("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mDistanceMult)); - getChild("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mMaxAlt)); - - // sunlight - getChild("WLSunlight")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mSunlight)); - - // glow - getChild("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowRMoved, this, _1, &mSkyAdapter->mGlow)); - getChild("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowBMoved, this, _1, &mSkyAdapter->mGlow)); - - // time of day -// getChild("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm)); // multi-slider -// getChild("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl -// getChild("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm)); - getChild("WLSunRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunRotationChanged, this)); - getChild("WLMoonRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onMoonRotationChanged, this)); - - // Clouds - - // Cloud Color - getChild("WLCloudColor")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mCloudColor)); - - // Cloud - getChild("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudMain)); - getChild("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudMain)); - getChild("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudMain)); - - // Cloud Detail - getChild("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudDetail)); - getChild("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudDetail)); - getChild("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudDetail)); - - // Cloud extras - getChild("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudCoverage)); - getChild("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudScale)); - getChild("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXMoved, this, _1)); - getChild("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYMoved, this, _1)); - - - // Dome - getChild("WLGamma")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mWLGamma)); - getChild("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterEditSky::onStarAlphaMoved, this, _1)); -} - -//================================================================================================= - -void LLFloaterEditSky::syncControls() -{ - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - mEditSettings = psky; - - std::string name = psky->getName(); - - mSkyPresetNameEditor->setText(name); - mSkyPresetCombo->setValue(name); - -// LEGACY_ATMOSPHERICS - // ambient - mSkyAdapter->mAmbient.setColor3( psky->getAmbientColor() ); - setColorSwatch("WLAmbient", mSkyAdapter->mAmbient, WL_SUN_AMBIENT_SLIDER_SCALE); - - // blue horizon / density - mSkyAdapter->mBlueHorizon.setColor3( psky->getBlueHorizon() ); - setColorSwatch("WLBlueHorizon", mSkyAdapter->mBlueHorizon, WL_BLUE_HORIZON_DENSITY_SCALE); - mSkyAdapter->mBlueDensity.setColor3( psky->getBlueDensity() ); - setColorSwatch("WLBlueDensity", mSkyAdapter->mBlueDensity, WL_BLUE_HORIZON_DENSITY_SCALE); - - // haze density, horizon, mult, and altitude - 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(); - mSkyAdapter->mDistanceMult = psky->getDistanceMultiplier(); - childSetValue("WLDistanceMult", (F32) mSkyAdapter->mDistanceMult); - childSetValue("WLMaxAltitude", (F32) mSkyAdapter->mMaxAlt); - - // Lighting - - // sunlight - mSkyAdapter->mSunlight.setColor3( psky->getSunlightColor() ); - setColorSwatch("WLSunlight", mSkyAdapter->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE); - - // glow - mSkyAdapter->mGlow.setColor3( psky->getGlow() ); - childSetValue("WLGlowR", 2 - mSkyAdapter->mGlow.getRed() / 20.0f); - childSetValue("WLGlowB", -mSkyAdapter->mGlow.getBlue() / 5.0f); - - - -// LLSettingsSky::azimalt_t azal = psky->getSunRotationAzAl(); -// -// F32 time24 = sun_pos_to_time24(azal.second / F_TWO_PI); -// getChild("WLSunPos")->setCurSliderValue(time24, TRUE); -// getChild("WLDayTime")->setTime24(time24); -// childSetValue("WLEastAngle", azal.first / F_TWO_PI); - getChild("WLSunRotation")->setRotation(psky->getSunRotation()); - getChild("WLMoonRotation")->setRotation(psky->getMoonRotation()); - - // Clouds - - // Cloud Color - mSkyAdapter->mCloudColor.setColor3( psky->getCloudColor() ); - setColorSwatch("WLCloudColor", mSkyAdapter->mCloudColor, WL_CLOUD_SLIDER_SCALE); - - // Cloud - mSkyAdapter->mCloudMain.setColor3( psky->getCloudPosDensity1() ); - childSetValue("WLCloudX", mSkyAdapter->mCloudMain.getRed()); - childSetValue("WLCloudY", mSkyAdapter->mCloudMain.getGreen()); - childSetValue("WLCloudDensity", mSkyAdapter->mCloudMain.getBlue()); - - // Cloud Detail - mSkyAdapter->mCloudDetail.setColor3( psky->getCloudPosDensity2() ); - childSetValue("WLCloudDetailX", mSkyAdapter->mCloudDetail.getRed()); - childSetValue("WLCloudDetailY", mSkyAdapter->mCloudDetail.getGreen()); - childSetValue("WLCloudDetailDensity", mSkyAdapter->mCloudDetail.getBlue()); - - // Cloud extras - mSkyAdapter->mCloudCoverage = psky->getCloudShadow(); - mSkyAdapter->mCloudScale = psky->getCloudScale(); - childSetValue("WLCloudCoverage", (F32) mSkyAdapter->mCloudCoverage); - childSetValue("WLCloudScale", (F32) mSkyAdapter->mCloudScale); - - // cloud scrolling - LLVector2 scroll_rate = psky->getCloudScrollRate(); - - // LAPRAS: These should go away... - childDisable("WLCloudLockX"); - childDisable("WLCloudLockY"); - - // disable if locked, enable if not - childEnable("WLCloudScrollX"); - childEnable("WLCloudScrollY"); - - // *HACK cloud scrolling is off my an additive of 10 - childSetValue("WLCloudScrollX", scroll_rate[0] - 10.0f); - childSetValue("WLCloudScrollY", scroll_rate[1] - 10.0f); - - // Tweak extras - - mSkyAdapter->mWLGamma = psky->getGamma(); - childSetValue("WLGamma", (F32) mSkyAdapter->mWLGamma); - - childSetValue("WLStarAlpha", psky->getStarBrightness()); -} - -void LLFloaterEditSky::setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k) -{ - // Set the value, dividing it by first. - LLColor4 color = from_ctrl.getColor4(); - getChild(name)->set(color / k); -} - -// color control callbacks -void LLFloaterEditSky::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl) -{ - LLColorSwatchCtrl* swatch = static_cast(ctrl); - LLColor4 color_vec(swatch->get().mV); - - // Multiply RGB values by the appropriate factor. - F32 k = WL_CLOUD_SLIDER_SCALE; - if (color_ctrl->getIsSunOrAmbientColor()) - { - k = WL_SUN_AMBIENT_SLIDER_SCALE; - } - 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->setColor4(color_vec); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onColorControlRMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLColorControl* color_ctrl = static_cast(userdata); - - F32 red_value = sldr_ctrl->getValueF32(); - F32 k = 1.0f; - - if (color_ctrl->getIsSunOrAmbientColor()) - { - k = WL_SUN_AMBIENT_SLIDER_SCALE; - } - if (color_ctrl->getIsBlueHorizonOrDensity()) - { - k = WL_BLUE_HORIZON_DENSITY_SCALE; - } - color_ctrl->setRed(red_value * k); - - adjustIntensity(color_ctrl, red_value, k); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onColorControlGMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLColorControl* color_ctrl = static_cast(userdata); - - F32 green_value = sldr_ctrl->getValueF32(); - F32 k = 1.0f; - - 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); - - adjustIntensity(color_ctrl, green_value, k); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onColorControlBMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLColorControl* color_ctrl = static_cast(userdata); - - F32 blue_value = sldr_ctrl->getValueF32(); - F32 k = 1.0f; - - 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); - - adjustIntensity(color_ctrl, blue_value, k); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::adjustIntensity(WLColorControl *ctrl, F32 val, F32 scale) -{ - if (ctrl->getHasSliderName()) - { - LLColor4 color = ctrl->getColor4(); - F32 i = color_max(color) / scale; - ctrl->setIntensity(i); - std::string name = ctrl->getSliderName(); - name.append("I"); - - childSetValue(name, i); - } -} - - -/// GLOW SPECIFIC CODE -void LLFloaterEditSky::onGlowRMoved(LLUICtrl* ctrl, void* userdata) -{ - - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLColorControl* color_ctrl = static_cast(userdata); - - // scaled by 20 - color_ctrl->setRed((2 - sldr_ctrl->getValueF32()) * 20); - - color_ctrl->update(mEditSettings); -} - -/// \NOTE that we want NEGATIVE (-) B -void LLFloaterEditSky::onGlowBMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLColorControl* color_ctrl = static_cast(userdata); - - /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big - color_ctrl->setBlue(-sldr_ctrl->getValueF32() * 5); - - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onFloatControlMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLFloatControl * floatControl = static_cast(userdata); - - floatControl->setValue(sldr_ctrl->getValueF32() / floatControl->getMult()); - - floatControl->update(mEditSettings); -} - - -// Lighting callbacks - -// time of day -void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata) -{ - LLMultiSliderCtrl* sun_msldr = getChild("WLSunPos"); - LLSliderCtrl* east_sldr = getChild("WLEastAngle"); - LLTimeCtrl* time_ctrl = getChild("WLDayTime"); - WLColorControl* color_ctrl = static_cast(userdata); - - F32 time24 = sun_msldr->getCurSliderValue(); - time_ctrl->setTime24(time24); // sync the time ctrl with the new sun position - - // get the two angles - 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); - - LLVector4 sunnorm( mEditSettings->getSunDirection(), 1.f ); - - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onTimeChanged() -{ - F32 time24 = getChild("WLDayTime")->getTime24(); - getChild("WLSunPos")->setCurSliderValue(time24, TRUE); - onSunMoved(getChild("WLSunPos"), &(mSkyAdapter->mLightnorm)); -} - -void LLFloaterEditSky::onSunRotationChanged() -{ - LLJoystickQuaternion* sun_spinner = getChild("WLSunRotation"); - LLQuaternion sunrot(sun_spinner->getRotation()); - - mEditSettings->setSunRotation(sunrot); -} - -void LLFloaterEditSky::onMoonRotationChanged() -{ - LLJoystickQuaternion* moon_spinner = getChild("WLMoonRotation"); - LLQuaternion moonrot(moon_spinner->getRotation()); - - mEditSettings->setMoonRotation(moonrot); -} - -void LLFloaterEditSky::onStarAlphaMoved(LLUICtrl* ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - mEditSettings->setStarBrightness(sldr_ctrl->getValueF32()); -} - -// Clouds -void LLFloaterEditSky::onCloudScrollXMoved(LLUICtrl* ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - // *HACK all cloud scrolling is off by an additive of 10. - mEditSettings->setCloudScrollRateX(sldr_ctrl->getValueF32() + 10.0f); -} - -void LLFloaterEditSky::onCloudScrollYMoved(LLUICtrl* ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - // *HACK all cloud scrolling is off by an additive of 10. - mEditSettings->setCloudScrollRateY(sldr_ctrl->getValueF32() + 10.0f); -} - -//================================================================================================= - -void LLFloaterEditSky::reset() -{ - if (isNewPreset()) - { - mSkyPresetNameEditor->setValue(LLSD()); - mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name - } - else - { - refreshSkyPresetsList(); - - // Disable controls until a sky preset to edit is selected. - enableEditing(false); - } -} - -bool LLFloaterEditSky::isNewPreset() const -{ - return mKey.asString() == "new"; -} - -void LLFloaterEditSky::refreshSkyPresetsList() -{ - mSkyPresetCombo->removeall(); - - LLEnvironment::list_name_id_t list = LLEnvironment::instance().getSkyList(); - - for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it) - { - mSkyPresetCombo->add((*it).first, LLSDArray((*it).first)((*it).second)); - } - - mSkyPresetCombo->setLabel(getString("combo_label")); -} - -void LLFloaterEditSky::enableEditing(bool enable) -{ - // Enable/disable the tab and their contents. - LLTabContainer* tab_container = getChild("WindLight Tabs"); - tab_container->setEnabled(enable); - for (S32 i = 0; i < tab_container->getTabCount(); ++i) - { - tab_container->enableTabButton(i, enable); - tab_container->getPanelByIndex(i)->setCtrlsEnabled(enable); - } - - // Enable/disable saving. - mSaveButton->setEnabled(enable); - mMakeDefaultCheckBox->setEnabled(enable); -} - -void LLFloaterEditSky::saveRegionSky() -{ -#if 0 - LLWLParamKey key(getSelectedSkyPreset()); - llassert(key.scope == LLEnvKey::SCOPE_REGION); - - LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << LL_ENDL; - LLWLParamManager& wl_mgr = LLWLParamManager::instance(); - wl_mgr.mCurParams.mName = key.name; - wl_mgr.setParamSet(key, wl_mgr.mCurParams); - - // *TODO: save to cached region settings. - LL_WARNS("Windlight") << "Saving region sky is not fully implemented yet" << LL_ENDL; -#endif -} - -std::string LLFloaterEditSky::getSelectedPresetName() const -{ - std::string name; - if (mSkyPresetNameEditor->getVisible()) - { - name = mSkyPresetNameEditor->getText(); - } - else - { - LLSD combo_val = mSkyPresetCombo->getValue(); - name = combo_val[0].asString(); - } - - return name; -} - -void LLFloaterEditSky::onSkyPresetNameEdited() -{ - std::string name = mSkyPresetNameEditor->getText(); - LLSettingsWater::ptr_t psky = LLEnvironment::instance().getCurrentWater(); - - psky->setName(name); -} - -void LLFloaterEditSky::onSkyPresetSelected() -{ - std::string name; - - name = getSelectedPresetName(); - - LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName(name); - - if (!psky) - { - LL_WARNS("WATEREDIT") << "Could not find water preset" << LL_ENDL; - enableEditing(false); - return; - } - - psky = psky->buildClone(); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, psky); - mEditSettings = psky; - - syncControls(); - enableEditing(true); - -} - -bool LLFloaterEditSky::onSaveAnswer(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - // If they choose save, do it. Otherwise, don't do anything - if (option == 0) - { - onSaveConfirmed(); - } - - return false; -} - -void LLFloaterEditSky::onSaveConfirmed() -{ - // Save currently displayed water params to the selected preset. - std::string name = mEditSettings->getName(); - - LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL; - - LLEnvironment::instance().addSky(mEditSettings); - - // Change preference if requested. - if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue()) - { - LL_DEBUGS("Windlight") << name << " is now the new preferred sky preset" << LL_ENDL; - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - } - - closeFloater(); -} - -void LLFloaterEditSky::onBtnSave() -{ - LLEnvironment::instance().addSky(mEditSettings); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - - closeFloater(); -} - -void LLFloaterEditSky::onBtnCancel() -{ - closeFloater(); -} - -void LLFloaterEditSky::onSkyPresetListChange() -{ - refreshSkyPresetsList(); -} - -void LLFloaterEditSky::onRegionSettingsChange() -{ -#if 0 - // If creating a new sky, don't bother. - if (isNewPreset()) - { - return; - } - - if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION) // if editing a region sky - { - // reset the floater to its initial state - reset(); - - // *TODO: Notify user? - } - else // editing a local sky - { - refreshSkyPresetsList(); - } -#endif -} - -void LLFloaterEditSky::onRegionInfoUpdate() -{ -#if 0 - bool can_edit = true; - - // If we've selected a region sky preset for editing. - if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION) - { - // check whether we have the access - can_edit = LLEnvManagerNew::canEditRegionSettings(); - } - - enableEditing(can_edit); -#endif -} diff --git a/indra/newview/llfloatereditsky.h b/indra/newview/llfloatereditsky.h deleted file mode 100644 index 36438becce..0000000000 --- a/indra/newview/llfloatereditsky.h +++ /dev/null @@ -1,125 +0,0 @@ -/** - * @file llfloatereditsky.h - * @brief Floater to create or edit a sky preset - * - * $LicenseInfo:firstyear=2011&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_LLFLOATEREDITSKY_H -#define LL_LLFLOATEREDITSKY_H - -#include "llfloater.h" -#include "llsettingssky.h" - -class LLButton; -class LLCheckBoxCtrl; -class LLComboBox; -class LLLineEditor; -class WLColorControl; -class LLSkySettingsAdapter; - -typedef boost::shared_ptr LLSkySettingsAdapterPtr; - - -/** - * Floater for creating or editing a sky preset. - */ -class LLFloaterEditSky : public LLFloater -{ - LOG_CLASS(LLFloaterEditSky); - -public: - LLFloaterEditSky(const LLSD &key); - - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ void draw(); - -private: - void initCallbacks(void); - - //-- WL stuff begins ------------------------------------------------------ - - void syncControls(); /// sync up sliders with parameters - - void setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k); - - // general purpose callbacks for dealing with color controllers - void onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl); - void onColorControlRMoved(LLUICtrl* ctrl, void* userdata); - void onColorControlGMoved(LLUICtrl* ctrl, void* userdata); - 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); - - // lighting callbacks for sun - void onSunMoved(LLUICtrl* ctrl, void* userdata); - void onTimeChanged(); - - void onSunRotationChanged(); - void onMoonRotationChanged(); - - // for handling when the star slider is moved to adjust the alpha - void onStarAlphaMoved(LLUICtrl* ctrl); - - // handle cloud scrolling - void onCloudScrollXMoved(LLUICtrl* ctrl); - void onCloudScrollYMoved(LLUICtrl* ctrl); - - //-- WL stuff ends -------------------------------------------------------- - - void reset(); /// reset the floater to its initial state - bool isNewPreset() const; - void refreshSkyPresetsList(); - void enableEditing(bool enable); - void saveRegionSky(); - std::string getSelectedPresetName() const; - - void onSkyPresetNameEdited(); - void onSkyPresetSelected(); - bool onSaveAnswer(const LLSD& notification, const LLSD& response); - void onSaveConfirmed(); - - void onBtnSave(); - void onBtnCancel(); - - void onSkyPresetListChange(); - 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/llfloatereditwater.cpp b/indra/newview/llfloatereditwater.cpp deleted file mode 100644 index 4d8ffdef21..0000000000 --- a/indra/newview/llfloatereditwater.cpp +++ /dev/null @@ -1,526 +0,0 @@ -/** - * @file llfloatereditwater.cpp - * @brief Floater to create or edit a water preset - * - * $LicenseInfo:firstyear=2011&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 "llfloatereditwater.h" - -#include - -// libs -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llcolorswatch.h" -#include "llcombobox.h" -//#include "llnotifications.h" -#include "llnotificationsutil.h" -#include "llsliderctrl.h" -#include "lltexturectrl.h" - -// newview -#include "llagent.h" -#include "llregioninfomodel.h" -#include "llviewerregion.h" - -#include "llenvironment.h" -#include "llsettingswater.h" -#include "llenvadapters.h" - -#include "v3colorutil.h" - -#undef max // Fixes a Windows compiler error - -LLFloaterEditWater::LLFloaterEditWater(const LLSD &key): - LLFloater(key), - mWaterPresetNameEditor(NULL), - mWaterPresetCombo(NULL), - mMakeDefaultCheckBox(NULL), - mSaveButton(NULL), - mWaterAdapter() -{ -} - -// virtual -BOOL LLFloaterEditWater::postBuild() -{ - mWaterPresetNameEditor = getChild("water_preset_name"); - mWaterPresetCombo = getChild("water_preset_combo"); - mMakeDefaultCheckBox = getChild("make_default_cb"); - mSaveButton = getChild("save"); - - mWaterAdapter = boost::make_shared(); - - LLEnvironment::instance().setWaterListChange(boost::bind(&LLFloaterEditWater::onWaterPresetListChange, this)); - - initCallbacks(); - refreshWaterPresetsList(); - syncControls(); - - return TRUE; -} - -// virtual -void LLFloaterEditWater::onOpen(const LLSD& key) -{ - bool new_preset = isNewPreset(); - std::string param = key.asString(); - std::string floater_title = getString(std::string("title_") + param); - std::string hint = getString(std::string("hint_" + param)); - - // Update floater title. - setTitle(floater_title); - - // Update the hint at the top. - getChild("hint")->setValue(hint); - - // Hide the hint to the right of the combo if we're invoked to create a new preset. - getChildView("note")->setVisible(!new_preset); - - // Switch between the water presets combobox and preset name input field. - mWaterPresetCombo->setVisible(!new_preset); - mWaterPresetNameEditor->setVisible(new_preset); - - reset(); -} - -// virtual -void LLFloaterEditWater::onClose(bool app_quitting) -{ - if (!app_quitting) // there's no point to change environment if we're quitting - { - LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); - } -} - -// virtual -void LLFloaterEditWater::draw() -{ - syncControls(); - LLFloater::draw(); -} - -void LLFloaterEditWater::initCallbacks(void) -{ - mWaterPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this), NULL); - mWaterPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditWater::onWaterPresetSelected, this)); - mWaterPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this)); - - mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnSave, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnCancel, this)); - - // Connect to region info updates. - LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditWater::onRegionInfoUpdate, this)); - - //------------------------------------------------------------------------- - - getChild("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterEditWater::onColorControlMoved, this, _1, &mWaterAdapter->mFogColor)); - - // fog density - getChild("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterEditWater::onExpFloatControlMoved, this, _1, &mWaterAdapter->mFogDensity)); - getChild("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mUnderWaterFogMod)); - - // blue density - getChild("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlXMoved, this, _1, &mWaterAdapter->mNormalScale)); - getChild("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlYMoved, this, _1, &mWaterAdapter->mNormalScale)); - getChild("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlZMoved, this, _1, &mWaterAdapter->mNormalScale)); - - // fresnel - getChild("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelScale)); - getChild("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelOffset)); - - // scale above/below - getChild("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleAbove)); - getChild("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleBelow)); - - // blur mult - getChild("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mBlurMultiplier)); - - // wave direction - getChild("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave1Dir)); - getChild("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave1Dir)); - getChild("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave2Dir)); - getChild("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave2Dir)); - - LLTextureCtrl* texture_ctrl = getChild("WaterNormalMap"); - texture_ctrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); - texture_ctrl->setCommitCallback(boost::bind(&LLFloaterEditWater::onNormalMapPicked, this, _1)); -} - -//============================================================================= - -void LLFloaterEditWater::syncControls() -{ - // *TODO: Eliminate slow getChild() calls. - - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); - mEditSettings = pwater; - - std::string name = pwater->getName(); - mWaterPresetNameEditor->setText(name); - mWaterPresetCombo->setValue(name); - - //getChild("WaterGlow")->setValue(col.mV[3]); - getChild("WaterFogColor")->set(LLColor4(pwater->getFogColor())); - - // fog and wavelets - mWaterAdapter->mFogDensity = pwater->getFogDensity(); - getChild("WaterFogDensity")->setValue(mWaterAdapter->mFogDensity.getExp()); - - mWaterAdapter->mUnderWaterFogMod = pwater->getFogMod(); - getChild("WaterUnderWaterFogMod")->setValue(static_cast(mWaterAdapter->mUnderWaterFogMod)); - - mWaterAdapter->mNormalScale = pwater->getNormalScale(); - getChild("WaterNormalScaleX")->setValue(mWaterAdapter->mNormalScale.getX()); - getChild("WaterNormalScaleY")->setValue(mWaterAdapter->mNormalScale.getY()); - getChild("WaterNormalScaleZ")->setValue(mWaterAdapter->mNormalScale.getZ()); - - // Fresnel - mWaterAdapter->mFresnelScale = pwater->getFresnelScale(); - getChild("WaterFresnelScale")->setValue(static_cast(mWaterAdapter->mFresnelScale)); - mWaterAdapter->mFresnelOffset = pwater->getFresnelOffset(); - getChild("WaterFresnelOffset")->setValue(static_cast(mWaterAdapter->mFresnelOffset)); - - // Scale Above/Below - mWaterAdapter->mScaleAbove = pwater->getScaleAbove(); - getChild("WaterScaleAbove")->setValue(static_cast(mWaterAdapter->mScaleAbove)); - mWaterAdapter->mScaleBelow = pwater->getScaleBelow(); - getChild("WaterScaleBelow")->setValue(static_cast(mWaterAdapter->mScaleBelow)); - - // blur mult - mWaterAdapter->mBlurMultiplier = pwater->getBlurMultiplier(); - getChild("WaterBlurMult")->setValue(static_cast(mWaterAdapter->mBlurMultiplier)); - - // wave directions - mWaterAdapter->mWave1Dir = pwater->getWave1Dir(); - getChild("WaterWave1DirX")->setValue(mWaterAdapter->mWave1Dir.getU()); - getChild("WaterWave1DirY")->setValue(mWaterAdapter->mWave1Dir.getV()); - - mWaterAdapter->mWave2Dir = pwater->getWave2Dir(); - getChild("WaterWave2DirX")->setValue(mWaterAdapter->mWave2Dir.getU()); - getChild("WaterWave2DirY")->setValue(mWaterAdapter->mWave2Dir.getV()); - - LLTextureCtrl* textCtrl = getChild("WaterNormalMap"); - textCtrl->setImageAssetID(pwater->getNormalMapID()); -} - - -// vector control callbacks -void LLFloaterEditWater::onVector3ControlXMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - vector_ctrl->setX( sldr_ctrl->getValueF32() ); - vector_ctrl->update(mEditSettings); -} - -// vector control callbacks -void LLFloaterEditWater::onVector3ControlYMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - vector_ctrl->setY(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - -// vector control callbacks -void LLFloaterEditWater::onVector3ControlZMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - vector_ctrl->setZ(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - - -// vector control callbacks -void LLFloaterEditWater::onVector2ControlXMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - vector_ctrl->setU(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - -// vector control callbacks -void LLFloaterEditWater::onVector2ControlYMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - vector_ctrl->setV(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - -void LLFloaterEditWater::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* floatControl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - floatControl->setValue(sldr_ctrl->getValueF32()); - floatControl->update(mEditSettings); -} - -void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl* expFloatControl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - expFloatControl->setExp(sldr_ctrl->getValueF32()); - expFloatControl->update(mEditSettings); -} - -void LLFloaterEditWater::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl) -{ - LLColorSwatchCtrl* swatch = static_cast(ctrl); - color_ctrl->setColor4( swatch->get() ); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditWater::onNormalMapPicked(LLUICtrl* ctrl) -{ - LLTextureCtrl* textCtrl = static_cast(ctrl); - LLUUID textID = textCtrl->getImageAssetID(); - mEditSettings->setNormalMapID(textID); -} - -//============================================================================= - -void LLFloaterEditWater::reset() -{ - if (isNewPreset()) - { - mWaterPresetNameEditor->setValue(LLSD()); - mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name - } - else - { - refreshWaterPresetsList(); - - // Disable controls until a water preset to edit is selected. - enableEditing(false); - } -} - -bool LLFloaterEditWater::isNewPreset() const -{ - return mKey.asString() == "new"; -} - -void LLFloaterEditWater::refreshWaterPresetsList() -{ - mWaterPresetCombo->removeall(); - - LLEnvironment::list_name_id_t list = LLEnvironment::instance().getWaterList(); - - for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it) - { - mWaterPresetCombo->add((*it).first, LLSDArray((*it).first)((*it).second)); - } - - mWaterPresetCombo->setLabel(getString("combo_label")); -} - -void LLFloaterEditWater::enableEditing(bool enable) -{ - // Enable/disable water controls. - getChild("panel_water_preset")->setCtrlsEnabled(enable); - - // Enable/disable saving. - mSaveButton->setEnabled(enable); - mMakeDefaultCheckBox->setEnabled(enable); -} - -void LLFloaterEditWater::saveRegionWater() -{ -#if 0 - llassert(getCurrentScope() == LLEnvKey::SCOPE_REGION); // make sure we're editing region water - - LL_DEBUGS("Windlight") << "Saving region water preset" << LL_ENDL; - - //LLWaterParamSet region_water = water_mgr.mCurParams; - - // *TODO: save to cached region settings. - LL_WARNS("Windlight") << "Saving region water is not fully implemented yet" << LL_ENDL; -#endif -} - -#if 0 -std::string LLFloaterEditWater::getCurrentPresetName() const -{ - std::string name; - LLEnvKey::EScope scope; - getSelectedPreset(name, scope); - return name; -} -#endif - -#if 0 -LLEnvKey::EScope LLFloaterEditWater::getCurrentScope() const -{ - std::string name; - LLEnvKey::EScope scope; - getSelectedPreset(name, scope); - return scope; -} -#endif - -std::string LLFloaterEditWater::getSelectedPresetName() const -{ - std::string name; - if (mWaterPresetNameEditor->getVisible()) - { - name = mWaterPresetNameEditor->getText(); - } - else - { - LLSD combo_val = mWaterPresetCombo->getValue(); - name = combo_val[0].asString(); - } - - return name; -} - -void LLFloaterEditWater::onWaterPresetNameEdited() -{ - std::string name = mWaterPresetNameEditor->getText(); - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); - - pwater->setName(name); -#if 0 - // Disable saving a water preset having empty name. - mSaveButton->setEnabled(!getCurrentPresetName().empty()); -#endif -} - -void LLFloaterEditWater::onWaterPresetSelected() -{ - std::string name; - - name = getSelectedPresetName(); - - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().findWaterByName(name); - - if (!pwater) - { - LL_WARNS("WATEREDIT") << "Could not find water preset" << LL_ENDL; - enableEditing(false); - return; - } - - pwater = pwater->buildClone(); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, pwater); - mEditSettings = pwater; - - syncControls(); - enableEditing(true); -} - -bool LLFloaterEditWater::onSaveAnswer(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - // If they choose save, do it. Otherwise, don't do anything - if (option == 0) - { - onSaveConfirmed(); - } - - return false; -} - -void LLFloaterEditWater::onSaveConfirmed() -{ - // Save currently displayed water params to the selected preset. - std::string name = mEditSettings->getName(); - - LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL; - - LLEnvironment::instance().addWater(mEditSettings); - - // Change preference if requested. - if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue()) - { - LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL; - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - } - - closeFloater(); -} - -void LLFloaterEditWater::onBtnSave() -{ - LLEnvironment::instance().addWater(mEditSettings); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - - closeFloater(); -} - -void LLFloaterEditWater::onBtnCancel() -{ - closeFloater(); -} - -void LLFloaterEditWater::onWaterPresetListChange() -{ - refreshWaterPresetsList(); -} - -void LLFloaterEditWater::onRegionSettingsChange() -{ -#if 0 - // If creating a new preset, don't bother. - if (isNewPreset()) - { - return; - } - - if (getCurrentScope() == LLEnvKey::SCOPE_REGION) // if editing region water - { - // reset the floater to its initial state - reset(); - - // *TODO: Notify user? - } - else // editing a local preset - { - refreshWaterPresetsList(); - } -#endif -} - -void LLFloaterEditWater::onRegionInfoUpdate() -{ -#if 0 - bool can_edit = true; - - // If we've selected the region water for editing. - if (getCurrentScope() == LLEnvKey::SCOPE_REGION) - { - // check whether we have the access - can_edit = LLEnvManagerNew::canEditRegionSettings(); - } - - enableEditing(can_edit); -#endif -} diff --git a/indra/newview/llfloatereditwater.h b/indra/newview/llfloatereditwater.h deleted file mode 100644 index 081b939039..0000000000 --- a/indra/newview/llfloatereditwater.h +++ /dev/null @@ -1,116 +0,0 @@ -/** - * @file llfloatereditwater.h - * @brief Floater to create or edit a water preset - * - * $LicenseInfo:firstyear=2011&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_LLFLOATEREDITWATER_H -#define LL_LLFLOATEREDITWATER_H - -#include "llfloater.h" -#include "llsettingswater.h" - -class LLButton; -class LLCheckBoxCtrl; -class LLComboBox; -class LLLineEditor; - -class WLVect2Control; -class WLVect3Control; -class WLColorControl; -class WLFloatControl; -class WLXFloatControl; - -class LLWatterSettingsAdapter; - -typedef boost::shared_ptr LLWaterSettingsAdapterPtr; - -class LLFloaterEditWater : public LLFloater -{ - LOG_CLASS(LLFloaterEditWater); - -public: - LLFloaterEditWater(const LLSD &key); - - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ void draw(); - -private: - void initCallbacks(void); - - //-- WL stuff begins ------------------------------------------------------ - - void syncControls(); /// sync up sliders with parameters - - void onVector3ControlXMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl); - void onVector3ControlYMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl); - void onVector3ControlZMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl); - - void onVector2ControlXMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl); - void onVector2ControlYMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl); - - void onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* floatControl); - - void onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl* expFloatControl); - - void onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl); - - void onNormalMapPicked(LLUICtrl* ctrl); /// handle if they choose a new normal map - - //-- WL stuff ends -------------------------------------------------------- - - void reset(); - bool isNewPreset() const; - void refreshWaterPresetsList(); - void enableEditing(bool enable); - void saveRegionWater(); - - std::string getSelectedPresetName() const; -// std::string getCurrentPresetName() const; -// LLEnvKey::EScope getCurrentScope() const; -// void getSelectedPreset(std::string& name, LLEnvKey::EScope& scope) const; - - void onWaterPresetNameEdited(); - void onWaterPresetSelected(); - bool onSaveAnswer(const LLSD& notification, const LLSD& response); - void onSaveConfirmed(); - - void onBtnSave(); - void onBtnCancel(); - - void onWaterPresetListChange(); - void onRegionSettingsChange(); - void onRegionInfoUpdate(); - - LLLineEditor* mWaterPresetNameEditor; - LLComboBox* mWaterPresetCombo; - LLCheckBoxCtrl* mMakeDefaultCheckBox; - LLButton* mSaveButton; - - LLWaterSettingsAdapterPtr mWaterAdapter; - LLSettingsWater::ptr_t mEditSettings; -}; - -#endif // LL_LLFLOATEREDITWATER_H diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 7e0a3a5fd8..528987f3bf 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -59,8 +59,6 @@ #include "llfloaterdestinations.h" #include "llfloatereditdaycycle.h" #include "llfloatereditextdaycycle.h" -#include "llfloatereditsky.h" -#include "llfloatereditwater.h" #include "llfloaterenvironmentsettings.h" #include "llfloaterexperienceprofile.h" #include "llfloaterexperiences.h" @@ -223,8 +221,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_settings", "floater_environment_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_edit_sky", "floater_edit_sky_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_edit_water", "floater_edit_water_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_edit_day_cycle", "floater_edit_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_fixed_environmentent_water", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 6bc28ad284..861ef05dbd 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8474,6 +8474,7 @@ class LLWorldEnvPreset : public view_listener_t { std::string item = userdata.asString(); +// *LAPRAS* These go away! Keep for the moment. if (item == "new_water") { LLFloaterReg::showInstance("env_fixed_environmentent_water", "new"); diff --git a/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml b/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml deleted file mode 100644 index c03a206e88..0000000000 --- a/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml +++ /dev/null @@ -1,980 +0,0 @@ - - - - Create a New Sky Preset - Edit Sky Preset - Name your preset, adjust the controls to create it, and click "Save". - To edit your sky preset, adjust the controls and click "Save". - -Select a preset- - - - To edit your preset, adjust the controls then click "Save" - - - Preset Name: - - - - - Note: if you change the name of your preset, you will be creating a new preset and the existing preset will not be changed. - - - - - - - - - - Blue Horizon - - - - Haze Horizon - - - - - - - Blue Density - - - - Haze Density - - - - - - - Density Multiplier - - - - - Distance Multiplier - - - - Max Altitude - - - - - - - - - Sun/Moon Color - - - - Ambient - - - - - - Sun Glow - - - - - Star Brightness - - - - Scene Gamma - - - - - - - Sun/Moon Position - - - /> - - /> - - - - - - - - - - Cloud Color - - - - Cloud XY/Density - - - - - - - - - Cloud Coverage - - - - Cloud Scale - - - - - Cloud Detail (XY/Density) - - - - - - - - - Cloud Scroll X - - - - - Cloud Scroll Y - - - - - - - - -