From 5c4ae5b11a44ab4711f0148cb721f35be9f18100 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 23 Feb 2017 17:50:36 -0500 Subject: STORM-2145 Camera Presets -- some initial work --- indra/llui/llfloater.cpp | 12 +- indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 52 ++++ indra/newview/llagentcamera.cpp | 2 + indra/newview/llagentcamera.h | 5 +- indra/newview/llfloatercamera.cpp | 20 ++ indra/newview/llfloatercamera.h | 2 + indra/newview/llfloaterdeleteprefpreset.cpp | 12 +- indra/newview/llfloaterpreference.cpp | 110 +++++++- indra/newview/llfloaterpreference.h | 15 +- indra/newview/llpanelpresetscamerapulldown.cpp | 236 +++++++++++++++++ indra/newview/llpanelpresetscamerapulldown.h | 62 +++++ indra/newview/llpanelpresetspulldown.cpp | 2 +- indra/newview/llpresetsmanager.cpp | 291 +++++++++++++++------ indra/newview/llpresetsmanager.h | 19 +- indra/newview/llstatusbar.cpp | 44 +++- indra/newview/llstatusbar.h | 6 +- .../skins/default/textures/icons/Presets_Icon.png | Bin 366 -> 0 bytes .../default/textures/icons/Presets_Icon_Camera.png | Bin 0 -> 1381 bytes .../textures/icons/Presets_Icon_Graphic.png | Bin 0 -> 366 bytes indra/newview/skins/default/textures/textures.xml | 3 +- .../skins/default/xui/en/floater_camera.xml | 38 ++- .../skins/default/xui/en/floater_preferences.xml | 2 +- .../default/xui/en/panel_preferences_graphics1.xml | 16 +- .../default/xui/en/panel_preferences_move.xml | 123 +++++++-- .../xui/en/panel_presets_camera_pulldown.xml | 69 +++++ .../skins/default/xui/en/panel_status_bar.xml | 14 +- 27 files changed, 1023 insertions(+), 134 deletions(-) create mode 100644 indra/newview/llpanelpresetscamerapulldown.cpp create mode 100644 indra/newview/llpanelpresetscamerapulldown.h delete mode 100644 indra/newview/skins/default/textures/icons/Presets_Icon.png create mode 100644 indra/newview/skins/default/textures/icons/Presets_Icon_Camera.png create mode 100644 indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png create mode 100644 indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml (limited to 'indra') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 4f664a1ccc..8b0e19e4f6 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1839,7 +1839,7 @@ void LLFloater::onClickCloseBtn(bool app_quitting) // virtual void LLFloater::draw() { - const F32 alpha = getCurrentTransparency(); + F32 alpha = getCurrentTransparency(); // draw background if( isBackgroundVisible() ) @@ -1854,6 +1854,16 @@ void LLFloater::draw() LLUIImage* image = NULL; LLColor4 color; LLColor4 overlay_color; + std::string help_topic; + if (this->findHelpTopic(help_topic)) + { + if("camera_floater" == help_topic) + { + alpha = llmin(LLCachedControl(gSavedSettings, "CameraOpacity"), + LLCachedControl(gSavedSettings, "ActiveFloaterTransparency")); + } + } + if (isBackgroundOpaque()) { // NOTE: image may not be set diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d6d7d2c563..395aa785bf 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -460,6 +460,7 @@ set(viewer_SOURCE_FILES llpanelplaceprofile.cpp llpanelplaces.cpp llpanelplacestab.cpp + llpanelpresetscamerapulldown.cpp llpanelpresetspulldown.cpp llpanelprimmediacontrols.cpp llpanelprofile.cpp @@ -1070,6 +1071,7 @@ set(viewer_HEADER_FILES llpanelplaceprofile.h llpanelplaces.h llpanelplacestab.h + llpanelpresetscamerapulldown.h llpanelpresetspulldown.h llpanelprimmediacontrols.h llpanelprofile.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6621b9e269..541a5d070d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15975,6 +15975,58 @@ Value 0 + CameraOpacity + + Comment + Opacity of the Camera Controls floater + Persist + 1 + Type + F32 + Value + 1.0 + + PresetCameraActive + + Comment + Name of currently selected preference + Persist + 1 + Type + String + Value + + + CameraOffsetCustom0 + + Comment + Customized camera offset from avatar + Persist + 1 + Type + Vector3 + Value + + -3.0 + 0.0 + 0.75 + + + FocusOffsetCustom0 + + Comment + Custom focus point offset relative to avatar (x-axis is forward) + Persist + 1 + Type + Vector3D + Value + + 1.0 + 0.0 + 1.0 + + diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index e335eabd1a..1b006a2311 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -208,10 +208,12 @@ void LLAgentCamera::init() mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("CameraOffsetRearView"); mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("CameraOffsetFrontView"); mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("CameraOffsetGroupView"); + mCameraOffsetInitial[CAMERA_PRESET_CUSTOM0] = gSavedSettings.getControl("CameraOffsetCustom0"); mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView"); mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView"); mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView"); + mFocusOffsetInitial[CAMERA_PRESET_CUSTOM0] = gSavedSettings.getControl("FocusOffsetCustom0"); mCameraCollidePlane.clearVec(); mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index ab793ff316..29a1891d82 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -56,7 +56,10 @@ enum ECameraPreset CAMERA_PRESET_FRONT_VIEW, /** "Above and to the left, over the shoulder, pulled back a little on the zoom" */ - CAMERA_PRESET_GROUP_VIEW + CAMERA_PRESET_GROUP_VIEW, + + /** Current view when a preset is saved */ + CAMERA_PRESET_CUSTOM0 }; //------------------------------------------------------------------------ diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 20d650fa37..777963bec5 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -42,6 +42,7 @@ #include "llslider.h" #include "llfirstuse.h" #include "llhints.h" +#include "lltabcontainer.h" static LLDefaultChildRegistry::Register r("panel_camera_item"); @@ -353,6 +354,7 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val) { LLHints::registerHintTarget("view_popup", getHandle()); mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2)); + mCommitCallbackRegistrar.add("Presets.GoViewPrefs", boost::bind(&LLFloaterCamera::onViewButtonClick, this, _2)); } // virtual @@ -376,6 +378,24 @@ BOOL LLFloaterCamera::postBuild() return LLFloater::postBuild(); } +void LLFloaterCamera::onViewButtonClick(const LLSD& user_data) +{ + // bring up the prefs floater + LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences"); + if (prefsfloater) + { + // grab the 'view' panel from the preferences floater and + // bring it the front! + LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); + LLPanel* graphicspanel = prefsfloater->getChild("move"); + if (tabcontainer && graphicspanel) + { + tabcontainer->selectTabPanel(graphicspanel); + } + } +} + + void LLFloaterCamera::fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel) { // copying child list and then iterating over a copy, because list itself diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 4d6d03f22d..3601813bc1 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -91,6 +91,8 @@ private: /*virtual*/ BOOL postBuild(); + void onViewButtonClick(const LLSD& user_data); + ECameraControlMode determineMode(); /* resets to the previous mode */ diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index 7dedbbf984..bd62849b42 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -60,13 +60,15 @@ void LLFloaterDeletePrefPreset::onOpen(const LLSD& key) { mSubdirectory = key.asString(); std::string floater_title = getString(std::string("title_") + mSubdirectory); - setTitle(floater_title); LLComboBox* combo = getChild("preset_combo"); - EDefaultOptions option = DEFAULT_HIDE; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + bool action; + action = LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + + LLButton* delete_btn = getChild("delete"); + delete_btn->setEnabled(action); } void LLFloaterDeletePrefPreset::onBtnDelete() @@ -87,12 +89,10 @@ void LLFloaterDeletePrefPreset::onBtnDelete() void LLFloaterDeletePrefPreset::onPresetsListChange() { LLComboBox* combo = getChild("preset_combo"); - LLButton* delete_btn = getChild("delete"); EDefaultOptions option = DEFAULT_HIDE; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); - delete_btn->setEnabled(0 != combo->getItemCount()); + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); } void LLFloaterDeletePrefPreset::onBtnCancel() diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 100ee5ab72..6e5a773c33 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -768,7 +768,8 @@ void LLFloaterPreference::onOpen(const LLSD& key) saveSettings(); // Make sure there is a default preference file - LLPresetsManager::getInstance()->createMissingDefault(); + LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA); + LLPresetsManager::getInstance()->createMissingDefault(PRESETS_GRAPHIC); bool started = (LLStartUp::getStartupState() == STATE_STARTED); @@ -776,9 +777,23 @@ void LLFloaterPreference::onOpen(const LLSD& key) LLButton* save_btn = findChild("PrefSaveButton"); LLButton* delete_btn = findChild("PrefDeleteButton"); - load_btn->setEnabled(started); - save_btn->setEnabled(started); - delete_btn->setEnabled(started); + if (load_btn && save_btn && delete_btn) + { + load_btn->setEnabled(started); + save_btn->setEnabled(started); + delete_btn->setEnabled(started); + } + + LLButton* load_camera_btn = findChild("PrefCameraLoadButton"); + LLButton* save_camera_btn = findChild("PrefCameraSaveButton"); + LLButton* delete_camera_btn = findChild("PrefCameraDeleteButton"); + + if (load_camera_btn && save_camera_btn && delete_camera_btn) + { + load_camera_btn->setEnabled(started); + save_camera_btn->setEnabled(started); + delete_camera_btn->setEnabled(started); + } } void LLFloaterPreference::onVertexShaderEnable() @@ -2128,6 +2143,11 @@ void LLFloaterPreference::changed() } +void LLFloaterPreference::saveCameraPreset(std::string& preset) +{ + mSavedCameraPreset = preset; +} + void LLFloaterPreference::saveGraphicsPreset(std::string& preset) { mSavedGraphicsPreset = preset; @@ -2474,6 +2494,86 @@ private: static LLPanelInjector t_pref_graph("panel_preference_graphics"); static LLPanelInjector t_pref_privacy("panel_preference_privacy"); +static LLPanelInjector t_pref_view("panel_preference_view"); + +BOOL LLPanelPreferenceView::postBuild() +{ + setPresetText(); + + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPreferenceView::onPresetsListChangeCamera, this)); + presetsMgr->createMissingDefault(PRESETS_CAMERA); // a no-op after the first time, but that's ok + } + + return LLPanelPreference::postBuild(); +} + +void LLPanelPreferenceView::onPresetsListChangeCamera() +{ + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + presetsMgr->setCameraDirty(false); + } + + setPresetText(); + + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance && !gSavedSettings.getString("PresetCameraActive").empty()) + { + instance->saveSettings(); //make cancel work correctly after changing the preset + } +} + +void LLPanelPreferenceView::draw() +{ + setPresetText(); + LLPanelPreference::draw(); +} + +void LLPanelPreferenceView::setPresetText() +{ + LLTextBox* preset_text = getChild("preset_camera_text"); + + std::string preset_camera_active = gSavedSettings.getString("PresetCameraActive"); + + if (!preset_camera_active.empty() && preset_camera_active != preset_text->getText()) + { + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->saveCameraPreset(preset_camera_active); + } + } + + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + if (presetsMgr->isCameraDirty() && !preset_camera_active.empty()) + { + gSavedSettings.setString("PresetCameraActive", ""); + preset_camera_active.clear(); + // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown + // panel to update. + LLPresetsManager::getInstance()->triggerChangeCameraSignal(); + } + } + + if (!preset_camera_active.empty()) + { + if (preset_camera_active == PRESETS_DEFAULT) + { + preset_camera_active = LLTrans::getString(PRESETS_DEFAULT); + } + preset_text->setText(preset_camera_active); + } + else + { + preset_text->setText(LLTrans::getString("none_paren_cap")); + } +} BOOL LLPanelPreferenceGraphics::postBuild() { @@ -2497,7 +2597,7 @@ BOOL LLPanelPreferenceGraphics::postBuild() LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); presetsMgr->setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this)); - presetsMgr->createMissingDefault(); // a no-op after the first time, but that's ok + presetsMgr->createMissingDefault(PRESETS_GRAPHIC); // a no-op after the first time, but that's ok return LLPanelPreference::postBuild(); } diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index fa0c09e97a..ea3a1fc98c 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -174,6 +174,7 @@ public: void buildPopupLists(); static void refreshSkin(void* data); void selectPanel(const LLSD& name); + void saveCameraPreset(std::string& preset); void saveGraphicsPreset(std::string& preset); private: @@ -196,6 +197,7 @@ private: std::string mDirectoryVisibility; LLAvatarData mAvatarProperties; + std::string mSavedCameraPreset; std::string mSavedGraphicsPreset; LOG_CLASS(LLFloaterPreference); }; @@ -244,6 +246,18 @@ private: LOG_CLASS(LLPanelPreference); }; +class LLPanelPreferenceView : public LLPanelPreference +{ +public: + BOOL postBuild(); + void draw(); + void setPresetText(); + +private: + void onPresetsListChangeCamera(); + LOG_CLASS(LLPanelPreferenceView); +}; + class LLPanelPreferenceGraphics : public LLPanelPreference { public: @@ -261,7 +275,6 @@ protected: bool hasDirtyChilds(); private: - void onPresetsListChange(); LOG_CLASS(LLPanelPreferenceGraphics); }; diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp new file mode 100644 index 0000000000..2c95c06c31 --- /dev/null +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -0,0 +1,236 @@ +/** + * @file llpanelpresetscamerapulldown.cpp + * @brief A panel showing a quick way to pick camera presets + * + * $LicenseInfo:firstyear=2017&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2017, 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 "llpanelpresetscamerapulldown.h" + +#include "llviewercontrol.h" +#include "llstatusbar.h" + +#include "llbutton.h" +#include "lltabcontainer.h" +#include "llfloaterreg.h" +#include "llfloaterpreference.h" +#include "llpresetsmanager.h" +#include "llsliderctrl.h" +#include "llscrolllistctrl.h" +#include "lltrans.h" + +/* static */ const F32 LLPanelPresetsCameraPulldown::sAutoCloseFadeStartTimeSec = 2.0f; +/* static */ const F32 LLPanelPresetsCameraPulldown::sAutoCloseTotalTimeSec = 3.0f; + +///---------------------------------------------------------------------------- +/// Class LLPanelPresetsCameraPulldown +///---------------------------------------------------------------------------- + +// Default constructor +LLPanelPresetsCameraPulldown::LLPanelPresetsCameraPulldown() +{ + mHoverTimer.stop(); + + mCommitCallbackRegistrar.add("Presets.GoViewPrefs", boost::bind(&LLPanelPresetsCameraPulldown::onViewButtonClick, this, _2)); + mCommitCallbackRegistrar.add("PresetsCamera.RowClick", boost::bind(&LLPanelPresetsCameraPulldown::onRowClick, this, _2)); + + buildFromFile( "panel_presets_camera_pulldown.xml"); +} + +BOOL LLPanelPresetsCameraPulldown::postBuild() +{ + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPresetsCameraPulldown::populatePanel, this)); +LL_WARNS() << "DBG pulldown" << LL_ENDL; + // Make sure there is a default preference file + presetsMgr->createMissingDefault(PRESETS_CAMERA); + presetsMgr->startWatching(PRESETS_CAMERA); + } + + populatePanel(); + + return LLPanel::postBuild(); +} + +void LLPanelPresetsCameraPulldown::populatePanel() +{ + std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_CAMERA); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP); + + LLScrollListCtrl* scroll = getChild("preset_camera_list"); + + if (scroll && mPresetNames.begin() != mPresetNames.end()) + { + scroll->clearRows(); + + std::string active_preset = gSavedSettings.getString("PresetCameraActive"); + if (active_preset == PRESETS_DEFAULT) + { + active_preset = LLTrans::getString(PRESETS_DEFAULT); + } + + for (std::list::const_iterator it = mPresetNames.begin(); it != mPresetNames.end(); ++it) + { + const std::string& name = *it; + LL_DEBUGS() << "adding '" << name << "'" << LL_ENDL; + + LLSD row; + row["columns"][0]["column"] = "preset_name"; + row["columns"][0]["value"] = name; + + bool is_selected_preset = false; + if (name == active_preset) + { + row["columns"][1]["column"] = "icon"; + row["columns"][1]["type"] = "icon"; + row["columns"][1]["value"] = "Check_Mark"; + + is_selected_preset = true; + } + + LLScrollListItem* new_item = scroll->addElement(row); + new_item->setSelected(is_selected_preset); + } + } +} + +/*virtual*/ +void LLPanelPresetsCameraPulldown::onMouseEnter(S32 x, S32 y, MASK mask) +{ + mHoverTimer.stop(); + LLPanel::onMouseEnter(x,y,mask); +} + +/*virtual*/ +void LLPanelPresetsCameraPulldown::onTopLost() +{ + setVisible(FALSE); +} + +/*virtual*/ +BOOL LLPanelPresetsCameraPulldown::handleMouseDown(S32 x, S32 y, MASK mask) +{ + LLPanel::handleMouseDown(x,y,mask); + return TRUE; +} + +/*virtual*/ +BOOL LLPanelPresetsCameraPulldown::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + LLPanel::handleRightMouseDown(x, y, mask); + return TRUE; +} + +/*virtual*/ +BOOL LLPanelPresetsCameraPulldown::handleDoubleClick(S32 x, S32 y, MASK mask) +{ + LLPanel::handleDoubleClick(x, y, mask); + return TRUE; +} + +/*virtual*/ +void LLPanelPresetsCameraPulldown::onMouseLeave(S32 x, S32 y, MASK mask) +{ + mHoverTimer.start(); + LLPanel::onMouseLeave(x,y,mask); +} + +/*virtual*/ +void LLPanelPresetsCameraPulldown::onVisibilityChange ( BOOL new_visibility ) +{ + if (new_visibility) + { + mHoverTimer.start(); // timer will be stopped when mouse hovers over panel + } + else + { + mHoverTimer.stop(); + + } +} + +void LLPanelPresetsCameraPulldown::onRowClick(const LLSD& user_data) +{ + LLScrollListCtrl* scroll = getChild("preset_camera_list"); + + if (scroll) + { + LLScrollListItem* item = scroll->getFirstSelected(); + if (item) + { + std::string name = item->getColumn(1)->getValue().asString(); + + LL_DEBUGS() << "selected '" << name << "'" << LL_ENDL; + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, name); + + setVisible(FALSE); + } + else + { + LL_DEBUGS() << "none selected" << LL_ENDL; + } + } + else + { + LL_DEBUGS() << "no scroll" << LL_ENDL; + } +} + +void LLPanelPresetsCameraPulldown::onViewButtonClick(const LLSD& user_data) +{ + // close the minicontrol, we're bringing up the big one + setVisible(FALSE); + + // bring up the prefs floater + LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences"); + if (prefsfloater) + { + // grab the 'view' panel from the preferences floater and + // bring it the front! + LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); + LLPanel* graphicspanel = prefsfloater->getChild("move"); + if (tabcontainer && graphicspanel) + { + tabcontainer->selectTabPanel(graphicspanel); + } + } +} + +//virtual +void LLPanelPresetsCameraPulldown::draw() +{ + F32 alpha = mHoverTimer.getStarted() + ? clamp_rescale(mHoverTimer.getElapsedTimeF32(), sAutoCloseFadeStartTimeSec, sAutoCloseTotalTimeSec, 1.f, 0.f) + : 1.0f; + LLViewDrawContext context(alpha); + + LLPanel::draw(); + + if (alpha == 0.f) + { + setVisible(FALSE); + } +} diff --git a/indra/newview/llpanelpresetscamerapulldown.h b/indra/newview/llpanelpresetscamerapulldown.h new file mode 100644 index 0000000000..12d9bc26ec --- /dev/null +++ b/indra/newview/llpanelpresetscamerapulldown.h @@ -0,0 +1,62 @@ +/** + * @file llpanelpresetscamerapulldown.h + * @brief A panel showing a quick way to pick camera presets + * + * $LicenseInfo:firstyear=2017&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2017, 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_LLPANELPRESETSCAMERAPULLDOWN_H +#define LL_LLPANELPRESETSCAMERAPULLDOWN_H + +#include "linden_common.h" + +#include "llpanel.h" + +class LLFrameTimer; + +class LLPanelPresetsCameraPulldown : public LLPanel +{ + public: + LLPanelPresetsCameraPulldown(); + /*virtual*/ void draw(); + /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ void onTopLost(); + /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); + /*virtual*/ BOOL postBuild(); + void populatePanel(); + + private: + void onViewButtonClick(const LLSD& user_data); + void onRowClick(const LLSD& user_data); + + std::list mPresetNames; + LLFrameTimer mHoverTimer; + static const F32 sAutoCloseFadeStartTimeSec; + static const F32 sAutoCloseTotalTimeSec; + LOG_CLASS(LLPanelPresetsCameraPulldown); +}; + +#endif // LL_LLPANELPRESETSCAMERAPULLDOWN_H diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 9b4dc5474a..0bbf1781a5 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -63,7 +63,7 @@ BOOL LLPanelPresetsPulldown::postBuild() LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); presetsMgr->setPresetListChangeCallback(boost::bind(&LLPanelPresetsPulldown::populatePanel, this)); // Make sure there is a default preference file - presetsMgr->createMissingDefault(); + presetsMgr->createMissingDefault(PRESETS_GRAPHIC); populatePanel(); diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 836f63bffa..16721a6efc 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -39,6 +39,7 @@ #include "llfloaterpreference.h" #include "llfloaterreg.h" #include "llfeaturemanager.h" +#include "llagentcamera.h" LLPresetsManager::LLPresetsManager() { @@ -46,6 +47,12 @@ LLPresetsManager::LLPresetsManager() LLPresetsManager::~LLPresetsManager() { + mCameraChangedSignal.disconnect(); +} + +void LLPresetsManager::triggerChangeCameraSignal() +{ + mPresetListChangeCameraSignal(); } void LLPresetsManager::triggerChangeSignal() @@ -53,15 +60,16 @@ void LLPresetsManager::triggerChangeSignal() mPresetListChangeSignal(); } -void LLPresetsManager::createMissingDefault() +void LLPresetsManager::createMissingDefault(const std::string& subdirectory) { - std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_GRAPHIC, PRESETS_DEFAULT + ".xml"); + std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, + subdirectory, PRESETS_DEFAULT + ".xml"); if (!gDirUtilp->fileExists(default_file)) { LL_INFOS() << "No default preset found -- creating one at " << default_file << LL_ENDL; - // Write current graphic settings as the default - savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT, true); + // Write current settings as the default + savePreset(subdirectory, PRESETS_DEFAULT, true); } else { @@ -69,6 +77,34 @@ void LLPresetsManager::createMissingDefault() } } +void LLPresetsManager::startWatching(const std::string& subdirectory) +{ + if (PRESETS_CAMERA == subdirectory) + { + std::vector name_list; + getControlNames(name_list); + + for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) + { + std::string ctrl_name = *it; +LL_WARNS() << "DBG starting watch on " << ctrl_name << LL_ENDL; + if (gSavedSettings.controlExists(ctrl_name)) + { + LLPointer cntrl_ptr = gSavedSettings.getControl(ctrl_name); + if (cntrl_ptr.isNull()) + { + LL_WARNS("Init") << "Unable to set signal on global setting '" << ctrl_name + << "'" << LL_ENDL; + } + else + { + mCameraChangedSignal = cntrl_ptr->getCommitSignal()->connect(boost::bind(&settingChanged)); + } + } + } + } +} + std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory) { std::string presets_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR); @@ -134,6 +170,49 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam presets = mPresetNames; } +bool LLPresetsManager::mCameraDirty = false; + +void LLPresetsManager::setCameraDirty(bool dirty) +{ + mCameraDirty = dirty; +} + +bool LLPresetsManager::isCameraDirty() +{ + return mCameraDirty; +} + +void LLPresetsManager::settingChanged() +{ +LL_WARNS() << "DBG setting changed" << LL_ENDL; + setCameraDirty(true); +} + +void LLPresetsManager::getControlNames(std::vector& names) +{ + names = boost::assign::list_of + ("CameraOffsetCustom0") + ("FocusOffsetCustom0") + // From panel_preferences_move.xml + ("CameraAngle") + ("CameraOffsetScale") + ("CameraOpacity") + ("EditCameraMovement") + ("AppearanceCameraMovement") + // From llagentcamera.cpp + ("RenderFarClip") + ("CameraOffsetBuild") + ("CameraPreset") + ("CameraOffsetRearView") + ("CameraOffsetFrontView") + ("CameraOffsetGroupView") + ("FocusOffsetRearView") + ("FocusOffsetFrontView") + ("FocusOffsetGroupView") + ("CameraOffsetScale") + ("TrackFocusObject"); +} + bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name, bool createDefault) { if (LLTrans::getString(PRESETS_DEFAULT) == name) @@ -149,94 +228,110 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); if (instance && !createDefault) { - gSavedSettings.setString("PresetGraphicActive", name); + gSavedSettings.setString("PresetGraphicActive", name); instance->getControlNames(name_list); - LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL; + LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL; name_list.push_back("PresetGraphicActive"); } - else + else { - LL_WARNS() << "preferences floater instance not found" << LL_ENDL; - } + LL_WARNS() << "preferences floater instance not found" << LL_ENDL; + } } - else if(PRESETS_CAMERA == subdirectory) + else if(PRESETS_CAMERA == subdirectory) { - name_list = boost::assign::list_of - ("Placeholder"); + gSavedSettings.setString("PresetGraphicActive", name); +// gSavedSettings.setU32("CameraPreset", CAMERA_PRESET_CUSTOM0); + +// gSavedSettings.setVector3d("CameraOffsetCustom0", gAgentCamera.calcCameraPositionTargetGlobal()); +// gSavedSettings.setVector3d("FocusOffsetCustom0", gAgentCamera.calcFocusPositionTargetGlobal()); + + getControlNames(name_list); + name_list.push_back("PresetCameraActive"); } - else - { - LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL; - } - - if (name_list.size() > 1 // if the active preset name is the only thing in the list, don't save the list - || (createDefault && name == PRESETS_DEFAULT && subdirectory == PRESETS_GRAPHIC)) // or create a default graphics preset from hw recommended settings - { - // make an empty llsd - LLSD paramsData(LLSD::emptyMap()); + else + { + LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL; + } + + // make an empty llsd + LLSD paramsData(LLSD::emptyMap()); - if (createDefault) - { - paramsData = LLFeatureManager::getInstance()->getRecommendedSettingsMap(); - if (gSavedSettings.getU32("RenderAvatarMaxComplexity") == 0) - { - // use the recommended setting as an initial one (MAINT-6435) - gSavedSettings.setU32("RenderAvatarMaxComplexity", paramsData["RenderAvatarMaxComplexity"]["Value"].asInteger()); - } - } - else - { - for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) - { - std::string ctrl_name = *it; - LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); - std::string comment = ctrl->getComment(); - std::string type = LLControlGroup::typeEnumToString(ctrl->type()); - LLSD value = ctrl->getValue(); - - paramsData[ctrl_name]["Comment"] = comment; - paramsData[ctrl_name]["Persist"] = 1; - paramsData[ctrl_name]["Type"] = type; - paramsData[ctrl_name]["Value"] = value; - } - } - - std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); - - // write to file - llofstream presetsXML(pathName.c_str()); - if (presetsXML.is_open()) - { - - LLPointer formatter = new LLSDXMLFormatter(); - formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); - presetsXML.close(); - saved = true; + // Create a default graphics preset from hw recommended settings + if (createDefault && name == PRESETS_DEFAULT && subdirectory == PRESETS_GRAPHIC) + { + paramsData = LLFeatureManager::getInstance()->getRecommendedSettingsMap(); + if (gSavedSettings.getU32("RenderAvatarMaxComplexity") == 0) + { + // use the recommended setting as an initial one (MAINT-6435) + gSavedSettings.setU32("RenderAvatarMaxComplexity", paramsData["RenderAvatarMaxComplexity"]["Value"].asInteger()); + } + } + else + { + for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) + { + std::string ctrl_name = *it; + LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); + std::string comment = ctrl->getComment(); + std::string type = LLControlGroup::typeEnumToString(ctrl->type()); + LLSD value = ctrl->getValue(); + + paramsData[ctrl_name]["Comment"] = comment; + paramsData[ctrl_name]["Persist"] = 1; + paramsData[ctrl_name]["Type"] = type; + paramsData[ctrl_name]["Value"] = value; + } + } + + std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); + + // If the active preset name is the only thing in the list, don't save the list + if (paramsData.size() > 1) + { + // write to file + llofstream presetsXML(pathName.c_str()); + if (presetsXML.is_open()) + { + LLPointer formatter = new LLSDXMLFormatter(); + formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); + presetsXML.close(); + saved = true; - LL_DEBUGS() << "saved preset '" << name << "'; " << paramsData.size() << " parameters" << LL_ENDL; - - if (!createDefault) - { - gSavedSettings.setString("PresetGraphicActive", name); - // signal interested parties - triggerChangeSignal(); - } - } - else - { - LL_WARNS("Presets") << "Cannot open for output preset file " << pathName << LL_ENDL; - } - } + LL_DEBUGS() << "saved preset '" << name << "'; " << paramsData.size() << " parameters" << LL_ENDL; + + if (subdirectory == PRESETS_GRAPHIC) + { + gSavedSettings.setString("PresetGraphicActive", name); + // signal interested parties + triggerChangeSignal(); + } + + if (subdirectory == PRESETS_CAMERA) + { + gSavedSettings.setString("PresetCameraActive", name); + setCameraDirty(false); + // signal interested parties + triggerChangeCameraSignal(); + } + } + else + { + LL_WARNS("Presets") << "Cannot open for output preset file " << pathName << LL_ENDL; + } + } else - { - LL_INFOS() << "No settings found; preferences floater has not yet been created" << LL_ENDL; - } + { + LL_INFOS() << "No settings available to be saved" << LL_ENDL; + } return saved; } -void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option) +bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option) { + bool sts = true; + combo->clearRows(); std::string presets_dir = getPresetsDir(subdirectory); @@ -259,8 +354,10 @@ void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, else { combo->setLabel(LLTrans::getString("preset_combo_label")); + sts = false; } } + return sts; } void LLPresetsManager::loadPreset(const std::string& subdirectory, std::string name) @@ -279,14 +376,19 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, std::string n if(PRESETS_GRAPHIC == subdirectory) { gSavedSettings.setString("PresetGraphicActive", name); - } - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refreshEnabledGraphics(); + } + triggerChangeSignal(); + } + if(PRESETS_CAMERA == subdirectory) { - instance->refreshEnabledGraphics(); + gSavedSettings.setString("PresetCameraActive", name); + triggerChangeCameraSignal(); } - triggerChangeSignal(); } else { @@ -317,17 +419,34 @@ bool LLPresetsManager::deletePreset(const std::string& subdirectory, std::string } // If you delete the preset that is currently marked as loaded then also indicate that no preset is loaded. - if (gSavedSettings.getString("PresetGraphicActive") == name) + if(PRESETS_GRAPHIC == subdirectory) { - gSavedSettings.setString("PresetGraphicActive", ""); + if (gSavedSettings.getString("PresetGraphicActive") == name) + { + gSavedSettings.setString("PresetGraphicActive", ""); + } + // signal interested parties + triggerChangeSignal(); } - // signal interested parties - triggerChangeSignal(); + if(PRESETS_CAMERA == subdirectory) + { + if (gSavedSettings.getString("PresetCameraActive") == name) + { + gSavedSettings.setString("PresetCameraActive", ""); + } + // signal interested parties + triggerChangeCameraSignal(); + } return sts; } +boost::signals2::connection LLPresetsManager::setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb) +{ + return mPresetListChangeCameraSignal.connect(cb); +} + boost::signals2::connection LLPresetsManager::setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb) { return mPresetListChangeSignal.connect(cb); diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 21f9885f27..71ec4736b2 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -51,16 +51,21 @@ public: typedef std::list preset_name_list_t; typedef boost::signals2::signal preset_list_signal_t; - void createMissingDefault(); + void createMissingDefault(const std::string& subdirectory); + void startWatching(const std::string& subdirectory); + void triggerChangeCameraSignal(); void triggerChangeSignal(); static std::string getPresetsDir(const std::string& subdirectory); - void setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option); + bool setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option); void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option); bool savePreset(const std::string& subdirectory, std::string name, bool createDefault = false); void loadPreset(const std::string& subdirectory, std::string name); bool deletePreset(const std::string& subdirectory, std::string name); + bool isCameraDirty(); + static void setCameraDirty(bool dirty); // Emitted when a preset gets loaded, deleted, or saved. + boost::signals2::connection setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb); boost::signals2::connection setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb); // Emitted when a preset gets loaded or saved. @@ -70,10 +75,18 @@ public: LLPresetsManager(); ~LLPresetsManager(); + preset_list_signal_t mPresetListChangeCameraSignal; preset_list_signal_t mPresetListChangeSignal; private: - LOG_CLASS(LLPresetsManager); + LOG_CLASS(LLPresetsManager); + + void getControlNames(std::vector& names); + static void LLPresetsManager::settingChanged(); + + boost::signals2::connection mCameraChangedSignal; + + static bool mCameraDirty; }; #endif // LL_PRESETSMANAGER_H diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 041eae4b3c..702b9a8484 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -38,6 +38,7 @@ #include "llfloaterbuycurrency.h" #include "llbuycurrencyhtml.h" #include "llpanelnearbymedia.h" +#include "llpanelpresetscamerapulldown.h" #include "llpanelpresetspulldown.h" #include "llpanelvolumepulldown.h" #include "llfloaterregioninfo.h" @@ -171,8 +172,11 @@ BOOL LLStatusBar::postBuild() mBtnStats = getChildView("stat_btn"); - mIconPresets = getChild( "presets_icon" ); - mIconPresets->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterPresets, this)); + mIconPresetsCamera = getChild( "presets_icon_camera" ); + mIconPresetsCamera->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterPresetsCamera, this)); + + mIconPresetsGraphic = getChild( "presets_icon_graphic" ); + mIconPresetsGraphic->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterPresets, this)); mBtnVolume = getChild( "volume_btn" ); mBtnVolume->setClickedCallback( onClickVolume, this ); @@ -227,6 +231,11 @@ BOOL LLStatusBar::postBuild() mSGPacketLoss = LLUICtrlFactory::create(pgp); addChild(mSGPacketLoss); + mPanelPresetsCameraPulldown = new LLPanelPresetsCameraPulldown(); + addChild(mPanelPresetsCameraPulldown); + mPanelPresetsCameraPulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); + mPanelPresetsCameraPulldown->setVisible(FALSE); + mPanelPresetsPulldown = new LLPanelPresetsPulldown(); addChild(mPanelPresetsPulldown); mPanelPresetsPulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); @@ -325,7 +334,8 @@ void LLStatusBar::setVisibleForMouselook(bool visible) mSGBandwidth->setVisible(visible); mSGPacketLoss->setVisible(visible); setBackgroundVisible(visible); - mIconPresets->setVisible(visible); + mIconPresetsCamera->setVisible(visible); + mIconPresetsGraphic->setVisible(visible); } void LLStatusBar::debitBalance(S32 debit) @@ -470,10 +480,34 @@ void LLStatusBar::onClickBuyCurrency() LLFirstUse::receiveLindens(false); } +void LLStatusBar::onMouseEnterPresetsCamera() +{ + LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); + LLIconCtrl* icon = getChild( "presets_icon_camera" ); + LLRect icon_rect = icon->getRect(); + LLRect pulldown_rect = mPanelPresetsCameraPulldown->getRect(); + pulldown_rect.setLeftTopAndSize(icon_rect.mLeft - + (pulldown_rect.getWidth() - icon_rect.getWidth()), + icon_rect.mBottom, + pulldown_rect.getWidth(), + pulldown_rect.getHeight()); + + pulldown_rect.translate(popup_holder->getRect().getWidth() - pulldown_rect.mRight, 0); + mPanelPresetsCameraPulldown->setShape(pulldown_rect); + + // show the master presets pull-down + LLUI::clearPopups(); + LLUI::addPopup(mPanelPresetsCameraPulldown); + mPanelNearByMedia->setVisible(FALSE); + mPanelVolumePulldown->setVisible(FALSE); + mPanelPresetsPulldown->setVisible(FALSE); + mPanelPresetsCameraPulldown->setVisible(TRUE); +} + void LLStatusBar::onMouseEnterPresets() { LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); - LLIconCtrl* icon = getChild( "presets_icon" ); + LLIconCtrl* icon = getChild( "presets_icon_graphic" ); LLRect icon_rect = icon->getRect(); LLRect pulldown_rect = mPanelPresetsPulldown->getRect(); pulldown_rect.setLeftTopAndSize(icon_rect.mLeft - @@ -512,6 +546,7 @@ void LLStatusBar::onMouseEnterVolume() // show the master volume pull-down LLUI::clearPopups(); LLUI::addPopup(mPanelVolumePulldown); + mPanelPresetsCameraPulldown->setVisible(FALSE); mPanelPresetsPulldown->setVisible(FALSE); mPanelNearByMedia->setVisible(FALSE); mPanelVolumePulldown->setVisible(TRUE); @@ -536,6 +571,7 @@ void LLStatusBar::onMouseEnterNearbyMedia() LLUI::clearPopups(); LLUI::addPopup(mPanelNearByMedia); + mPanelPresetsCameraPulldown->setVisible(FALSE); mPanelPresetsPulldown->setVisible(FALSE); mPanelVolumePulldown->setVisible(FALSE); mPanelNearByMedia->setVisible(TRUE); diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 277f039f20..507afcd147 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -41,6 +41,7 @@ class LLUICtrl; class LLUUID; class LLFrameTimer; class LLStatGraph; +class LLPanelPresetsCameraPulldown; class LLPanelPresetsPulldown; class LLPanelVolumePulldown; class LLPanelNearByMedia; @@ -91,6 +92,7 @@ private: void onClickBuyCurrency(); void onVolumeChanged(const LLSD& newvalue); + void onMouseEnterPresetsCamera(); void onMouseEnterPresets(); void onMouseEnterVolume(); void onMouseEnterNearbyMedia(); @@ -106,7 +108,8 @@ private: LLStatGraph *mSGPacketLoss; LLView *mBtnStats; - LLIconCtrl *mIconPresets; + LLIconCtrl *mIconPresetsCamera; + LLIconCtrl *mIconPresetsGraphic; LLButton *mBtnVolume; LLTextBox *mBoxBalance; LLButton *mMediaToggle; @@ -119,6 +122,7 @@ private: S32 mSquareMetersCommitted; LLFrameTimer* mBalanceTimer; LLFrameTimer* mHealthTimer; + LLPanelPresetsCameraPulldown* mPanelPresetsCameraPulldown; LLPanelPresetsPulldown* mPanelPresetsPulldown; LLPanelVolumePulldown* mPanelVolumePulldown; LLPanelNearByMedia* mPanelNearByMedia; diff --git a/indra/newview/skins/default/textures/icons/Presets_Icon.png b/indra/newview/skins/default/textures/icons/Presets_Icon.png deleted file mode 100644 index 5a6628816b..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Presets_Icon.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Presets_Icon_Camera.png b/indra/newview/skins/default/textures/icons/Presets_Icon_Camera.png new file mode 100644 index 0000000000..8cb51cdc8e Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Presets_Icon_Camera.png differ diff --git a/indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png b/indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png new file mode 100644 index 0000000000..5a6628816b Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index f2da22256c..de9ed4d479 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -205,7 +205,8 @@ with the same filename but different name - + + diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml index 521389d7b3..4eec922915 100644 --- a/indra/newview/skins/default/xui/en/floater_camera.xml +++ b/indra/newview/skins/default/xui/en/floater_camera.xml @@ -150,8 +150,26 @@ left="0" mouse_opaque="false" name="zoom" - top="20" + top="0" width="226"> + + + + diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index 9a9101e0da..cbaeae5b94 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -79,7 +79,7 @@ help_topic="preferences_chat_tab" name="chat" /> + +[https://community.secondlife.com/t5/Featured-News/Why-are-all-these-people-made-of-colored-jelly/ba-p/3031255 What's this?] + + + - min_val="0.125" + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml b/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml new file mode 100644 index 0000000000..dc37270751 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml @@ -0,0 +1,69 @@ + + + + Camera Presets + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index 998f1ce599..c6a42ea612 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -35,7 +35,7 @@ + - - - diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index c6a42ea612..299f019145 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -108,7 +108,7 @@ Date: Sat, 13 Jan 2018 12:18:40 -0500 Subject: STORM-2145 Added a small floater --- indra/llui/llfloater.cpp | 2 + indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 31 ----- indra/newview/llagentcamera.cpp | 2 - indra/newview/llfloaterpreference.cpp | 2 +- indra/newview/llfloaterpreferencemoveadvanced.cpp | 151 +++++++++++++++++++++ indra/newview/llfloaterpreferencemoveadvanced.h | 58 ++++++++ indra/newview/llpanelpresetscamerapulldown.cpp | 2 +- indra/newview/llpresetsmanager.cpp | 10 -- indra/newview/llviewerfloaterreg.cpp | 2 + .../xui/en/floater_preferences_move_advanced.xml | 140 +++++++++++++++++++ .../default/xui/en/panel_preferences_move.xml | 14 ++ 12 files changed, 371 insertions(+), 45 deletions(-) create mode 100644 indra/newview/llfloaterpreferencemoveadvanced.cpp create mode 100644 indra/newview/llfloaterpreferencemoveadvanced.h create mode 100644 indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml (limited to 'indra') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index e5fe6967d1..663d96bdd4 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -64,6 +64,8 @@ // use this to control "jumping" behavior when Ctrl-Tabbing const S32 TABBED_FLOATER_OFFSET = 0; +extern LLControlGroup gSavedSettings; + namespace LLInitParam { void TypeValues::declareValues() diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 658c3c56fc..7de4e85316 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -277,6 +277,7 @@ set(viewer_SOURCE_FILES llfloaterperms.cpp llfloaterpostprocess.cpp llfloaterpreference.cpp + llfloaterpreferencemoveadvanced.cpp llfloaterpreviewtrash.cpp llfloaterproperties.cpp llfloaterregiondebugconsole.cpp @@ -901,6 +902,7 @@ set(viewer_HEADER_FILES llfloaterperms.h llfloaterpostprocess.h llfloaterpreference.h + llfloaterpreferencemoveadvanced.h llfloaterpreviewtrash.h llfloaterproperties.h llfloaterregiondebugconsole.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9b5b614111..bcce87dc13 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16176,36 +16176,5 @@ Value - CameraOffsetCustom0 - - Comment - Customized camera offset from avatar - Persist - 1 - Type - Vector3 - Value - - -3.0 - 0.0 - 0.75 - - - FocusOffsetCustom0 - - Comment - Custom focus point offset relative to avatar (x-axis is forward) - Persist - 1 - Type - Vector3D - Value - - 1.0 - 0.0 - 1.0 - - - diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index e0ade4d395..5b9f1b9d4f 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -208,12 +208,10 @@ void LLAgentCamera::init() mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("CameraOffsetRearView"); mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("CameraOffsetFrontView"); mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("CameraOffsetGroupView"); - mCameraOffsetInitial[CAMERA_PRESET_CUSTOM0] = gSavedSettings.getControl("CameraOffsetCustom0"); mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView"); mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView"); mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView"); - mFocusOffsetInitial[CAMERA_PRESET_CUSTOM0] = gSavedSettings.getControl("FocusOffsetCustom0"); mCameraCollidePlane.clearVec(); mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 212cb922f2..872e961a70 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -661,7 +661,7 @@ void LLFloaterPreference::cancel() // hide spellchecker settings folder LLFloaterReg::hideInstance("prefs_spellchecker"); - // hide advancede floater + // hide advanced graphics floater LLFloaterReg::hideInstance("prefs_graphics_advanced"); // reverts any changes to current skin diff --git a/indra/newview/llfloaterpreferencemoveadvanced.cpp b/indra/newview/llfloaterpreferencemoveadvanced.cpp new file mode 100644 index 0000000000..3ff19147b1 --- /dev/null +++ b/indra/newview/llfloaterpreferencemoveadvanced.cpp @@ -0,0 +1,151 @@ +/** + * @file llfloaterpreferencemoveadvanced.cpp + * @brief floater for adjusting camera position + * + * $LicenseInfo:firstyear=2018&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2018, 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 "llfloaterpreferencemoveadvanced.h" +#include "llfloater.h" +#include "llfloaterreg.h" +#include "lluictrlfactory.h" +#include "llspinctrl.h" +#include "llviewercontrol.h" + + +LLFloaterPreferenceMoveAdvanced::LLFloaterPreferenceMoveAdvanced(const LLSD& key) +: LLFloater(key) +{ + mCommitCallbackRegistrar.add("Cancel", boost::bind(&LLFloaterPreferenceMoveAdvanced::onClickCancel, this)); + mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterPreferenceMoveAdvanced::onCommitSettings, this)); + mCommitCallbackRegistrar.add("Ok", boost::bind(&LLFloaterPreferenceMoveAdvanced::onClickOk, this)); + +} + +LLFloaterPreferenceMoveAdvanced::~LLFloaterPreferenceMoveAdvanced() +{} + +void LLFloaterPreferenceMoveAdvanced::onClickOk() +{ + closeFloater(); +} + +void LLFloaterPreferenceMoveAdvanced::onClickCancel() +{ + gSavedSettings.setVector3("CameraOffsetRearView", mCameraSaved); + gSavedSettings.setVector3d("FocusOffsetRearView", mFocusSaved); + + updateCameraControl(mCameraSaved); + updateFocusControl(mFocusSaved); +} + +BOOL LLFloaterPreferenceMoveAdvanced::postBuild() +{ + mCameraSaved = gSavedSettings.getVector3("CameraOffsetRearView"); + mFocusSaved = gSavedSettings.getVector3d("FocusOffsetRearView"); + + updateCameraControl(mCameraSaved); + updateFocusControl(mFocusSaved); + + return TRUE; +} + +void LLFloaterPreferenceMoveAdvanced::updateCameraControl(LLVector3 vector) +{ + LLSpinCtrl* spinnerx = getChild("camera_x"); + LLSpinCtrl* spinnery = getChild("camera_y"); + LLSpinCtrl* spinnerz = getChild("camera_z"); + + if (!spinnerx || !spinnery || !spinnerz) + { + LL_WARNS() << "Could not find all desired UI camera elements" + << LL_ENDL; + return; + } + + if (!spinnerx->hasFocus()) + { + spinnerx->setValue(vector[VX]); + } + + if (!spinnery->hasFocus()) + { + spinnery->setValue(vector[VY]); + } + + if (!spinnerz->hasFocus()) + { + spinnerz->setValue(vector[VZ]); + } +} + +void LLFloaterPreferenceMoveAdvanced::updateFocusControl(LLVector3d vector3d) +{ + LLSpinCtrl* spinnerx = getChild("focus_x"); + LLSpinCtrl* spinnery = getChild("focus_y"); + LLSpinCtrl* spinnerz = getChild("focus_z"); + + if (!spinnerx || !spinnery || !spinnerz) + { + LL_WARNS() << "Could not find all desired UI focus elements" + << LL_ENDL; + return; + } + + if (!spinnerx->hasFocus()) + { + spinnerx->setValue(vector3d[VX]); + } + + if (!spinnery->hasFocus()) + { + spinnery->setValue(vector3d[VY]); + } + + if (!spinnerz->hasFocus()) + { + spinnerz->setValue(vector3d[VZ]); + } +} + + void LLFloaterPreferenceMoveAdvanced::draw() +{ +// updateControl(); + LLFloater::draw(); +} + +void LLFloaterPreferenceMoveAdvanced::onCommitSettings() +{ + LLVector3 vector; + LLVector3d vector3d; + + vector.mV[VX] = (F32)getChild("camera_x")->getValue().asReal(); + vector.mV[VY] = (F32)getChild("camera_y")->getValue().asReal(); + vector.mV[VZ] = (F32)getChild("camera_z")->getValue().asReal(); + gSavedSettings.setVector3("CameraOffsetRearView", vector); + + vector3d.mdV[VX] = (F32)getChild("focus_x")->getValue().asReal(); + vector3d.mdV[VY] = (F32)getChild("focus_y")->getValue().asReal(); + vector3d.mdV[VZ] = (F32)getChild("focus_z")->getValue().asReal(); + gSavedSettings.setVector3d("FocusOffsetRearView", vector3d); +} diff --git a/indra/newview/llfloaterpreferencemoveadvanced.h b/indra/newview/llfloaterpreferencemoveadvanced.h new file mode 100644 index 0000000000..98648af19e --- /dev/null +++ b/indra/newview/llfloaterpreferencemoveadvanced.h @@ -0,0 +1,58 @@ +/** + * @file llfloaterpreferencemoveadvanced.h + * @brief floater for adjusting camera position + * + * $LicenseInfo:firstyear=2018&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2018, 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 LLFLOATERPREFERENCEMOVEADVANCED_H +#define LLFLOATERPREFERENCEMOVEADVANCED_H + +#include "llcontrol.h" +#include "llfloater.h" + +class LLFloaterPreferenceMoveAdvanced +: public LLFloater +{ + friend class LLFloaterReg; + +public: + LLFloaterPreferenceMoveAdvanced(const LLSD& key); + virtual BOOL postBuild(); + virtual void draw(); + + void onCommitSettings(); + void onClickCancel(); + void onClickOk(); + void updateCameraControl(LLVector3 vector); + void updateFocusControl(LLVector3d vector3d); + +private: + virtual ~LLFloaterPreferenceMoveAdvanced(); + + LLVector3 mCameraSaved; + LLVector3d mFocusSaved; + +}; + +#endif //LLFLOATERPREFERENCEMOVEADVANCED_H + diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp index 2c95c06c31..ffdfc445ce 100644 --- a/indra/newview/llpanelpresetscamerapulldown.cpp +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -64,9 +64,9 @@ BOOL LLPanelPresetsCameraPulldown::postBuild() if (presetsMgr) { presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPresetsCameraPulldown::populatePanel, this)); -LL_WARNS() << "DBG pulldown" << LL_ENDL; // Make sure there is a default preference file presetsMgr->createMissingDefault(PRESETS_CAMERA); + presetsMgr->startWatching(PRESETS_CAMERA); } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 80386b61f7..3daa6894f0 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -92,7 +92,6 @@ void LLPresetsManager::startWatching(const std::string& subdirectory) for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) { std::string ctrl_name = *it; -LL_WARNS() << "DBG starting watch on " << ctrl_name << LL_ENDL; if (gSavedSettings.controlExists(ctrl_name)) { LLPointer cntrl_ptr = gSavedSettings.getControl(ctrl_name); @@ -189,23 +188,18 @@ bool LLPresetsManager::isCameraDirty() void LLPresetsManager::settingChanged() { -LL_WARNS() << "DBG setting changed" << LL_ENDL; setCameraDirty(true); } void LLPresetsManager::getControlNames(std::vector& names) { names = boost::assign::list_of - ("CameraOffsetCustom0") - ("FocusOffsetCustom0") // From panel_preferences_move.xml ("CameraAngle") ("CameraOffsetScale") - ("CameraOpacity") ("EditCameraMovement") ("AppearanceCameraMovement") // From llagentcamera.cpp - ("RenderFarClip") ("CameraOffsetBuild") ("CameraPreset") ("CameraOffsetRearView") @@ -246,10 +240,6 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n else if(PRESETS_CAMERA == subdirectory) { gSavedSettings.setString("PresetGraphicActive", name); -// gSavedSettings.setU32("CameraPreset", CAMERA_PRESET_CUSTOM0); - -// gSavedSettings.setVector3d("CameraOffsetCustom0", gAgentCamera.calcCameraPositionTargetGlobal()); -// gSavedSettings.setVector3d("FocusOffsetCustom0", gAgentCamera.calcFocusPositionTargetGlobal()); getControlNames(name_list); name_list.push_back("PresetCameraActive"); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 0ebacddd9b..440bf46b1e 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -104,6 +104,7 @@ #include "llfloaterperms.h" #include "llfloaterpostprocess.h" #include "llfloaterpreference.h" +#include "llfloaterpreferencemoveadvanced.h" #include "llfloaterpreviewtrash.h" #include "llfloaterproperties.h" #include "llfloaterregiondebugconsole.h" @@ -295,6 +296,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_graphics_advanced", "floater_preferences_graphics_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("prefs_move_advanced", "floater_preferences_move_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_spellchecker_import", "floater_spellcheck_import.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml new file mode 100644 index 0000000000..28e5d2c607 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml @@ -0,0 +1,140 @@ + + + + + Camera offset: + + + + + + + + + + + + + + + + Focus offset: + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move.xml b/indra/newview/skins/default/xui/en/panel_preferences_move.xml index e4a5f5e283..d832dac4ff 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml @@ -127,6 +127,20 @@ tool_tip="Use automatic camera positioning while in edit mode" width="242" /> + + - - diff --git a/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml new file mode 100644 index 0000000000..5b2cbee914 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml @@ -0,0 +1,140 @@ + + + + + Camera offset: + + + + + + + + + + + + + + + + Focus offset: + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml index 7dee28eff3..a9cda26f0b 100644 --- a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml +++ b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml @@ -4,7 +4,7 @@ height="145" help_topic="floater_save_preset" layout="topleft" - name="Save Pref Preset" + name="save_pref_preset" save_rect="true" title="SAVE PREF PRESET" width="300"> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move.xml b/indra/newview/skins/default/xui/en/panel_preferences_move.xml index d832dac4ff..8d8441695f 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml @@ -138,7 +138,7 @@ width="115"> + parameter="prefs_view_advanced" /> - - - - - - - - - + + + + + + Preset in use: + + + + (None) + + + + + + Automatic position for: + + + + + + + + + + + + + + + -- cgit v1.2.3 From 7bf2a8c0a8b3baeade7ce5c828c4cfec41bef085 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 30 Jan 2018 11:28:24 -0500 Subject: replace space in "Pennys Gamer" settings with an underscore --- indra/newview/app_settings/camera/Pennys Gamer.xml | 115 --------------------- indra/newview/app_settings/camera/Pennys_Gamer.xml | 115 +++++++++++++++++++++ 2 files changed, 115 insertions(+), 115 deletions(-) delete mode 100644 indra/newview/app_settings/camera/Pennys Gamer.xml create mode 100644 indra/newview/app_settings/camera/Pennys_Gamer.xml (limited to 'indra') diff --git a/indra/newview/app_settings/camera/Pennys Gamer.xml b/indra/newview/app_settings/camera/Pennys Gamer.xml deleted file mode 100644 index 5d249153a0..0000000000 --- a/indra/newview/app_settings/camera/Pennys Gamer.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - AppearanceCameraMovement - - Comment - When entering appearance editing mode, camera zooms in on currently selected portion of avatar - Persist - 1 - Type - Boolean - Value - 1 - - CameraAngle - - Comment - Camera field of view angle (Radians) - Persist - 1 - Type - F32 - Value - 1.047197551 - - CameraOffsetBuild - - Comment - Default camera position relative to focus point when entering build mode - Persist - 1 - Type - Vector3 - Value - - -6 - 0 - 6 - - - CameraOffsetRearView - - Comment - Initial camera offset from avatar in Rear View - Persist - 1 - Type - Vector3 - Value - - -3.0 - 0.0 - -0.2 - - - CameraOffsetScale - - Comment - Scales the default offset - Persist - 1 - Type - F32 - Value - 1 - - EditCameraMovement - - Comment - When entering build mode, camera moves up above avatar - Persist - 1 - Type - Boolean - Value - 0 - - FocusOffsetRearView - - Comment - Initial focus point offset relative to avatar for the camera preset Rear View (x-axis is forward) - Persist - 1 - Type - Vector3D - Value - - 0.9 - 0.0 - 0.2 - - - PresetCameraActive - - Comment - Name of currently selected preference - Persist - 1 - Type - String - Value - Default - - TrackFocusObject - - Comment - Camera tracks last object zoomed on - Persist - 1 - Type - Boolean - Value - 1 - - - diff --git a/indra/newview/app_settings/camera/Pennys_Gamer.xml b/indra/newview/app_settings/camera/Pennys_Gamer.xml new file mode 100644 index 0000000000..5d249153a0 --- /dev/null +++ b/indra/newview/app_settings/camera/Pennys_Gamer.xml @@ -0,0 +1,115 @@ + + + AppearanceCameraMovement + + Comment + When entering appearance editing mode, camera zooms in on currently selected portion of avatar + Persist + 1 + Type + Boolean + Value + 1 + + CameraAngle + + Comment + Camera field of view angle (Radians) + Persist + 1 + Type + F32 + Value + 1.047197551 + + CameraOffsetBuild + + Comment + Default camera position relative to focus point when entering build mode + Persist + 1 + Type + Vector3 + Value + + -6 + 0 + 6 + + + CameraOffsetRearView + + Comment + Initial camera offset from avatar in Rear View + Persist + 1 + Type + Vector3 + Value + + -3.0 + 0.0 + -0.2 + + + CameraOffsetScale + + Comment + Scales the default offset + Persist + 1 + Type + F32 + Value + 1 + + EditCameraMovement + + Comment + When entering build mode, camera moves up above avatar + Persist + 1 + Type + Boolean + Value + 0 + + FocusOffsetRearView + + Comment + Initial focus point offset relative to avatar for the camera preset Rear View (x-axis is forward) + Persist + 1 + Type + Vector3D + Value + + 0.9 + 0.0 + 0.2 + + + PresetCameraActive + + Comment + Name of currently selected preference + Persist + 1 + Type + String + Value + Default + + TrackFocusObject + + Comment + Camera tracks last object zoomed on + Persist + 1 + Type + Boolean + Value + 1 + + + -- cgit v1.2.3 From 0bf50e2f8cfa5f3ccd6165ce935cf0fd9c174ced Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 30 Jan 2018 16:42:34 -0800 Subject: Cleanup on daycyle selection and stack. Move blenders into environment. (Transition bronken, instant only. Shaddows moved based on region, not parcel) --- indra/llinventory/llparcel.cpp | 15 - indra/llinventory/llparcel.h | 16 - indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsbase.h | 17 +- indra/llinventory/llsettingsdaycycle.cpp | 160 +---- indra/llinventory/llsettingsdaycycle.h | 50 +- indra/llinventory/llsettingssky.cpp | 2 +- indra/newview/llenvironment.cpp | 845 +++++++++++++++---------- indra/newview/llenvironment.h | 149 +++-- indra/newview/llfloatereditdaycycle.cpp | 3 +- indra/newview/llfloatereditextdaycycle.cpp | 10 +- indra/newview/llfloatereditsky.cpp | 10 +- indra/newview/llfloatereditwater.cpp | 10 +- indra/newview/llfloaterenvironmentsettings.cpp | 34 +- indra/newview/llfloaterland.cpp | 27 +- indra/newview/llfloaterregioninfo.cpp | 15 +- indra/newview/llviewermenu.cpp | 21 +- indra/newview/llviewerregion.cpp | 4 +- indra/newview/llviewerregion.h | 17 - 19 files changed, 696 insertions(+), 711 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 411c35ed6b..0908613c10 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -231,12 +231,6 @@ void LLParcel::init(const LLUUID &owner_id, setAllowGroupAVSounds(TRUE); setAllowAnyAVSounds(TRUE); setHaveNewParcelLimitData(FALSE); - - mDayLength = S64Seconds(LLSettingsDay::DEFAULT_DAYLENGTH); - mDayOffset = S64Seconds(LLSettingsDay::DEFAULT_DAYOFFSET); - mIsDefaultDayCycle = true; - mDayCycle.reset(); - mDayCycleHash = 0; } void LLParcel::overrideOwner(const LLUUID& owner_id, BOOL is_group_owned) @@ -1273,12 +1267,3 @@ U32 LLParcel::countExperienceKeyType( U32 type ) boost::end(mExperienceKeys | boost::adaptors::map_values), std::bind2nd(std::equal_to(), type)); } - -void LLParcel::clearParcelDayCycleInfo() -{ - mDayLength = S64Seconds(LLSettingsDay::DEFAULT_DAYLENGTH); - mDayOffset = S64Seconds(LLSettingsDay::DEFAULT_DAYOFFSET); - mIsDefaultDayCycle = true; - mDayCycle.reset(); - mDayCycleHash = 0; -} diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 6bbd5a949d..6ef389d246 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -590,18 +590,6 @@ public: LLUUID getPreviousOwnerID() const { return mPreviousOwnerID; } BOOL getPreviouslyGroupOwned() const { return mPreviouslyGroupOwned; } BOOL getSellWithObjects() const { return (mParcelFlags & PF_SELL_PARCEL_OBJECTS) ? TRUE : FALSE; } - - S64Seconds getDayLength() const { return mDayLength; } - void setDayLength(S64SecondsImplicit seconds) { mDayLength = seconds; } - S64Seconds getDayOffset() const { return mDayOffset; } - void setDayOffset(S64SecondsImplicit seconds) { mDayOffset = seconds; } - bool getUsesDefaultDayCycle() const { return mIsDefaultDayCycle; } - void setUsesDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; } - LLSettingsDay::ptr_t getParcelDayCycle() const { return mDayCycle; } - void setParcelDayCycle(const LLSettingsDay::ptr_t &pday) { mDayCycle = pday; } - size_t getParcelDayCycleHash() const { return mDayCycleHash; } - void setParcelDayCycleHash(size_t hash) { mDayCycleHash = hash; } - void clearParcelDayCycleInfo(); protected: LLUUID mID; @@ -677,11 +665,7 @@ protected: BOOL mAllowGroupAVSounds; BOOL mAllowAnyAVSounds; - S64Seconds mDayLength; - S64Seconds mDayOffset; bool mIsDefaultDayCycle; - LLSettingsDay::ptr_t mDayCycle; - size_t mDayCycleHash; public: // HACK, make private diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index a35504e0e6..ffeae8677f 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -592,12 +592,12 @@ void LLSettingsBlender::update(F64Seconds timedelta) { LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon mOnFinished(shared_from_this()); - mOnFinished.disconnect_all_slots(); // prevent from firing more than once. return; } F64 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value(); + //_WARNS("LAPRAS") << "blending at " << (blendf * 100.0f) << "%" << LL_ENDL; mTarget->replaceSettings(mInitial->getSettings()); mTarget->blend(mFinal, blendf); } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index fa5fb7a763..f5146b1c27 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -253,7 +253,6 @@ public: mFinal(endsetting), mSeconds(seconds), mOnFinished(), - mBlendThreshold(DEFAULT_THRESHOLD), mLastUpdate(0.0f), mTimeSpent(0.0f) { @@ -264,11 +263,11 @@ public: ~LLSettingsBlender() {} - void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 seconds ) + void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds ) { mInitial = initsetting; mFinal = endsetting; - mSeconds.value(seconds); + mSeconds = seconds; mTarget->replaceSettings(mInitial->getSettings()); mTimeStart.value(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; @@ -280,16 +279,6 @@ public: return mOnFinished.connect(onfinished); } - void setUpdateThreshold(F64Seconds threshold) - { - mBlendThreshold = threshold; - } - - F64Seconds getUpdateThreshold() const - { - return mBlendThreshold; - } - LLSettingsBase::ptr_t getTarget() const { return mTarget; @@ -306,13 +295,13 @@ public: } void update(F64Seconds time); + private: LLSettingsBase::ptr_t mTarget; LLSettingsBase::ptr_t mInitial; LLSettingsBase::ptr_t mFinal; F64Seconds mSeconds; finish_signal_t mOnFinished; - F64Seconds mBlendThreshold; F64Seconds mLastUpdate; F64Seconds mTimeSpent; F64Seconds mTimeStart; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 1b992ff313..9b0a6c1127 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -96,7 +96,6 @@ namespace } //========================================================================= -const std::string LLSettingsDay::SETTING_DAYLENGTH("day_length"); const std::string LLSettingsDay::SETTING_KEYID("key_id"); const std::string LLSettingsDay::SETTING_KEYNAME("key_name"); const std::string LLSettingsDay::SETTING_KEYKFRAME("key_keyframe"); @@ -104,13 +103,13 @@ const std::string LLSettingsDay::SETTING_KEYHASH("key_hash"); const std::string LLSettingsDay::SETTING_TRACKS("tracks"); const std::string LLSettingsDay::SETTING_FRAMES("frames"); -const S64 LLSettingsDay::MINIMUM_DAYLENGTH( 300); // 5 mins -const S64 LLSettingsDay::DEFAULT_DAYLENGTH( 14400); // 4 hours -const S64 LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days +const S64Seconds LLSettingsDay::MINIMUM_DAYLENGTH(300); // 5 mins +const S64Seconds LLSettingsDay::DEFAULT_DAYLENGTH(14400); // 4 hours +const S64Seconds LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days -const S32 LLSettingsDay::MINIMUM_DAYOFFSET( 0); -const S32 LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset) -const S32 LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours +const S64Seconds LLSettingsDay::MINIMUM_DAYOFFSET(0); +const S64Seconds LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset) +const S64Seconds LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0 const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water @@ -119,18 +118,14 @@ const S32 LLSettingsDay::FRAME_MAX(56); //========================================================================= LLSettingsDay::LLSettingsDay(const LLSD &data) : LLSettingsBase(data), - mInitialized(false), - mDayLength(DEFAULT_DAYLENGTH), - mDayOffset(DEFAULT_DAYOFFSET) + mInitialized(false) { mDayTracks.resize(TRACK_MAX); } LLSettingsDay::LLSettingsDay() : LLSettingsBase(), - mInitialized(false), - mDayLength(DEFAULT_DAYLENGTH), - mDayOffset(DEFAULT_DAYOFFSET) + mInitialized(false) { mDayTracks.resize(TRACK_MAX); } @@ -287,7 +282,6 @@ LLSD LLSettingsDay::defaults() LLSD dfltsetting; dfltsetting[SETTING_NAME] = "_default_"; - dfltsetting[SETTING_DAYLENGTH] = static_cast(MINIMUM_DAYLENGTH); dfltsetting[SETTING_TRACKS] = LLSDArray( LLSDArray(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_")) (LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_"))); @@ -376,12 +370,10 @@ namespace LLSD frame = (*itf).second; std::string ftype = frame[LLSettingsBase::SETTING_TYPE]; - LL_WARNS("LAPRAS") << "Validating frame: " << frame << LL_ENDL; if (ftype == "sky") { LLSettingsSky::validation_list_t valid_sky = LLSettingsSky::validationList(); LLSD res_sky = LLSettingsSky::settingValidation(frame, valid_sky); - LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_sky << LL_ENDL; if (res_sky["success"].asInteger() == 0) { @@ -395,7 +387,6 @@ namespace { LLSettingsWater::validation_list_t valid_h2o = LLSettingsWater::validationList(); LLSD res_h2o = LLSettingsWater::settingValidation(frame, valid_h2o); - LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_h2o << LL_ENDL; if (res_h2o["success"].asInteger() == 0) { LL_WARNS("SETTINGS") << "Water setting named '" << (*itf).first << "' validation failed!: " << res_h2o << LL_ENDL; @@ -456,23 +447,6 @@ LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track) return mDayTracks[track]; } -//========================================================================= -F32 LLSettingsDay::secondsToKeyframe(S64Seconds seconds) -{ - S64Seconds daylength = getDayLength(); - S64Seconds dayoffset = getDayOffset(); - - return llclamp(static_cast((seconds.value() + dayoffset.value()) % daylength.value()) / static_cast(daylength.value()), 0.0f, 1.0f); -} - -F64Seconds LLSettingsDay::keyframeToSeconds(F32 keyframe) -{ - S64Seconds daylength = getDayLength(); - S64Seconds dayoffset = getDayOffset(); - - return F64Seconds(static_cast(keyframe * static_cast(daylength.value())) - dayoffset.value()); -} - //========================================================================= void LLSettingsDay::startDayCycle() { @@ -484,63 +458,11 @@ void LLSettingsDay::startDayCycle() return; } - // water - if (mDayTracks[0].empty()) - { - mBlendedWater.reset(); - mWaterBlender.reset(); - } - else if (mDayTracks[0].size() == 1) - { - mBlendedWater = boost::static_pointer_cast((*(mDayTracks[0].begin())).second); - mWaterBlender.reset(); - } - else - { - TrackBound_t bounds = getBoundingEntries(mDayTracks[0], now); - - F64Seconds timespan = F64Seconds( getDayLength() * get_wrapping_distance((*bounds.first).first, (*bounds.second).first)); - - mBlendedWater = getDefaultWater(); - mWaterBlender = boost::make_shared(mBlendedWater, - (*bounds.first).second, (*bounds.second).second, timespan); - mWaterBlender->setOnFinished(boost::bind(&LLSettingsDay::onWaterTransitionDone, this, _1)); - } - - // sky - if (mDayTracks[1].empty()) - { - mBlendedSky.reset(); - mSkyBlender.reset(); - } - else if (mDayTracks[1].size() == 1) - { - mBlendedSky = boost::static_pointer_cast( (*(mDayTracks[1].begin())).second); - mSkyBlender.reset(); - } - else - { - TrackBound_t bounds = getBoundingEntries(mDayTracks[1], now); - F64Seconds timespan = F64Seconds(getDayLength() * get_wrapping_distance((*bounds.first).first, (*bounds.second).first)); - - mBlendedSky = getDefaultSky(); - mSkyBlender = boost::make_shared(mBlendedSky, - (*bounds.first).second, (*bounds.second).second, timespan); - mSkyBlender->setOnFinished(boost::bind(&LLSettingsDay::onSkyTransitionDone, this, 1, _1)); - } } void LLSettingsDay::updateSettings() { - static LLFrameTimer timer; - - F64Seconds delta(timer.getElapsedTimeAndResetF32()); - - if (mSkyBlender) - mSkyBlender->update(delta); - if (mWaterBlender) - mWaterBlender->update(delta); } //========================================================================= @@ -565,30 +487,6 @@ LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) return keyframes; } -LLSettingsDay::TimeList_t LLSettingsDay::getTrackTimes(S32 trackno) -{ - KeyframeList_t keyframes = getTrackKeyframes(trackno); - - if (keyframes.empty()) - return TimeList_t(); - - TimeList_t times; - - times.reserve(keyframes.size()); - for (KeyframeList_t::iterator it = keyframes.begin(); it != keyframes.end(); ++it) - { - times.push_back(keyframeToSeconds(*it)); - } - - return times; -} - -void LLSettingsDay::setWaterAtTime(const LLSettingsWaterPtr_t &water, S64Seconds seconds) -{ - F32 keyframe = secondsToKeyframe(seconds); - setWaterAtKeyframe(water, keyframe); -} - void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe) { mDayTracks[TRACK_WATER][llclamp(keyframe, 0.0f, 1.0f)] = water; @@ -596,12 +494,6 @@ void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 ke } -void LLSettingsDay::setSkyAtTime(const LLSettingsSkyPtr_t &sky, S64Seconds seconds, S32 track) -{ - F32 keyframe = secondsToKeyframe(seconds); - setSkyAtKeyframe(sky, keyframe, track); -} - void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track) { if ((track < 1) || (track >= TRACK_MAX)) @@ -619,40 +511,4 @@ LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::Cyc return TrackBound_t(get_wrapping_atbefore(track, keyframe), get_wrapping_atafter(track, keyframe)); } -LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, F64Seconds time) -{ - F32 frame = secondsToKeyframe(time); - - return getBoundingEntries(track, frame); -} - //========================================================================= -void LLSettingsDay::onSkyTransitionDone(S32 track, const LLSettingsBlender::ptr_t &blender) -{ - F64Seconds now(LLDate::now().secondsSinceEpoch()); - TrackBound_t bounds = getBoundingEntries(mDayTracks[track], now); - - F32 distance = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); - F64Seconds timespan = F64Seconds(distance * getDayLength()); - - LL_DEBUGS("DAYCYCLE") << "New sky blender. now=" << now << - " start=" << (*bounds.first).first << " end=" << (*bounds.second).first << - " span=" << timespan << LL_ENDL; - - mSkyBlender = boost::make_shared(mBlendedSky, - (*bounds.first).second, (*bounds.second).second, timespan); - mSkyBlender->setOnFinished(boost::bind(&LLSettingsDay::onSkyTransitionDone, this, track, _1)); -} - -void LLSettingsDay::onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender) -{ - F64Seconds now(LLDate::now().secondsSinceEpoch()); - TrackBound_t bounds = getBoundingEntries(mDayTracks[0], now); - - F32 distance = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); - F64Seconds timespan = F64Seconds(distance * getDayLength()); - - mWaterBlender = boost::make_shared(mBlendedWater, - (*bounds.first).second, (*bounds.second).second, timespan); - mWaterBlender->setOnFinished(boost::bind(&LLSettingsDay::onWaterTransitionDone, this, _1)); -} diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 4a7bc02871..8a1634d674 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -39,7 +39,6 @@ typedef boost::shared_ptr LLSettingsSkyPtr_t; class LLSettingsDay : public LLSettingsBase { public: - static const std::string SETTING_DAYLENGTH; static const std::string SETTING_KEYID; static const std::string SETTING_KEYNAME; static const std::string SETTING_KEYKFRAME; @@ -47,13 +46,13 @@ public: static const std::string SETTING_TRACKS; static const std::string SETTING_FRAMES; - static const S64 MINIMUM_DAYLENGTH; - static const S64 DEFAULT_DAYLENGTH; - static const S64 MAXIMUM_DAYLENGTH; + static const S64Seconds MINIMUM_DAYLENGTH; + static const S64Seconds DEFAULT_DAYLENGTH; + static const S64Seconds MAXIMUM_DAYLENGTH; - static const S32 MINIMUM_DAYOFFSET; - static const S32 DEFAULT_DAYOFFSET; - static const S32 MAXIMUM_DAYOFFSET; + static const S64Seconds MINIMUM_DAYOFFSET; + static const S64Seconds DEFAULT_DAYOFFSET; + static const S64Seconds MAXIMUM_DAYOFFSET; static const S32 TRACK_WATER; static const S32 TRACK_MAX; @@ -62,7 +61,6 @@ public: typedef std::map CycleTrack_t; typedef std::vector CycleList_t; typedef boost::shared_ptr ptr_t; - typedef std::vector TimeList_t; typedef std::vector KeyframeList_t; typedef std::pair TrackBound_t; @@ -86,26 +84,12 @@ public: //--------------------------------------------------------------------- KeyframeList_t getTrackKeyframes(S32 track); - TimeList_t getTrackTimes(S32 track); - void setWaterAtTime(const LLSettingsWaterPtr_t &water, S64Seconds seconds); void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe); - - void setSkyAtTime(const LLSettingsSkyPtr_t &sky, S64Seconds seconds, S32 track); void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track); //--------------------------------------------------------------------- void startDayCycle(); - LLSettingsSkyPtr_t getCurrentSky() const - { - return mBlendedSky; - } - - LLSettingsWaterPtr_t getCurrentWater() const - { - return mBlendedWater; - } - virtual LLSettingsSkyPtr_t getDefaultSky() const = 0; virtual LLSettingsWaterPtr_t getDefaultWater() const = 0; @@ -121,11 +105,6 @@ public: virtual validation_list_t getValidationList() const; static validation_list_t validationList(); - S64Seconds getDayLength() const { return mDayLength; } - void setDayLength(S64Seconds val ) { mDayLength = val; } - S64Seconds getDayOffset() const { return mDayOffset; } - void setDayOffset(S64Seconds val) { mDayOffset = val; } - protected: LLSettingsDay(); @@ -134,32 +113,19 @@ protected: bool mInitialized; private: - LLSettingsBlender::ptr_t mSkyBlender; // convert to [] for altitudes - LLSettingsBlender::ptr_t mWaterBlender; - - LLSettingsSkyPtr_t mBlendedSky; - LLSettingsWaterPtr_t mBlendedWater; - CycleList_t mDayTracks; F64Seconds mLastUpdateTime; - S64Seconds mDayLength; - S64Seconds mDayOffset; - - F32 secondsToKeyframe(S64Seconds seconds); - F64Seconds keyframeToSeconds(F32 keyframe); - void parseFromLLSD(LLSD &data); static CycleTrack_t::iterator getEntryAtOrBefore(CycleTrack_t &track, F32 keyframe); static CycleTrack_t::iterator getEntryAtOrAfter(CycleTrack_t &track, F32 keyframe); TrackBound_t getBoundingEntries(CycleTrack_t &track, F32 keyframe); - TrackBound_t getBoundingEntries(CycleTrack_t &track, F64Seconds time); - void onSkyTransitionDone(S32 track, const LLSettingsBlender::ptr_t &blender); - void onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender); +// void onSkyTransitionDone(S32 track, const LLSettingsBlender::ptr_t &blender); +// void onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender); }; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c02d99fb67..32b292e384 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -265,7 +265,7 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); - dfltsetting[SETTING_BLOOM_TEXTUREID] = LLUUID::null; + dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; dfltsetting[SETTING_CLOUD_TEXTUREID] = LLUUID::null; dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! dfltsetting[SETTING_SUN_TEXUTUREID] = IMG_SUN; // gSunTextureID; diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 25c7fb89db..db8fd570c0 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -83,28 +83,26 @@ LLEnvironment::LLEnvironment(): mDayCycleByName(), mDayCycleById(), mUserPrefs(), - mSelectedEnvironment(ENV_LOCAL), - mDayLength(LLSettingsDay::DEFAULT_DAYLENGTH), - mDayOffset(LLSettingsDay::DEFAULT_DAYOFFSET) + mSelectedEnvironment(LLEnvironment::ENV_LOCAL) { - mSetSkys.resize(ENV_END); - mSetWater.resize(ENV_END); - mSetDays.resize(ENV_END); } void LLEnvironment::initSingleton() { LLSettingsSky::ptr_t p_default_sky = LLSettingsVOSky::buildDefaultSky(); addSky(p_default_sky); - mCurrentSky = p_default_sky; LLSettingsWater::ptr_t p_default_water = LLSettingsVOWater::buildDefaultWater(); addWater(p_default_water); - mCurrentWater = p_default_water; LLSettingsDay::ptr_t p_default_day = LLSettingsVODay::buildDefaultDayCycle(); addDayCycle(p_default_day); - mCurrentDay.reset(); + + mCurrentEnvironment = boost::make_shared(); + mCurrentEnvironment->setSky(p_default_sky); + mCurrentEnvironment->setWater(p_default_water); + + mEnvironments[ENV_DEFAULT] = mCurrentEnvironment; // LEGACY! legacyLoadAllPresets(); @@ -181,17 +179,16 @@ void LLEnvironment::onLegacyRegionSettings(LLSD data) else regionday = LLSettingsVODay::buildFromLegacyMessage(regionId, data[1], data[2], data[3]); - setSkyFor(ENV_REGION, LLSettingsSky::ptr_t()); - setWaterFor(ENV_REGION, LLSettingsWater::ptr_t()); - setDayFor(ENV_REGION, regionday); + clearEnvironment(ENV_PARCEL); + setEnvironment(ENV_REGION, regionday, LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET); - applyChosenEnvironment(); + updateEnvironment(); } //------------------------------------------------------------------------- F32 LLEnvironment::getCamHeight() const { - return (mCurrentSky->getDomeOffset() * mCurrentSky->getDomeRadius()); + return (mCurrentEnvironment->getSky()->getDomeOffset() * mCurrentEnvironment->getSky()->getDomeRadius()); } F32 LLEnvironment::getWaterHeight() const @@ -201,21 +198,191 @@ F32 LLEnvironment::getWaterHeight() const bool LLEnvironment::getIsDayTime() const { - return mCurrentSky->getSunDirection().mV[2] > NIGHTTIME_ELEVATION_COS; + return mCurrentEnvironment->getSky()->getSunDirection().mV[2] > NIGHTTIME_ELEVATION_COS; +} + +//------------------------------------------------------------------------- +void LLEnvironment::setSelectedEnvironment(LLEnvironment::EnvSelection_t env, F64Seconds transition) +{ + mSelectedEnvironment = env; + updateEnvironment(transition); +} + +bool LLEnvironment::hasEnvironment(LLEnvironment::EnvSelection_t env) +{ + if ((env < ENV_EDIT) || (env >= ENV_DEFAULT) || (!mEnvironments[env])) + { + return false; + } + + return true; +} + +LLEnvironment::DayInstance::ptr_t LLEnvironment::getEnvironmentInstance(LLEnvironment::EnvSelection_t env, bool create /*= false*/) +{ + DayInstance::ptr_t environment = mEnvironments[env]; + if (!environment && create) + { + environment = boost::make_shared(); + mEnvironments[env] = environment; + } + + return environment; +} + + +void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, const LLSettingsDay::ptr_t &pday, S64Seconds daylength, S64Seconds dayoffset) +{ + if ((env < ENV_EDIT) || (env >= ENV_DEFAULT)) + { + LL_WARNS("ENVIRONMENT") << "Attempt to change invalid environment selection." << LL_ENDL; + return; + } + + DayInstance::ptr_t environment = getEnvironmentInstance(env, true); + + environment->clear(); + environment->setDay(pday, daylength, dayoffset); + environment->animate(); + /*TODO: readjust environment*/ +} + + +void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironment::fixedEnvironment_t fixed) +{ + if ((env < ENV_EDIT) || (env >= ENV_DEFAULT)) + { + LL_WARNS("ENVIRONMENT") << "Attempt to change invalid environment selection." << LL_ENDL; + return; + } + + DayInstance::ptr_t environment = getEnvironmentInstance(env, true); + + environment->clear(); + environment->setSky((fixed.first) ? fixed.first : mEnvironments[ENV_DEFAULT]->getSky()); + environment->setWater((fixed.second) ? fixed.second : mEnvironments[ENV_DEFAULT]->getWater()); + + /*TODO: readjust environment*/ +} + + +void LLEnvironment::clearEnvironment(LLEnvironment::EnvSelection_t env) +{ + if ((env < ENV_EDIT) || (env >= ENV_DEFAULT)) + { + LL_WARNS("ENVIRONMENT") << "Attempt to change invalid environment selection." << LL_ENDL; + return; + } + + mEnvironments[env].reset(); + /*TODO: readjust environment*/ } -void LLEnvironment::setDayLength(S64Seconds seconds) +LLSettingsDay::ptr_t LLEnvironment::getEnvironmentDay(LLEnvironment::EnvSelection_t env) { - mDayLength = seconds; - if (mCurrentDay) - mCurrentDay->setDayLength(mDayLength); + if ((env < ENV_EDIT) || (env > ENV_DEFAULT)) + { + LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection." << LL_ENDL; + return LLSettingsDay::ptr_t(); + } + + DayInstance::ptr_t environment = getEnvironmentInstance(env); + + if (environment) + return environment->getDayCycle(); + + return LLSettingsDay::ptr_t(); +} + +S64Seconds LLEnvironment::getEnvironmentDayLength(EnvSelection_t env) +{ + if ((env < ENV_EDIT) || (env > ENV_DEFAULT)) + { + LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection." << LL_ENDL; + return S64Seconds(0); + } + + DayInstance::ptr_t environment = getEnvironmentInstance(env); + + if (environment) + return environment->getDayLength(); + + return S64Seconds(0); +} + +S64Seconds LLEnvironment::getEnvironmentDayOffset(EnvSelection_t env) +{ + if ((env < ENV_EDIT) || (env > ENV_DEFAULT)) + { + LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection." << LL_ENDL; + return S64Seconds(0); + } + + DayInstance::ptr_t environment = getEnvironmentInstance(env); + if (environment) + return environment->getDayOffset(); + + return S64Seconds(0); +} + + +LLEnvironment::fixedEnvironment_t LLEnvironment::getEnvironmentFixed(LLEnvironment::EnvSelection_t env) +{ + if ((env < ENV_EDIT) || (env > ENV_DEFAULT)) + { + LL_WARNS("ENVIRONMENT") << "Attempt to retrieve invalid environment selection." << LL_ENDL; + return fixedEnvironment_t(); + } + + DayInstance::ptr_t environment = getEnvironmentInstance(env); + + if (environment) + return fixedEnvironment_t(environment->getSky(), environment->getWater()); + + return fixedEnvironment_t(); +} + +LLEnvironment::DayInstance::ptr_t LLEnvironment::getSelectedEnvironmentInstance() +{ + for (S32 idx = mSelectedEnvironment; idx < ENV_DEFAULT; ++idx) + { + if (mEnvironments[idx]) + return mEnvironments[idx]; + } + + return mEnvironments[ENV_DEFAULT]; +} + + +void LLEnvironment::updateEnvironment(F64Seconds transition) +{ + DayInstance::ptr_t pinstance = getSelectedEnvironmentInstance(); + + if (mCurrentEnvironment != pinstance) + { + LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); + LLSettingsWater::ptr_t pwater = mCurrentEnvironment->getWater(); + + LLSettingsSky::ptr_t ptargetsky = psky->buildClone(); + LLSettingsWater::ptr_t ptargetwater = pwater->buildClone(); + + LLSettingsBlender::ptr_t skyblend = boost::make_shared(ptargetsky, psky, pinstance->getSky(), transition); + skyblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, true)); + LLSettingsBlender::ptr_t waterblend = boost::make_shared(ptargetwater, pwater, pinstance->getWater(), transition); + waterblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, false)); + + pinstance->setBlenders(skyblend, waterblend); + + mCurrentEnvironment = pinstance; + + mCurrentEnvironment->animate(); + } } -void LLEnvironment::setDayOffset(S64Seconds seconds) +void LLEnvironment::onTransitionDone(const LLSettingsBlender::ptr_t &blender, bool isSky) { - mDayOffset = seconds; - if (mCurrentDay) - mCurrentDay->setDayOffset(seconds); + /*TODO: Test for both sky and water*/ + mCurrentEnvironment->animate(); } //------------------------------------------------------------------------- @@ -227,21 +394,28 @@ void LLEnvironment::update(const LLViewerCamera * cam) F32Seconds delta(timer.getElapsedTimeAndResetF32()); - if (mBlenderSky) - mBlenderSky->update(delta); - if (mBlenderWater) - mBlenderWater->update(delta); + for (InstanceArray_t::iterator it = mEnvironments.begin(); it != mEnvironments.end(); ++it) + { + if (*it) + (*it)->update(delta); + } // update clouds, sun, and general updateCloudScroll(); - if (mCurrentDay) - mCurrentDay->update(); - - if (mCurrentSky) - mCurrentSky->update(); - if (mCurrentWater) - mCurrentWater->update(); +// if (mBlenderSky) +// mBlenderSky->update(delta); +// if (mBlenderWater) +// mBlenderWater->update(delta); +// +// +// if (mCurrentDay) +// mCurrentDay->update(); +// +// if (mCurrentEnvironment->getSky()) +// mCurrentEnvironment->getSky()->update(); +// if (mCurrentEnvironment->getWater()) +// mCurrentEnvironment->getWater()->update(); F32 camYaw = cam->getYaw(); @@ -277,10 +451,11 @@ void LLEnvironment::updateCloudScroll() F64 delta_t = s_cloud_timer.getElapsedTimeAndResetF64(); - LLVector2 cloud_delta = static_cast(delta_t)* (mCurrentSky->getCloudScrollRate() - LLVector2(10.0, 10.0)) / 100.0; - mCloudScrollDelta += cloud_delta; - - + if (mCurrentEnvironment->getSky()) + { + LLVector2 cloud_delta = static_cast(delta_t)* (mCurrentEnvironment->getSky()->getCloudScrollRate() - LLVector2(10.0, 10.0)) / 100.0; + mCloudScrollDelta += cloud_delta; + } } @@ -352,11 +527,10 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS void LLEnvironment::updateShaderUniforms(LLGLSLShader *shader) { - if (gPipeline.canUseWindLightShaders()) { - updateGLVariablesForSettings(shader, mCurrentSky); - updateGLVariablesForSettings(shader, mCurrentWater); + updateGLVariablesForSettings(shader, mCurrentEnvironment->getSky()); + updateGLVariablesForSettings(shader, mCurrentEnvironment->getWater()); } if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT) @@ -374,237 +548,8 @@ void LLEnvironment::updateShaderUniforms(LLGLSLShader *shader) } shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, getSceneLightStrength()); - - -} -//-------------------------------------------------------------------------- -void LLEnvironment::selectSky(const std::string &name, F32Seconds transition) -{ - LLSettingsSky::ptr_t next_sky = findSkyByName(name); - if (!next_sky) - { - LL_WARNS("ENVIRONMENT") << "Unable to select sky with unknown name '" << name << "'" << LL_ENDL; - return; - } - - selectSky(next_sky, transition); -} - -void LLEnvironment::selectSky(const LLSettingsSky::ptr_t &sky, F32Seconds transition) -{ - if (!sky) - { - mCurrentSky = mSelectedSky; - mBlenderSky.reset(); - return; - } - mSelectedSky = sky; - if (fabs(transition.value()) <= F_ALMOST_ZERO) - { - mBlenderSky.reset(); - mCurrentSky = sky; - mCurrentSky->setDirtyFlag(true); - mSelectedSky = sky; - } - else - { - LLSettingsSky::ptr_t skytarget = mCurrentSky->buildClone(); - - mBlenderSky = boost::make_shared( skytarget, mCurrentSky, sky, transition ); - mBlenderSky->setOnFinished(boost::bind(&LLEnvironment::onSkyTransitionDone, this, _1)); - mCurrentSky = skytarget; - mSelectedSky = sky; - } -} - -void LLEnvironment::onSkyTransitionDone(const LLSettingsBlender::ptr_t &blender) -{ - mCurrentSky = mSelectedSky; - mBlenderSky.reset(); -} - -void LLEnvironment::selectWater(const std::string &name, F32Seconds transition) -{ - LLSettingsWater::ptr_t next_water = findWaterByName(name); - - if (!next_water) - { - LL_WARNS("ENVIRONMENT") << "Unable to select water with unknown name '" << name << "'" << LL_ENDL; - return; - } - - selectWater(next_water, transition); -} - -void LLEnvironment::selectWater(const LLSettingsWater::ptr_t &water, F32Seconds transition) -{ - if (!water) - { - mCurrentWater = mSelectedWater; - mBlenderWater.reset(); - return; - } - mSelectedWater = water; - if (fabs(transition.value()) <= F_ALMOST_ZERO) - { - mBlenderWater.reset(); - mCurrentWater = water; - mCurrentWater->setDirtyFlag(true); - mSelectedWater = water; - } - else - { - LLSettingsWater::ptr_t watertarget = mCurrentWater->buildClone(); - - mBlenderWater = boost::make_shared(watertarget, mCurrentWater, water, transition); - mBlenderWater->setOnFinished(boost::bind(&LLEnvironment::onWaterTransitionDone, this, _1)); - mCurrentWater = watertarget; - mSelectedWater = water; - } -} - -void LLEnvironment::onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender) -{ - mCurrentWater = mSelectedWater; - mBlenderWater.reset(); -} - -void LLEnvironment::selectDayCycle(const std::string &name, F32Seconds transition) -{ - LLSettingsDay::ptr_t next_daycycle = findDayCycleByName(name); - - if (!next_daycycle) - { - LL_WARNS("ENVIRONMENT") << "Unable to select daycycle with unknown name '" << name << "'" << LL_ENDL; - return; - } - - selectDayCycle(next_daycycle, transition); -} - -void LLEnvironment::selectDayCycle(const LLSettingsDay::ptr_t &daycycle, F32Seconds transition) -{ - if (!daycycle || (daycycle == mCurrentDay)) - { - return; - } - - mCurrentDay = daycycle; - mCurrentDay->setDayLength(mDayLength); - mCurrentDay->setDayOffset(mDayOffset); - - daycycle->startDayCycle(); - selectWater(daycycle->getCurrentWater(), transition); - selectSky(daycycle->getCurrentSky(), transition); -} - - -void LLEnvironment::setSelectedEnvironment(EnvSelection_t env) -{ - if (env == mSelectedEnvironment) - { // No action to take - return; - } - - mSelectedEnvironment = env; - applyChosenEnvironment(); -} - -void LLEnvironment::applyChosenEnvironment() -{ - mSelectedSky.reset(); - mSelectedWater.reset(); - mSelectedDay.reset(); - - for (S32 idx = mSelectedEnvironment; idx < ENV_END; ++idx) - { - if (mSetDays[idx] && !mSelectedSky && !mSelectedWater) - selectDayCycle(mSetDays[idx]); - if (mSetSkys[idx] && !mSelectedSky) - selectSky(mSetSkys[idx]); - if (mSetWater[idx] && !mSelectedWater) - selectWater(mSetWater[idx]); - if (mSelectedSky && mSelectedWater) - return; - } - - if (!mSelectedSky) - selectSky("Default"); - if (!mSelectedWater) - selectWater("Default"); -} - -LLSettingsSky::ptr_t LLEnvironment::getChosenSky() const -{ - for (S32 idx = mSelectedEnvironment; idx < ENV_END; ++idx) - { - if (mSetSkys[idx]) - return mSetSkys[idx]; - } - - return LLSettingsSky::ptr_t(); -} - -LLSettingsWater::ptr_t LLEnvironment::getChosenWater() const -{ - for (S32 idx = mSelectedEnvironment; idx < ENV_END; ++idx) - { - if (mSetWater[idx]) - return mSetWater[idx]; - } - - return LLSettingsWater::ptr_t(); -} - -LLSettingsDay::ptr_t LLEnvironment::getChosenDay() const -{ - for (S32 idx = mSelectedEnvironment; idx < ENV_END; ++idx) - { - if (mSetDays[idx]) - return mSetDays[idx]; - } - - return LLSettingsDay::ptr_t(); -} - -void LLEnvironment::setSkyFor(EnvSelection_t env, const LLSettingsSky::ptr_t &sky) -{ - mSetSkys[env] = sky; -} - -LLSettingsSky::ptr_t LLEnvironment::getSkyFor(EnvSelection_t env) const -{ - return mSetSkys[env]; -} - -void LLEnvironment::setWaterFor(EnvSelection_t env, const LLSettingsWater::ptr_t &water) -{ - mSetWater[env] = water; -} - -LLSettingsWater::ptr_t LLEnvironment::getWaterFor(EnvSelection_t env) const -{ - return mSetWater[env]; -} - -void LLEnvironment::setDayFor(EnvSelection_t env, const LLSettingsDay::ptr_t &day) -{ - mSetDays[env] = day; -} - -LLSettingsDay::ptr_t LLEnvironment::getDayFor(EnvSelection_t env) const -{ - return mSetDays[env]; -} - -void LLEnvironment::clearUserSettings() -{ - mSetSkys[ENV_LOCAL].reset(); - mSetWater[ENV_LOCAL].reset(); - mSetDays[ENV_LOCAL].reset(); } - LLEnvironment::list_name_id_t LLEnvironment::getSkyList() const { list_name_id_t list; @@ -778,42 +723,6 @@ LLSettingsDay::ptr_t LLEnvironment::findDayCycleByName(std::string name) const } -void LLEnvironment::selectAgentEnvironment() -{ - S64Seconds day_length(LLSettingsDay::DEFAULT_DAYLENGTH); - S64Seconds day_offset(LLSettingsDay::DEFAULT_DAYOFFSET); - LLSettingsDay::ptr_t pday; - - // TODO: Test if editing environment has been set. - - // TODO: Test if agent has local environment set. - - LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); - LLViewerRegion *pRegion = gAgent.getRegion(); - - if (!parcel || parcel->getUsesDefaultDayCycle() || !parcel->getParcelDayCycle()) - { - day_length = pRegion->getDayLength(); - day_offset = pRegion->getDayOffset(); - pday = pRegion->getRegionDayCycle(); - } - else - { - day_length = parcel->getDayLength(); - day_offset = parcel->getDayOffset(); - pday = parcel->getParcelDayCycle(); - } - - if (getDayLength() != day_length) - setDayLength(day_length); - - if (getDayOffset() != day_offset) - setDayOffset(day_offset); - - if (pday) - selectDayCycle(pday); -} - void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envinfo) { LL_WARNS("ENVIRONMENT") << "Have environment" << LL_ENDL; @@ -824,48 +733,65 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI if (envinfo->mParcelId == INVALID_PARCEL_ID) { // the returned info applies to an entire region. - LLViewerRegion *pRegion = gAgent.getRegion(); - - pRegion->setDayLength(envinfo->mDayLength); - pRegion->setDayOffset(envinfo->mDayOffset); - pRegion->setIsDefaultDayCycle(envinfo->mIsDefault); - if (pRegion->getRegionDayCycleHash() != envinfo->mDayHash) - { - pRegion->setRegionDayCycle(pday); - pRegion->setRegionDayCycleHash(envinfo->mDayHash); - } - + LL_WARNS("LAPRAS") << "Setting Region environment" << LL_ENDL; + setEnvironment(ENV_REGION, pday, envinfo->mDayLength, envinfo->mDayOffset); if (parcel_id != INVALID_PARCEL_ID) - { // We requested a parcel environment but got back the region's. If this is the parcel we are in - // clear it out. - LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); - - if (parcel->getLocalID() == parcel_id) - { - parcel->clearParcelDayCycleInfo(); - } + { + LL_WARNS("LAPRAS") << "Had requested parcel environment #" << parcel_id << " but got region." << LL_ENDL; + clearEnvironment(ENV_PARCEL); } +// LLViewerRegion *pRegion = gAgent.getRegion(); +// +// pRegion->setDayLength(envinfo->mDayLength); +// pRegion->setDayOffset(envinfo->mDayOffset); +// pRegion->setIsDefaultDayCycle(envinfo->mIsDefault); +// if (pRegion->getRegionDayCycleHash() != envinfo->mDayHash) +// { +// pRegion->setRegionDayCycle(pday); +// pRegion->setRegionDayCycleHash(envinfo->mDayHash); +// } +// +// if (parcel_id != INVALID_PARCEL_ID) +// { // We requested a parcel environment but got back the region's. If this is the parcel we are in +// // clear it out. +// LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); +// +// if (parcel->getLocalID() == parcel_id) +// { +// parcel->clearParcelDayCycleInfo(); +// } +// } } else { LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); - if (parcel->getLocalID() == parcel_id) + LL_WARNS("LAPRAS") << "Have parcel environment #" << envinfo->mParcelId << LL_ENDL; + if (parcel && (parcel->getLocalID() != parcel_id)) { - parcel->setDayLength(envinfo->mDayLength); - parcel->setDayOffset(envinfo->mDayOffset); - parcel->setUsesDefaultDayCycle(envinfo->mIsDefault); - if (parcel->getParcelDayCycleHash() != envinfo->mDayHash) - { - parcel->setParcelDayCycle(pday); - parcel->setParcelDayCycleHash(envinfo->mDayHash); - } - + LL_WARNS("ENVIRONMENT") << "Requested parcel #" << parcel_id << " agent is on " << parcel->getLocalID() << LL_ENDL; + return; } + + setEnvironment(ENV_PARCEL, pday, envinfo->mDayLength, envinfo->mDayOffset); +// LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); +// +// if (parcel->getLocalID() == parcel_id) +// { +// parcel->setDayLength(envinfo->mDayLength); +// parcel->setDayOffset(envinfo->mDayOffset); +// parcel->setUsesDefaultDayCycle(envinfo->mIsDefault); +// if (parcel->getParcelDayCycleHash() != envinfo->mDayHash) +// { +// parcel->setParcelDayCycle(pday); +// parcel->setParcelDayCycleHash(envinfo->mDayHash); +// } +// +// } } /*TODO: track_altitudes*/ - selectAgentEnvironment(); + updateEnvironment(); } //========================================================================= @@ -1337,3 +1263,250 @@ void LLEnvironment::legacyLoadAllPresets() } } } + +//========================================================================= +namespace +{ + inline F32 get_wrapping_distance(F32 begin, F32 end) + { + if (begin < end) + { + return end - begin; + } + else if (begin > end) + { + return 1.0 - (begin - end); + } + + return 0; + } + + LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, F32 key) + { + if (collection.empty()) + return collection.end(); + + LLSettingsDay::CycleTrack_t::iterator it = collection.upper_bound(key); + + if (it == collection.end()) + { // wrap around + it = collection.begin(); + } + + return it; + } + + LLSettingsDay::CycleTrack_t::iterator get_wrapping_atbefore(LLSettingsDay::CycleTrack_t &collection, F32 key) + { + if (collection.empty()) + return collection.end(); + + LLSettingsDay::CycleTrack_t::iterator it = collection.lower_bound(key); + + if (it == collection.end()) + { // all keyframes are lower, take the last one. + --it; // we know the range is not empty + } + else if ((*it).first > key) + { // the keyframe we are interested in is smaller than the found. + if (it == collection.begin()) + it = collection.end(); + --it; + } + + return it; + } + + LLSettingsDay::TrackBound_t get_bounding_entries(LLSettingsDay::CycleTrack_t &track, F32 keyframe) + { + return LLSettingsDay::TrackBound_t(get_wrapping_atbefore(track, keyframe), get_wrapping_atafter(track, keyframe)); + } + +} +//========================================================================= + + +LLEnvironment::DayInstance::DayInstance() : + mDayCycle(), + mSky(), + mWater(), + mDayLength(LLSettingsDay::DEFAULT_DAYLENGTH), + mDayOffset(LLSettingsDay::DEFAULT_DAYOFFSET), + mBlenderSky(), + mBlenderWater(), + mInitialized(false), + mType(TYPE_INVALID) +{ } + +void LLEnvironment::DayInstance::update(F64Seconds delta) +{ + if (!mInitialized) + initialize(); + + if (mBlenderSky) + mBlenderSky->update(delta); + if (mBlenderWater) + mBlenderWater->update(delta); + + if (mSky) + mSky->update(); + if (mWater) + mWater->update(); +} + +void LLEnvironment::DayInstance::setDay(const LLSettingsDay::ptr_t &pday, S64Seconds daylength, S64Seconds dayoffset) +{ + if (mType == TYPE_FIXED) + LL_WARNS("ENVIRONMENT") << "Fixed day instance changed to Cycled" << LL_ENDL; + mType = TYPE_CYCLED; + mInitialized = false; + + mDayCycle = pday; + mDayLength = daylength; + mDayOffset = dayoffset; + + mBlenderSky.reset(); + mBlenderWater.reset(); + + mSky = LLSettingsVOSky::buildDefaultSky(); + mWater = LLSettingsVOWater::buildDefaultWater(); + + animate(); +} + + +void LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky) +{ + if (mType == TYPE_CYCLED) + LL_WARNS("ENVIRONMENT") << "Cycled day instance changed to FIXED" << LL_ENDL; + mType = TYPE_FIXED; + mInitialized = false; + + mSky = psky; + mBlenderSky.reset(); +} + +void LLEnvironment::DayInstance::setWater(const LLSettingsWater::ptr_t &pwater) +{ + if (mType == TYPE_CYCLED) + LL_WARNS("ENVIRONMENT") << "Cycled day instance changed to FIXED" << LL_ENDL; + mType = TYPE_FIXED; + mInitialized = false; + + mWater = pwater; + mBlenderWater.reset(); +} + +void LLEnvironment::DayInstance::initialize() +{ + mInitialized = true; + + if (!mWater) + mWater = LLSettingsVOWater::buildDefaultWater(); + if (!mSky) + mSky = LLSettingsVOSky::buildDefaultSky(); +} + +void LLEnvironment::DayInstance::clear() +{ + mType = TYPE_INVALID; + mDayCycle.reset(); + mSky.reset(); + mWater.reset(); + mDayLength = LLSettingsDay::DEFAULT_DAYLENGTH; + mDayOffset = LLSettingsDay::DEFAULT_DAYOFFSET; + mBlenderSky.reset(); + mBlenderWater.reset(); +} + +void LLEnvironment::DayInstance::setBlenders(const LLSettingsBlender::ptr_t &skyblend, const LLSettingsBlender::ptr_t &waterblend) +{ + mBlenderSky = skyblend; + mBlenderWater = waterblend; +} + +F64 LLEnvironment::DayInstance::secondsToKeyframe(S64Seconds seconds) +{ + F64 frame = static_cast(seconds.value() % mDayLength.value()) / static_cast(mDayLength.value()); + + return llclamp(frame, 0.0, 1.0); +} + +void LLEnvironment::DayInstance::animate() +{ + F64Seconds now(LLDate::now().secondsSinceEpoch()); + + now += mDayOffset; + + if (!mDayCycle) + return; + + LLSettingsDay::CycleTrack_t &wtrack = mDayCycle->getCycleTrack(0); + + if (wtrack.empty()) + { + mWater.reset(); + mBlenderWater.reset(); + } + else if (wtrack.size() == 1) + { + mWater = boost::static_pointer_cast((*(wtrack.begin())).second); + mBlenderWater.reset(); + } + else + { + LLSettingsDay::TrackBound_t bounds = get_bounding_entries(wtrack, secondsToKeyframe(now)); + F64Seconds timespan = mDayLength * get_wrapping_distance((*bounds.first).first, (*bounds.second).first); + + mWater = boost::static_pointer_cast((*bounds.first).second)->buildClone(); + mBlenderWater = boost::make_shared(mWater, + (*bounds.first).second, (*bounds.second).second, timespan); + mBlenderWater->setOnFinished(boost::bind(&LLEnvironment::DayInstance::onTrackTransitionDone, this, 0, _1)); + } + + // Day track 1 only for the moment + // sky + LLSettingsDay::CycleTrack_t &track = mDayCycle->getCycleTrack(1); + + if (track.empty()) + { + mSky.reset(); + mBlenderSky.reset(); + } + else if (track.size() == 1) + { + mSky = boost::static_pointer_cast((*(track.begin())).second); + mBlenderSky.reset(); + } + else + { + LLSettingsDay::TrackBound_t bounds = get_bounding_entries(track, secondsToKeyframe(now)); + F64Seconds timespan = mDayLength * get_wrapping_distance((*bounds.first).first, (*bounds.second).first); + + mSky = boost::static_pointer_cast((*bounds.first).second)->buildClone(); + mBlenderSky = boost::make_shared(mSky, + (*bounds.first).second, (*bounds.second).second, timespan); + mBlenderSky->setOnFinished(boost::bind(&LLEnvironment::DayInstance::onTrackTransitionDone, this, 1, _1)); + } +} + +void LLEnvironment::DayInstance::onTrackTransitionDone(S32 trackno, const LLSettingsBlender::ptr_t &blender) +{ + LL_WARNS("LAPRAS") << "onTrackTransitionDone for " << trackno << LL_ENDL; + F64Seconds now(LLDate::now().secondsSinceEpoch()); + + now += mDayOffset; + + LLSettingsDay::CycleTrack_t &track = mDayCycle->getCycleTrack(trackno); + + LLSettingsDay::TrackBound_t bounds = get_bounding_entries(track, secondsToKeyframe(now)); + + F32 distance = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); + F64Seconds timespan = mDayLength * distance; + + LL_WARNS("LAPRAS") << "New sky blender. now=" << now << + " start=" << (*bounds.first).first << " end=" << (*bounds.second).first << + " span=" << timespan << LL_ENDL; + + blender->reset((*bounds.first).second, (*bounds.second).second, timespan); +} diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 451bab5f9e..4230f76862 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -77,9 +77,11 @@ public: enum EnvSelection_t { + ENV_EDIT, ENV_LOCAL, ENV_PARCEL, ENV_REGION, + ENV_DEFAULT, ENV_END }; @@ -116,6 +118,8 @@ public: std::string mDayCycleName; }; + typedef std::pair fixedEnvironment_t; + typedef std::map namedSettingMap_t; typedef std::pair name_id_t; typedef std::vector list_name_id_t; @@ -130,56 +134,35 @@ public: bool canEdit() const; - LLSettingsSky::ptr_t getCurrentSky() const { return mCurrentSky; } - LLSettingsWater::ptr_t getCurrentWater() const { return mCurrentWater; } + LLSettingsSky::ptr_t getCurrentSky() const { return mCurrentEnvironment->getSky(); } + LLSettingsWater::ptr_t getCurrentWater() const { return mCurrentEnvironment->getWater(); } void update(const LLViewerCamera * cam); void updateGLVariablesForSettings(LLGLSLShader *shader, const LLSettingsBase::ptr_t &psetting); void updateShaderUniforms(LLGLSLShader *shader); - void addSky(const LLSettingsSky::ptr_t &sky); - void addWater(const LLSettingsWater::ptr_t &sky); - void addDayCycle(const LLSettingsDay::ptr_t &day); + void setSelectedEnvironment(EnvSelection_t env, F64Seconds transition = TRANSITION_DEFAULT); + EnvSelection_t getSelectedEnvironment() const { return mSelectedEnvironment; } - void selectSky(const std::string &name, F32Seconds transition = TRANSITION_DEFAULT); - void selectSky(const LLSettingsSky::ptr_t &sky, F32Seconds transition = TRANSITION_DEFAULT); - void selectWater(const std::string &name, F32Seconds transition = TRANSITION_DEFAULT); - void selectWater(const LLSettingsWater::ptr_t &water, F32Seconds transition = TRANSITION_DEFAULT); - void selectDayCycle(const std::string &name, F32Seconds transition = TRANSITION_DEFAULT); - void selectDayCycle(const LLSettingsDay::ptr_t &daycycle, F32Seconds transition = TRANSITION_DEFAULT); + bool hasEnvironment(EnvSelection_t env); + void setEnvironment(EnvSelection_t env, const LLSettingsDay::ptr_t &pday, S64Seconds daylength, S64Seconds dayoffset); + void setEnvironment(EnvSelection_t env, fixedEnvironment_t fixed); + void setEnvironment(EnvSelection_t env, const LLSettingsSky::ptr_t & fixed) { setEnvironment(env, fixedEnvironment_t(fixed, LLSettingsWater::ptr_t())); } + void setEnvironment(EnvSelection_t env, const LLSettingsWater::ptr_t & fixed) { setEnvironment(env, fixedEnvironment_t(LLSettingsSky::ptr_t(), fixed)); } + void clearEnvironment(EnvSelection_t env); + LLSettingsDay::ptr_t getEnvironmentDay(EnvSelection_t env); + S64Seconds getEnvironmentDayLength(EnvSelection_t env); + S64Seconds getEnvironmentDayOffset(EnvSelection_t env); + fixedEnvironment_t getEnvironmentFixed(EnvSelection_t env); + LLSettingsSky::ptr_t getEnvironmentFixedSky(EnvSelection_t env) { return getEnvironmentFixed(env).first; }; + LLSettingsWater::ptr_t getEnvironmentFixedWater(EnvSelection_t env) { return getEnvironmentFixed(env).second; }; - void setUserSky(const LLSettingsSky::ptr_t &sky) - { - setSkyFor(ENV_LOCAL, sky); - } - void setUserWater(const LLSettingsWater::ptr_t &water) - { - setWaterFor(ENV_LOCAL, water); - } - void setUserDaycycle(const LLSettingsDay::ptr_t &day) - { - setDayFor(ENV_LOCAL, day); - } + void updateEnvironment(F64Seconds transition = TRANSITION_DEFAULT); - void setSelectedEnvironment(EnvSelection_t env); - EnvSelection_t getSelectedEnvironment() const - { - return mSelectedEnvironment; - } - void applyChosenEnvironment(); - LLSettingsSky::ptr_t getChosenSky() const; - LLSettingsWater::ptr_t getChosenWater() const; - LLSettingsDay::ptr_t getChosenDay() const; - - void setSkyFor(EnvSelection_t env, const LLSettingsSky::ptr_t &sky); - LLSettingsSky::ptr_t getSkyFor(EnvSelection_t env) const; - void setWaterFor(EnvSelection_t env, const LLSettingsWater::ptr_t &water); - LLSettingsWater::ptr_t getWaterFor(EnvSelection_t env) const; - void setDayFor(EnvSelection_t env, const LLSettingsDay::ptr_t &day); - LLSettingsDay::ptr_t getDayFor(EnvSelection_t env) const; - - void clearUserSettings(); + void addSky(const LLSettingsSky::ptr_t &sky); + void addWater(const LLSettingsWater::ptr_t &sky); + void addDayCycle(const LLSettingsDay::ptr_t &day); list_name_id_t getSkyList() const; list_name_id_t getWaterList() const; @@ -199,14 +182,10 @@ public: inline F32 getSceneLightStrength() const { return mSceneLightStrength; } inline void setSceneLightStrength(F32 light_strength) { mSceneLightStrength = light_strength; } - inline LLVector4 getLightDirection() const { return LLVector4(mCurrentSky->getLightDirection(), 0.0f); } - inline LLVector4 getClampedLightDirection() const { return LLVector4(mCurrentSky->getClampedLightDirection(), 0.0f); } + inline LLVector4 getLightDirection() const { return ((mCurrentEnvironment->getSky()) ? LLVector4(mCurrentEnvironment->getSky()->getLightDirection(), 0.0f) : LLVector4()); } + inline LLVector4 getClampedLightDirection() const { return LLVector4(mCurrentEnvironment->getSky()->getClampedLightDirection(), 0.0f); } inline LLVector4 getRotatedLight() const { return mRotatedLight; } - inline S64Seconds getDayLength() const { return mDayLength; } - void setDayLength(S64Seconds seconds); - inline S64Seconds getDayOffset() const { return mDayOffset; } - void setDayOffset(S64Seconds seconds); //------------------------------------------- connection_t setSkyListChange(const change_signal_t::slot_type& cb); connection_t setWaterListChange(const change_signal_t::slot_type& cb); @@ -229,6 +208,62 @@ protected: virtual void initSingleton(); private: + class DayInstance + { + public: + enum InstanceType_t + { + TYPE_INVALID, + TYPE_FIXED, + TYPE_CYCLED + }; + typedef boost::shared_ptr ptr_t; + + DayInstance(); + + void update(F64Seconds); + + void setDay(const LLSettingsDay::ptr_t &pday, S64Seconds daylength, S64Seconds dayoffset); + void setSky(const LLSettingsSky::ptr_t &psky); + void setWater(const LLSettingsWater::ptr_t &pwater); + + void initialize(); + bool isInitialized(); + + void clear(); + + LLSettingsDay::ptr_t getDayCycle() const { return mDayCycle; } + LLSettingsSky::ptr_t getSky() const { return mSky; } + LLSettingsWater::ptr_t getWater() const { return mWater; } + S64Seconds getDayLength() const { return mDayLength; } + S64Seconds getDayOffset() const { return mDayOffset; } + + void animate(); + + void setBlenders(const LLSettingsBlender::ptr_t &skyblend, const LLSettingsBlender::ptr_t &waterblend); + + private: + LLSettingsDay::ptr_t mDayCycle; + LLSettingsSky::ptr_t mSky; + LLSettingsWater::ptr_t mWater; + + InstanceType_t mType; + bool mInitialized; + + S64Seconds mDayLength; + S64Seconds mDayOffset; + + LLSettingsBlender::ptr_t mBlenderSky; + LLSettingsBlender::ptr_t mBlenderWater; + + + F64 secondsToKeyframe(S64Seconds seconds); + + void onTrackTransitionDone(S32 trackno, const LLSettingsBlender::ptr_t &blender); + }; + typedef std::array InstanceArray_t; + + static const F32 SUN_DELTA_YAW; static const F32 NIGHTTIME_ELEVATION_COS; @@ -236,6 +271,11 @@ private: LLVector2 mCloudScrollDelta; // cumulative cloud delta + InstanceArray_t mEnvironments; + + EnvSelection_t mSelectedEnvironment; + DayInstance::ptr_t mCurrentEnvironment; + LLSettingsSky::ptr_t mSelectedSky; LLSettingsWater::ptr_t mSelectedWater; LLSettingsDay::ptr_t mSelectedDay; @@ -243,20 +283,12 @@ private: LLSettingsBlender::ptr_t mBlenderSky; LLSettingsBlender::ptr_t mBlenderWater; - LLSettingsSky::ptr_t mCurrentSky; - LLSettingsWater::ptr_t mCurrentWater; LLSettingsDay::ptr_t mCurrentDay; - EnvSelection_t mSelectedEnvironment; - typedef std::vector SkyList_t; typedef std::vector WaterList_t; typedef std::vector DayList_t; - SkyList_t mSetSkys; - WaterList_t mSetWater; - DayList_t mSetDays; - namedSettingMap_t mSkysByName; AssetSettingMap_t mSkysById; @@ -275,11 +307,9 @@ private: change_signal_t mWaterListChange; change_signal_t mDayCycleListChange; - S64Seconds mDayLength; - S64Seconds mDayOffset; + DayInstance::ptr_t getEnvironmentInstance(EnvSelection_t env, bool create = false); - void onSkyTransitionDone(const LLSettingsBlender::ptr_t &blender); - void onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender); + DayInstance::ptr_t getSelectedEnvironmentInstance(); //void addSky(const LLUUID &id, const LLSettingsSky::ptr_t &sky); @@ -308,6 +338,7 @@ private: void recordEnvironment(S32 parcel_id, EnvironmentInfo::ptr_t environment); + void onTransitionDone(const LLSettingsBlender::ptr_t &, bool isSky); //========================================================================= void legacyLoadAllPresets(); LLSD legacyLoadPreset(const std::string& path); diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index efeec72f6e..4ddedbf7df 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -114,7 +114,8 @@ void LLFloaterEditDayCycle::onClose(bool app_quitting) { if (!app_quitting) // there's no point to change environment if we're quitting { - LLEnvironment::instance().applyChosenEnvironment(); + LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); + LLEnvironment::instance().updateEnvironment(); } } diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 76c275e47c..0beb856456 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -98,7 +98,8 @@ void LLFloaterEditExtDayCycle::onClose(bool app_quitting) if (!app_quitting) // there's no point to change environment if we're quitting { /* TODO: don't restore this environment. We may have gotten here from land or region. */ - LLEnvironment::instance().applyChosenEnvironment(); + LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); + LLEnvironment::instance().updateEnvironment(); } } @@ -106,12 +107,13 @@ void LLFloaterEditExtDayCycle::onVisibilityChange(BOOL new_visibility) { if (new_visibility) { - LLEnvironment::instance().selectDayCycle(mEditDay, LLEnvironment::TRANSITION_FAST); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mEditDay, LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT); } else { /* TODO: don't restore this environment. We may have gotten here from land or region. */ - LLEnvironment::instance().applyChosenEnvironment(); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } } @@ -125,7 +127,7 @@ void LLFloaterEditExtDayCycle::onDayPresetChanged() if (pday) { pday = pday->buildClone(); - LLEnvironment::instance().selectDayCycle(pday, LLEnvironment::TRANSITION_INSTANT); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, pday, LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET); mEditDay = pday; } diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp index ab9cb81db5..1574e73caa 100644 --- a/indra/newview/llfloatereditsky.cpp +++ b/indra/newview/llfloatereditsky.cpp @@ -125,7 +125,8 @@ void LLFloaterEditSky::onClose(bool app_quitting) { if (!app_quitting) // there's no point to change environment if we're quitting { - LLEnvironment::instance().applyChosenEnvironment(); + LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } } @@ -644,7 +645,8 @@ void LLFloaterEditSky::onSkyPresetSelected() } psky = psky->buildClone(); - LLEnvironment::instance().selectSky(psky, LLEnvironment::TRANSITION_FAST); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, psky); + mEditSettings = psky; syncControls(); enableEditing(true); @@ -677,7 +679,7 @@ void LLFloaterEditSky::onSaveConfirmed() if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue()) { LL_DEBUGS("Windlight") << name << " is now the new preferred sky preset" << LL_ENDL; - LLEnvironment::instance().setUserSky(mEditSettings); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); } closeFloater(); @@ -686,7 +688,7 @@ void LLFloaterEditSky::onSaveConfirmed() void LLFloaterEditSky::onBtnSave() { LLEnvironment::instance().addSky(mEditSettings); - LLEnvironment::instance().setUserSky(mEditSettings); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); closeFloater(); } diff --git a/indra/newview/llfloatereditwater.cpp b/indra/newview/llfloatereditwater.cpp index 6b218d5008..4d8ffdef21 100644 --- a/indra/newview/llfloatereditwater.cpp +++ b/indra/newview/llfloatereditwater.cpp @@ -111,7 +111,8 @@ void LLFloaterEditWater::onClose(bool app_quitting) { if (!app_quitting) // there's no point to change environment if we're quitting { - LLEnvironment::instance().applyChosenEnvironment(); + LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } } @@ -428,7 +429,8 @@ void LLFloaterEditWater::onWaterPresetSelected() } pwater = pwater->buildClone(); - LLEnvironment::instance().selectWater(pwater, LLEnvironment::TRANSITION_FAST); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, pwater); + mEditSettings = pwater; syncControls(); enableEditing(true); @@ -460,7 +462,7 @@ void LLFloaterEditWater::onSaveConfirmed() if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue()) { LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL; - LLEnvironment::instance().setUserWater(mEditSettings); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); } closeFloater(); @@ -469,7 +471,7 @@ void LLFloaterEditWater::onSaveConfirmed() void LLFloaterEditWater::onBtnSave() { LLEnvironment::instance().addWater(mEditSettings); - LLEnvironment::instance().setUserWater(mEditSettings); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); closeFloater(); } diff --git a/indra/newview/llfloaterenvironmentsettings.cpp b/indra/newview/llfloaterenvironmentsettings.cpp index 9a41d434ee..b7bf6918fe 100644 --- a/indra/newview/llfloaterenvironmentsettings.cpp +++ b/indra/newview/llfloaterenvironmentsettings.cpp @@ -84,7 +84,7 @@ void LLFloaterEnvironmentSettings::onOpen(const LLSD& key) void LLFloaterEnvironmentSettings::onClose(bool app_quitting) { if (!app_quitting) - LLEnvironment::instance().applyChosenEnvironment(); + LLEnvironment::instance().updateEnvironment(); } @@ -124,23 +124,24 @@ void LLFloaterEnvironmentSettings::onBtnOK() { bool use_region_settings = mRegionSettingsRadioGroup->getSelectedIndex() == 0; + LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); if (use_region_settings) { - LLEnvironment::instance().clearUserSettings(); + LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_PARCEL); } else { - LLEnvironment::instance().clearUserSettings(); - bool use_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0; if (!use_fixed_sky) { + std::string day_cycle = mDayCyclePresetCombo->getValue().asString(); LLSettingsDay::ptr_t day = LLEnvironment::instance().findDayCycleByName(day_cycle); if (day) { - LLEnvironment::instance().setDayFor(LLEnvironment::ENV_LOCAL, day); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, day, LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET); } } else @@ -151,9 +152,9 @@ void LLFloaterEnvironmentSettings::onBtnOK() LLSettingsSky::ptr_t sky = LLEnvironment::instance().findSkyByName(sky_preset); LLSettingsWater::ptr_t water = LLEnvironment::instance().findWaterByName(water_preset); - LLEnvironment::instance().setSkyFor(LLEnvironment::ENV_LOCAL, sky); - LLEnvironment::instance().setWaterFor(LLEnvironment::ENV_LOCAL, water); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::fixedEnvironment_t(sky, water)); } + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } #if 0 @@ -183,11 +184,12 @@ void LLFloaterEnvironmentSettings::onBtnCancel() void LLFloaterEnvironmentSettings::refresh() { - LLSettingsDay::ptr_t day = LLEnvironment::instance().getChosenDay(); - LLSettingsSky::ptr_t sky = LLEnvironment::instance().getChosenSky(); - LLSettingsWater::ptr_t water = LLEnvironment::instance().getChosenWater(); + LLEnvironment::fixedEnvironment_t fixed = LLEnvironment::instance().getEnvironmentFixed(LLEnvironment::ENV_EDIT); + + LLSettingsDay::ptr_t day = LLEnvironment::instance().getEnvironmentDay(LLEnvironment::ENV_EDIT); + LLSettingsSky::ptr_t sky = fixed.first; + LLSettingsWater::ptr_t water = fixed.second; - bool use_region_settings = true; bool use_fixed_sky = !day; @@ -239,18 +241,18 @@ void LLFloaterEnvironmentSettings::apply() { LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName(sky_preset); if (psky) - LLEnvironment::instance().selectSky(psky, LLEnvironment::TRANSITION_FAST); - } + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, psky); + } else { LLSettingsDay::ptr_t pday = LLEnvironment::instance().findDayCycleByName(day_cycle); if (pday) - LLEnvironment::instance().selectDayCycle(pday, LLEnvironment::TRANSITION_FAST); - } + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, pday, LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET); + } LLSettingsWater::ptr_t pwater = LLEnvironment::instance().findWaterByName(water_preset); if (pwater) - LLEnvironment::instance().selectWater(pwater, LLEnvironment::TRANSITION_FAST); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, pwater); } } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 18bf4a47b3..39dada1984 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -3283,8 +3283,19 @@ void LLPanelLandEnvironment::refresh() F64Hours daylength; F64Hours dayoffset; - daylength = parcel->getDayLength(); - dayoffset = parcel->getDayOffset(); + LLEnvironment::EnvSelection_t env = LLEnvironment::ENV_PARCEL; + + if (!LLEnvironment::instance().hasEnvironment(env)) + env = LLEnvironment::ENV_REGION; + + daylength = LLEnvironment::instance().getEnvironmentDayLength(env); + dayoffset = LLEnvironment::instance().getEnvironmentDayOffset(env); + + LLSettingsDay::ptr_t pday = LLEnvironment::instance().getEnvironmentDay(env); + + mEditingDayCycle = pday->buildClone(); + + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mEditingDayCycle, daylength, dayoffset); if (dayoffset.value() > 12.0) dayoffset = dayoffset - F32Hours(24.0f); @@ -3292,19 +3303,11 @@ void LLPanelLandEnvironment::refresh() mDayLengthSlider->setValue(daylength.value()); mDayOffsetSlider->setValue(dayoffset.value()); - mRegionSettingsRadioGroup->setSelectedIndex(parcel->getUsesDefaultDayCycle() ? 0 : 1); + //mRegionSettingsRadioGroup->setSelectedIndex(parcel->getUsesDefaultDayCycle() ? 0 : 1); + mRegionSettingsRadioGroup->setSelectedIndex(1); setControlsEnabled(owner_or_god); - if (!parcel->getUsesDefaultDayCycle()) - mEditingDayCycle = parcel->getParcelDayCycle()->buildClone(); - else - { - LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion(); - if (regionp) - mEditingDayCycle = regionp->getRegionDayCycle()->buildClone(); - } - } void LLPanelLandEnvironment::doApply() diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index bf965afbe1..272ac8a1bb 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3395,22 +3395,25 @@ bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region) F64Hours daylength; F64Hours dayoffset; - daylength = region->getDayLength(); - dayoffset = region->getDayOffset(); + daylength = LLEnvironment::instance().getEnvironmentDayLength(LLEnvironment::ENV_REGION); + dayoffset = LLEnvironment::instance().getEnvironmentDayOffset(LLEnvironment::ENV_REGION); if (dayoffset.value() > 12.0) - dayoffset = dayoffset - F32Hours(24.0f); + dayoffset = dayoffset - F64Hours(24.0f); mDayLengthSlider->setValue(daylength.value()); mDayOffsetSlider->setValue(dayoffset.value()); - mRegionSettingsRadioGroup->setSelectedIndex(region->getIsDefaultDayCycle() ? 0 : 1); + //mRegionSettingsRadioGroup->setSelectedIndex(region->getIsDefaultDayCycle() ? 0 : 1); + mRegionSettingsRadioGroup->setSelectedIndex(1); setControlsEnabled(owner_or_god_or_manager); mLastRegion = region; - if (region->getRegionDayCycle()) - mEditingDayCycle = region->getRegionDayCycle()->buildClone(); + LLSettingsDay::ptr_t pday = LLEnvironment::instance().getEnvironmentDay(LLEnvironment::ENV_REGION); + + if (pday) + mEditingDayCycle = pday->buildClone(); return true; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 647489666f..456c080f8a 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8392,29 +8392,34 @@ class LLWorldEnvSettings : public view_listener_t if (tod == "sunrise") { LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName("Sunrise"); - LLEnvironment::instance().setSkyFor(LLEnvironment::ENV_LOCAL, psky); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, psky); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } else if (tod == "noon") { LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName("Midday"); - LLEnvironment::instance().setSkyFor(LLEnvironment::ENV_LOCAL, psky); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, psky); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } else if (tod == "sunset") { LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName("Sunset"); - LLEnvironment::instance().setSkyFor(LLEnvironment::ENV_LOCAL, psky); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, psky); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } else if (tod == "midnight") { LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName("Midnight"); - LLEnvironment::instance().setSkyFor(LLEnvironment::ENV_LOCAL, psky); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, psky); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } else { - LLEnvironment::instance().clearUserSettings(); - } + LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); + } - LLEnvironment::instance().applyChosenEnvironment(); + LLEnvironment::instance().updateEnvironment(); return true; } }; @@ -8426,7 +8431,7 @@ class LLWorldEnableEnvSettings : public view_listener_t bool result = false; std::string tod = userdata.asString(); - LLSettingsSky::ptr_t sky = LLEnvironment::instance().getSkyFor(LLEnvironment::ENV_LOCAL); + LLSettingsSky::ptr_t sky = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_LOCAL); if (!sky) { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 1dda516ca4..b272595d79 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -535,9 +535,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mInvisibilityCheckHistory(-1), mPaused(FALSE), mRegionCacheHitCount(0), - mRegionCacheMissCount(0), - mDayLength(LLSettingsDay::DEFAULT_DAYLENGTH), - mDayOffset(LLSettingsDay::DEFAULT_DAYOFFSET) + mRegionCacheMissCount(0) { mWidth = region_width_meters; mImpl->mOriginGlobal = from_region_handle(handle); diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 71d4d85ade..1628c3620a 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -390,17 +390,6 @@ public: static BOOL isNewObjectCreationThrottleDisabled() { return sNewObjectCreationThrottle < 0; } - S64Seconds getDayLength() const { return mDayLength; } - void setDayLength(S64SecondsImplicit seconds) { mDayLength = seconds; } - S64Seconds getDayOffset() const { return mDayOffset; } - void setDayOffset(S64SecondsImplicit seconds) { mDayOffset = seconds; } - bool getIsDefaultDayCycle() const { return mIsDefaultDayCycle; } - void setIsDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; } - LLSettingsDay::ptr_t getRegionDayCycle() const { return mDayCycle; } - void setRegionDayCycle(const LLSettingsDay::ptr_t &pday) { mDayCycle = pday; } - size_t getRegionDayCycleHash() const { return mDayCycleHash; } - void setRegionDayCycleHash(size_t hash) { mDayCycleHash = hash; } - private: void addToVOCacheTree(LLVOCacheEntry* entry); LLViewerObject* addNewObject(LLVOCacheEntry* entry); @@ -540,12 +529,6 @@ private: typedef std::map > orphan_list_t; orphan_list_t mOrphanMap; - S64Seconds mDayLength; - S64Seconds mDayOffset; - bool mIsDefaultDayCycle; - LLSettingsDay::ptr_t mDayCycle; - size_t mDayCycleHash; - class CacheMissItem { public: -- cgit v1.2.3 From 148856721293c3fd4b7ec961aeecb9090c1dd189 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 30 Jan 2018 17:10:03 -0800 Subject: Unused function in llsettingsdaycycle --- indra/llinventory/llsettingsdaycycle.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 9b0a6c1127..3abf76175f 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -42,20 +42,6 @@ namespace LLTrace::BlockTimerStatHandle FTM_BLEND_WATERVALUES("Blending Water Environment"); LLTrace::BlockTimerStatHandle FTM_UPDATE_WATERVALUES("Update Water Environment"); - inline F32 get_wrapping_distance(F32 begin, F32 end) - { - if (begin < end) - { - return end - begin; - } - else if (begin > end) - { - return 1.0 - (begin - end); - } - - return 0; - } - LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, F32 key) { if (collection.empty()) -- cgit v1.2.3 From bff875d25f03501ddad9a2be7cc45d1c949d83e0 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 2 Feb 2018 10:39:59 -0500 Subject: STORM-2145 Camera controls opacity is now working --- indra/llui/lluictrl.h | 3 ++- indra/newview/llfloatercamera.cpp | 9 +++++++++ indra/newview/llfloatercamera.h | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 550bee5c70..e53ecd30c2 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -212,7 +212,8 @@ public: virtual void setColor(const LLColor4& color); - F32 getCurrentTransparency(); + // Ansariel: Changed to virtual. We might want to change the transparency ourself! + virtual F32 getCurrentTransparency(); void setTransparencyType(ETypeTransparency type); ETypeTransparency getTransparencyType() const {return mTransparencyType;} diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 5bebebf21f..c12ccb386e 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -378,6 +378,15 @@ BOOL LLFloaterCamera::postBuild() return LLFloater::postBuild(); } +F32 LLFloaterCamera::getCurrentTransparency() +{ + + static LLCachedControl camera_opacity(gSavedSettings, "CameraOpacity"); + static LLCachedControl active_floater_transparency(gSavedSettings, "ActiveFloaterTransparency"); + return llmin(camera_opacity(), active_floater_transparency()); + +} + void LLFloaterCamera::onViewButtonClick(const LLSD& user_data) { // bring up the prefs floater diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 3601813bc1..481e9aec1b 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -91,6 +91,8 @@ private: /*virtual*/ BOOL postBuild(); + F32 getCurrentTransparency(); + void onViewButtonClick(const LLSD& user_data); ECameraControlMode determineMode(); -- cgit v1.2.3 From f0ae109b696671c5773a5084a7329d0b164b7735 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 2 Feb 2018 12:36:15 -0500 Subject: STORM-2145 Tiny optimizations --- indra/newview/llfloaterpreferenceviewadvanced.cpp | 60 +++-------------------- indra/newview/llfloaterpreferenceviewadvanced.h | 4 +- 2 files changed, 10 insertions(+), 54 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterpreferenceviewadvanced.cpp b/indra/newview/llfloaterpreferenceviewadvanced.cpp index 055c6f2232..791ff79d87 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.cpp +++ b/indra/newview/llfloaterpreferenceviewadvanced.cpp @@ -70,62 +70,18 @@ BOOL LLFloaterPreferenceViewAdvanced::postBuild() return TRUE; } -void LLFloaterPreferenceViewAdvanced::updateCameraControl(LLVector3 vector) +void LLFloaterPreferenceViewAdvanced::updateCameraControl(const LLVector3& vector) { - LLSpinCtrl* spinnerx = getChild("camera_x"); - LLSpinCtrl* spinnery = getChild("camera_y"); - LLSpinCtrl* spinnerz = getChild("camera_z"); - - if (!spinnerx || !spinnery || !spinnerz) - { - LL_WARNS() << "Could not find all desired UI camera elements" - << LL_ENDL; - return; - } - - if (!spinnerx->hasFocus()) - { - spinnerx->setValue(vector[VX]); - } - - if (!spinnery->hasFocus()) - { - spinnery->setValue(vector[VY]); - } - - if (!spinnerz->hasFocus()) - { - spinnerz->setValue(vector[VZ]); - } + getChild("camera_x")->setValue(vector[VX]); + getChild("camera_y")->setValue(vector[VY]); + getChild("camera_z")->setValue(vector[VZ]); } -void LLFloaterPreferenceViewAdvanced::updateFocusControl(LLVector3d vector3d) +void LLFloaterPreferenceViewAdvanced::updateFocusControl(const LLVector3d& vector3d) { - LLSpinCtrl* spinnerx = getChild("focus_x"); - LLSpinCtrl* spinnery = getChild("focus_y"); - LLSpinCtrl* spinnerz = getChild("focus_z"); - - if (!spinnerx || !spinnery || !spinnerz) - { - LL_WARNS() << "Could not find all desired UI focus elements" - << LL_ENDL; - return; - } - - if (!spinnerx->hasFocus()) - { - spinnerx->setValue(vector3d[VX]); - } - - if (!spinnery->hasFocus()) - { - spinnery->setValue(vector3d[VY]); - } - - if (!spinnerz->hasFocus()) - { - spinnerz->setValue(vector3d[VZ]); - } + getChild("focus_x")->setValue(vector3d[VX]); + getChild("focus_y")->setValue(vector3d[VY]); + getChild("focus_z")->setValue(vector3d[VZ]); } void LLFloaterPreferenceViewAdvanced::draw() diff --git a/indra/newview/llfloaterpreferenceviewadvanced.h b/indra/newview/llfloaterpreferenceviewadvanced.h index 5b63770059..8f4b594605 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.h +++ b/indra/newview/llfloaterpreferenceviewadvanced.h @@ -43,8 +43,8 @@ public: void onCommitSettings(); void onClickCancel(); void onClickOk(); - void updateCameraControl(LLVector3 vector); - void updateFocusControl(LLVector3d vector3d); + void updateCameraControl(const LLVector3& vector); + void updateFocusControl(const LLVector3d& vector3d); private: virtual ~LLFloaterPreferenceViewAdvanced(); -- cgit v1.2.3 From f07e5ee2a4907b9488a67a13db794c770878e648 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 5 Feb 2018 15:12:23 -0800 Subject: Transitions between skys. 1 --- indra/llinventory/llsettingsbase.h | 2 +- indra/newview/llenvironment.cpp | 117 ++++++++++++++++++++++++------------- indra/newview/llenvironment.h | 32 +++++++--- 3 files changed, 103 insertions(+), 48 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index f5146b1c27..073e4616a5 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -241,7 +241,7 @@ class LLSettingsBlender : public boost::enable_shared_from_this ptr_t; - typedef boost::signals2::signal finish_signal_t; + typedef boost::signals2::signal finish_signal_t; typedef boost::signals2::connection connection_t; static const F64Seconds DEFAULT_THRESHOLD; diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index db8fd570c0..cb1d85bed2 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -360,26 +360,33 @@ void LLEnvironment::updateEnvironment(F64Seconds transition) if (mCurrentEnvironment != pinstance) { - LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); - LLSettingsWater::ptr_t pwater = mCurrentEnvironment->getWater(); + DayInstance::ptr_t trans = boost::make_shared( + mCurrentEnvironment->getSky(), mCurrentEnvironment->getWater(), pinstance, transition); - LLSettingsSky::ptr_t ptargetsky = psky->buildClone(); - LLSettingsWater::ptr_t ptargetwater = pwater->buildClone(); - - LLSettingsBlender::ptr_t skyblend = boost::make_shared(ptargetsky, psky, pinstance->getSky(), transition); - skyblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, true)); - LLSettingsBlender::ptr_t waterblend = boost::make_shared(ptargetwater, pwater, pinstance->getWater(), transition); - waterblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, false)); + trans->animate(); - pinstance->setBlenders(skyblend, waterblend); - - mCurrentEnvironment = pinstance; - - mCurrentEnvironment->animate(); + mCurrentEnvironment = trans; +// +// LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); +// LLSettingsWater::ptr_t pwater = mCurrentEnvironment->getWater(); +// +// LLSettingsSky::ptr_t ptargetsky = psky->buildClone(); +// LLSettingsWater::ptr_t ptargetwater = pwater->buildClone(); +// +// LLSettingsBlender::ptr_t skyblend = boost::make_shared(ptargetsky, psky, pinstance->getSky(), transition); +// skyblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, true)); +// LLSettingsBlender::ptr_t waterblend = boost::make_shared(ptargetwater, pwater, pinstance->getWater(), transition); +// waterblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, false)); +// +// pinstance->setBlenders(skyblend, waterblend); +// +// mCurrentEnvironment = pinstance; +// +// mCurrentEnvironment->animate(); } } -void LLEnvironment::onTransitionDone(const LLSettingsBlender::ptr_t &blender, bool isSky) +void LLEnvironment::onTransitionDone(const LLSettingsBlender::ptr_t blender, bool isSky) { /*TODO: Test for both sky and water*/ mCurrentEnvironment->animate(); @@ -394,29 +401,16 @@ void LLEnvironment::update(const LLViewerCamera * cam) F32Seconds delta(timer.getElapsedTimeAndResetF32()); - for (InstanceArray_t::iterator it = mEnvironments.begin(); it != mEnvironments.end(); ++it) - { - if (*it) - (*it)->update(delta); - } +// for (InstanceArray_t::reverse_iterator it = mEnvironments.rbegin(); it != mEnvironments.rend(); ++it) +// { +// if (*it) +// (*it)->update(delta); +// } + mCurrentEnvironment->update(delta); // update clouds, sun, and general updateCloudScroll(); -// if (mBlenderSky) -// mBlenderSky->update(delta); -// if (mBlenderWater) -// mBlenderWater->update(delta); -// -// -// if (mCurrentDay) -// mCurrentDay->update(); -// -// if (mCurrentEnvironment->getSky()) -// mCurrentEnvironment->getSky()->update(); -// if (mCurrentEnvironment->getWater()) -// mCurrentEnvironment->getWater()->update(); - F32 camYaw = cam->getYaw(); stop_glerror(); @@ -1348,10 +1342,10 @@ void LLEnvironment::DayInstance::update(F64Seconds delta) if (mBlenderWater) mBlenderWater->update(delta); - if (mSky) - mSky->update(); - if (mWater) - mWater->update(); +// if (mSky) +// mSky->update(); +// if (mWater) +// mWater->update(); } void LLEnvironment::DayInstance::setDay(const LLSettingsDay::ptr_t &pday, S64Seconds daylength, S64Seconds dayoffset) @@ -1490,7 +1484,7 @@ void LLEnvironment::DayInstance::animate() } } -void LLEnvironment::DayInstance::onTrackTransitionDone(S32 trackno, const LLSettingsBlender::ptr_t &blender) +void LLEnvironment::DayInstance::onTrackTransitionDone(S32 trackno, const LLSettingsBlender::ptr_t blender) { LL_WARNS("LAPRAS") << "onTrackTransitionDone for " << trackno << LL_ENDL; F64Seconds now(LLDate::now().secondsSinceEpoch()); @@ -1510,3 +1504,48 @@ void LLEnvironment::DayInstance::onTrackTransitionDone(S32 trackno, const LLSett blender->reset((*bounds.first).second, (*bounds.second).second, timespan); } + +//------------------------------------------------------------------------- +LLEnvironment::DayTransition::DayTransition(const LLSettingsSky::ptr_t &skystart, + const LLSettingsWater::ptr_t &waterstart, LLEnvironment::DayInstance::ptr_t &end, S64Seconds time) : + DayInstance(), + mStartSky(skystart), + mStartWater(waterstart), + mNextInstance(end), + mTransitionTime(time) +{ + +} + +void LLEnvironment::DayTransition::update(F64Seconds delta) +{ + mNextInstance->update(delta); + DayInstance::update(delta); +} + +void LLEnvironment::DayTransition::animate() +{ + mNextInstance->animate(); + + mWater = mStartWater->buildClone(); + mBlenderWater = boost::make_shared(mWater, mStartWater, mNextInstance->getWater(), mTransitionTime); + mBlenderWater->setOnFinished(boost::bind(&LLEnvironment::DayTransition::onTransitonDone, this, LLSettingsDay::TRACK_WATER, _1)); + + mSky = mStartSky->buildClone(); + mBlenderSky = boost::make_shared(mSky, mStartSky, mNextInstance->getSky(), mTransitionTime); + mBlenderSky->setOnFinished(boost::bind(&LLEnvironment::DayTransition::onTransitonDone, this, LLSettingsDay::TRACK_MAX, _1)); +} + + +void LLEnvironment::DayTransition::onTransitonDone(S32 trackno, const LLSettingsBlender::ptr_t blender) +{ + if (trackno == LLSettingsDay::TRACK_WATER) + mBlenderWater.reset(); + else + mBlenderSky.reset(); + + if (!mBlenderSky && !mBlenderWater) + { + LLEnvironment::instance().mCurrentEnvironment = mNextInstance; + } +} diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 4230f76862..2b045e483c 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -220,8 +220,9 @@ private: typedef boost::shared_ptr ptr_t; DayInstance(); + virtual ~DayInstance() { }; - void update(F64Seconds); + virtual void update(F64Seconds); void setDay(const LLSettingsDay::ptr_t &pday, S64Seconds daylength, S64Seconds dayoffset); void setSky(const LLSettingsSky::ptr_t &psky); @@ -238,11 +239,11 @@ private: S64Seconds getDayLength() const { return mDayLength; } S64Seconds getDayOffset() const { return mDayOffset; } - void animate(); + virtual void animate(); void setBlenders(const LLSettingsBlender::ptr_t &skyblend, const LLSettingsBlender::ptr_t &waterblend); - private: + protected: LLSettingsDay::ptr_t mDayCycle; LLSettingsSky::ptr_t mSky; LLSettingsWater::ptr_t mWater; @@ -256,14 +257,31 @@ private: LLSettingsBlender::ptr_t mBlenderSky; LLSettingsBlender::ptr_t mBlenderWater; - F64 secondsToKeyframe(S64Seconds seconds); - void onTrackTransitionDone(S32 trackno, const LLSettingsBlender::ptr_t &blender); + void onTrackTransitionDone(S32 trackno, const LLSettingsBlender::ptr_t blender); }; typedef std::array InstanceArray_t; + class DayTransition : public DayInstance + { + public: + DayTransition(const LLSettingsSky::ptr_t &skystart, const LLSettingsWater::ptr_t &waterstart, DayInstance::ptr_t &end, S64Seconds time); + virtual ~DayTransition() { }; + + virtual void update(F64Seconds); + virtual void animate(); + + protected: + LLSettingsSky::ptr_t mStartSky; + LLSettingsWater::ptr_t mStartWater; + DayInstance::ptr_t mNextInstance; + S64Seconds mTransitionTime; + + void onTransitonDone(S32 trackno, const LLSettingsBlender::ptr_t blender); + }; + static const F32 SUN_DELTA_YAW; static const F32 NIGHTTIME_ELEVATION_COS; @@ -283,8 +301,6 @@ private: LLSettingsBlender::ptr_t mBlenderSky; LLSettingsBlender::ptr_t mBlenderWater; - LLSettingsDay::ptr_t mCurrentDay; - typedef std::vector SkyList_t; typedef std::vector WaterList_t; typedef std::vector DayList_t; @@ -338,7 +354,7 @@ private: void recordEnvironment(S32 parcel_id, EnvironmentInfo::ptr_t environment); - void onTransitionDone(const LLSettingsBlender::ptr_t &, bool isSky); + void onTransitionDone(const LLSettingsBlender::ptr_t, bool isSky); //========================================================================= void legacyLoadAllPresets(); LLSD legacyLoadPreset(const std::string& path); -- cgit v1.2.3 From 7838189843ff3b9c800e458b2452943edbc202ea Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 6 Feb 2018 17:27:56 -0800 Subject: boost->std & same level interp --- indra/llinventory/llsettingsbase.h | 9 ++++----- indra/llinventory/llsettingsdaycycle.h | 6 +++--- indra/llinventory/llsettingssky.cpp | 2 +- indra/llinventory/llsettingssky.h | 2 +- indra/llinventory/llsettingswater.cpp | 2 +- indra/llinventory/llsettingswater.h | 2 +- indra/newview/llenvironment.cpp | 37 +++++++++++++++++----------------- indra/newview/llenvironment.h | 4 ++-- indra/newview/llsettingsvo.cpp | 30 +++++++++++++-------------- 9 files changed, 47 insertions(+), 47 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 073e4616a5..420bcb9943 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -31,7 +31,6 @@ #include #include #include -#include #include #include "llsd.h" @@ -44,7 +43,7 @@ #include "v3color.h" class LLSettingsBase : - public boost::enable_shared_from_this, + public std::enable_shared_from_this, private boost::noncopyable { friend class LLEnvironment; @@ -58,7 +57,7 @@ public: typedef std::map parammapping_t; - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; virtual ~LLSettingsBase() { }; @@ -237,10 +236,10 @@ private: }; -class LLSettingsBlender : public boost::enable_shared_from_this +class LLSettingsBlender : public std::enable_shared_from_this { public: - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; typedef boost::signals2::signal finish_signal_t; typedef boost::signals2::connection connection_t; diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 8a1634d674..4c7ce011a1 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -33,8 +33,8 @@ class LLSettingsWater; class LLSettingsSky; -typedef boost::shared_ptr LLSettingsWaterPtr_t; -typedef boost::shared_ptr LLSettingsSkyPtr_t; +typedef std::shared_ptr LLSettingsWaterPtr_t; +typedef std::shared_ptr LLSettingsSkyPtr_t; class LLSettingsDay : public LLSettingsBase { @@ -60,7 +60,7 @@ public: typedef std::map CycleTrack_t; typedef std::vector CycleList_t; - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; typedef std::vector KeyframeList_t; typedef std::pair TrackBound_t; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 32b292e384..572b5703b3 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -98,7 +98,7 @@ LLSettingsSky::LLSettingsSky(): void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsSky::ptr_t other = boost::static_pointer_cast(end); + LLSettingsSky::ptr_t other = std::static_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 9947ffc022..e9ffbdb32c 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -62,7 +62,7 @@ public: static const std::string SETTING_SUN_ROTATION; static const std::string SETTING_SUN_TEXUTUREID; - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; typedef std::pair azimalt_t; //--------------------------------------------------------------------- diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 0fe3de44d3..a72cbc4136 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -163,7 +163,7 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsWater::ptr_t other = boost::static_pointer_cast(end); + LLSettingsWater::ptr_t other = std::static_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 4c61e2a34c..4d206a1be0 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -48,7 +48,7 @@ public: static const LLUUID DEFAULT_WATER_NORMAL_ID; - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; //--------------------------------------------------------------------- LLSettingsWater(const LLSD &data); diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index cb1d85bed2..cf5a68fdd2 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -98,7 +98,7 @@ void LLEnvironment::initSingleton() LLSettingsDay::ptr_t p_default_day = LLSettingsVODay::buildDefaultDayCycle(); addDayCycle(p_default_day); - mCurrentEnvironment = boost::make_shared(); + mCurrentEnvironment = std::make_shared(); mCurrentEnvironment->setSky(p_default_sky); mCurrentEnvironment->setWater(p_default_water); @@ -221,9 +221,10 @@ bool LLEnvironment::hasEnvironment(LLEnvironment::EnvSelection_t env) LLEnvironment::DayInstance::ptr_t LLEnvironment::getEnvironmentInstance(LLEnvironment::EnvSelection_t env, bool create /*= false*/) { DayInstance::ptr_t environment = mEnvironments[env]; - if (!environment && create) +// if (!environment && create) + if (create) { - environment = boost::make_shared(); + environment = std::make_shared(); mEnvironments[env] = environment; } @@ -360,7 +361,7 @@ void LLEnvironment::updateEnvironment(F64Seconds transition) if (mCurrentEnvironment != pinstance) { - DayInstance::ptr_t trans = boost::make_shared( + DayInstance::ptr_t trans = std::make_shared( mCurrentEnvironment->getSky(), mCurrentEnvironment->getWater(), pinstance, transition); trans->animate(); @@ -373,9 +374,9 @@ void LLEnvironment::updateEnvironment(F64Seconds transition) // LLSettingsSky::ptr_t ptargetsky = psky->buildClone(); // LLSettingsWater::ptr_t ptargetwater = pwater->buildClone(); // -// LLSettingsBlender::ptr_t skyblend = boost::make_shared(ptargetsky, psky, pinstance->getSky(), transition); +// LLSettingsBlender::ptr_t skyblend = std::make_shared(ptargetsky, psky, pinstance->getSky(), transition); // skyblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, true)); -// LLSettingsBlender::ptr_t waterblend = boost::make_shared(ptargetwater, pwater, pinstance->getWater(), transition); +// LLSettingsBlender::ptr_t waterblend = std::make_shared(ptargetwater, pwater, pinstance->getWater(), transition); // waterblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, false)); // // pinstance->setBlenders(skyblend, waterblend); @@ -687,7 +688,7 @@ LLSettingsSky::ptr_t LLEnvironment::findSkyByName(std::string name) const return LLSettingsSky::ptr_t(); } - return boost::static_pointer_cast((*it).second); + return std::static_pointer_cast((*it).second); } LLSettingsWater::ptr_t LLEnvironment::findWaterByName(std::string name) const @@ -700,7 +701,7 @@ LLSettingsWater::ptr_t LLEnvironment::findWaterByName(std::string name) const return LLSettingsWater::ptr_t(); } - return boost::static_pointer_cast((*it).second); + return std::static_pointer_cast((*it).second); } LLSettingsDay::ptr_t LLEnvironment::findDayCycleByName(std::string name) const @@ -713,7 +714,7 @@ LLSettingsDay::ptr_t LLEnvironment::findDayCycleByName(std::string name) const return LLSettingsDay::ptr_t(); } - return boost::static_pointer_cast((*it).second); + return std::static_pointer_cast((*it).second); } @@ -1071,7 +1072,7 @@ LLEnvironment::EnvironmentInfo::EnvironmentInfo(): LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extract(LLSD environment) { - ptr_t pinfo = boost::make_shared(); + ptr_t pinfo = std::make_shared(); if (environment.has("parcel_id")) pinfo->mParcelId = environment["parcel_id"].asInteger(); @@ -1444,7 +1445,7 @@ void LLEnvironment::DayInstance::animate() } else if (wtrack.size() == 1) { - mWater = boost::static_pointer_cast((*(wtrack.begin())).second); + mWater = std::static_pointer_cast((*(wtrack.begin())).second); mBlenderWater.reset(); } else @@ -1452,8 +1453,8 @@ void LLEnvironment::DayInstance::animate() LLSettingsDay::TrackBound_t bounds = get_bounding_entries(wtrack, secondsToKeyframe(now)); F64Seconds timespan = mDayLength * get_wrapping_distance((*bounds.first).first, (*bounds.second).first); - mWater = boost::static_pointer_cast((*bounds.first).second)->buildClone(); - mBlenderWater = boost::make_shared(mWater, + mWater = std::static_pointer_cast((*bounds.first).second)->buildClone(); + mBlenderWater = std::make_shared(mWater, (*bounds.first).second, (*bounds.second).second, timespan); mBlenderWater->setOnFinished(boost::bind(&LLEnvironment::DayInstance::onTrackTransitionDone, this, 0, _1)); } @@ -1469,7 +1470,7 @@ void LLEnvironment::DayInstance::animate() } else if (track.size() == 1) { - mSky = boost::static_pointer_cast((*(track.begin())).second); + mSky = std::static_pointer_cast((*(track.begin())).second); mBlenderSky.reset(); } else @@ -1477,8 +1478,8 @@ void LLEnvironment::DayInstance::animate() LLSettingsDay::TrackBound_t bounds = get_bounding_entries(track, secondsToKeyframe(now)); F64Seconds timespan = mDayLength * get_wrapping_distance((*bounds.first).first, (*bounds.second).first); - mSky = boost::static_pointer_cast((*bounds.first).second)->buildClone(); - mBlenderSky = boost::make_shared(mSky, + mSky = std::static_pointer_cast((*bounds.first).second)->buildClone(); + mBlenderSky = std::make_shared(mSky, (*bounds.first).second, (*bounds.second).second, timespan); mBlenderSky->setOnFinished(boost::bind(&LLEnvironment::DayInstance::onTrackTransitionDone, this, 1, _1)); } @@ -1528,11 +1529,11 @@ void LLEnvironment::DayTransition::animate() mNextInstance->animate(); mWater = mStartWater->buildClone(); - mBlenderWater = boost::make_shared(mWater, mStartWater, mNextInstance->getWater(), mTransitionTime); + mBlenderWater = std::make_shared(mWater, mStartWater, mNextInstance->getWater(), mTransitionTime); mBlenderWater->setOnFinished(boost::bind(&LLEnvironment::DayTransition::onTransitonDone, this, LLSettingsDay::TRACK_WATER, _1)); mSky = mStartSky->buildClone(); - mBlenderSky = boost::make_shared(mSky, mStartSky, mNextInstance->getSky(), mTransitionTime); + mBlenderSky = std::make_shared(mSky, mStartSky, mNextInstance->getSky(), mTransitionTime); mBlenderSky->setOnFinished(boost::bind(&LLEnvironment::DayTransition::onTransitonDone, this, LLSettingsDay::TRACK_MAX, _1)); } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 2b045e483c..06bcd368dd 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -58,7 +58,7 @@ public: { EnvironmentInfo(); - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; S32 mParcelId; LLUUID mRegionId; @@ -217,7 +217,7 @@ private: TYPE_FIXED, TYPE_CYCLED }; - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; DayInstance(); virtual ~DayInstance() { }; diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index eadc035b3b..6b1c663357 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -94,7 +94,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n LLSettingsSky::ptr_t(); } - LLSettingsSky::ptr_t skyp = boost::make_shared(newsettings); + LLSettingsSky::ptr_t skyp = std::make_shared(newsettings); #ifdef VERIFY_LEGACY_CONVERSION LLSD oldsettings = LLSettingsVOSky::convertToLegacy(skyp); @@ -124,7 +124,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky() LLSettingsSky::ptr_t(); } - LLSettingsSky::ptr_t skyp = boost::make_shared(settings); + LLSettingsSky::ptr_t skyp = std::make_shared(settings); return skyp; } @@ -140,7 +140,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildClone() LLSettingsSky::ptr_t(); } - LLSettingsSky::ptr_t skyp = boost::make_shared(settings); + LLSettingsSky::ptr_t skyp = std::make_shared(settings); return skyp; } @@ -267,7 +267,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin return LLSettingsWater::ptr_t(); } - LLSettingsWater::ptr_t waterp = boost::make_shared(newsettings); + LLSettingsWater::ptr_t waterp = std::make_shared(newsettings); #ifdef VERIFY_LEGACY_CONVERSION LLSD oldsettings = LLSettingsVOWater::convertToLegacy(waterp); @@ -296,7 +296,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater() return LLSettingsWater::ptr_t(); } - LLSettingsWater::ptr_t waterp = boost::make_shared(settings); + LLSettingsWater::ptr_t waterp = std::make_shared(settings); return waterp; } @@ -312,7 +312,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() return LLSettingsWater::ptr_t(); } - LLSettingsWater::ptr_t waterp = boost::make_shared(settings); + LLSettingsWater::ptr_t waterp = std::make_shared(settings); return waterp; } @@ -459,7 +459,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n } - LLSettingsDay::ptr_t dayp = boost::make_shared(newsettings); + LLSettingsDay::ptr_t dayp = std::make_shared(newsettings); #ifdef VERIFY_LEGACY_CONVERSION LLSD testsettings = LLSettingsVODay::convertToLegacy(dayp); @@ -525,7 +525,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®io return LLSettingsDay::ptr_t(); } - LLSettingsDay::ptr_t dayp = boost::make_shared(newsettings); + LLSettingsDay::ptr_t dayp = std::make_shared(newsettings); if (dayp) { @@ -547,7 +547,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDefaultDayCycle() LLSettingsDay::ptr_t(); } - LLSettingsDay::ptr_t dayp = boost::make_shared(settings); + LLSettingsDay::ptr_t dayp = std::make_shared(settings); dayp->initialize(); return dayp; @@ -563,7 +563,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromEnvironmentMessage(LLSD settings) LLSettingsDay::ptr_t(); } - LLSettingsDay::ptr_t dayp = boost::make_shared(settings); + LLSettingsDay::ptr_t dayp = std::make_shared(settings); dayp->initialize(); return dayp; @@ -582,7 +582,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone() LLSettingsDay::ptr_t(); } - LLSettingsDay::ptr_t dayp = boost::make_shared(settings); + LLSettingsDay::ptr_t dayp = std::make_shared(settings); dayp->initialize(); return dayp; @@ -595,7 +595,7 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday) LLSettingsWater::ptr_t pwater; if (!trackwater.empty()) { - pwater = boost::static_pointer_cast((*trackwater.begin()).second); + pwater = std::static_pointer_cast((*trackwater.begin()).second); } if (!pwater) @@ -615,7 +615,7 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday) name << hash; - skys[name.str()] = boost::static_pointer_cast((*it).second); + skys[name.str()] = std::static_pointer_cast((*it).second); F32 frame = ((tracksky.size() == 1) && (it == tracksky.begin())) ? -1.0f : (*it).first; llsdcycle.append( LLSDArray(LLSD::Real(frame))(name.str()) ); @@ -649,7 +649,7 @@ LLSettingsWaterPtr_t LLSettingsVODay::getDefaultWater() const LLSettingsSkyPtr_t LLSettingsVODay::buildSky(LLSD settings) const { - LLSettingsSky::ptr_t skyp = boost::make_shared(settings); + LLSettingsSky::ptr_t skyp = std::make_shared(settings); if (skyp->validate()) return skyp; @@ -659,7 +659,7 @@ LLSettingsSkyPtr_t LLSettingsVODay::buildSky(LLSD settings) const LLSettingsWaterPtr_t LLSettingsVODay::buildWater(LLSD settings) const { - LLSettingsWater::ptr_t waterp = boost::make_shared(settings); + LLSettingsWater::ptr_t waterp = std::make_shared(settings); if (waterp->validate()) return waterp; -- cgit v1.2.3 From e9edd37cdb39639e1ab24e2e63d4f83432282c88 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 9 Feb 2018 10:10:13 -0800 Subject: Update a couple constructs --- indra/llinventory/llsettingsbase.cpp | 81 ++-------------- indra/llinventory/llsettingsdaycycle.cpp | 20 ++-- indra/newview/llenvironment.cpp | 161 ++++++++++--------------------- indra/newview/llenvironment.h | 4 +- indra/newview/llwlhandlers.cpp | 6 +- 5 files changed, 69 insertions(+), 203 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index ffeae8677f..7ade345168 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -262,57 +262,6 @@ size_t LLSettingsBase::getHash() const return boost::hash{}(hash_settings); } -#ifdef VALIDATION_DEBUG -namespace -{ - bool compare_llsd(LLSD valA, LLSD valB) - { - if (valA.type() != valB.type()) - return false; - - switch (valA.type()) - { - // case LLSD::TypeMap: - // newSettings[key_name] = combineSDMaps(value, LLSD()); - // break; - case LLSD::TypeArray: - if (valA.size() != valB.size()) - return false; - - for (S32 idx = 0; idx < valA.size(); ++idx) - { - if (!compare_llsd(valA[idx], valB[idx])) - return false; - } - return true; - - case LLSD::TypeInteger: - return valA.asInteger() == valB.asInteger(); - - case LLSD::TypeReal: - return is_approx_equal(valA.asReal(), valB.asReal()); - - case LLSD::TypeBoolean: - return valA.asBoolean() == valB.asBoolean(); - - case LLSD::TypeString: - return valA.asString() == valB.asString(); - - case LLSD::TypeUUID: - return valA.asUUID() == valB.asUUID(); - - case LLSD::TypeURI: - return valA.asString() == valB.asString(); - - case LLSD::TypeDate: - return valA.asDate() == valB.asDate(); - } - - return true; - } -} -#endif - bool LLSettingsBase::validate() { validation_list_t validations = getValidationList(); @@ -378,35 +327,17 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida validated.insert(validateType.getName()); // Fields for specific settings. - for (validation_list_t::iterator itv = validations.begin(); itv != validations.end(); ++itv) + for (auto &test: validations) { -#ifdef VALIDATION_DEBUG - LLSD oldvalue; - if (settings.has((*itv).getName())) - { - oldvalue = llsd_clone(mSettings[(*itv).getName()]); - } -#endif - - if (!(*itv).verify(settings)) + if (!test.verify(settings)) { std::stringstream errtext; - errtext << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!"; + errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!"; errors.append( errtext.str() ); isValid = false; } - validated.insert((*itv).getName()); - -#ifdef VALIDATION_DEBUG - if (!oldvalue.isUndefined()) - { - if (!compare_llsd(settings[(*itv).getName()], oldvalue)) - { - LL_WARNS("SETTINGS") << "Setting '" << (*itv).getName() << "' was changed: " << oldvalue << " -> " << settings[(*itv).getName()] << LL_ENDL; - } - } -#endif + validated.insert(test.getName()); } // strip extra entries @@ -422,9 +353,9 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } } - for (stringset_t::iterator its = strip.begin(); its != strip.end(); ++its) + for (const std::string &its: strip) { - settings.erase(*its); + settings.erase(its); } return LLSDMap("success", LLSD::Boolean(isValid)) diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 3abf76175f..a689dd3710 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -131,20 +131,20 @@ LLSD LLSettingsDay::getSettings() const LLSD tracks(LLSD::emptyArray()); - for (CycleList_t::const_iterator itTrack = mDayTracks.begin(); itTrack != mDayTracks.end(); ++itTrack) + for (auto &track: mDayTracks) { LLSD trackout(LLSD::emptyArray()); - for (CycleTrack_t::const_iterator itFrame = (*itTrack).begin(); itFrame != (*itTrack).end(); ++itFrame) + for (auto &frame: track) { - F32 frame = (*itFrame).first; - LLSettingsBase::ptr_t data = (*itFrame).second; + F32 frame_time = frame.first; + LLSettingsBase::ptr_t data = frame.second; size_t datahash = data->getHash(); std::stringstream keyname; keyname << datahash; - trackout.append(LLSD(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(frame))(SETTING_KEYNAME, keyname.str()))); + trackout.append(LLSD(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(frame_time))(SETTING_KEYNAME, keyname.str()))); in_use[keyname.str()] = data; } tracks.append(trackout); @@ -152,12 +152,12 @@ LLSD LLSettingsDay::getSettings() const settings[SETTING_TRACKS] = tracks; LLSD frames(LLSD::emptyMap()); - for (std::map::iterator itFrame = in_use.begin(); itFrame != in_use.end(); ++itFrame) + for (auto &used_frame: in_use) { - LLSD framesettings = llsd_clone((*itFrame).second->getSettings(), + LLSD framesettings = llsd_clone(used_frame.second->getSettings(), LLSDMap("*", true)(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)); - frames[(*itFrame).first] = framesettings; + frames[used_frame.first] = framesettings; } settings[SETTING_FRAMES] = frames; @@ -465,9 +465,9 @@ LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) keyframes.reserve(track.size()); - for (CycleTrack_t::iterator it = track.begin(); it != track.end(); ++it) + for (auto &frame: track) { - keyframes.push_back((*it).first); + keyframes.push_back(frame.first); } return keyframes; diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index cf5a68fdd2..c67fcf880e 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -367,23 +367,6 @@ void LLEnvironment::updateEnvironment(F64Seconds transition) trans->animate(); mCurrentEnvironment = trans; -// -// LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); -// LLSettingsWater::ptr_t pwater = mCurrentEnvironment->getWater(); -// -// LLSettingsSky::ptr_t ptargetsky = psky->buildClone(); -// LLSettingsWater::ptr_t ptargetwater = pwater->buildClone(); -// -// LLSettingsBlender::ptr_t skyblend = std::make_shared(ptargetsky, psky, pinstance->getSky(), transition); -// skyblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, true)); -// LLSettingsBlender::ptr_t waterblend = std::make_shared(ptargetwater, pwater, pinstance->getWater(), transition); -// waterblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, false)); -// -// pinstance->setBlenders(skyblend, waterblend); -// -// mCurrentEnvironment = pinstance; -// -// mCurrentEnvironment->animate(); } } @@ -402,11 +385,6 @@ void LLEnvironment::update(const LLViewerCamera * cam) F32Seconds delta(timer.getElapsedTimeAndResetF32()); -// for (InstanceArray_t::reverse_iterator it = mEnvironments.rbegin(); it != mEnvironments.rend(); ++it) -// { -// if (*it) -// (*it)->update(delta); -// } mCurrentEnvironment->update(delta); // update clouds, sun, and general @@ -460,28 +438,28 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS //_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL; LLSettingsBase::parammapping_t params = psetting->getParameterMap(); - for (LLSettingsBase::parammapping_t::iterator it = params.begin(); it != params.end(); ++it) + for (auto &it: params) { - if (!psetting->mSettings.has((*it).first)) + if (!psetting->mSettings.has(it.first)) continue; - LLSD value = psetting->mSettings[(*it).first]; + LLSD value = psetting->mSettings[it.first]; LLSD::Type setting_type = value.type(); stop_glerror(); switch (setting_type) { case LLSD::TypeInteger: - shader->uniform1i((*it).second, value.asInteger()); + shader->uniform1i(it.second, value.asInteger()); //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL; break; case LLSD::TypeReal: - shader->uniform1f((*it).second, value.asReal()); + shader->uniform1f(it.second, value.asReal()); //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL; break; case LLSD::TypeBoolean: - shader->uniform1i((*it).second, value.asBoolean() ? 1 : 0); + shader->uniform1i(it.second, value.asBoolean() ? 1 : 0); //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL; break; @@ -489,7 +467,7 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS { LLVector4 vect4(value); //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL; - shader->uniform4fv((*it).second, 1, vect4.mV); + shader->uniform4fv(it.second, 1, vect4.mV); break; } @@ -551,9 +529,9 @@ LLEnvironment::list_name_id_t LLEnvironment::getSkyList() const list.reserve(mSkysByName.size()); - for (namedSettingMap_t::const_iterator it = mSkysByName.begin(); it != mSkysByName.end(); ++it) + for (auto &it: mSkysByName) { - list.push_back(std::vector::value_type((*it).second->getName(), (*it).second->getId())); + list.push_back(std::vector::value_type(it.second->getName(), it.second->getId())); } return list; @@ -565,9 +543,9 @@ LLEnvironment::list_name_id_t LLEnvironment::getWaterList() const list.reserve(mWaterByName.size()); - for (namedSettingMap_t::const_iterator it = mWaterByName.begin(); it != mWaterByName.end(); ++it) + for (auto &it : mWaterByName) { - list.push_back(std::vector::value_type((*it).second->getName(), (*it).second->getId())); + list.push_back(std::vector::value_type(it.second->getName(), it.second->getId())); } return list; @@ -579,9 +557,9 @@ LLEnvironment::list_name_id_t LLEnvironment::getDayCycleList() const list.reserve(mDayCycleByName.size()); - for (namedSettingMap_t::const_iterator it = mDayCycleByName.begin(); it != mDayCycleByName.end(); ++it) + for (auto &it: mDayCycleByName) { - list.push_back(std::vector::value_type((*it).second->getName(), (*it).second->getId())); + list.push_back(std::vector::value_type(it.second->getName(), it.second->getId())); } return list; @@ -593,8 +571,7 @@ void LLEnvironment::addSky(const LLSettingsSky::ptr_t &sky) LL_WARNS("RIDER") << "Adding sky as '" << name << "'" << LL_ENDL; - std::pair result; - result = mSkysByName.insert(namedSettingMap_t::value_type(name, sky)); + auto result = mSkysByName.insert(namedSettingMap_t::value_type(name, sky)); // auto should be: std::pair if (!result.second) (*(result.first)).second = sky; @@ -603,7 +580,7 @@ void LLEnvironment::addSky(const LLSettingsSky::ptr_t &sky) void LLEnvironment::removeSky(const std::string &name) { - namedSettingMap_t::iterator it = mSkysByName.find(name); + auto it = mSkysByName.find(name); if (it != mSkysByName.end()) mSkysByName.erase(it); mSkyListChange(); @@ -622,8 +599,7 @@ void LLEnvironment::addWater(const LLSettingsWater::ptr_t &water) LL_WARNS("RIDER") << "Adding water as '" << name << "'" << LL_ENDL; - std::pair result; - result = mWaterByName.insert(namedSettingMap_t::value_type(name, water)); + auto result = mWaterByName.insert(namedSettingMap_t::value_type(name, water)); if (!result.second) (*(result.first)).second = water; @@ -633,7 +609,7 @@ void LLEnvironment::addWater(const LLSettingsWater::ptr_t &water) void LLEnvironment::removeWater(const std::string &name) { - namedSettingMap_t::iterator it = mWaterByName.find(name); + auto it = mWaterByName.find(name); if (it != mWaterByName.end()) mWaterByName.erase(it); mWaterListChange(); @@ -652,8 +628,7 @@ void LLEnvironment::addDayCycle(const LLSettingsDay::ptr_t &daycycle) LL_WARNS("RIDER") << "Adding daycycle as '" << name << "'" << LL_ENDL; - std::pair result; - result = mDayCycleByName.insert(namedSettingMap_t::value_type(name, daycycle)); + auto result = mDayCycleByName.insert(namedSettingMap_t::value_type(name, daycycle)); if (!result.second) (*(result.first)).second = daycycle; @@ -664,7 +639,7 @@ void LLEnvironment::addDayCycle(const LLSettingsDay::ptr_t &daycycle) void LLEnvironment::removeDayCycle(const std::string &name) { - namedSettingMap_t::iterator it = mDayCycleByName.find(name); + auto it = mDayCycleByName.find(name); if (it != mDayCycleByName.end()) mDayCycleByName.erase(it); mDayCycleListChange(); @@ -680,7 +655,7 @@ void LLEnvironment::clearAllDayCycles() LLSettingsSky::ptr_t LLEnvironment::findSkyByName(std::string name) const { - namedSettingMap_t::const_iterator it = mSkysByName.find(name); + auto it = mSkysByName.find(name); if (it == mSkysByName.end()) { @@ -693,7 +668,7 @@ LLSettingsSky::ptr_t LLEnvironment::findSkyByName(std::string name) const LLSettingsWater::ptr_t LLEnvironment::findWaterByName(std::string name) const { - namedSettingMap_t::const_iterator it = mWaterByName.find(name); + auto it = mWaterByName.find(name); if (it == mWaterByName.end()) { @@ -706,7 +681,7 @@ LLSettingsWater::ptr_t LLEnvironment::findWaterByName(std::string name) const LLSettingsDay::ptr_t LLEnvironment::findDayCycleByName(std::string name) const { - namedSettingMap_t::const_iterator it = mDayCycleByName.find(name); + auto it = mDayCycleByName.find(name); if (it == mDayCycleByName.end()) { @@ -735,27 +710,6 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI LL_WARNS("LAPRAS") << "Had requested parcel environment #" << parcel_id << " but got region." << LL_ENDL; clearEnvironment(ENV_PARCEL); } -// LLViewerRegion *pRegion = gAgent.getRegion(); -// -// pRegion->setDayLength(envinfo->mDayLength); -// pRegion->setDayOffset(envinfo->mDayOffset); -// pRegion->setIsDefaultDayCycle(envinfo->mIsDefault); -// if (pRegion->getRegionDayCycleHash() != envinfo->mDayHash) -// { -// pRegion->setRegionDayCycle(pday); -// pRegion->setRegionDayCycleHash(envinfo->mDayHash); -// } -// -// if (parcel_id != INVALID_PARCEL_ID) -// { // We requested a parcel environment but got back the region's. If this is the parcel we are in -// // clear it out. -// LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); -// -// if (parcel->getLocalID() == parcel_id) -// { -// parcel->clearParcelDayCycleInfo(); -// } -// } } else { @@ -769,20 +723,6 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI } setEnvironment(ENV_PARCEL, pday, envinfo->mDayLength, envinfo->mDayOffset); -// LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); -// -// if (parcel->getLocalID() == parcel_id) -// { -// parcel->setDayLength(envinfo->mDayLength); -// parcel->setDayOffset(envinfo->mDayOffset); -// parcel->setUsesDefaultDayCycle(envinfo->mIsDefault); -// if (parcel->getParcelDayCycleHash() != envinfo->mDayHash) -// { -// parcel->setParcelDayCycle(pday); -// parcel->setParcelDayCycleHash(envinfo->mDayHash); -// } -// -// } } /*TODO: track_altitudes*/ @@ -819,32 +759,27 @@ void LLEnvironment::resetRegion() void LLEnvironment::requestParcel(S32 parcel_id) { - environment_apply_fn apply = boost::bind(&LLEnvironment::recordEnvironment, this, _1, _2); - std::string coroname = LLCoros::instance().launch("LLEnvironment::coroRequestEnvironment", - boost::bind(&LLEnvironment::coroRequestEnvironment, this, parcel_id, apply)); - + boost::bind(&LLEnvironment::coroRequestEnvironment, this, parcel_id, + [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); })); } void LLEnvironment::updateParcel(S32 parcel_id, LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset) { - environment_apply_fn apply = boost::bind(&LLEnvironment::recordEnvironment, this, _1, _2); - std::string coroname = LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment", boost::bind(&LLEnvironment::coroUpdateEnvironment, this, parcel_id, - pday, day_length, day_offset, apply)); - + pday, day_length, day_offset, + [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); })); } void LLEnvironment::resetParcel(S32 parcel_id) { - environment_apply_fn apply = boost::bind(&LLEnvironment::recordEnvironment, this, _1, _2); - std::string coroname = LLCoros::instance().launch("LLEnvironment::coroResetEnvironment", - boost::bind(&LLEnvironment::coroResetEnvironment, this, parcel_id, apply)); + boost::bind(&LLEnvironment::coroResetEnvironment, this, parcel_id, + [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); })); } void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environment_apply_fn apply) @@ -890,7 +825,7 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ else { LLSD environment = result["environment"]; - if (environment.isDefined() && !apply.empty()) + if (environment.isDefined() && apply) { EnvironmentInfo::ptr_t envinfo = LLEnvironment::EnvironmentInfo::extract(environment); apply(parcel_id, envinfo); @@ -953,7 +888,7 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, LLSettingsDay::ptr_t pd else { LLSD environment = result["environment"]; - if (environment.isDefined() && !apply.empty()) + if (environment.isDefined() && apply) { EnvironmentInfo::ptr_t envinfo = LLEnvironment::EnvironmentInfo::extract(environment); apply(parcel_id, envinfo); @@ -1004,7 +939,7 @@ void LLEnvironment::coroResetEnvironment(S32 parcel_id, environment_apply_fn app else { LLSD environment = result["environment"]; - if (environment.isDefined() && !apply.empty()) + if (environment.isDefined() && apply) { EnvironmentInfo::ptr_t envinfo = LLEnvironment::EnvironmentInfo::extract(environment); apply(parcel_id, envinfo); @@ -1456,7 +1391,10 @@ void LLEnvironment::DayInstance::animate() mWater = std::static_pointer_cast((*bounds.first).second)->buildClone(); mBlenderWater = std::make_shared(mWater, (*bounds.first).second, (*bounds.second).second, timespan); - mBlenderWater->setOnFinished(boost::bind(&LLEnvironment::DayInstance::onTrackTransitionDone, this, 0, _1)); + mBlenderWater->setOnFinished( + [this](LLSettingsBlender::ptr_t blender) { onTrackTransitionDone(0, blender); }); + + } // Day track 1 only for the moment @@ -1481,7 +1419,8 @@ void LLEnvironment::DayInstance::animate() mSky = std::static_pointer_cast((*bounds.first).second)->buildClone(); mBlenderSky = std::make_shared(mSky, (*bounds.first).second, (*bounds.second).second, timespan); - mBlenderSky->setOnFinished(boost::bind(&LLEnvironment::DayInstance::onTrackTransitionDone, this, 1, _1)); + mBlenderSky->setOnFinished( + [this](LLSettingsBlender::ptr_t blender) { onTrackTransitionDone(1, blender); }); } } @@ -1530,23 +1469,21 @@ void LLEnvironment::DayTransition::animate() mWater = mStartWater->buildClone(); mBlenderWater = std::make_shared(mWater, mStartWater, mNextInstance->getWater(), mTransitionTime); - mBlenderWater->setOnFinished(boost::bind(&LLEnvironment::DayTransition::onTransitonDone, this, LLSettingsDay::TRACK_WATER, _1)); + mBlenderWater->setOnFinished( + [this](LLSettingsBlender::ptr_t blender) { + mBlenderWater.reset(); + + if (!mBlenderSky && !mBlenderWater) + LLEnvironment::instance().mCurrentEnvironment = mNextInstance; + }); mSky = mStartSky->buildClone(); mBlenderSky = std::make_shared(mSky, mStartSky, mNextInstance->getSky(), mTransitionTime); - mBlenderSky->setOnFinished(boost::bind(&LLEnvironment::DayTransition::onTransitonDone, this, LLSettingsDay::TRACK_MAX, _1)); -} - - -void LLEnvironment::DayTransition::onTransitonDone(S32 trackno, const LLSettingsBlender::ptr_t blender) -{ - if (trackno == LLSettingsDay::TRACK_WATER) - mBlenderWater.reset(); - else + mBlenderSky->setOnFinished( + [this](LLSettingsBlender::ptr_t blender) { mBlenderSky.reset(); - if (!mBlenderSky && !mBlenderWater) - { - LLEnvironment::instance().mCurrentEnvironment = mNextInstance; - } + if (!mBlenderSky && !mBlenderWater) + LLEnvironment::instance().mCurrentEnvironment = mNextInstance; + }); } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 06bcd368dd..a7159ca84d 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -124,7 +124,7 @@ public: typedef std::pair name_id_t; typedef std::vector list_name_id_t; typedef boost::signals2::signal change_signal_t; - typedef boost::function environment_apply_fn; + typedef std::function environment_apply_fn; virtual ~LLEnvironment(); @@ -278,8 +278,6 @@ private: LLSettingsWater::ptr_t mStartWater; DayInstance::ptr_t mNextInstance; S64Seconds mTransitionTime; - - void onTransitonDone(S32 trackno, const LLSettingsBlender::ptr_t blender); }; static const F32 SUN_DELTA_YAW; diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp index acec028489..6aa379e0de 100644 --- a/indra/newview/llwlhandlers.cpp +++ b/indra/newview/llwlhandlers.cpp @@ -52,7 +52,7 @@ bool LLEnvironmentRequest::initiate() if (!cur_region->capabilitiesReceived()) { LL_INFOS("WindlightCaps") << "Deferring windlight settings request until we've got region caps" << LL_ENDL; - cur_region->setCapabilitiesReceivedCallback(boost::bind(&LLEnvironmentRequest::onRegionCapsReceived, _1)); + cur_region->setCapabilitiesReceivedCallback([](LLUUID region_id) { LLEnvironmentRequest::onRegionCapsReceived(region_id); }); return false; } @@ -85,7 +85,7 @@ bool LLEnvironmentRequest::doRequest() std::string coroname = LLCoros::instance().launch("LLEnvironmentRequest::environmentRequestCoro", - boost::bind(&LLEnvironmentRequest::environmentRequestCoro, url)); + [url]() { LLEnvironmentRequest::environmentRequestCoro(url); }); LL_INFOS("WindlightCaps") << "Requesting region windlight settings via " << url << LL_ENDL; return true; @@ -178,7 +178,7 @@ bool LLEnvironmentApply::initiateRequest(const LLSD& content) std::string coroname = LLCoros::instance().launch("LLEnvironmentApply::environmentApplyCoro", - boost::bind(&LLEnvironmentApply::environmentApplyCoro, url, content)); + [url, content]() { LLEnvironmentApply::environmentApplyCoro(url, content); }); return true; } -- cgit v1.2.3 From 99b82d944937ce321f64aa91fb18ab2aedd3992a Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Sun, 18 Feb 2018 15:52:23 +0000 Subject: Atmospherics WIP libatmosphere integrated in indra/llrender/llatmosphere.cpp Still working on runtime shaders to use libatmosphere precomputed atmospherics textures --- indra/cmake/LLRender.cmake | 1 + indra/llappearance/lltexlayer.cpp | 2 +- indra/llmath/llquaternion.cpp | 20 +++ indra/llmath/llquaternion.h | 4 +- indra/llplugin/llpluginprocesschild.cpp | 2 +- indra/llrender/CMakeLists.txt | 7 +- indra/llrender/llgl.cpp | 15 +- indra/llrender/llglslshader.cpp | 5 + indra/llrender/llglslshader.h | 2 + indra/llrender/llgltexture.cpp | 198 +++++++++++---------- indra/llrender/llgltexture.h | 10 +- indra/llrender/llimagegl.cpp | 39 +++- indra/llrender/llimagegl.h | 9 +- indra/llrender/llrender.cpp | 4 +- indra/llrender/llrender.h | 10 +- indra/llrender/llshadermgr.cpp | 28 ++- indra/llrender/llshadermgr.h | 11 ++ indra/llrender/lltexture.cpp | 12 ++ indra/llrender/lltexture.h | 22 +-- indra/newview/app_settings/logcontrol.xml | 2 +- indra/newview/app_settings/settings.xml | 11 ++ .../shaders/class1/deferred/softenLightF.glsl | 4 +- .../shaders/class2/deferred/softenLightF.glsl | 4 - .../shaders/class2/deferred/spotLightF.glsl | 4 +- indra/newview/llappviewer.cpp | 7 +- indra/newview/lldrawpoolwlsky.cpp | 119 +++++++++---- indra/newview/lldrawpoolwlsky.h | 2 + indra/newview/llmeshrepository.cpp | 2 +- indra/newview/llviewershadermgr.cpp | 92 +++++++--- indra/newview/llviewershadermgr.h | 2 + indra/newview/llviewertexture.cpp | 28 +-- indra/newview/llviewertexture.h | 4 +- indra/newview/pipeline.cpp | 122 +++++++++++-- indra/newview/pipeline.h | 19 +- 34 files changed, 574 insertions(+), 249 deletions(-) (limited to 'indra') diff --git a/indra/cmake/LLRender.cmake b/indra/cmake/LLRender.cmake index 868922451f..0940d1de63 100644 --- a/indra/cmake/LLRender.cmake +++ b/indra/cmake/LLRender.cmake @@ -3,6 +3,7 @@ include(Variables) include(FreeType) include(GLH) +include(Atmosphere) set(LLRENDER_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llrender diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 2cf86bb4fe..3dbab22de1 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -1578,7 +1578,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC alpha_data = new U8[width * height]; mAlphaCache[cache_index] = alpha_data; glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data); - } + } getTexLayerSet()->getAvatarAppearance()->dirtyMesh(); diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp index dcef2b345e..a8d9eba2a0 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -864,6 +864,26 @@ void LLQuaternion::getAngleAxis(F32* angle, LLVector3 &vec) const } } +const LLQuaternion& LLQuaternion::setFromAzimuthAndAltitude(F32 azimuthRadians, F32 altitudeRadians) +{ + // euler angle inputs are complements of azimuth/altitude which are measured from zenith + F32 pitch = llclamp(F_PI_BY_TWO - altitudeRadians, 0.0f, F_PI_BY_TWO); + F32 yaw = llclamp(F_PI_BY_TWO - azimuthRadians, 0.0f, F_PI_BY_TWO); + setEulerAngles(0.0f, pitch, yaw); + return *this; +} + +void LLQuaternion::getAzimuthAndAltitude(F32 &azimuthRadians, F32 &altitudeRadians) +{ + F32 rick_roll; + F32 pitch; + F32 yaw; + getEulerAngles(&rick_roll, &pitch, &yaw); + // make these measured from zenith + altitudeRadians = llclamp(F_PI_BY_TWO - pitch, 0.0f, F_PI_BY_TWO); + azimuthRadians = llclamp(F_PI_BY_TWO - yaw, 0.0f, F_PI_BY_TWO); +} + // quaternion does not need to be normalized void LLQuaternion::getEulerAngles(F32 *roll, F32 *pitch, F32 *yaw) const { diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h index 11b6abf800..e2cdad548b 100644 --- a/indra/llmath/llquaternion.h +++ b/indra/llmath/llquaternion.h @@ -84,7 +84,8 @@ public: const LLQuaternion& set(const F32 *q); // Sets Quaternion to normalize(quat[VX], quat[VY], quat[VZ], quat[VW]) const LLQuaternion& set(const LLMatrix3 &mat); // Sets Quaternion to mat2quat(mat) const LLQuaternion& set(const LLMatrix4 &mat); // Sets Quaternion to mat2quat(mat) - + const LLQuaternion& setFromAzimuthAndAltitude(F32 azimuth, F32 altitude); + const LLQuaternion& setAngleAxis(F32 angle, F32 x, F32 y, F32 z); // Sets Quaternion to axis_angle2quat(angle, x, y, z) const LLQuaternion& setAngleAxis(F32 angle, const LLVector3 &vec); // Sets Quaternion to axis_angle2quat(angle, vec) const LLQuaternion& setAngleAxis(F32 angle, const LLVector4 &vec); // Sets Quaternion to axis_angle2quat(angle, vec) @@ -105,6 +106,7 @@ public: void getAngleAxis(F32* angle, F32* x, F32* y, F32* z) const; // returns rotation in radians about axis x,y,z void getAngleAxis(F32* angle, LLVector3 &vec) const; void getEulerAngles(F32 *roll, F32* pitch, F32 *yaw) const; + void getAzimuthAndAltitude(F32 &azimuth, F32 &altitude); F32 normalize(); // Normalizes Quaternion and returns magnitude F32 normQuat(); // deprecated diff --git a/indra/llplugin/llpluginprocesschild.cpp b/indra/llplugin/llpluginprocesschild.cpp index e24d222cb6..594793cf56 100644 --- a/indra/llplugin/llpluginprocesschild.cpp +++ b/indra/llplugin/llpluginprocesschild.cpp @@ -253,7 +253,7 @@ void LLPluginProcessChild::sleep(F64 seconds) } else { - ms_sleep((int)(seconds * 1000.0f)); + ms_sleep((int)(seconds * 1000.0f)); } } diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index 331f988382..89451a072c 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -13,6 +13,7 @@ include(LLVFS) include(LLWindow) include(LLXML) include(LLVFS) +include(Atmosphere) include_directories( ${FREETYPE_INCLUDE_DIRS} @@ -24,6 +25,7 @@ include_directories( ${LLWINDOW_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} + ${ATMOSPHERE_INCLUDE_DIR} ) include_directories(SYSTEM ${LLCOMMON_SYSTEM_INCLUDE_DIRS} @@ -31,6 +33,7 @@ include_directories(SYSTEM ) set(llrender_SOURCE_FILES + llatmosphere.cpp llcubemap.cpp llfontbitmapcache.cpp llfontfreetype.cpp @@ -56,6 +59,7 @@ set(llrender_SOURCE_FILES set(llrender_HEADER_FILES CMakeLists.txt + llatmosphere.h llcubemap.h llfontgl.h llfontfreetype.h @@ -126,5 +130,6 @@ target_link_libraries(llrender ${LLVFS_LIBRARIES} ${LLWINDOW_LIBRARIES} ${FREETYPE_LIBRARIES} - ${OPENGL_LIBRARIES}) + ${OPENGL_LIBRARIES} + ${ATMOSPHERE_LIBRARIES}) diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 155c2402bd..2f78b6e104 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1348,8 +1348,19 @@ void LLGLManager::initExtensions() if (mHasVertexShader) { LL_INFOS() << "initExtensions() VertexShader-related procs..." << LL_ENDL; - glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB"); - glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB"); + + // nSight doesn't support use of ARB funcs that have been normalized in the API + if (!LLRender::sNsightDebugSupport) + { + glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB"); + glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB"); + } + else + { + glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocation"); + glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocation"); + } + glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveAttribARB"); glVertexAttrib1dARB = (PFNGLVERTEXATTRIB1DARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dARB"); glVertexAttrib1dvARB = (PFNGLVERTEXATTRIB1DVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dvARB"); diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index bba94a976f..b09ec53bc0 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -401,6 +401,11 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, mDefines["OLD_SELECT"] = "1"; #endif + if (mExtraLinkObject) + { + attachObject(mExtraLinkObject); + } + //compile new source vector< pair >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 8e9c29ea4c..a7a9e27fcd 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -205,6 +205,8 @@ public: bool mTextureStateFetched; magmin_filter_t mTextureMagMinFilter; + GLhandleARB mExtraLinkObject = 0; + private: void unloadInternal(); diff --git a/indra/llrender/llgltexture.cpp b/indra/llrender/llgltexture.cpp index 3a6eebebba..c0e5477cea 100644 --- a/indra/llrender/llgltexture.cpp +++ b/indra/llrender/llgltexture.cpp @@ -30,20 +30,20 @@ // static S32 LLGLTexture::getTotalNumOfCategories() { - return MAX_GL_IMAGE_CATEGORY - (BOOST_HIGH - BOOST_SCULPTED) + 2 ; + return MAX_GL_IMAGE_CATEGORY - (BOOST_HIGH - BOOST_SCULPTED) + 2; } // static //index starts from zero. S32 LLGLTexture::getIndexFromCategory(S32 category) { - return (category < BOOST_HIGH) ? category : category - (BOOST_HIGH - BOOST_SCULPTED) + 1 ; + return (category < BOOST_HIGH) ? category : category - (BOOST_HIGH - BOOST_SCULPTED) + 1; } //static S32 LLGLTexture::getCategoryFromIndex(S32 index) { - return (index < BOOST_HIGH) ? index : index + (BOOST_HIGH - BOOST_SCULPTED) - 1 ; + return (index < BOOST_HIGH) ? index : index + (BOOST_HIGH - BOOST_SCULPTED) - 1; } LLGLTexture::LLGLTexture(BOOL usemipmaps) @@ -55,19 +55,19 @@ LLGLTexture::LLGLTexture(BOOL usemipmaps) LLGLTexture::LLGLTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) { init(); - mFullWidth = width ; - mFullHeight = height ; + mFullWidth = width; + mFullHeight = height; mUseMipMaps = usemipmaps; - mComponents = components ; + mComponents = components; setTexelsPerImage(); } LLGLTexture::LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps) { init(); - mUseMipMaps = usemipmaps ; + mUseMipMaps = usemipmaps; // Create an empty image of the specified size and width - mGLTexturep = new LLImageGL(raw, usemipmaps) ; + mGLTexturep = new LLImageGL(raw, usemipmaps); } LLGLTexture::~LLGLTexture() @@ -81,13 +81,13 @@ void LLGLTexture::init() mFullWidth = 0; mFullHeight = 0; - mTexelsPerImage = 0 ; - mUseMipMaps = FALSE ; - mComponents = 0 ; + mTexelsPerImage = 0; + mUseMipMaps = FALSE; + mComponents = 0; - mTextureState = NO_DELETE ; + mTextureState = NO_DELETE; mDontDiscard = FALSE; - mNeedsGLTexture = FALSE ; + mNeedsGLTexture = FALSE; } void LLGLTexture::cleanup() @@ -111,287 +111,301 @@ void LLGLTexture::setBoostLevel(S32 level) { if(mBoostLevel != level) { - mBoostLevel = level ; + mBoostLevel = level; if(mBoostLevel != LLGLTexture::BOOST_NONE && mBoostLevel != LLGLTexture::BOOST_ICON) { - setNoDelete() ; + setNoDelete(); } } } void LLGLTexture::forceActive() { - mTextureState = ACTIVE ; + mTextureState = ACTIVE; } void LLGLTexture::setActive() { if(mTextureState != NO_DELETE) { - mTextureState = ACTIVE ; + mTextureState = ACTIVE; } } //set the texture to stay in memory void LLGLTexture::setNoDelete() { - mTextureState = NO_DELETE ; + mTextureState = NO_DELETE; } void LLGLTexture::generateGLTexture() { if(mGLTexturep.isNull()) { - mGLTexturep = new LLImageGL(mFullWidth, mFullHeight, mComponents, mUseMipMaps) ; + mGLTexturep = new LLImageGL(mFullWidth, mFullHeight, mComponents, mUseMipMaps); } } LLImageGL* LLGLTexture::getGLTexture() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep ; + return mGLTexturep; } BOOL LLGLTexture::createGLTexture() { if(mGLTexturep.isNull()) { - generateGLTexture() ; + generateGLTexture(); } - return mGLTexturep->createGLTexture() ; + return mGLTexturep->createGLTexture(); } BOOL LLGLTexture::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename, BOOL to_create, S32 category) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category) ; + BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category); if(ret) { - mFullWidth = mGLTexturep->getCurrentWidth() ; - mFullHeight = mGLTexturep->getCurrentHeight() ; - mComponents = mGLTexturep->getComponents() ; + mFullWidth = mGLTexturep->getCurrentWidth(); + mFullHeight = mGLTexturep->getCurrentHeight(); + mComponents = mGLTexturep->getComponents(); setTexelsPerImage(); } - return ret ; + return ret; } void LLGLTexture::setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - mGLTexturep->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes) ; + mGLTexturep->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes); } void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode mode) { - llassert(mGLTexturep.notNull()) ; - mGLTexturep->setAddressMode(mode) ; + llassert(mGLTexturep.notNull()); + mGLTexturep->setAddressMode(mode); } void LLGLTexture::setFilteringOption(LLTexUnit::eTextureFilterOptions option) { - llassert(mGLTexturep.notNull()) ; - mGLTexturep->setFilteringOption(option) ; + llassert(mGLTexturep.notNull()); + mGLTexturep->setFilteringOption(option); } //virtual S32 LLGLTexture::getWidth(S32 discard_level) const { - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getWidth(discard_level) ; + llassert(mGLTexturep.notNull()); + return mGLTexturep->getWidth(discard_level); } //virtual S32 LLGLTexture::getHeight(S32 discard_level) const { - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getHeight(discard_level) ; + llassert(mGLTexturep.notNull()); + return mGLTexturep->getHeight(discard_level); } S32 LLGLTexture::getMaxDiscardLevel() const { - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getMaxDiscardLevel() ; + llassert(mGLTexturep.notNull()); + return mGLTexturep->getMaxDiscardLevel(); } S32 LLGLTexture::getDiscardLevel() const { - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getDiscardLevel() ; + llassert(mGLTexturep.notNull()); + return mGLTexturep->getDiscardLevel(); } S8 LLGLTexture::getComponents() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getComponents() ; + return mGLTexturep->getComponents(); } LLGLuint LLGLTexture::getTexName() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getTexName() ; + return mGLTexturep->getTexName(); } BOOL LLGLTexture::hasGLTexture() const { if(mGLTexturep.notNull()) { - return mGLTexturep->getHasGLTexture() ; + return mGLTexturep->getHasGLTexture(); } - return FALSE ; + return FALSE; } BOOL LLGLTexture::getBoundRecently() const { if(mGLTexturep.notNull()) { - return mGLTexturep->getBoundRecently() ; + return mGLTexturep->getBoundRecently(); } - return FALSE ; + return FALSE; } LLTexUnit::eTextureType LLGLTexture::getTarget(void) const { - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getTarget() ; + llassert(mGLTexturep.notNull()); + return mGLTexturep->getTarget(); } BOOL LLGLTexture::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->setSubImage(imageraw, x_pos, y_pos, width, height) ; + return mGLTexturep->setSubImage(imageraw, x_pos, y_pos, width, height); } BOOL LLGLTexture::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->setSubImage(datap, data_width, data_height, x_pos, y_pos, width, height) ; + return mGLTexturep->setSubImage(datap, data_width, data_height, x_pos, y_pos, width, height); } void LLGLTexture::setGLTextureCreated (bool initialized) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - mGLTexturep->setGLTextureCreated (initialized) ; + mGLTexturep->setGLTextureCreated (initialized); } void LLGLTexture::setCategory(S32 category) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); + + mGLTexturep->setCategory(category); +} - mGLTexturep->setCategory(category) ; +void LLGLTexture::setTexName(LLGLuint texName) +{ + llassert(mGLTexturep.notNull()); + return mGLTexturep->setTexName(texName); +} + +void LLGLTexture::setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target) +{ + llassert(mGLTexturep.notNull()); + return mGLTexturep->setTarget(target, bind_target); } LLTexUnit::eTextureAddressMode LLGLTexture::getAddressMode(void) const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getAddressMode() ; + return mGLTexturep->getAddressMode(); } S32Bytes LLGLTexture::getTextureMemory() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->mTextureMemory ; + return mGLTexturep->mTextureMemory; } LLGLenum LLGLTexture::getPrimaryFormat() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getPrimaryFormat() ; + return mGLTexturep->getPrimaryFormat(); } BOOL LLGLTexture::getIsAlphaMask() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getIsAlphaMask() ; + return mGLTexturep->getIsAlphaMask(); } BOOL LLGLTexture::getMask(const LLVector2 &tc) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getMask(tc) ; + return mGLTexturep->getMask(tc); } F32 LLGLTexture::getTimePassedSinceLastBound() { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getTimePassedSinceLastBound() ; + return mGLTexturep->getTimePassedSinceLastBound(); } BOOL LLGLTexture::getMissed() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getMissed() ; + return mGLTexturep->getMissed(); } BOOL LLGLTexture::isJustBound() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->isJustBound() ; + return mGLTexturep->isJustBound(); } void LLGLTexture::forceUpdateBindStats(void) const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->forceUpdateBindStats() ; + return mGLTexturep->forceUpdateBindStats(); } U32 LLGLTexture::getTexelsInAtlas() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getTexelsInAtlas() ; + return mGLTexturep->getTexelsInAtlas(); } U32 LLGLTexture::getTexelsInGLTexture() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getTexelsInGLTexture() ; + return mGLTexturep->getTexelsInGLTexture(); } BOOL LLGLTexture::isGLTextureCreated() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->isGLTextureCreated() ; + return mGLTexturep->isGLTextureCreated(); } S32 LLGLTexture::getDiscardLevelInAtlas() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getDiscardLevelInAtlas() ; + return mGLTexturep->getDiscardLevelInAtlas(); } void LLGLTexture::destroyGLTexture() { if(mGLTexturep.notNull() && mGLTexturep->getHasGLTexture()) { - mGLTexturep->destroyGLTexture() ; - mTextureState = DELETED ; + mGLTexturep->destroyGLTexture(); + mTextureState = DELETED; } } void LLGLTexture::setTexelsPerImage() { - S32 fullwidth = llmin(mFullWidth,(S32)MAX_IMAGE_SIZE_DEFAULT); - S32 fullheight = llmin(mFullHeight,(S32)MAX_IMAGE_SIZE_DEFAULT); - mTexelsPerImage = (F32)fullwidth * fullheight; + U32 fullwidth = llmin(mFullWidth, (U32)MAX_IMAGE_SIZE_DEFAULT); + U32 fullheight = llmin(mFullHeight, (U32)MAX_IMAGE_SIZE_DEFAULT); + mTexelsPerImage = (U32)fullwidth * fullheight; } +static LLUUID sStubUUID; +const LLUUID& LLGLTexture::getID() const { return sStubUUID; } \ No newline at end of file diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h index 45592ee077..a57e48ffad 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -103,7 +103,7 @@ public: virtual void dump(); // debug info to LL_INFOS() - virtual const LLUUID& getID() const = 0; + virtual const LLUUID& getID() const; void setBoostLevel(S32 level); S32 getBoostLevel() { return mBoostLevel; } @@ -132,6 +132,8 @@ public: BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height); void setGLTextureCreated (bool initialized); void setCategory(S32 category) ; + void setTexName(LLGLuint); // for forcing w/ externally created textures only + void setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target); LLTexUnit::eTextureAddressMode getAddressMode(void) const ; S32 getMaxDiscardLevel() const; @@ -178,11 +180,11 @@ protected: protected: S32 mBoostLevel; // enum describing priority level - S32 mFullWidth; - S32 mFullHeight; + U32 mFullWidth; + U32 mFullHeight; BOOL mUseMipMaps; S8 mComponents; - F32 mTexelsPerImage; // Texels per image. + U32 mTexelsPerImage; // Texels per image. mutable S8 mNeedsGLTexture; //GL texture diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 20cba68f84..75f6cd405a 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -352,10 +352,9 @@ BOOL LLImageGL::create(LLPointer& dest, const LLImageRaw* imageraw, B } //---------------------------------------------------------------------------- - LLImageGL::LLImageGL(BOOL usemipmaps) : LLTrace::MemTrackable("LLImageGL"), - mSaveData(0) + mSaveData(0), mExternalTexture(FALSE) { init(usemipmaps); setSize(0, 0, 0); @@ -365,7 +364,7 @@ LLImageGL::LLImageGL(BOOL usemipmaps) LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) : LLTrace::MemTrackable("LLImageGL"), - mSaveData(0) + mSaveData(0), mExternalTexture(FALSE) { llassert( components <= 4 ); init(usemipmaps); @@ -376,7 +375,7 @@ LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps) : LLTrace::MemTrackable("LLImageGL"), - mSaveData(0) + mSaveData(0), mExternalTexture(FALSE) { init(usemipmaps); setSize(0, 0, 0); @@ -386,12 +385,36 @@ LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps) createGLTexture(0, imageraw); } +LLImageGL::LLImageGL( + LLGLuint texName, + U32 components, + LLGLenum target, + LLGLint formatInternal, + LLGLenum formatPrimary, + LLGLenum formatType, + LLTexUnit::eTextureAddressMode addressMode) + : LLTrace::MemTrackable("LLImageGL"), mSaveData(0), mExternalTexture(TRUE) +{ + init(false); + mTexName = texName; + mTarget = target; + mComponents = components; + mAddressMode = addressMode; + mFormatType = formatType; + mFormatInternal = formatInternal; + mFormatPrimary = formatPrimary; +} + + LLImageGL::~LLImageGL() { - LLImageGL::cleanup(); - sImageList.erase(this); - freePickMask(); - sCount--; + if (!mExternalTexture) + { + LLImageGL::cleanup(); + sImageList.erase(this); + freePickMask(); + sCount--; + } } void LLImageGL::init(BOOL usemipmaps) diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index ad2aea9067..bb0284a166 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -84,7 +84,10 @@ public: LLImageGL(BOOL usemipmaps = TRUE); LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps = TRUE); LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps = TRUE); - + + // For wrapping textures created via GL elsewhere with our API only. Use with caution. + LLImageGL(LLGLuint mTexName, U32 components, LLGLenum target, LLGLint formatInternal, LLGLenum formatPrimary, LLGLenum formatType, LLTexUnit::eTextureAddressMode addressMode); + protected: virtual ~LLImageGL(); @@ -234,6 +237,8 @@ protected: LLGLenum mFormatType; BOOL mFormatSwapBytes;// if true, use glPixelStorei(GL_UNPACK_SWAP_BYTES, 1) + BOOL mExternalTexture; + // STATICS public: static std::set sImageList; @@ -279,6 +284,8 @@ public: void setCategory(S32 category) {mCategory = category;} S32 getCategory()const {return mCategory;} + void setTexName(GLuint texName) { mTexName = texName; } + //for debug use: show texture size distribution //---------------------------------------- static S32 sCurTexSizeBar ; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 76f28bb43f..a8f622d3ff 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -49,6 +49,7 @@ U32 LLRender::sUICalls = 0; U32 LLRender::sUIVerts = 0; U32 LLTexUnit::sWhiteTexture = 0; bool LLRender::sGLCoreProfile = false; +bool LLRender::sNsightDebugSupport = false; static const U32 LL_NUM_TEXTURE_LAYERS = 32; static const U32 LL_NUM_LIGHT_UNITS = 8; @@ -58,7 +59,8 @@ static const GLenum sGLTextureType[] = GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_CUBE_MAP_ARB, - GL_TEXTURE_2D_MULTISAMPLE + GL_TEXTURE_2D_MULTISAMPLE, + GL_TEXTURE_3D }; static const GLint sGLAddressMode[] = diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index a67fb8da52..9ad3a6e593 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -61,10 +61,11 @@ public: typedef enum { TT_TEXTURE = 0, // Standard 2D Texture - TT_RECT_TEXTURE, // Non power of 2 texture - TT_CUBE_MAP, // 6-sided cube map texture + TT_RECT_TEXTURE, // Non power of 2 texture + TT_CUBE_MAP, // 6-sided cube map texture TT_MULTISAMPLE_TEXTURE, // see GL_ARB_texture_multisample - TT_NONE // No texture type is currently enabled + TT_TEXTURE_3D, // standard 3D Texture + TT_NONE, // No texture type is currently enabled } eTextureType; typedef enum @@ -438,7 +439,8 @@ public: static U32 sUICalls; static U32 sUIVerts; static bool sGLCoreProfile; - + static bool sNsightDebugSupport; + private: friend class LLLightState; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index b010a4ae64..287f22783f 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -512,16 +512,16 @@ static std::string get_object_log(GLhandleARB ret) void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string& filename) { std::string log = get_object_log(ret); + std::string fname = filename; + if (filename.empty()) + { + fname = "unknown shader file"; + } - if (log.length() > 0 || warns) + if (log.length() > 0) { - LL_DEBUGS("ShaderLoading") << "Shader loading "; - - if (!filename.empty()) - { - LL_CONT << "From " << filename << ":\n"; - } - LL_CONT << log << LL_ENDL; + LL_INFOS() << "Shader loading from " << fname << ":\n" << LL_ENDL; + LL_INFOS() << log << LL_ENDL; } } @@ -1114,7 +1114,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("specularMap"); mReservedUniforms.push_back("bumpMap"); mReservedUniforms.push_back("environmentMap"); - mReservedUniforms.push_back("cloude_noise_texture"); + mReservedUniforms.push_back("cloud_noise_texture"); mReservedUniforms.push_back("fullbright"); mReservedUniforms.push_back("lightnorm"); mReservedUniforms.push_back("sunlight_color"); @@ -1267,6 +1267,16 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("origin"); mReservedUniforms.push_back("display_gamma"); + + mReservedUniforms.push_back("inscatter"); + mReservedUniforms.push_back("sun_size"); + mReservedUniforms.push_back("fog_color"); + + mReservedUniforms.push_back("transmittance_texture"); + mReservedUniforms.push_back("scattering_texture"); + mReservedUniforms.push_back("irradiance_texture"); + mReservedUniforms.push_back("single_mie_scattering_texture"); + llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS); std::set dupe_check; diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 7bdd97200d..ac3f7d58d5 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -221,6 +221,17 @@ public: SHINY_ORIGIN, DISPLAY_GAMMA, + + INSCATTER_RT, + SUN_SIZE, + FOG_COLOR, + + // precomputed textures from libatmosphere + TRANSMITTANCE_TEX, + SCATTER_TEX, + ILLUMINANCE_TEX, + SINGLE_MIE_SCATTER_TEX, + END_RESERVED_UNIFORMS } eGLSLReservedUniforms; diff --git a/indra/llrender/lltexture.cpp b/indra/llrender/lltexture.cpp index 90fbcec2be..787a09a159 100644 --- a/indra/llrender/lltexture.cpp +++ b/indra/llrender/lltexture.cpp @@ -29,3 +29,15 @@ LLTexture::~LLTexture() { } + +S8 LLTexture::getType() const { llassert(false); return 0; } +void LLTexture::setKnownDrawSize(S32 width, S32 height) { llassert(false); } +bool LLTexture::bindDefaultImage(const S32 stage) { llassert(false); return false; } +bool LLTexture::bindDebugImage(const S32 stage) { llassert(false); return false; } +void LLTexture::forceImmediateUpdate() { llassert(false); } +void LLTexture::setActive() { llassert(false); } +S32 LLTexture::getWidth(S32 discard_level) const { llassert(false); return 0; } +S32 LLTexture::getHeight(S32 discard_level) const { llassert(false); return 0; } +bool LLTexture::isActiveFetching() { llassert(false); return false; } +LLImageGL* LLTexture::getGLTexture() const { llassert(false); return nullptr; } +void LLTexture::updateBindStatsForTester() { } \ No newline at end of file diff --git a/indra/llrender/lltexture.h b/indra/llrender/lltexture.h index 9fca8b8cd3..41481fb8a7 100644 --- a/indra/llrender/lltexture.h +++ b/indra/llrender/lltexture.h @@ -58,21 +58,21 @@ public: // //interfaces to access LLGLTexture // - virtual S8 getType() const = 0 ; - virtual void setKnownDrawSize(S32 width, S32 height) = 0 ; - virtual bool bindDefaultImage(const S32 stage = 0) = 0 ; - virtual bool bindDebugImage(const S32 stage = 0) = 0; - virtual void forceImmediateUpdate() = 0 ; - virtual void setActive() = 0 ; - virtual S32 getWidth(S32 discard_level = -1) const = 0 ; - virtual S32 getHeight(S32 discard_level = -1) const = 0 ; - virtual bool isActiveFetching() = 0; + virtual S8 getType() const; + virtual void setKnownDrawSize(S32 width, S32 height); + virtual bool bindDefaultImage(const S32 stage = 0); + virtual bool bindDebugImage(const S32 stage = 0); + virtual void forceImmediateUpdate(); + virtual void setActive(); + virtual S32 getWidth(S32 discard_level = -1) const; + virtual S32 getHeight(S32 discard_level = -1) const; + virtual bool isActiveFetching(); private: //note: do not make this function public. - virtual LLImageGL* getGLTexture() const = 0 ; + virtual LLImageGL* getGLTexture() const; - virtual void updateBindStatsForTester() = 0 ; + virtual void updateBindStatsForTester(); }; #endif diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index ecd7c4bc36..380d7762d6 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -35,7 +35,7 @@ tags - + levelDEBUG diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4a4f4bfc61..d277a1158c 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10122,6 +10122,17 @@ Value 0 + RenderUseAdvancedAtmospherics + + Comment + Use fancy precomputed atmospherics and stuff. + Persist + 1 + Type + Boolean + Value + 1 + RenderUseTriStrips Comment diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 03bdb754b5..7f1a8cce0d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -397,7 +397,9 @@ void main() float da = dot(norm.xyz, sun_dir.xyz); float final_da = max(0.0,da); - final_da = min(final_da, 1.0f); + final_da = min(final_da, 1.0f); + +// why an ad hoc gamma boost here? srgb_to_linear instead? final_da = pow(final_da, 1.0/1.3); vec4 diffuse = texture2DRect(diffuseRect, tc); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index f7832521fa..cf076d156a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -276,10 +276,6 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) { + tmpAmbient))); //brightness of surface both sunlight and ambient - /*setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * global_gamma); - setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * global_gamma); - setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * global_gamma);*/ - setSunlitColor(vec3(sunlight * .5)); setAmblitColor(vec3(tmpAmbient * .25)); setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 81af1fdc8a..b2d9de6e73 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -238,8 +238,8 @@ void main() proj_tc.xyz /= proj_tc.w; - float fa = falloff+1.0; - float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0); + float fa = falloff + 1.0; + float dist_atten = min(1.0 - (dist - 1.0 * (1.0 - fa)) / fa, 1.0); dist_atten *= dist_atten; dist_atten *= 2.0; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 95e5cbe09e..85ec2a6ebc 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -205,6 +205,7 @@ #include "llfloateroutfitsnapshot.h" #include "llfloatersnapshot.h" #include "llsidepanelinventory.h" +#include "llatmosphere.h" // includes for idle() idleShutdown() #include "llviewercontrol.h" @@ -1097,6 +1098,7 @@ bool LLAppViewer::init() } } +#if LL_RELEASE_FOR_DOWNLOAD char* PARENT = getenv("PARENT"); if (! (PARENT && std::string(PARENT) == "SL_Launcher")) { @@ -1109,6 +1111,7 @@ bool LLAppViewer::init() // him/herself in the foot. LLNotificationsUtil::add("RunLauncher"); } +#endif #if LL_WINDOWS if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion()) @@ -1470,7 +1473,7 @@ bool LLAppViewer::frame() LLAppViewer::getImageDecodeThread()->pause(); } } - + if (mRandomizeFramerate) { ms_sleep(rand() % 200); @@ -1641,6 +1644,8 @@ void LLAppViewer::flushVFSIO() bool LLAppViewer::cleanup() { + LLAtmosphere::cleanupClass(); + //ditch LLVOAvatarSelf instance gAgentAvatarp = NULL; diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index f10c116555..042d7d971a 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -42,6 +42,7 @@ #include "llrender.h" #include "llenvironment.h" +#include "llatmosphere.h" LLPointer LLDrawPoolWLSky::sCloudNoiseTexture = NULL; @@ -125,38 +126,51 @@ void LLDrawPoolWLSky::endDeferredPass(S32 pass) void LLDrawPoolWLSky::renderDome(F32 camHeightLocal, LLGLSLShader * shader) const { - LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); - - llassert_always(NULL != shader); - - gGL.pushMatrix(); - - //chop off translation - if (LLPipeline::sReflectionRender && origin.mV[2] > 256.f) - { - gGL.translatef(origin.mV[0], origin.mV[1], 256.f-origin.mV[2]*0.5f); - } - else - { - gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); - } + llassert_always(NULL != shader); + + static LLStaticHashedString sCamPosLocal("camPosLocal"); + + LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); + + if (gPipeline.useAdvancedAtmospherics()) + { + // Draw WL Sky w/ normal cam pos (where you are) for adv atmo sky + sky_shader->uniform3f(sCamPosLocal, origin.mV[0], origin.mV[1], origin.mV[2]); + +// TBD replace this with a FS tri pass, there's little point to the tess when you have fragment shaders... + + gSky.mVOWLSkyp->drawDome(); + } + else + { + gGL.pushMatrix(); + + //chop off translation + if (LLPipeline::sReflectionRender && origin.mV[2] > 256.f) + { + gGL.translatef(origin.mV[0], origin.mV[1], 256.f-origin.mV[2]*0.5f); + } + else + { + gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); + } - // the windlight sky dome works most conveniently in a coordinate system - // where Y is up, so permute our basis vectors accordingly. - gGL.rotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3); + // the windlight sky dome works most conveniently in a coordinate system + // where Y is up, so permute our basis vectors accordingly. + gGL.rotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3); - gGL.scalef(0.333f, 0.333f, 0.333f); + gGL.scalef(0.333f, 0.333f, 0.333f); - gGL.translatef(0.f,-camHeightLocal, 0.f); + gGL.translatef(0.f,-camHeightLocal, 0.f); - // Draw WL Sky - static LLStaticHashedString sCamPosLocal("camPosLocal"); - shader->uniform3f(sCamPosLocal, 0.f, camHeightLocal, 0.f); + // Draw WL Sky + shader->uniform3f(sCamPosLocal, 0.f, camHeightLocal, 0.f); - gSky.mVOWLSkyp->drawDome(); + gSky.mVOWLSkyp->drawDome(); - gGL.popMatrix(); + gGL.popMatrix(); + } } void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const @@ -167,6 +181,33 @@ void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const sky_shader->bind(); + if (gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders() && gAtmosphere) + { + // bind precomputed textures necessary for calculating sun and sky luminance + sky_shader->bindTexture(LLShaderMgr::TRANSMITTANCE_TEX, gAtmosphere->getTransmittance()); + sky_shader->bindTexture(LLShaderMgr::SCATTER_TEX, gAtmosphere->getScattering()); + sky_shader->bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getSingleMieScattering()); + + static float sunSize = (float)cos(0.0005); + + sky_shader->uniform1f(LLShaderMgr::SUN_SIZE, sunSize); + + static LLVector3 solDir(0.7f, 0.2f, 0.2f); + + //neither of these appear to track with the env settings, would the real sun please stand up. + //sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, gPipeline.mTransformedSunDir.mV); + //sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, gSky.mVOSkyp->getSun().getDirection().mV); + solDir.normalize(); + + sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, solDir.mV); + + // clouds are rendered along with sky in adv atmo + if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && sCloudNoiseTexture.notNull()) + { + sky_shader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, sCloudNoiseTexture); + } + } + /// Render the skydome renderDome(camHeightLocal, sky_shader); @@ -190,8 +231,9 @@ void LLDrawPoolWLSky::renderStars(void) const // *NOTE: we divide by two here and GL_ALPHA_SCALE by two below to avoid // clamping and allow the star_alpha param to brighten the stars. LLColor4 star_alpha(LLColor4::black); + // *LAPRAS - star_alpha.mV[3] = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / 2.f; + star_alpha.mV[3] = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / (2.f + ((rand() >> 16)/65535.0f)); // twinkle twinkle // If start_brightness is not set, exit if( star_alpha.mV[3] < 0.001 ) @@ -322,8 +364,10 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) renderSkyHaze(camHeightLocal); - LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); - gGL.pushMatrix(); + if (!gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders()) + { + LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); + gGL.pushMatrix(); gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); @@ -340,13 +384,12 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) gDeferredStarProgram.unbind(); - gGL.popMatrix(); + gGL.popMatrix(); + } renderSkyClouds(camHeightLocal); - - gGL.setColorMask(true, true); - //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - + + gGL.setColorMask(true, true); } void LLDrawPoolWLSky::render(S32 pass) @@ -367,8 +410,10 @@ void LLDrawPoolWLSky::render(S32 pass) renderSkyHaze(camHeightLocal); - LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); - gGL.pushMatrix(); + if (!gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders()) + { + LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); + gGL.pushMatrix(); gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); @@ -380,9 +425,9 @@ void LLDrawPoolWLSky::render(S32 pass) renderHeavenlyBodies(); renderStars(); - - gGL.popMatrix(); + gGL.popMatrix(); + } renderSkyClouds(camHeightLocal); diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index cd15c991ee..586219e4bc 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -39,6 +39,8 @@ public: static const U32 STAR_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXCOORD0; + static const U32 ADV_ATMO_SKY_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX; + LLDrawPoolWLSky(void); /*virtual*/ ~LLDrawPoolWLSky(); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index df708013fc..6e89763ba2 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2507,7 +2507,7 @@ void LLMeshUploadThread::requestWholeModelFee() { ms_sleep(sleep_time); sleep_time = llmin(250U, sleep_time + sleep_time); - mHttpRequest->update(0); + mHttpRequest->update(0); } if (isDiscarded()) { diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index e40d3da338..bec05fa263 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -44,6 +44,7 @@ #include "lljoint.h" #include "llskinningutil.h" #include "llenvironment.h" +#include "llatmosphere.h" #ifdef LL_RELEASE_FOR_DOWNLOAD #define UNIFORM_ERRS LL_WARNS_ONCE("Shader") @@ -92,6 +93,8 @@ LLGLSLShader gDebugProgram; LLGLSLShader gClipProgram; LLGLSLShader gDownsampleDepthProgram; LLGLSLShader gDownsampleDepthRectProgram; +LLGLSLShader gDownsampleMinMaxDepthRectProgram; +LLGLSLShader gInscatterRectProgram; LLGLSLShader gAlphaMaskProgram; LLGLSLShader gBenchmarkProgram; @@ -474,7 +477,7 @@ void LLViewerShaderMgr::setShaders() S32 env_class = 2; S32 obj_class = 2; S32 effect_class = 2; - S32 wl_class = 2; + S32 wl_class = 3; S32 water_class = 2; S32 deferred_class = 0; S32 transform_class = gGLManager.mHasTransformFeedback ? 1 : 0; @@ -498,14 +501,13 @@ void LLViewerShaderMgr::setShaders() { //no shadows deferred_class = 1; } - - //make sure hardware skinning is enabled - //gSavedSettings.setBOOL("RenderAvatarVP", TRUE); - - //make sure atmospheric shaders are enabled - //gSavedSettings.setBOOL("WindLightUseAtmosShaders", TRUE); } + // clamp to WL class 2 if we have disabled adv atmo (class 3) + if (!gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics")) + { + wl_class = llmin(wl_class, 2); + } if (!(LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders") && gSavedSettings.getBOOL("WindLightUseAtmosShaders"))) @@ -515,7 +517,6 @@ void LLViewerShaderMgr::setShaders() wl_class = 1; } - // Trigger a full rebuild of the fallback skybox / cubemap if we've toggled windlight shaders if (mVertexShaderLevel[SHADER_WINDLIGHT] != wl_class && gSky.mVOSkyp.notNull()) { @@ -543,6 +544,7 @@ void LLViewerShaderMgr::setShaders() // Load all shaders to set max levels loaded = loadShadersEnvironment(); + llassert(loaded); if (loaded) { @@ -579,14 +581,10 @@ void LLViewerShaderMgr::setShaders() if (gSavedSettings.getBOOL("RenderAvatarVP") && loadShadersObject()) { //hardware skinning is enabled and rigged attachment shaders loaded correctly BOOL avatar_cloth = gSavedSettings.getBOOL("RenderAvatarCloth"); - S32 avatar_class = 1; - - // cloth is a class3 shader - if(avatar_cloth) - { - avatar_class = 3; - } + // cloth is a class3 shader + S32 avatar_class = avatar_cloth ? 3 : 1; + // Set the actual level mVertexShaderLevel[SHADER_AVATAR] = avatar_class; loadShadersAvatar(); @@ -699,6 +697,8 @@ void LLViewerShaderMgr::unloadShaders() gClipProgram.unload(); gDownsampleDepthProgram.unload(); gDownsampleDepthRectProgram.unload(); + gDownsampleMinMaxDepthRectProgram.unload(); + gInscatterRectProgram.unload(); gBenchmarkProgram.unload(); gAlphaMaskProgram.unload(); gUIProgram.unload(); @@ -1954,15 +1954,19 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { gDeferredWLSkyProgram.mName = "Deferred Windlight Sky Shader"; //gWLSkyProgram.mFeatures.hasGamma = true; - gDeferredWLSkyProgram.mShaderFiles.clear(); + gDeferredWLSkyProgram.mShaderFiles.clear(); gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; + if (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3) + { + gDeferredWLSkyProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); + } success = gDeferredWLSkyProgram.createShader(NULL, NULL); } - if (success) + if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3)) { gDeferredWLCloudProgram.mName = "Deferred Windlight Cloud Program"; gDeferredWLCloudProgram.mShaderFiles.clear(); @@ -3265,16 +3269,6 @@ BOOL LLViewerShaderMgr::loadShadersInterface() success = gDownsampleDepthRectProgram.createShader(NULL, NULL); } - if (success) - { - gDownsampleDepthRectProgram.mName = "DownsampleDepthRect Shader"; - gDownsampleDepthRectProgram.mShaderFiles.clear(); - gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthV.glsl", GL_VERTEX_SHADER_ARB)); - gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthRectF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDownsampleDepthRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; - success = gDownsampleDepthRectProgram.createShader(NULL, NULL); - } - if (success) { gAlphaMaskProgram.mName = "Alpha Mask Shader"; @@ -3302,9 +3296,43 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() { gWLSkyProgram.unload(); gWLCloudProgram.unload(); + gDownsampleMinMaxDepthRectProgram.unload(); + gInscatterRectProgram.unload(); return TRUE; } + if (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3) + { + // Prepare precomputed atmospherics textures using libatmosphere + LLAtmosphere::initClass(); + } + + // this shader uses gather so it can't live with the other basic shaders safely + if (success) + { + gDownsampleMinMaxDepthRectProgram.mName = "DownsampleMinMaxDepthRect Shader"; + gDownsampleMinMaxDepthRectProgram.mShaderFiles.clear(); + gDownsampleMinMaxDepthRectProgram.mShaderFiles.push_back(make_pair("windlight/downsampleMinMaxDepthV.glsl", GL_VERTEX_SHADER_ARB)); + gDownsampleMinMaxDepthRectProgram.mShaderFiles.push_back(make_pair("windlight/downsampleMinMaxDepthRectF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDownsampleMinMaxDepthRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; + success = gDownsampleMinMaxDepthRectProgram.createShader(NULL, NULL); + } + + // this shader uses gather so it can't live with the other basic shaders safely + if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3)) + { + gInscatterRectProgram.mName = "Inscatter Shader"; + gInscatterRectProgram.mShaderFiles.clear(); + gInscatterRectProgram.mShaderFiles.push_back(make_pair("windlight/atmoV.glsl", GL_VERTEX_SHADER_ARB)); + gInscatterRectProgram.mShaderFiles.push_back(make_pair("windlight/atmoF.glsl", GL_FRAGMENT_SHADER_ARB)); + gInscatterRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; + llassert(gAtmosphere != nullptr); + gInscatterRectProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); + success = gInscatterRectProgram.createShader(NULL, NULL); + } + + llassert(success); + if (success) { gWLSkyProgram.mName = "Windlight Sky Shader"; @@ -3314,10 +3342,16 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyF.glsl", GL_FRAGMENT_SHADER_ARB)); gWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; gWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; + if (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3) + { + gWLSkyProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); + } success = gWLSkyProgram.createShader(NULL, NULL); } - if (success) + llassert(success); + + if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3)) { gWLCloudProgram.mName = "Windlight Cloud Program"; //gWLCloudProgram.mFeatures.hasGamma = true; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 923aa522ad..10c60187f3 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -184,6 +184,8 @@ extern LLGLSLShader gDebugProgram; extern LLGLSLShader gClipProgram; extern LLGLSLShader gDownsampleDepthProgram; extern LLGLSLShader gDownsampleDepthRectProgram; +extern LLGLSLShader gDownsampleMinMaxDepthRectProgram; +extern LLGLSLShader gInscatterRectProgram; extern LLGLSLShader gBenchmarkProgram; //output tex0[tc0] + tex1[tc1] diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index e5a1bed48c..cbde0af9b3 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1176,12 +1176,12 @@ void LLViewerFetchedTexture::loadFromFastCache() { return; //no need to access the fast cache. } - mInFastCacheList = FALSE; + mInFastCacheList = FALSE; mRawImage = LLAppViewer::getTextureCache()->readFromFastCache(getID(), mRawDiscardLevel); if(mRawImage.notNull()) { - mFullWidth = mRawImage->getWidth() << mRawDiscardLevel; + mFullWidth = mRawImage->getWidth() << mRawDiscardLevel; mFullHeight = mRawImage->getHeight() << mRawDiscardLevel; setTexelsPerImage(); @@ -1196,20 +1196,20 @@ void LLViewerFetchedTexture::loadFromFastCache() else { if (mBoostLevel == LLGLTexture::BOOST_ICON) + { + S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENTIONS; + S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENTIONS; + if (mRawImage && (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height)) { - S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENTIONS; - S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENTIONS; - if (mRawImage && (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height)) - { - // scale oversized icon, no need to give more work to gl - mRawImage->scale(expected_width, expected_height); - } + // scale oversized icon, no need to give more work to gl + mRawImage->scale(expected_width, expected_height); + } } - mRequestedDiscardLevel = mDesiredDiscardLevel + 1; - mIsRawImageValid = TRUE; - addToCreateTexture(); - } + mRequestedDiscardLevel = mDesiredDiscardLevel + 1; + mIsRawImageValid = TRUE; + addToCreateTexture(); + } } } @@ -1965,7 +1965,7 @@ bool LLViewerFetchedTexture::updateFetch() mIsFetched = TRUE; tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)); } - mRawDiscardLevel = fetch_discard; + mRawDiscardLevel = fetch_discard; if ((mRawImage->getDataSize() > 0 && mRawDiscardLevel >= 0) && (current_discard < 0 || mRawDiscardLevel < current_discard)) { diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index c9dea17f63..5bc274ee5b 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -225,8 +225,8 @@ public: static S8 sCameraMovingDiscardBias; static F32 sCameraMovingBias; static S32 sMaxSculptRez ; - static S32 sMinLargeImageSize ; - static S32 sMaxSmallImageSize ; + static U32 sMinLargeImageSize ; + static U32 sMaxSmallImageSize ; static BOOL sFreezeImageScalingDown ;//do not scale down image res if set. static F32 sCurrentTime ; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 0ac1bfa3e7..849273df15 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -381,6 +381,7 @@ bool LLPipeline::sRenderBump = true; bool LLPipeline::sBakeSunlight = false; bool LLPipeline::sNoAlpha = false; bool LLPipeline::sUseTriStrips = true; +bool LLPipeline::sUseAdvancedAtmospherics = true; bool LLPipeline::sUseFarClip = true; bool LLPipeline::sShadowRender = false; bool LLPipeline::sWaterReflections = false; @@ -480,6 +481,7 @@ void LLPipeline::init() sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD"); sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips"); + sUseAdvancedAtmospherics = gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics"); LLVertexBuffer::sUseStreamDraw = gSavedSettings.getBOOL("RenderUseStreamVBO"); LLVertexBuffer::sUseVAO = gSavedSettings.getBOOL("RenderUseVAO"); LLVertexBuffer::sPreferStreamDraw = gSavedSettings.getBOOL("RenderPreferStreamDraw"); @@ -981,7 +983,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) for (U32 i = 0; i < 4; i++) { if (!mShadow[i].allocate(sun_shadow_map_width,U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false; - if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false; + if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false; } } else @@ -993,6 +995,13 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) } } +// for EEP atmospherics + bool allocated_inscatter = mInscatter.allocate(resX >> 2, resY >> 2, GL_RGBA16F_ARB, FALSE, FALSE, LLTexUnit::TT_TEXTURE); + if (!allocated_inscatter) + { + return false; + } + U32 width = (U32) (resX*scale); U32 height = width; @@ -1229,6 +1238,8 @@ void LLPipeline::releaseScreenBuffers() mShadow[i].release(); mShadowOcclusion[i].release(); } + + mInscatter.release(); } @@ -2646,6 +2657,65 @@ void LLPipeline::markOccluder(LLSpatialGroup* group) } } +void LLPipeline::downsampleMinMaxDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space) +{ + LLGLSLShader* last_shader = LLGLSLShader::sCurBoundShaderPtr; + + LLGLSLShader* shader = NULL; + + if (scratch_space) + { + scratch_space->copyContents(source, + 0, 0, source.getWidth(), source.getHeight(), + 0, 0, scratch_space->getWidth(), scratch_space->getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); + } + + dest.bindTarget(); + dest.clear(GL_COLOR_BUFFER_BIT); // dest should be an RG16F target + + LLStrider vert; + mDeferredVB->getVertexStrider(vert); + LLStrider tc0; + + vert[0].set(-1, 1, 0); + vert[1].set(-1, -3, 0); + vert[2].set(3, 1, 0); + + if (source.getUsage() == LLTexUnit::TT_RECT_TEXTURE) + { + shader = &gDownsampleMinMaxDepthRectProgram; + shader->bind(); + shader->uniform2f(sDelta, 1.f, 1.f); + shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, source.getWidth(), source.getHeight()); + } + else + { + shader = &gDownsampleMinMaxDepthRectProgram; + shader->bind(); + shader->uniform2f(sDelta, 1.f / source.getWidth(), 1.f / source.getHeight()); + shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, 1.f, 1.f); + } + + gGL.getTexUnit(0)->bind(scratch_space ? scratch_space : &source, TRUE); + + { + LLGLDepthTest depth(GL_FALSE, GL_FALSE, GL_ALWAYS); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); + } + + dest.flush(); + + if (last_shader) + { + last_shader->bind(); + } + else + { + shader->unbind(); + } +} + void LLPipeline::downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space) { LLGLSLShader* last_shader = LLGLSLShader::sCurBoundShaderPtr; @@ -8282,6 +8352,21 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n } } + channel = shader.enableTexture(LLShaderMgr::INSCATTER_RT, LLTexUnit::TT_TEXTURE); + stop_glerror(); + if (channel > -1) + { + stop_glerror(); + gGL.getTexUnit(channel)->bind(&mInscatter, TRUE); + gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + stop_glerror(); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_ALWAYS); + stop_glerror(); + } + stop_glerror(); F32 mat[16*6]; @@ -9095,6 +9180,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) } } +// pretty sure this doesn't work as expected since the shaders using 'shadow_ofset' all declare it as a single uniform float, no array or vec gDeferredSunProgram.uniform3fv(LLShaderMgr::DEFERRED_SHADOW_OFFSET, slice, offset); gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredLight.getWidth(), mDeferredLight.getHeight()); @@ -9911,9 +9997,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) } else { - renderGeom(camera); - } - } + renderGeom(camera); + } + } } if (LLPipeline::sRenderDeferred && materials_in_water) @@ -10412,23 +10498,25 @@ bool LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector for (U32 j = 0; j < 3; ++j) { - if (p[j] < ext[0].mV[j] || - p[j] > ext[1].mV[j]) + if (p[j] < ext[0].mV[j] || p[j] > ext[1].mV[j]) { found = false; break; } } - - for (U32 j = 0; j < LLCamera::AGENT_PLANE_NO_USER_CLIP_NUM; ++j) + + if (found) // don't bother testing user clip planes if we're already rejected... { - const LLPlane& cp = camera.getAgentPlane(j); - F32 dist = cp.dist(pp[i]); - if (dist > 0.05f) //point is above some plane, not contained - { - found = false; - break; - } + for (U32 j = 0; j < LLCamera::AGENT_PLANE_NO_USER_CLIP_NUM; ++j) + { + const LLPlane& cp = camera.getAgentPlane(j); + F32 dist = cp.dist(pp[i]); + if (dist > 0.05f) //point is above some plane, not contained + { + found = false; + break; + } + } } if (found) @@ -11959,3 +12047,7 @@ void LLPipeline::restoreHiddenObject( const LLUUID& id ) } } +bool LLPipeline::useAdvancedAtmospherics() const +{ + return sUseAdvancedAtmospherics; +} \ No newline at end of file diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index c9670a60f2..6023a41ca2 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -168,6 +168,9 @@ public: // if source's depth buffer cannot be bound for reading, a scratch space depth buffer must be provided void downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL); + // Downsample depth buffer with gather and find local min/max depth values. Writes to a 16F RG render target. + void downsampleMinMaxDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL); + void doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL); void doOcclusion(LLCamera& camera); void markNotCulled(LLSpatialGroup* group, LLCamera &camera); @@ -541,6 +544,8 @@ public: void updateCamera(bool reset = false); + bool useAdvancedAtmospherics() const; + LLVector3 mFlyCamPosition; LLQuaternion mFlyCamRotation; @@ -568,6 +573,7 @@ public: static bool sBakeSunlight; static bool sNoAlpha; static bool sUseTriStrips; + static bool sUseAdvancedAtmospherics; static bool sUseFarClip; static bool sShadowRender; static bool sWaterReflections; @@ -614,12 +620,13 @@ public: //sun shadow map LLRenderTarget mShadow[6]; LLRenderTarget mShadowOcclusion[6]; - std::vector mShadowFrustPoints[4]; - LLVector4 mShadowError; - LLVector4 mShadowFOV; - LLVector3 mShadowFrustOrigin[4]; - LLCamera mShadowCamera[8]; - LLVector3 mShadowExtents[4][2]; + LLRenderTarget mInscatter; + std::vector mShadowFrustPoints[4]; + LLVector4 mShadowError; + LLVector4 mShadowFOV; + LLVector3 mShadowFrustOrigin[4]; + LLCamera mShadowCamera[8]; + LLVector3 mShadowExtents[4][2]; glh::matrix4f mSunShadowMatrix[6]; glh::matrix4f mShadowModelview[6]; glh::matrix4f mShadowProjection[6]; -- cgit v1.2.3 From 6cc4a091b3ba4dd4842cc06e3b34af3d04dc5796 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 22 Feb 2018 00:35:24 +0000 Subject: Add settings/validations for new advanced atmo settings. --- indra/cmake/Atmosphere.cmake | 5 + indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsbase.h | 1 + indra/llinventory/llsettingssky.cpp | 287 +++++++++++++++++++++++++++++++- indra/llinventory/llsettingssky.h | 30 +++- indra/llrender/CMakeLists.txt | 7 +- indra/llrender/llatmosphere.cpp | 218 ++++++++++++++++++++++++ indra/llrender/llatmosphere.h | 72 ++++++++ indra/llrender/llgltexture.h | 2 +- indra/newview/app_settings/settings.xml | 2 +- indra/newview/lldrawpoolwlsky.cpp | 2 +- indra/newview/llsettingsvo.cpp | 1 + indra/newview/llviewershadermgr.cpp | 6 +- indra/newview/llviewertexture.cpp | 4 +- indra/newview/pipeline.cpp | 2 +- 15 files changed, 621 insertions(+), 20 deletions(-) create mode 100644 indra/cmake/Atmosphere.cmake create mode 100644 indra/llrender/llatmosphere.cpp create mode 100644 indra/llrender/llatmosphere.h (limited to 'indra') diff --git a/indra/cmake/Atmosphere.cmake b/indra/cmake/Atmosphere.cmake new file mode 100644 index 0000000000..0975e3df02 --- /dev/null +++ b/indra/cmake/Atmosphere.cmake @@ -0,0 +1,5 @@ +# -*- cmake -*- +include(Prebuilt) +use_prebuilt_binary(libatmosphere) +set(LIBATMOSPHERE_LIBRARIES libatmosphere) +set(LIBATMOSPHERE_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/atmosphere) diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7ade345168..0918252fa0 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -333,7 +333,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida { std::stringstream errtext; - errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!"; + errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!\n"; errors.append( errtext.str() ); isValid = false; } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 420bcb9943..4273e1d3a0 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -191,6 +191,7 @@ public: typedef std::vector validation_list_t; static LLSD settingValidation(LLSD &settings, validation_list_t &validations); + protected: LLSettingsBase(); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 572b5703b3..ff3f5224dd 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -79,12 +79,28 @@ const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id"); const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness"); const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color"); const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation"); -const std::string LLSettingsSky::SETTING_SUN_TEXUTUREID("sun_id"); +const std::string LLSettingsSky::SETTING_SUN_TEXTUREID("sun_id"); const std::string LLSettingsSky::SETTING_LEGACY_EAST_ANGLE("east_angle"); const std::string LLSettingsSky::SETTING_LEGACY_ENABLE_CLOUD_SCROLL("enable_cloud_scroll"); const std::string LLSettingsSky::SETTING_LEGACY_SUN_ANGLE("sun_angle"); +// these are new settings for the advanced atmospherics model +const std::string LLSettingsSky::SETTING_PLANET_RADIUS("planet_radius"); +const std::string LLSettingsSky::SETTING_SKY_BOTTOM_RADIUS("sky_bottom_radius"); +const std::string LLSettingsSky::SETTING_SKY_TOP_RADIUS("sky_top_radius"); +const std::string LLSettingsSky::SETTING_RAYLEIGH_CONFIG("rayleigh"); +const std::string LLSettingsSky::SETTING_MIE_CONFIG("mie"); +const std::string LLSettingsSky::SETTING_ABSORPTION_CONFIG("absorption"); +const std::string LLSettingsSky::KEY_DENSITY_PROFILE("density"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH("width"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM("exp_term"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_scale"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); +const std::string LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR("anisotropy"); +const std::string LLSettingsSky::SETTING_SUN_ARC_RADIANS("sun_arc_radians"); + //========================================================================= LLSettingsSky::LLSettingsSky(const LLSD &data) : LLSettingsBase(data) @@ -144,6 +160,78 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const return slepSet; } +LLSettingsSky::validation_list_t LLSettingsSky::rayleighValidationList() +{ + static validation_list_t rayleighValidation; + if (rayleighValidation.empty()) + { + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return rayleighValidation; +} + +LLSettingsSky::validation_list_t LLSettingsSky::absorptionValidationList() +{ + static validation_list_t absorptionValidation; + if (absorptionValidation.empty()) + { + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return absorptionValidation; +} + +LLSettingsSky::validation_list_t LLSettingsSky::mieValidationList() +{ + static validation_list_t mieValidation; + if (mieValidation.empty()) + { + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + + mieValidation.push_back(Validator(SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return mieValidation; +} + LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const { return LLSettingsSky::validationList(); @@ -224,7 +312,19 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_SUN_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); - validation.push_back(Validator(SETTING_SUN_TEXUTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_SUN_TEXTUREID, false, LLSD::TypeUUID)); + + validation.push_back(Validator(SETTING_PLANET_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SKY_BOTTOM_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SKY_TOP_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); } return validation; @@ -268,13 +368,194 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; dfltsetting[SETTING_CLOUD_TEXTUREID] = LLUUID::null; dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! - dfltsetting[SETTING_SUN_TEXUTUREID] = IMG_SUN; // gSunTextureID; + dfltsetting[SETTING_SUN_TEXTUREID] = IMG_SUN; // gSunTextureID; dfltsetting[SETTING_TYPE] = "sky"; + // defaults are for earth... + dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + + LLSD dflt_rayleigh; + dflt_rayleigh[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + + dfltsetting[SETTING_RAYLEIGH_CONFIG] = dflt_rayleigh; + + LLSD dflt_mie; + dflt_mie[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_mie[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_mie[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; + dflt_mie[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_mie[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_mie[SETTING_MIE_ANISOTROPY_FACTOR] = 0.9f; + + dfltsetting[SETTING_MIE_CONFIG] = dflt_mie; + + // absorption (ozone) has two linear ramping zones + LLSD dflt_absorption_a; + dflt_absorption_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere + dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; + dflt_absorption_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; + + LLSD dflt_absorption_b; + dflt_absorption_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere + dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; + dflt_absorption_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; + + LLSD wtf; + wtf.append(dflt_absorption_a); + wtf.append(dflt_absorption_b); + + dfltsetting[SETTING_ABSORPTION_CONFIG] = wtf; + return dfltsetting; } +#pragma optimize("", off) + +LLSD LLSettingsSky::settingValidation(LLSD &settingsIn, validation_list_t &validations) +{ + // Make a copy we can safely modify + LLSD settings = settingsIn; + + validation_list_t& rayleighValidations = rayleighValidationList(); + validation_list_t& absorptionValidations = absorptionValidationList(); + validation_list_t& mieValidations = mieValidationList(); + + bool isValid = true; + + LLSD& rayleighConfigs = settings[SETTING_RAYLEIGH_CONFIG]; + LLSD& mieConfigs = settings[SETTING_MIE_CONFIG]; + LLSD& absorptionConfigs = settings[SETTING_ABSORPTION_CONFIG]; + +// this is an attempt to handle a single defined layer (w/o array elem) +// but also handle an array of density profiles if they are specified thus. + if (rayleighConfigs.isArray()) + { + for (LLSD::array_iterator it = rayleighConfigs.beginArray(); it != rayleighConfigs.endArray(); ++it) + { + LLSD rayleighResults = LLSettingsBase::settingValidation(*it, rayleighValidations); + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD rayleighResults = LLSettingsBase::settingValidation(rayleighConfigs, rayleighValidations); + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + + if (mieConfigs.isArray()) + { + for (LLSD::array_iterator it = mieConfigs.beginArray(); it != mieConfigs.endArray(); ++it) + { + LLSD mieResults = LLSettingsBase::settingValidation(*it, mieValidations); + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD mieResults = LLSettingsBase::settingValidation(mieConfigs, mieValidations); + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + + if (absorptionConfigs.isArray()) + { + for (LLSD::array_iterator it = absorptionConfigs.beginArray(); it != absorptionConfigs.endArray(); ++it) + { + LLSD absorptionResults = LLSettingsBase::settingValidation(*it, absorptionValidations); + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD absorptionResults = LLSettingsBase::settingValidation(absorptionConfigs, absorptionValidations); + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + +#if 0 + LLSD& rayleigh = settings[SETTING_RAYLEIGH_CONFIG]; + LLSD& absorption = settings[SETTING_ABSORPTION_CONFIG]; + LLSD& mie = settings[SETTING_MIE_CONFIG]; + LLSD rayleighResults = LLSettingsBase::settingValidation(rayleigh, rayleighValidations); + LLSD absorptionResults = LLSettingsBase::settingValidation(absorption, absorptionValidations); + LLSD mieResults = LLSettingsBase::settingValidation(mie, mieValidations); + + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } +#endif + + settings.erase(SETTING_RAYLEIGH_CONFIG); + settings.erase(SETTING_ABSORPTION_CONFIG); + settings.erase(SETTING_MIE_CONFIG); + + if (isValid) + { + return LLSettingsBase::settingValidation(settings, validations); + } + + return LLSDMap("success", LLSD::Boolean(false)); +} + +#pragma optimize("", on) + LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { LLSD newsettings(defaults()); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e9ffbdb32c..1d860016fb 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -60,7 +60,24 @@ public: static const std::string SETTING_STAR_BRIGHTNESS; static const std::string SETTING_SUNLIGHT_COLOR; static const std::string SETTING_SUN_ROTATION; - static const std::string SETTING_SUN_TEXUTUREID; + static const std::string SETTING_SUN_TEXTUREID; + + static const std::string SETTING_PLANET_RADIUS; + static const std::string SETTING_SKY_BOTTOM_RADIUS; + static const std::string SETTING_SKY_TOP_RADIUS; + static const std::string SETTING_SUN_ARC_RADIANS; + + static const std::string SETTING_RAYLEIGH_CONFIG; + static const std::string SETTING_MIE_CONFIG; + static const std::string SETTING_ABSORPTION_CONFIG; + + static const std::string KEY_DENSITY_PROFILE; + static const std::string SETTING_DENSITY_PROFILE_WIDTH; + static const std::string SETTING_DENSITY_PROFILE_EXP_TERM; + static const std::string SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR; + static const std::string SETTING_DENSITY_PROFILE_LINEAR_TERM; + static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; + static const std::string SETTING_MIE_ANISOTROPY_FACTOR; typedef std::shared_ptr ptr_t; typedef std::pair azimalt_t; @@ -345,7 +362,7 @@ public: LLUUID getSunTextureId() const { - return mSettings[SETTING_SUN_TEXUTUREID].asUUID(); + return mSettings[SETTING_SUN_TEXTUREID].asUUID(); } // Internal/calculated settings @@ -414,6 +431,8 @@ public: static LLSD translateLegacySettings(LLSD legacy); + static LLSD settingValidation(LLSD &settings, validation_list_t &validations); + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; @@ -423,9 +442,14 @@ protected: virtual stringset_t getSlerpKeys() const; - virtual void updateSettings(); + virtual void updateSettings(); private: + // validations for structured sections of sky settings data + static validation_list_t rayleighValidationList(); + static validation_list_t absorptionValidationList(); + static validation_list_t mieValidationList(); + static const F32 NIGHTTIME_ELEVATION; static const F32 NIGHTTIME_ELEVATION_COS; diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index 89451a072c..dcfbd71dec 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -107,7 +107,9 @@ if (BUILD_HEADLESS) ${LLXML_LIBRARIES} ${LLVFS_LIBRARIES} ${LLWINDOW_HEADLESS_LIBRARIES} - ${OPENGL_HEADLESS_LIBRARIES}) + ${LIBATMOSPHERE_LIBRARIES} + ${OPENGL_HEADLESS_LIBRARIES} + ) endif (BUILD_HEADLESS) @@ -130,6 +132,7 @@ target_link_libraries(llrender ${LLVFS_LIBRARIES} ${LLWINDOW_LIBRARIES} ${FREETYPE_LIBRARIES} + ${LIBATMOSPHERE_LIBRARIES} ${OPENGL_LIBRARIES} - ${ATMOSPHERE_LIBRARIES}) + ) diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp new file mode 100644 index 0000000000..fb159a3e47 --- /dev/null +++ b/indra/llrender/llatmosphere.cpp @@ -0,0 +1,218 @@ +/** + * @file llatmosphere.cpp + * @brief LLAtmosphere integration impl + * + * $LicenseInfo:firstyear=2018&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2018, 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 "linden_common.h" + +#include "llatmosphere.h" +#include "llfasttimer.h" +#include "llsys.h" +#include "llglheaders.h" +#include "llrender.h" +#include "llshadermgr.h" +#include "llglslshader.h" + +LLAtmosphere* gAtmosphere = nullptr; + +void LLAtmosphere::initClass() +{ + if (!gAtmosphere) + { + gAtmosphere = new LLAtmosphere; + } +} + +void LLAtmosphere::cleanupClass() +{ + if(gAtmosphere) + { + delete gAtmosphere; + } + gAtmosphere = NULL; +} + +LLAtmosphere::LLAtmosphere() +{ + // Init libatmosphere model + m_config.num_scattering_orders = 4; + + // Values from "Reference Solar Spectral Irradiance: ASTM G-173", ETR column + // (see http://rredc.nrel.gov/solar/spectra/am1.5/ASTMG173/ASTMG173.html), + // summed and averaged in each bin (e.g. the value for 360nm is the average + // of the ASTM G-173 values for all wavelengths between 360 and 370nm). + // Values in W.m^-2. + const int kLambdaMin = 360; + const int kLambdaMax = 830; + const double kSolarIrradiance[48] = { + 1.11776, 1.14259, 1.01249, 1.14716, 1.72765, 1.73054, 1.6887, 1.61253, + 1.91198, 2.03474, 2.02042, 2.02212, 1.93377, 1.95809, 1.91686, 1.8298, + 1.8685, 1.8931, 1.85149, 1.8504, 1.8341, 1.8345, 1.8147, 1.78158, 1.7533, + 1.6965, 1.68194, 1.64654, 1.6048, 1.52143, 1.55622, 1.5113, 1.474, 1.4482, + 1.41018, 1.36775, 1.34188, 1.31429, 1.28303, 1.26758, 1.2367, 1.2082, + 1.18737, 1.14683, 1.12362, 1.1058, 1.07124, 1.04992 + }; + + // Values from http://www.iup.uni-bremen.de/gruppen/molspec/databases/ + // referencespectra/o3spectra2011/index.html for 233K, summed and averaged in + // each bin (e.g. the value for 360nm is the average of the original values + // for all wavelengths between 360 and 370nm). Values in m^2. + const double kOzoneCrossSection[48] = { + 1.18e-27, 2.182e-28, 2.818e-28, 6.636e-28, 1.527e-27, 2.763e-27, 5.52e-27, + 8.451e-27, 1.582e-26, 2.316e-26, 3.669e-26, 4.924e-26, 7.752e-26, 9.016e-26, + 1.48e-25, 1.602e-25, 2.139e-25, 2.755e-25, 3.091e-25, 3.5e-25, 4.266e-25, + 4.672e-25, 4.398e-25, 4.701e-25, 5.019e-25, 4.305e-25, 3.74e-25, 3.215e-25, + 2.662e-25, 2.238e-25, 1.852e-25, 1.473e-25, 1.209e-25, 9.423e-26, 7.455e-26, + 6.566e-26, 5.105e-26, 4.15e-26, 4.228e-26, 3.237e-26, 2.451e-26, 2.801e-26, + 2.534e-26, 1.624e-26, 1.465e-26, 2.078e-26, 1.383e-26, 7.105e-27 + }; + + // From https://en.wikipedia.org/wiki/Dobson_unit, in molecules.m^-2. + const double kDobsonUnit = 2.687e20; + + // Maximum number density of ozone molecules, in m^-3 (computed so at to get + // 300 Dobson units of ozone - for this we divide 300 DU by the integral of + // the ozone density profile defined below, which is equal to 15km). + const double kMaxOzoneNumberDensity = 300.0 * kDobsonUnit / 15000.0; + + const double kSunAngularRadius = 0.00935 / 2.0; + const double kBottomRadius = 6360000.0; + const double kTopRadius = 6420000.0; + const double kRayleigh = 1.24062e-6; + const double kRayleighScaleHeight = 8000.0; + const double kMieScaleHeight = 1200.0; + const double kMieAngstromAlpha = 0.0; + const double kMieAngstromBeta = 5.328e-3; + const double kMieSingleScatteringAlbedo = 0.9; + const double kMiePhaseFunctionG = 0.8; + const double max_sun_zenith_angle = F_PI * 2.0 / 3.0; + + atmosphere::DensityProfileLayer rayleigh_density(0.0, 1.0, -1.0 / kRayleighScaleHeight, 0.0, 0.0); + atmosphere::DensityProfileLayer mie_density(0.0, 1.0, -1.0 / kMieScaleHeight, 0.0, 0.0); + + // Density profile increasing linearly from 0 to 1 between 10 and 25km, and + // decreasing linearly from 1 to 0 between 25 and 40km. This is an approximate + // profile from http://www.kln.ac.lk/science/Chemistry/Teaching_Resources/ + // Documents/Introduction%20to%20atmospheric%20chemistry.pdf (page 10). + std::vector ozone_density; + ozone_density.push_back(atmosphere::DensityProfileLayer(25000.0, 0.0, 0.0, 1.0 / 15000.0, -2.0 / 3.0)); + ozone_density.push_back(atmosphere::DensityProfileLayer(0.0, 0.0, 0.0, -1.0 / 15000.0, 8.0 / 3.0)); + + std::vector wavelengths; + std::vector solar_irradiance; + std::vector rayleigh_scattering; + std::vector mie_scattering; + std::vector mie_extinction; + std::vector absorption_extinction; + std::vector ground_albedo; + + for (int l = kLambdaMin; l <= kLambdaMax; l += 10) + { + double lambda = static_cast(l) * 1e-3; // micro-meters + double mie = kMieAngstromBeta / kMieScaleHeight * pow(lambda, -kMieAngstromAlpha); + wavelengths.push_back(l); + solar_irradiance.push_back(kSolarIrradiance[(l - kLambdaMin) / 10]); + rayleigh_scattering.push_back(kRayleigh * pow(lambda, -4)); + mie_scattering.push_back(mie * kMieSingleScatteringAlbedo); + mie_extinction.push_back(mie); + absorption_extinction.push_back(kMaxOzoneNumberDensity * kOzoneCrossSection[(l - kLambdaMin) / 10]); + ground_albedo.push_back(0.1f); + } + + m_model = new atmosphere::Model( + wavelengths, + solar_irradiance, + kSunAngularRadius, + kBottomRadius, + kTopRadius, + {rayleigh_density}, + rayleigh_scattering, + {mie_density}, + mie_scattering, + mie_extinction, + kMiePhaseFunctionG, + ozone_density, + absorption_extinction, + ground_albedo, + max_sun_zenith_angle, + 1000.0, + 15, + false, + true); + + m_model->Init(m_config, m_textures); + + m_transmittance = new LLGLTexture; + m_scattering = new LLGLTexture; + m_mie_scattering = new LLGLTexture; + + m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); + m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); + m_transmittance->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); + m_transmittance->setTexName(m_textures.transmittance_texture); + m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); + + m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); + m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); + m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); + m_scattering->setTexName(m_textures.transmittance_texture); + m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); + + m_mie_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); + m_mie_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); + m_mie_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); + m_mie_scattering->setTexName(m_textures.transmittance_texture); + m_mie_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); +}; + +LLAtmosphere::~LLAtmosphere() +{ + // Cease referencing textures from atmosphere::model from our LLGLTextures wrappers for same. + m_transmittance->setTexName(0); + m_scattering->setTexName(0); + m_mie_scattering->setTexName(0); + + delete m_model; + m_model = nullptr; +} + +LLGLTexture* LLAtmosphere::getTransmittance() const +{ + return m_transmittance; +} + +LLGLTexture* LLAtmosphere::getScattering() const +{ + return m_scattering; +} + +LLGLTexture* LLAtmosphere::getMieScattering() const +{ + return m_mie_scattering; +} + +GLuint LLAtmosphere::getAtmosphericShaderForLink() const +{ + return m_model ? m_model->GetShader() : 0; +} diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h new file mode 100644 index 0000000000..4aa36be27f --- /dev/null +++ b/indra/llrender/llatmosphere.h @@ -0,0 +1,72 @@ +/** + * @file llatmosphere.h + * @brief LLAtmosphere class for integration with libatmosphere + * + * $LicenseInfo:firstyear=2018&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2018, 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_ATMOSPHERE_H +#define LL_ATMOSPHERE_H + +#include "llglheaders.h" +#include "llgltexture.h" +#include "libatmosphere/model.h" + +class LLAtmosphere +{ +public: + LLAtmosphere(); + ~LLAtmosphere(); + + static void initClass(); + static void cleanupClass(); + + const LLAtmosphere& operator=(const LLAtmosphere& rhs) + { + LL_ERRS() << "Illegal operation!" << LL_ENDL; + return *this; + } + + LLGLTexture* getTransmittance() const; + LLGLTexture* getScattering() const; + LLGLTexture* getMieScattering() const; + + GLuint getAtmosphericShaderForLink() const; + +protected: + LLAtmosphere(const LLAtmosphere& rhs) + { + *this = rhs; + } + + atmosphere::ModelConfig m_config; + atmosphere::PrecomputedTextures m_textures; + atmosphere::Model* m_model = nullptr; + + LLPointer m_transmittance; + LLPointer m_scattering; + LLPointer m_mie_scattering; +}; + +extern LLAtmosphere* gAtmosphere; + +#endif // LL_ATMOSPHERE_H diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h index a57e48ffad..b8d646ed15 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -133,7 +133,7 @@ public: void setGLTextureCreated (bool initialized); void setCategory(S32 category) ; void setTexName(LLGLuint); // for forcing w/ externally created textures only - void setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target); + void setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target); LLTexUnit::eTextureAddressMode getAddressMode(void) const ; S32 getMaxDiscardLevel() const; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d277a1158c..9f1b9fb373 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10131,7 +10131,7 @@ Type Boolean Value - 1 + 0 RenderUseTriStrips diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 042d7d971a..a28041034b 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -186,7 +186,7 @@ void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const // bind precomputed textures necessary for calculating sun and sky luminance sky_shader->bindTexture(LLShaderMgr::TRANSMITTANCE_TEX, gAtmosphere->getTransmittance()); sky_shader->bindTexture(LLShaderMgr::SCATTER_TEX, gAtmosphere->getScattering()); - sky_shader->bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getSingleMieScattering()); + sky_shader->bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getMieScattering()); static float sunSize = (float)cos(0.0005); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 6b1c663357..db68b39f75 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -117,6 +117,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky() settings[SETTING_NAME] = std::string("_default_"); LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList(); + LLSD results = LLSettingsSky::settingValidation(settings, validations); if (!results["success"].asBoolean()) { diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index bec05fa263..6d174442fb 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -3308,7 +3308,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() } // this shader uses gather so it can't live with the other basic shaders safely - if (success) + if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3)) { gDownsampleMinMaxDepthRectProgram.mName = "DownsampleMinMaxDepthRect Shader"; gDownsampleMinMaxDepthRectProgram.mShaderFiles.clear(); @@ -3331,8 +3331,6 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() success = gInscatterRectProgram.createShader(NULL, NULL); } - llassert(success); - if (success) { gWLSkyProgram.mName = "Windlight Sky Shader"; @@ -3349,8 +3347,6 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() success = gWLSkyProgram.createShader(NULL, NULL); } - llassert(success); - if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3)) { gWLCloudProgram.mName = "Windlight Cloud Program"; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index cbde0af9b3..e59e86529a 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -98,8 +98,8 @@ const S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64; const S32 MAX_CACHED_RAW_SCULPT_IMAGE_AREA = LLViewerTexture::sMaxSculptRez * LLViewerTexture::sMaxSculptRez; const S32 MAX_CACHED_RAW_TERRAIN_IMAGE_AREA = 128 * 128; const S32 DEFAULT_ICON_DIMENTIONS = 32; -S32 LLViewerTexture::sMinLargeImageSize = 65536; //256 * 256. -S32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA; +U32 LLViewerTexture::sMinLargeImageSize = 65536; //256 * 256. +U32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA; BOOL LLViewerTexture::sFreezeImageScalingDown = FALSE; F32 LLViewerTexture::sCurrentTime = 0.0f; F32 LLViewerTexture::sTexelPixelRatio = 1.0f; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 849273df15..8f691a0453 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -381,7 +381,7 @@ bool LLPipeline::sRenderBump = true; bool LLPipeline::sBakeSunlight = false; bool LLPipeline::sNoAlpha = false; bool LLPipeline::sUseTriStrips = true; -bool LLPipeline::sUseAdvancedAtmospherics = true; +bool LLPipeline::sUseAdvancedAtmospherics = false; bool LLPipeline::sUseFarClip = true; bool LLPipeline::sShadowRender = false; bool LLPipeline::sWaterReflections = false; -- cgit v1.2.3 From 6303ef5763393021d35c55a012cacfa7ee8c650e Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Mon, 26 Feb 2018 16:38:50 +0000 Subject: Redo advanced atmo shader integration with SL. --- indra/llrender/llatmosphere.cpp | 3 + indra/llrender/llglslshader.cpp | 4 ++ .../shaders/class3/windlight/advancedAtmoF.glsl | 71 ++++++++++++++++++++++ .../shaders/class3/windlight/advancedAtmoV.glsl | 43 +++++++++++++ indra/newview/llviewershadermgr.cpp | 21 ++++--- 5 files changed, 132 insertions(+), 10 deletions(-) create mode 100644 indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl create mode 100644 indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl (limited to 'indra') diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp index fb159a3e47..8840f49454 100644 --- a/indra/llrender/llatmosphere.cpp +++ b/indra/llrender/llatmosphere.cpp @@ -167,18 +167,21 @@ LLAtmosphere::LLAtmosphere() m_scattering = new LLGLTexture; m_mie_scattering = new LLGLTexture; + m_transmittance->generateGLTexture(); m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); m_transmittance->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); m_transmittance->setTexName(m_textures.transmittance_texture); m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); + m_scattering->generateGLTexture(); m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); m_scattering->setTexName(m_textures.transmittance_texture); m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); + m_mie_scattering->generateGLTexture(); m_mie_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_mie_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); m_mie_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index b09ec53bc0..a5939a6eb9 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -374,6 +374,8 @@ void LLGLSLShader::unloadInternal() stop_glerror(); } +#pragma optimize("", off) + BOOL LLGLSLShader::createShader(std::vector * attributes, std::vector * uniforms, U32 varying_count, @@ -490,6 +492,8 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, return success; } +#pragma optimize("", on) + BOOL LLGLSLShader::attachObject(std::string object) { if (LLShaderMgr::instance()->mShaderObjects.count(object) > 0) diff --git a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl new file mode 100644 index 0000000000..c71eaf4b13 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl @@ -0,0 +1,71 @@ +/** + * @file advancedAtmoF.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ + */ + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +in vec3 view_dir; + +uniform vec3 cameraPosLocal; +uniform vec3 sun_direction; +uniform vec2 sun_size; + +uniform sampler2D cloud_noise_texture; +uniform sampler2D transmittance_texture; +uniform sampler3D scattering_texture; +uniform sampler3D mie_scattering_texture; + +vec3 GetSolarLuminance(); +vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 sun_dir, out vec3 transmittance); +vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 sun_dir, out vec3 transmittance); +vec3 GetSunAndSkyIlluminance(vec3 pos, vec3 norm, vec3 sun_dir, out vec3 sky_irradiance); + +void main() +{ + vec3 view_direction = normalize(view_dir); + + vec3 camPos = cameraPosLocal; + vec3 transmittance; + vec3 radiance = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance); + + radiance *= transmittance; + + // If the view ray intersects the Sun, add the Sun radiance. + if (dot(view_direction, sun_direction) >= sun_size.y) + { + radiance = radiance + transmittance * GetSolarLuminance(); + } + + vec3 color = vec3(1.0) - exp(-radiance); + color = pow(color, vec3(1.0 / 2.2)); + + frag_color.rgb = color; + + frag_color.a = 1.0; +} + diff --git a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl new file mode 100644 index 0000000000..52a7595379 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl @@ -0,0 +1,43 @@ +/** + * @file advancedAtmoV.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ + */ + +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; + +// Inputs +uniform vec3 camPosLocal; + +out vec3 view_dir; + +void main() +{ + // World / view / projection + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + + // this will be normalized in the frag shader... + view_dir = position.xyz - camPosLocal.xyz; +} + diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 6d174442fb..c4fa4e86b4 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -3288,8 +3288,10 @@ BOOL LLViewerShaderMgr::loadShadersInterface() return TRUE; } +#pragma optimize("", off) + BOOL LLViewerShaderMgr::loadShadersWindLight() -{ +{ BOOL success = TRUE; if (mVertexShaderLevel[SHADER_WINDLIGHT] < 2) @@ -3308,7 +3310,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() } // this shader uses gather so it can't live with the other basic shaders safely - if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3)) + /*if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3)) { gDownsampleMinMaxDepthRectProgram.mName = "DownsampleMinMaxDepthRect Shader"; gDownsampleMinMaxDepthRectProgram.mShaderFiles.clear(); @@ -3316,22 +3318,22 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() gDownsampleMinMaxDepthRectProgram.mShaderFiles.push_back(make_pair("windlight/downsampleMinMaxDepthRectF.glsl", GL_FRAGMENT_SHADER_ARB)); gDownsampleMinMaxDepthRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; success = gDownsampleMinMaxDepthRectProgram.createShader(NULL, NULL); - } + }*/ // this shader uses gather so it can't live with the other basic shaders safely if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3)) { gInscatterRectProgram.mName = "Inscatter Shader"; gInscatterRectProgram.mShaderFiles.clear(); - gInscatterRectProgram.mShaderFiles.push_back(make_pair("windlight/atmoV.glsl", GL_VERTEX_SHADER_ARB)); - gInscatterRectProgram.mShaderFiles.push_back(make_pair("windlight/atmoF.glsl", GL_FRAGMENT_SHADER_ARB)); + gInscatterRectProgram.mShaderFiles.push_back(make_pair("windlight/advancedAtmoV.glsl", GL_VERTEX_SHADER_ARB)); + gInscatterRectProgram.mShaderFiles.push_back(make_pair("windlight/advancedAtmoF.glsl", GL_FRAGMENT_SHADER_ARB)); gInscatterRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; llassert(gAtmosphere != nullptr); gInscatterRectProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); success = gInscatterRectProgram.createShader(NULL, NULL); } - if (success) + if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3)) { gWLSkyProgram.mName = "Windlight Sky Shader"; //gWLSkyProgram.mFeatures.hasGamma = true; @@ -3340,10 +3342,6 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyF.glsl", GL_FRAGMENT_SHADER_ARB)); gWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; gWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; - if (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3) - { - gWLSkyProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); - } success = gWLSkyProgram.createShader(NULL, NULL); } @@ -3362,6 +3360,9 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() return success; } +#pragma optimize("", on) + + BOOL LLViewerShaderMgr::loadTransformShaders() { BOOL success = TRUE; -- cgit v1.2.3 From 31017934581437836e847d8fcb5a76489f3baf50 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Mon, 26 Feb 2018 16:41:39 +0000 Subject: Add distinct versions of sky, cloud, and transport shaders so they can be different with adv atmo shaders. --- .../shaders/class3/windlight/cloudsF.glsl | 104 +++++++++++ .../shaders/class3/windlight/cloudsV.glsl | 190 +++++++++++++++++++++ .../shaders/class3/windlight/skyF.glsl | 65 +++++++ .../shaders/class3/windlight/skyV.glsl | 156 +++++++++++++++++ .../shaders/class3/windlight/transportF.glsl | 53 ++++++ 5 files changed, 568 insertions(+) create mode 100644 indra/newview/app_settings/shaders/class3/windlight/cloudsF.glsl create mode 100644 indra/newview/app_settings/shaders/class3/windlight/cloudsV.glsl create mode 100644 indra/newview/app_settings/shaders/class3/windlight/skyF.glsl create mode 100644 indra/newview/app_settings/shaders/class3/windlight/skyV.glsl create mode 100644 indra/newview/app_settings/shaders/class3/windlight/transportF.glsl (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class3/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class3/windlight/cloudsF.glsl new file mode 100644 index 0000000000..96c70651b1 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/cloudsF.glsl @@ -0,0 +1,104 @@ +/** + * @file WLCloudsF.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ + */ + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +///////////////////////////////////////////////////////////////////////// +// The fragment shader for the sky +///////////////////////////////////////////////////////////////////////// + +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; +VARYING float vary_CloudDensity; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; + +uniform sampler2D cloud_noise_texture; +uniform vec4 cloud_pos_density1; +uniform vec4 cloud_pos_density2; +uniform vec4 gamma; + +/// Soft clips the light with a gamma correction +vec3 scaleSoftClip(vec3 light) { + //soft clip effect: + light = 1. - clamp(light, vec3(0.), vec3(1.)); + light = 1. - pow(light, gamma.xxx); + + return light; +} + +void main() +{ + // Set variables + vec2 uv1 = vary_texcoord0.xy; + vec2 uv2 = vary_texcoord1.xy; + + vec4 cloudColorSun = vary_CloudColorSun; + vec4 cloudColorAmbient = vary_CloudColorAmbient; + float cloudDensity = vary_CloudDensity; + vec2 uv3 = vary_texcoord2.xy; + vec2 uv4 = vary_texcoord3.xy; + + // Offset texture coords + uv1 += cloud_pos_density1.xy; //large texture, visible density + uv2 += cloud_pos_density1.xy; //large texture, self shadow + uv3 += cloud_pos_density2.xy; //small texture, visible density + uv4 += cloud_pos_density2.xy; //small texture, self shadow + + + // Compute alpha1, the main cloud opacity + float alpha1 = (texture2D(cloud_noise_texture, uv1).x - 0.5) + (texture2D(cloud_noise_texture, uv3).x - 0.5) * cloud_pos_density2.z; + alpha1 = min(max(alpha1 + cloudDensity, 0.) * 10. * cloud_pos_density1.z, 1.); + + // And smooth + alpha1 = 1. - alpha1 * alpha1; + alpha1 = 1. - alpha1 * alpha1; + + + // Compute alpha2, for self shadowing effect + // (1 - alpha2) will later be used as percentage of incoming sunlight + float alpha2 = (texture2D(cloud_noise_texture, uv2).x - 0.5); + alpha2 = min(max(alpha2 + cloudDensity, 0.) * 2.5 * cloud_pos_density1.z, 1.); + + // And smooth + alpha2 = 1. - alpha2; + alpha2 = 1. - alpha2 * alpha2; + + // Combine + vec4 color; + color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient); + color *= 2.; + + /// Gamma correct for WL (soft clip effect). + frag_color.rgb = scaleSoftClip(color.rgb); + frag_color.a = alpha1; +} + diff --git a/indra/newview/app_settings/shaders/class3/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class3/windlight/cloudsV.glsl new file mode 100644 index 0000000000..c1dd45cd67 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/cloudsV.glsl @@ -0,0 +1,190 @@ +/** + * @file WLCloudsV.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ + */ + +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; + +////////////////////////////////////////////////////////////////////////// +// The vertex shader for creating the atmospheric sky +/////////////////////////////////////////////////////////////////////////////// + +// Output parameters +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; +VARYING float vary_CloudDensity; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; + +// Inputs +uniform vec3 camPosLocal; + +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 ambient; +uniform vec4 blue_horizon; +uniform vec4 blue_density; +uniform float haze_horizon; +uniform float haze_density; + +uniform float cloud_shadow; +uniform float density_multiplier; +uniform float max_y; + +uniform vec4 glow; + +uniform vec4 cloud_color; + +uniform float cloud_scale; + +void main() +{ + + // World / view / projection + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + + vary_texcoord0 = texcoord0; + + // Get relative position + vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); + + // Set altitude + if (P.y > 0.) + { + P *= (max_y / P.y); + } + else + { + P *= (-32000. / P.y); + } + + // Can normalize then + vec3 Pn = normalize(P); + float Plen = length(P); + + // Initialize temp variables + vec4 temp1 = vec4(0.); + vec4 temp2 = vec4(0.); + vec4 blue_weight; + vec4 haze_weight; + vec4 sunlight = sunlight_color; + vec4 light_atten; + + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); + + // Calculate relative weights + temp1 = blue_density + haze_density; + blue_weight = blue_density / temp1; + haze_weight = haze_density / temp1; + + // Compute sunlight from P & lightnorm (for long rays like sky) + temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y ); + temp2.y = 1. / temp2.y; + sunlight *= exp( - light_atten * temp2.y); + + // Distance + temp2.z = Plen * density_multiplier; + + // Transparency (-> temp1) + // ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati + // compiler gets confused. + temp1 = exp(-temp1 * temp2.z); + + + // Compute haze glow + temp2.x = dot(Pn, lightnorm.xyz); + temp2.x = 1. - temp2.x; + // temp2.x is 0 at the sun and increases away from sun + temp2.x = max(temp2.x, .001); + // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + temp2.x *= glow.x; + // Higher glow.x gives dimmer glow (because next step is 1 / "angle") + temp2.x = pow(temp2.x, glow.z); + // glow.z should be negative, so we're doing a sort of (1 / "angle") function + + // Add "minimum anti-solar illumination" + temp2.x += .25; + + // Increase ambient when there are more clouds + vec4 tmpAmbient = ambient; + tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; + + // Dim sunlight by cloud shadow percentage + sunlight *= (1. - cloud_shadow); + + // Haze color below cloud + vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient) + + (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient) + ); + + // CLOUDS + + sunlight = sunlight_color; + temp2.y = max(0., lightnorm.y * 2.); + temp2.y = 1. / temp2.y; + sunlight *= exp( - light_atten * temp2.y); + + // Cloud color out + vary_CloudColorSun = (sunlight * temp2.x) * cloud_color; + vary_CloudColorAmbient = tmpAmbient * cloud_color; + + // Attenuate cloud color by atmosphere + temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds + vary_CloudColorSun *= temp1; + vary_CloudColorAmbient *= temp1; + vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - temp1); + + // Make a nice cloud density based on the cloud_shadow value that was passed in. + vary_CloudDensity = 2. * (cloud_shadow - 0.25); + + + // Texture coords + vary_texcoord0 = texcoord0; + vary_texcoord0.xy -= 0.5; + vary_texcoord0.xy /= cloud_scale; + vary_texcoord0.xy += 0.5; + + vary_texcoord1 = vary_texcoord0; + vary_texcoord1.x += lightnorm.x * 0.0125; + vary_texcoord1.y += lightnorm.z * 0.0125; + + vary_texcoord2 = vary_texcoord0 * 16.; + vary_texcoord3 = vary_texcoord1 * 16.; + + // Combine these to minimize register use + vary_CloudColorAmbient += oHazeColorBelowCloud; + + // needs this to compile on mac + //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); + + // END CLOUDS +} + diff --git a/indra/newview/app_settings/shaders/class3/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class3/windlight/skyF.glsl new file mode 100644 index 0000000000..e2a2367626 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/skyF.glsl @@ -0,0 +1,65 @@ +/** + * @file WLSkyF.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ + */ + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +///////////////////////////////////////////////////////////////////////// +// The fragment shader for the sky +///////////////////////////////////////////////////////////////////////// + +VARYING vec4 vary_HazeColor; + +uniform sampler2D cloud_noise_texture; +uniform vec4 gamma; + +/// Soft clips the light with a gamma correction +vec3 scaleSoftClip(vec3 light) { + //soft clip effect: + light = 1. - clamp(light, vec3(0.), vec3(1.)); + light = 1. - pow(light, gamma.xxx); + + return light; +} + +void main() +{ + // Potential Fill-rate optimization. Add cloud calculation + // back in and output alpha of 0 (so that alpha culling kills + // the fragment) if the sky wouldn't show up because the clouds + // are fully opaque. + + vec4 color; + color = vary_HazeColor; + color *= 2.; + + /// Gamma correct for WL (soft clip effect). + frag_color.rgb = scaleSoftClip(color.rgb); + frag_color.a = 1.0; +} + diff --git a/indra/newview/app_settings/shaders/class3/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class3/windlight/skyV.glsl new file mode 100644 index 0000000000..3788ddaf2d --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/skyV.glsl @@ -0,0 +1,156 @@ +/** + * @file WLSkyV.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ + */ + +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; + +// SKY //////////////////////////////////////////////////////////////////////// +// The vertex shader for creating the atmospheric sky +/////////////////////////////////////////////////////////////////////////////// + +// Output parameters +VARYING vec4 vary_HazeColor; + +// Inputs +uniform vec3 camPosLocal; + +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 ambient; +uniform vec4 blue_horizon; +uniform vec4 blue_density; +uniform float haze_horizon; +uniform float haze_density; + +uniform float cloud_shadow; +uniform float density_multiplier; +uniform float max_y; + +uniform vec4 glow; + +uniform vec4 cloud_color; + +void main() +{ + + // World / view / projection + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + + // Get relative position + vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); + //vec3 P = position.xyz + vec3(0,50,0); + + // Set altitude + if (P.y > 0.) + { + P *= (max_y / P.y); + } + else + { + P *= (-32000. / P.y); + } + + // Can normalize then + vec3 Pn = normalize(P); + float Plen = length(P); + + // Initialize temp variables + vec4 temp1 = vec4(0.); + vec4 temp2 = vec4(0.); + vec4 blue_weight; + vec4 haze_weight; + vec4 sunlight = sunlight_color; + vec4 light_atten; + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); + + // Calculate relative weights + temp1 = blue_density + haze_density; + blue_weight = blue_density / temp1; + haze_weight = haze_density / temp1; + + // Compute sunlight from P & lightnorm (for long rays like sky) + temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y ); + temp2.y = 1. / temp2.y; + sunlight *= exp( - light_atten * temp2.y); + + // Distance + temp2.z = Plen * density_multiplier; + + // Transparency (-> temp1) + // ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati + // compiler gets confused. + temp1 = exp(-temp1 * temp2.z); + + + // Compute haze glow + temp2.x = dot(Pn, lightnorm.xyz); + temp2.x = 1. - temp2.x; + // temp2.x is 0 at the sun and increases away from sun + temp2.x = max(temp2.x, .001); + // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + temp2.x *= glow.x; + // Higher glow.x gives dimmer glow (because next step is 1 / "angle") + temp2.x = pow(temp2.x, glow.z); + // glow.z should be negative, so we're doing a sort of (1 / "angle") function + + // Add "minimum anti-solar illumination" + temp2.x += .25; + + + // Haze color above cloud + vary_HazeColor = ( blue_horizon * blue_weight * (sunlight + ambient) + + (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient) + ); + + + // Increase ambient when there are more clouds + vec4 tmpAmbient = ambient; + tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; + + // Dim sunlight by cloud shadow percentage + sunlight *= (1. - cloud_shadow); + + // Haze color below cloud + vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient) + + (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient) + ); + + // Final atmosphere additive + vary_HazeColor *= (1. - temp1); + + // Attenuate cloud color by atmosphere + temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds + + // At horizon, blend high altitude sky color towards the darker color below the clouds + vary_HazeColor += (additiveColorBelowCloud - vary_HazeColor) * (1. - sqrt(temp1)); + + // won't compile on mac without this being set + //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); +} + diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl new file mode 100644 index 0000000000..8a8e4cb0f6 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl @@ -0,0 +1,53 @@ +/** + * @file transportF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, 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$ + */ + +////////////////////////////////////////////////////////// +// The fragment shader for the terrain atmospherics +////////////////////////////////////////////////////////// + +vec3 getAdditiveColor(); +vec3 getAtmosAttenuation(); + +uniform sampler2D cloudMap; +uniform vec4 cloud_pos_density1; + +vec3 atmosTransport(vec3 light) { + light *= getAtmosAttenuation().r; + light += getAdditiveColor() * 2.0; + return light; +} + +vec3 fullbrightAtmosTransport(vec3 light) { + float brightness = dot(light.rgb, vec3(0.33333)); + + return mix(atmosTransport(light.rgb), light.rgb + getAdditiveColor().rgb, brightness * brightness); +} + +vec3 fullbrightShinyAtmosTransport(vec3 light) { + float brightness = dot(light.rgb, vec3(0.33333)); + + return mix(atmosTransport(light.rgb), (light.rgb + getAdditiveColor().rgb) * (2.0 - brightness), brightness * brightness); +} + -- cgit v1.2.3 From b766466b3013e39831bcfcaef5d1089c07202afb Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 26 Feb 2018 09:27:14 -0800 Subject: Added settings inventory object with subtype --- indra/llcommon/llassettype.h | 5 +- indra/llcommon/llsdserialize.cpp | 10 + indra/llcommon/llsdserialize.h | 2 +- indra/llinventory/CMakeLists.txt | 1 + indra/llinventory/llinventorysettings.h | 43 +++ indra/llinventory/llsettingsbase.cpp | 23 +- indra/llinventory/llsettingsbase.h | 29 +- indra/llinventory/llsettingsdaycycle.cpp | 1 + indra/llinventory/llsettingsdaycycle.h | 2 + indra/llinventory/llsettingssky.h | 4 +- indra/llinventory/llsettingswater.h | 3 +- indra/llmessage/llassetstorage.cpp | 34 ++- indra/llmessage/llassetstorage.h | 31 ++- indra/newview/llagentwearables.cpp | 11 +- indra/newview/llappearancemgr.cpp | 3 +- indra/newview/llfloatereditextdaycycle.cpp | 66 +++++ indra/newview/llfloatereditextdaycycle.h | 5 + indra/newview/llfloatergesture.cpp | 2 +- indra/newview/llfloaternamedesc.cpp | 4 +- indra/newview/llfriendcard.cpp | 2 +- indra/newview/lllandmarkactions.cpp | 2 +- indra/newview/lloutfitgallery.cpp | 2 +- indra/newview/llpanelsnapshotpostcard.cpp | 6 +- indra/newview/llpreviewgesture.cpp | 10 +- indra/newview/llpreviewnotecard.cpp | 13 +- indra/newview/llpreviewscript.cpp | 14 +- indra/newview/llsettingsvo.cpp | 307 +++++++++++++++++++++ indra/newview/llsettingsvo.h | 57 +++- indra/newview/llviewerassetstorage.h | 6 +- indra/newview/llviewerassetupload.cpp | 6 +- indra/newview/llviewerassetupload.h | 6 +- indra/newview/llviewerinventory.cpp | 35 ++- indra/newview/llviewerinventory.h | 22 +- indra/newview/llviewermenufile.cpp | 10 +- indra/newview/llviewermenufile.h | 2 +- indra/newview/llviewerregion.cpp | 6 +- .../default/xui/en/floater_edit_ext_day_cycle.xml | 16 +- 37 files changed, 705 insertions(+), 96 deletions(-) create mode 100644 indra/llinventory/llinventorysettings.h (limited to 'indra') diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index 3a660496e3..32502d5e33 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -124,10 +124,11 @@ public: AT_RESERVED_3 = 52, AT_RESERVED_4 = 53, AT_RESERVED_5 = 54, + AT_RESERVED_6 = 55, - AT_SETTINGS = 55, // Collection of settings + AT_SETTINGS = 56, // Collection of settings - AT_COUNT = 56, + AT_COUNT = 57, // +*********************************************************+ // | TO ADD AN ELEMENT TO THIS ENUM: | diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 3a219eb998..f6ba64f0a9 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -54,6 +54,7 @@ static const int MAX_HDR_LEN = 20; static const char LEGACY_NON_HEADER[] = ""; const std::string LLSD_BINARY_HEADER("LLSD/Binary"); const std::string LLSD_XML_HEADER("LLSD/XML"); +const std::string LLSD_NOTATION_HEADER("llsd/notation"); //used to deflate a gzipped asset (currently used for navmeshes) #define windowBits 15 @@ -80,6 +81,11 @@ void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize f = new LLSDXMLFormatter; break; + case LLSD_NOTATION: + str << "\n"; + f = new LLSDNotationFormatter; + break; + default: LL_WARNS() << "serialize request for unknown ELLSD_Serialize" << LL_ENDL; } @@ -167,6 +173,10 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes) { p = new LLSDXMLParser; } + else if (header == LLSD_NOTATION_HEADER) + { + p = new LLSDNotationParser; + } else { LL_WARNS() << "deserialize request for unknown ELLSD_Serialize" << LL_ENDL; diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index 23a0c8cfb1..cdca458e43 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -694,7 +694,7 @@ class LL_COMMON_API LLSDSerialize public: enum ELLSD_Serialize { - LLSD_BINARY, LLSD_XML + LLSD_BINARY, LLSD_XML, LLSD_NOTATION }; /** diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index 3eba746614..2d40dd6443 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -45,6 +45,7 @@ set(llinventory_HEADER_FILES llfoldertype.h llinventory.h llinventorydefines.h + llinventorysettings.h llinventorytype.h lllandmark.h llnotecard.h diff --git a/indra/llinventory/llinventorysettings.h b/indra/llinventory/llinventorysettings.h new file mode 100644 index 0000000000..0d15542fec --- /dev/null +++ b/indra/llinventory/llinventorysettings.h @@ -0,0 +1,43 @@ +/** +* @file llinventorysettings.h +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, 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_INVENTORY_SETTINGS_H +#define LL_INVENTORY_SETTINGS_H + + +enum class LLSettingsType +{ + ST_SKY = 0, + ST_WATER = 1, + ST_DAYCYCLE = 2, + + ST_INVALID = 255, + ST_NONE = -1 +}; + + +#endif diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7ade345168..3382716577 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -38,6 +38,14 @@ namespace const F64 BREAK_POINT = 0.5; } +//========================================================================= +std::ostream &::operator <<(std::ostream& os, LLSettingsBase &settings) +{ + LLSDSerialize::serialize(settings.getSettings(), os, LLSDSerialize::LLSD_NOTATION); + + return os; +} + //========================================================================= const std::string LLSettingsBase::SETTING_ID("id"); const std::string LLSettingsBase::SETTING_NAME("name"); @@ -49,13 +57,15 @@ const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); //========================================================================= LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), - mDirty(true) + mDirty(true), + mAssetID() { } LLSettingsBase::LLSettingsBase(const LLSD setting) : mSettings(setting), - mDirty(true) + mDirty(true), + mAssetID() { } @@ -368,8 +378,14 @@ bool LLSettingsBase::Validator::verify(LLSD &data) { if (!data.has(mName) || (data.has(mName) && data[mName].isUndefined())) { + if (!mDefault.isUndefined()) + { + LL_INFOS("SETTINGS") << "Inserting missing default for '" << mName << "'." << LL_ENDL; + data[mName] = mDefault; + return true; + } if (mRequired) - LL_WARNS("SETTINGS") << "Missing required setting '" << mName << "'" << LL_ENDL; + LL_WARNS("SETTINGS") << "Missing required setting '" << mName << "' with no default." << LL_ENDL; return !mRequired; } @@ -514,7 +530,6 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) } //========================================================================= - void LLSettingsBlender::update(F64Seconds timedelta) { mTimeSpent += timedelta; diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 420bcb9943..c7ed9e9e21 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -42,6 +42,8 @@ #include "v4color.h" #include "v3color.h" +#include "llinventorysettings.h" + class LLSettingsBase : public std::enable_shared_from_this, private boost::noncopyable @@ -49,6 +51,8 @@ class LLSettingsBase : friend class LLEnvironment; friend class LLSettingsDay; + friend std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings); + public: static const std::string SETTING_ID; static const std::string SETTING_NAME; @@ -64,6 +68,8 @@ public: //--------------------------------------------------------------------- virtual std::string getSettingType() const = 0; + virtual LLSettingsType getSettingTypeValue() const = 0; + //--------------------------------------------------------------------- // Settings status inline bool hasSetting(const std::string ¶m) const { return mSettings.has(param); } @@ -143,27 +149,28 @@ public: // Note this method is marked const but may modify the settings object. // (note the internal const cast). This is so that it may be called without // special consideration from getters. - inline void update() const + inline void update() const { if (!mDirty) return; (const_cast(this))->updateSettings(); } - virtual void blend(const ptr_t &end, F64 blendf) = 0; + virtual void blend(const ptr_t &end, F64 blendf) = 0; - virtual bool validate(); + virtual bool validate(); class Validator { public: typedef boost::function verify_pr; - Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr()) : + Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr(), LLSD defval = LLSD()) : mName(name), mRequired(required), mType(type), - mVerify(verify) + mVerify(verify), + mDefault(defval) { } std::string getName() const { return mName; } @@ -187,6 +194,7 @@ public: bool mRequired; LLSD::Type mType; verify_pr mVerify; + LLSD mDefault; }; typedef std::vector validation_list_t; @@ -223,15 +231,16 @@ protected: virtual parammapping_t getParameterMap() const { return parammapping_t(); } - LLSD mSettings; - bool mIsValid; + LLSD mSettings; + bool mIsValid; + LLAssetID mAssetID; - LLSD cloneSettings() const; + LLSD cloneSettings() const; private: - bool mDirty; + bool mDirty; - LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; + LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; }; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index a689dd3710..18add703cb 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -273,6 +273,7 @@ LLSD LLSettingsDay::defaults() (LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_"))); dfltsetting[SETTING_FRAMES] = LLSD::emptyMap(); + dfltsetting[SETTING_TYPE] = "daycycle"; return dfltsetting; } diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 4c7ce011a1..7703f7a0b4 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -72,6 +72,8 @@ public: virtual ptr_t buildClone() = 0; virtual LLSD getSettings() const; + virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_DAYCYCLE; } + //--------------------------------------------------------------------- virtual std::string getSettingType() const { return std::string("daycycle"); } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e9ffbdb32c..23daf0c5dc 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -72,7 +72,9 @@ public: virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- - virtual std::string getSettingType() const { return std::string("sky"); } + virtual std::string getSettingType() const override { return std::string("sky"); } + virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_SKY; } + // Settings status virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf); diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 4d206a1be0..16d5b2353a 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -57,7 +57,8 @@ public: virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- - virtual std::string getSettingType() const { return std::string("water"); } + virtual std::string getSettingType() const override { return std::string("water"); } + virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_WATER; } // Settings status virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf); diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 596d57c7b7..3d93f5aeb8 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -62,6 +62,24 @@ const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-0 const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds +namespace +{ + template + bool operator == (const std::function &a, const std::function &b) + { + typedef T(fnType)(U...); + + auto fnPtrA = a.target(); + auto fnPtrB = b.target(); + if (fnPtrA && fnPtrB) + return (*fnPtrA == *fnPtrB); + else if (!fnPtrA && !fnPtrB) + return true; + return false; + } + +} + ///---------------------------------------------------------------------------- /// LLAssetInfo ///---------------------------------------------------------------------------- @@ -160,7 +178,7 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv ) LLBaseDownloadRequest::LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetType::EType type) : mUUID(uuid), mType(type), - mDownCallback(NULL), + mDownCallback(), mUserData(NULL), mHost(), mIsTemp(FALSE), @@ -191,7 +209,7 @@ LLBaseDownloadRequest* LLBaseDownloadRequest::getCopy() LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type) : LLBaseDownloadRequest(uuid, type), - mUpCallback( NULL ), + mUpCallback(), mInfoCallback( NULL ), mIsLocal(FALSE), mIsUserWaiting(FALSE), @@ -496,7 +514,11 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, BOOL exists = mVFS->getExists(uuid, type); LLVFile file(mVFS, uuid, type); U32 size = exists ? file.getSize() : 0; - + +// LAPRAS TESTING +// if (type == LLAssetType::AT_SETTINGS) +// size = 0; + if (size > 0) { // we've already got the file @@ -1326,9 +1348,13 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, iter != mPendingDownloads.end(); ) { LLAssetRequest* tmp = *iter++; + + //void(*const* cbptr)(LLVFS *, const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat) + auto cbptr = tmp->mDownCallback.target(); + if (type == tmp->getType() && uuid == tmp->getUUID() && - legacyGetDataCallback == tmp->mDownCallback && + (cbptr && (*cbptr == legacyGetDataCallback)) && callback == ((LLLegacyAssetRequest *)tmp->mUserData)->mDownCallback && user_data == ((LLLegacyAssetRequest *)tmp->mUserData)->mUserData) { diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index 33b88473b9..c799d8eefc 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -28,6 +28,7 @@ #ifndef LL_LLASSETSTORAGE_H #define LL_LLASSETSTORAGE_H #include +#include #include "lluuid.h" #include "lltimer.h" @@ -59,6 +60,14 @@ const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4; const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5; const int LL_ERR_PRICE_MISMATCH = -23018; +// *TODO: these typedefs are passed into the VFS via a legacy C function pointer +// future project would be to convert these to C++ callables (std::function<>) so that +// we can use bind and remove the userData parameter. +// +typedef std::function LLGetAssetCallback; +typedef std::function LLStoreAssetCallback; + + class LLAssetInfo { protected: @@ -110,7 +119,8 @@ protected: LLAssetType::EType mType; public: - void(*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat); + LLGetAssetCallback mDownCallback; +// void(*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat); void *mUserData; LLHost mHost; @@ -131,7 +141,8 @@ public: virtual LLBaseDownloadRequest* getCopy(); - void (*mUpCallback)(const LLUUID&, void *, S32, LLExtStat); + LLStoreAssetCallback mUpCallback; +// void (*mUpCallback)(const LLUUID&, void *, S32, LLExtStat); void (*mInfoCallback)(LLAssetInfo *, void *, S32); BOOL mIsLocal; @@ -182,12 +193,7 @@ protected: // Map of known bad assets typedef std::map toxic_asset_map_t; -// *TODO: these typedefs are passed into the VFS via a legacy C function pointer -// future project would be to convert these to C++ callables (std::function<>) so that -// we can use bind and remove the userData parameter. -// -typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id, - LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); + class LLAssetStorage { @@ -195,7 +201,8 @@ public: // VFS member is public because static child methods need it :( LLVFS *mVFS; LLVFS *mStaticVFS; - typedef void (*LLStoreAssetCallback)(const LLUUID &asset_id, void *user_data, S32 status, LLExtStat ext_status); + typedef ::LLStoreAssetCallback LLStoreAssetCallback; + typedef ::LLGetAssetCallback LLGetAssetCallback; enum ERequestType { @@ -377,8 +384,8 @@ protected: void _cleanupRequests(BOOL all, S32 error); void _callUploadCallbacks(const LLUUID &uuid, const LLAssetType::EType asset_type, BOOL success, LLExtStat ext_status); - virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type, - void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), + virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type, LLGetAssetCallback callback, +// void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), void *user_data, BOOL duplicate, BOOL is_priority) = 0; @@ -424,7 +431,7 @@ class LLLegacyAssetRequest { public: void (*mDownCallback)(const char *, const LLUUID&, void *, S32, LLExtStat); - LLAssetStorage::LLStoreAssetCallback mUpCallback; + LLStoreAssetCallback mUpCallback; void *mUserData; }; diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 170e4063a1..2b865a1ae2 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -799,14 +799,13 @@ void LLAgentWearables::createStandardWearables() ((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable); // no need to update here... LLUUID category_id = LLUUID::null; - create_inventory_item(gAgent.getID(), + create_inventory_wearable(gAgent.getID(), gAgent.getSessionID(), category_id, wearable->getTransactionID(), wearable->getName(), wearable->getDescription(), wearable->getAssetType(), - LLInventoryType::IT_WEARABLE, wearable->getType(), wearable->getPermissions().getMaskNextOwner(), cb); @@ -868,14 +867,13 @@ void LLAgentWearables::addWearableToAgentInventory(LLPointergetTransactionID(), wearable->getName(), wearable->getDescription(), wearable->getAssetType(), - LLInventoryType::IT_WEARABLE, wearable->getType(), wearable->getPermissions().getMaskNextOwner(), cb); @@ -1540,7 +1538,6 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp); LLAssetType::EType asset_type = wearable->getAssetType(); - LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; LLPointer cb; if(wear) { @@ -1563,13 +1560,13 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con folder_id = gInventory.findCategoryUUIDForType(folder_type); } - create_inventory_item(gAgent.getID(), + create_inventory_wearable(gAgent.getID(), gAgent.getSessionID(), folder_id, wearable->getTransactionID(), wearable->getName(), wearable->getDescription(), - asset_type, inv_type, + asset_type, wearable->getType(), LLFloaterPerms::getNextOwnerPerms("Wearables"), cb); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 0fb811a386..534f3c7eb7 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1026,14 +1026,13 @@ void LLWearableHoldingPattern::recoverMissingWearable(LLWearableType::EType type const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(recovered_item_cb,_1,type,wearable,this)); - create_inventory_item(gAgent.getID(), + create_inventory_wearable(gAgent.getID(), gAgent.getSessionID(), lost_and_found_id, wearable->getTransactionID(), wearable->getName(), wearable->getDescription(), wearable->getAssetType(), - LLInventoryType::IT_WEARABLE, wearable->getType(), wearable->getPermissions().getMaskNextOwner(), cb); diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 0beb856456..c1063218fb 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -39,6 +39,8 @@ #include "llspinctrl.h" #include "lltimectrl.h" +#include "llsettingsvo.h" + // newview #include "llagent.h" #include "llregioninfomodel.h" @@ -73,12 +75,14 @@ BOOL LLFloaterEditExtDayCycle::postBuild() // mTimeCtrl = getChild("time"); mSaveButton = getChild("save_btn"); mCancelButton = getChild("cancel_btn"); + mUploadButton = getChild("upload_btn"); // mMakeDefaultCheckBox = getChild("make_default_cb"); mDayPresetsCombo->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onDayPresetChanged, this)); mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnSave, this)); mCancelButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnCancel, this)); + mUploadButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onUpload, this)); //initCallbacks(); @@ -90,6 +94,9 @@ BOOL LLFloaterEditExtDayCycle::postBuild() void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) { + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT); + LLEnvironment::instance().updateEnvironment(); + refreshSkyPresetsList(); } @@ -103,6 +110,65 @@ void LLFloaterEditExtDayCycle::onClose(bool app_quitting) } } + +void LLFloaterEditExtDayCycle::onUpload() +{ + LLSettingsVOBase::createInventoryItem( mEditDay ); + +#if 0 + LLSettingsVOBase::storeAsAsset(mEditDay); + + LLTransactionID tid; + tid.generate(); + LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); + + const std::string filename = asset_id_to_filename(mAssetID, LL_PATH_CACHE); + if (!exportFile(filename)) + { + std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str()); + LL_WARNS() << buffer << LL_ENDL; + + LLSD args; + args["NAME"] = mName; + LLNotificationsUtil::add("CannotSaveWearableOutOfSpace", args); + return; + } + + if (gSavedSettings.getBOOL("LogWearableAssetSave")) + { + const std::string log_filename = asset_id_to_filename(mAssetID, LL_PATH_LOGS); + exportFile(log_filename); + } + + // save it out to database + if (gAssetStorage) + { + /* + std::string url = gAgent.getRegion()->getCapability("NewAgentInventory"); + if (!url.empty()) + { + LL_INFOS() << "Update Agent Inventory via capability" << LL_ENDL; + LLSD body; + body["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetToFolderType(getAssetType())); + body["asset_type"] = LLAssetType::lookup(getAssetType()); + body["inventory_type"] = LLInventoryType::lookup(LLInventoryType::IT_WEARABLE); + body["name"] = getName(); + body["description"] = getDescription(); + LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, filename)); + } + else + { + } + */ + LLWearableSaveData* data = new LLWearableSaveData; + data->mType = mType; + gAssetStorage->storeAssetData(filename, mTransactionID, getAssetType(), + &LLViewerWearable::onSaveNewAssetComplete, + (void*)data); + } +#endif +} + void LLFloaterEditExtDayCycle::onVisibilityChange(BOOL new_visibility) { if (new_visibility) diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 8b5a087edb..18d0ce2259 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -54,6 +54,10 @@ public: void onOpen(const LLSD& key); void onClose(bool app_quitting); + + /*TEMP*/ + void onUpload(); + void onVisibilityChange(BOOL new_visibility); // /*virtual*/ void draw(); @@ -123,6 +127,7 @@ private: LLComboBox* mDayPresetsCombo; LLButton* mSaveButton; LLButton* mCancelButton; + LLButton* mUploadButton; edit_commit_signal_t mCommitSignal; diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index b840d37c4d..57c010502e 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -470,7 +470,7 @@ void LLFloaterGesture::onClickNew() "", LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, - NOT_WEARABLE, + NO_INV_SUBTYPE, PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Gestures"), cb); } diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index c9a689281e..7cde061515 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -161,7 +161,7 @@ void LLFloaterNameDesc::onBtnOK( ) { getChildView("ok_btn")->setEnabled(FALSE); // don't allow inadvertent extra uploads - LLAssetStorage::LLStoreAssetCallback callback = NULL; + LLAssetStorage::LLStoreAssetCallback callback; S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). if (can_afford_transaction(expected_upload_cost)) @@ -169,7 +169,7 @@ void LLFloaterNameDesc::onBtnOK( ) void *nruserdata = NULL; std::string display_name = LLStringUtil::null; - LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( + LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared( mFilenameAndPath, getChild("name_form")->getValue().asString(), getChild("description_form")->getValue().asString(), 0, diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 62cbea6401..0be748ace9 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -504,7 +504,7 @@ void LLFriendCardsManager::syncFriendsFolder() gAgentID.asString(), LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, - NOT_WEARABLE, + NO_INV_SUBTYPE, PERM_MOVE | PERM_TRANSFER, NULL); } diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp index 9c00243f44..c243f8b4f0 100644 --- a/indra/newview/lllandmarkactions.cpp +++ b/indra/newview/lllandmarkactions.cpp @@ -272,7 +272,7 @@ void LLLandmarkActions::createLandmarkHere( name, desc, LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, - NOT_WEARABLE, PERM_ALL, + NO_INV_SUBTYPE, PERM_ALL, NULL); } diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index c38d3ab140..4df05ea408 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1219,7 +1219,7 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id) checkRemovePhoto(outfit_id); std::string upload_pending_name = outfit_id.asString(); std::string upload_pending_desc = ""; - LLAssetStorage::LLStoreAssetCallback callback = NULL; + LLAssetStorage::LLStoreAssetCallback callback; LLUUID photo_id = upload_new_resource(filename, // file upload_pending_name, upload_pending_desc, diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp index f3a4cf36ee..b8aa976657 100644 --- a/indra/newview/llpanelsnapshotpostcard.cpp +++ b/indra/newview/llpanelsnapshotpostcard.cpp @@ -170,14 +170,16 @@ void LLPanelSnapshotPostcard::sendPostcard() std::string url = gAgent.getRegion()->getCapability("SendPostcard"); if (!url.empty()) { - LLResourceUploadInfo::ptr_t uploadInfo(new LLPostcardUploadInfo( + LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared( getChild("name_form")->getValue().asString(), getChild("to_form")->getValue().asString(), getChild("subject_form")->getValue().asString(), getChild("msg_form")->getValue().asString(), mSnapshotFloater->getPosTakenGlobal(), mSnapshotFloater->getImageData(), - boost::bind(&LLPanelSnapshotPostcard::sendPostcardFinished, _4))); + [](LLUUID, LLUUID, LLUUID, LLSD response) { + LLPanelSnapshotPostcard::sendPostcardFinished(response); + })); LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); } diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 787bd68e58..70ce275734 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -1091,7 +1091,7 @@ void LLPreviewGesture::saveIfNeeded() const LLViewerRegion* region = gAgent.getRegion(); if (!region) { - LL_WARNS() << "Not connected to a region, cannot save notecard." << LL_ENDL; + LL_WARNS() << "Not connected to a region, cannot save gesture." << LL_ENDL; return; } std::string agent_url = region->getCapability("UpdateGestureAgentInventory"); @@ -1111,13 +1111,15 @@ void LLPreviewGesture::saveIfNeeded() refresh(); item->setComplete(true); - uploadInfo = LLResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mItemUUID, LLAssetType::AT_GESTURE, buffer, - boost::bind(&LLPreviewGesture::finishInventoryUpload, _1, _2))); + uploadInfo = std::make_shared(mItemUUID, LLAssetType::AT_GESTURE, buffer, + [](LLUUID itemId, LLUUID newAssetId, LLUUID, LLSD) { + LLPreviewGesture::finishInventoryUpload(itemId, newAssetId); + }); url = agent_url; } else if (!mObjectUUID.isNull() && !task_url.empty()) { - uploadInfo = LLResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mObjectUUID, mItemUUID, LLAssetType::AT_GESTURE, buffer, NULL)); + uploadInfo = std::make_shared(mObjectUUID, mItemUUID, LLAssetType::AT_GESTURE, buffer, nullptr); url = task_url; } diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index d4a8bbdf45..fec16998d6 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -508,14 +508,19 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) if (mObjectUUID.isNull() && !agent_url.empty()) { - uploadInfo = LLResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mItemUUID, LLAssetType::AT_NOTECARD, buffer, - boost::bind(&LLPreviewNotecard::finishInventoryUpload, _1, _2, _3))); + uploadInfo = std::make_shared(mItemUUID, LLAssetType::AT_NOTECARD, buffer, + [](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD) { + LLPreviewNotecard::finishInventoryUpload(itemId, newAssetId, newItemId); + }); url = agent_url; } else if (!mObjectUUID.isNull() && !task_url.empty()) { - uploadInfo = LLResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mObjectUUID, mItemUUID, LLAssetType::AT_NOTECARD, buffer, - boost::bind(&LLPreviewNotecard::finishTaskUpload, _1, _3, mObjectUUID))); + LLUUID object_uuid(mObjectUUID); + uploadInfo = std::make_shared(mObjectUUID, mItemUUID, LLAssetType::AT_NOTECARD, buffer, + [object_uuid](LLUUID itemId, LLUUID, LLUUID newAssetId, LLSD) { + LLPreviewNotecard::finishTaskUpload(itemId, newAssetId, object_uuid); + }); url = task_url; } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 3795e043ba..72e6ba9609 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1707,9 +1707,11 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) if (!url.empty()) { std::string buffer(mScriptEd->mEditor->getText()); - LLBufferedAssetUploadInfo::invnUploadFinish_f proc = boost::bind(&LLPreviewLSL::finishedLSLUpload, _1, _4); - LLResourceUploadInfo::ptr_t uploadInfo(new LLScriptAssetUpload(mItemUUID, buffer, proc)); + LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared(mItemUUID, buffer, + [](LLUUID itemId, LLUUID, LLUUID, LLSD response) { + LLPreviewLSL::finishedLSLUpload(itemId, response); + })); LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); } @@ -2241,11 +2243,13 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) if (!url.empty()) { std::string buffer(mScriptEd->mEditor->getText()); - LLBufferedAssetUploadInfo::taskUploadFinish_f proc = boost::bind(&LLLiveLSLEditor::finishLSLUpload, _1, _2, _3, _4, isRunning); - LLResourceUploadInfo::ptr_t uploadInfo(new LLScriptAssetUpload(mObjectUUID, mItemUUID, + LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared(mObjectUUID, mItemUUID, monoChecked() ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2, - isRunning, mScriptEd->getAssociatedExperience(), buffer, proc)); + isRunning, mScriptEd->getAssociatedExperience(), buffer, + [isRunning](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) { + LLLiveLSLEditor::finishLSLUpload(itemId, taskId, newAssetId, response, isRunning); + })); LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); } diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 6b1c663357..aa3adfb8dd 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -32,6 +32,7 @@ #include "pipeline.h" #include +#include #include #include "lltrace.h" #include "llfasttimer.h" @@ -40,9 +41,21 @@ #include "llglslshader.h" #include "llviewershadermgr.h" +#include "llagent.h" +#include "llassettype.h" +#include "llnotificationsutil.h" + +#include "llviewerregion.h" +#include "llviewerassetupload.h" +#include "llviewerinventory.h" + #include "llenvironment.h" #include "llsky.h" +#include "llpermissions.h" + +#include "llinventorymodel.h" + #undef VERIFY_LEGACY_CONVERSION //========================================================================= @@ -66,7 +79,257 @@ LLSD ensureArray4(LLSD in, F32 fill) } return out; } + + +//------------------------------------------------------------------------- +class LLSettingsInventoryCB : public LLInventoryCallback +{ +public: + typedef std::function callback_t; + + LLSettingsInventoryCB(callback_t cbfn) : + mCbfn(cbfn) + { } + + void fire(const LLUUID& inv_item) override { if (mCbfn) mCbfn(inv_item); } + +private: + callback_t mCbfn; +}; + +} + + +//========================================================================= +#if 0 +void LLSettingsVOBase::storeAsAsset(const LLSettingsBase::ptr_t &settings) +{ + LLTransactionID tid; + tid.generate(); + + LLAssetID aid(tid.makeAssetID(gAgent.getSecureSessionID())); + + const std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, aid.asString()) + ".setting"; + + if (!exportFile(settings, filename)) + { + LL_WARNS("SETTINGS") << "Unable to save settings file named '" << filename << "'." << LL_ENDL; + + LLSD args; + args["NAME"] = aid.asString() + "setting"; + LLNotificationsUtil::add("CannotSaveWearableOutOfSpace", args); + return; + } + + SettingsSaveData::ptr_t psave = std::make_shared(); + psave->mType = settings->getSettingType(); + psave->mSettings = settings; + psave->mTempFile = filename; + psave->mTransId = tid; + + gAssetStorage->storeAssetData(filename, tid, LLAssetType::AT_SETTINGS, + [psave](const LLUUID &assetId, void *, S32 status, LLExtStat extstat) { + onSaveNewAssetComplete(assetId, psave, status, extstat); + }, + nullptr); + +} + +void testingOnGotAsset(LLVFS *vfs, const LLUUID &asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status) +{ + LL_WARNS("SETTINGS") << "Got back stored setting with id '" << asset_id << "' status is " << status << ":" << ext_status << LL_ENDL; +} + + +void LLSettingsVOBase::onSaveNewAssetComplete(const LLUUID& new_asset_id, const LLSettingsVOBase::SettingsSaveData::ptr_t &savedata, + S32 status, LLExtStat ext_status) +{ + if (!status) + { + // Success + LL_INFOS("SETTINGS") << "Saved setting of type '" << savedata->mType << "' as " << new_asset_id << LL_ENDL; + } + else + { + LL_WARNS("SETTINGS") << "Unable to save '" << savedata->mType << "' to central asset store." << LL_ENDL; + LLSD args; + args["NAME"] = savedata->mType; + LLNotificationsUtil::add("CannotSaveToAssetStore", args); + } + + gAssetStorage->getAssetData(new_asset_id, LLAssetType::AT_SETTINGS, &testingOnGotAsset, nullptr); + + std::remove(savedata->mTempFile.c_str()); +} +#endif + + +void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings) +{ + LLTransactionID tid; + LLUUID parentFolder = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); + U32 nextOwnerPerm = LLPermissions::DEFAULT.getMaskNextOwner(); + + tid.generate(); + + LLPointer cb = new LLSettingsInventoryCB([settings](const LLUUID &inventoryId) { + LLSettingsVOBase::onInventoryItemCreated(inventoryId, settings); + }); + + create_inventory_settings(gAgent.getID(), gAgent.getSessionID(), + parentFolder, tid, + settings->getName(), "new settings collection.", + settings->getSettingTypeValue(), nextOwnerPerm, cb); +} + +void LLSettingsVOBase::onInventoryItemCreated(const LLUUID &inventoryId, LLSettingsBase::ptr_t settings) +{ + // We need to update some inventory stuff here.... maybe. + uploadSettingsAsset(settings, inventoryId); +} + + +void LLSettingsVOBase::uploadSettingsAsset(const LLSettingsBase::ptr_t &settings, LLUUID inv_item_id) +{ + const LLViewerRegion* region = gAgent.getRegion(); + if (!region) + { + LL_WARNS("SETTINGS") << "Not connected to a region, cannot save setting." << LL_ENDL; + return; + } + + std::string agent_url(region->getCapability("UpdateSettingsAgentInventory")); + + if (agent_url.empty()) + { + LL_WARNS("SETTINGS") << "Region does not support settings inventory objects." << LL_ENDL; + return; + } + + std::stringstream buffer; + LLSD settingdata(settings->getSettings()); + LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION); + + LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared(inv_item_id, LLAssetType::AT_SETTINGS, buffer.str(), + [settings](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD response) { + LLSettingsVOBase::onAgentAssetUploadComplete(itemId, newAssetId, newItemId, response, settings); + }); + + LLViewerAssetUpload::EnqueueInventoryUpload(agent_url, uploadInfo); +} + +void LLSettingsVOBase::uploadSettingsAsset(const LLSettingsBase::ptr_t &settings, LLUUID object_id, LLUUID inv_item_id) +{ + const LLViewerRegion* region = gAgent.getRegion(); + if (!region) + { + LL_WARNS("SETTINGS") << "Not connected to a region, cannot save setting." << LL_ENDL; + return; + } + + std::string agent_url(region->getCapability("UpdateSettingsAgentInventory")); + + if (agent_url.empty()) + { + LL_WARNS("SETTINGS") << "Region does not support settings inventory objects." << LL_ENDL; + return; + } + + std::stringstream buffer; + LLSD settingdata(settings->getSettings()); + LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION); + + LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared(object_id, inv_item_id, LLAssetType::AT_SETTINGS, buffer.str(), + [settings](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) { + LLSettingsVOBase::onTaskAssetUploadComplete(itemId, taskId, newAssetId, response, settings); + }); + + LLViewerAssetUpload::EnqueueInventoryUpload(agent_url, uploadInfo); +} + +void LLSettingsVOBase::onAgentAssetUploadComplete(LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD response, LLSettingsBase::ptr_t psettings) +{ + LL_WARNS("SETTINGS") << "Upload to inventory complete!" << LL_ENDL; +} + +void LLSettingsVOBase::onTaskAssetUploadComplete(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, LLSettingsBase::ptr_t psettings) +{ + LL_WARNS("SETTINGS") << "Upload to task complete!" << LL_ENDL; +} + +bool LLSettingsVOBase::exportFile(const LLSettingsBase::ptr_t &settings, const std::string &filename, LLSDSerialize::ELLSD_Serialize format) +{ + try + { + std::ofstream file(filename, std::ios::out | std::ios::trunc); + file.exceptions(std::ios_base::failbit | std::ios_base::badbit); + + if (!file) + { + LL_WARNS("SETTINGS") << "Unable to open '" << filename << "' for writing." << LL_ENDL; + return false; + } + + LLSDSerialize::serialize(settings->getSettings(), file, format); + } + catch (const std::ios_base::failure &e) + { + LL_WARNS("SETTINGS") << "Unable to save settings to file '" << filename << "': " << e.what() << LL_ENDL; + return false; + } + + return true; +} + +LLSettingsBase::ptr_t LLSettingsVOBase::importFile(const std::string &filename) +{ + LLSD settings; + + try + { + std::ifstream file(filename, std::ios::in); + file.exceptions(std::ios_base::failbit | std::ios_base::badbit); + + if (!file) + { + LL_WARNS("SETTINGS") << "Unable to open '" << filename << "' for reading." << LL_ENDL; + return LLSettingsBase::ptr_t(); + } + + if (!LLSDSerialize::deserialize(settings, file, -1)) + { + LL_WARNS("SETTINGS") << "Unable to deserialize settings from '" << filename << "'" << LL_ENDL; + return LLSettingsBase::ptr_t(); + } + } + catch (const std::ios_base::failure &e) + { + LL_WARNS("SETTINGS") << "Unable to save settings to file '" << filename << "': " << e.what() << LL_ENDL; + return false; + } + + std::string settingtype = settings[SETTING_NAME].asString(); + + LLSettingsBase::ptr_t psetting; + + if (settingtype == "water") + { + return LLSettingsVOWater::buildWater(settings); + } + else if (settingtype == "sky") + { + return LLSettingsVOSky::buildSky(settings); + } + else if (settingtype == "daycycle") + { + return LLSettingsVODay::buildDay(settings); + } + + LL_WARNS("SETTINGS") << "Unable to determine settings type for '" << filename << "'." << LL_ENDL; + return LLSettingsBase::ptr_t(); } + + //========================================================================= LLSettingsVOSky::LLSettingsVOSky(const LLSD &data): LLSettingsSky(data) @@ -79,6 +342,20 @@ LLSettingsVOSky::LLSettingsVOSky(): } //------------------------------------------------------------------------- +LLSettingsSky::ptr_t LLSettingsVOSky::buildSky(LLSD settings) +{ + LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList(); + LLSD results = LLSettingsSky::settingValidation(settings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky setting validation failed!\n" << results << LL_ENDL; + LLSettingsSky::ptr_t(); + } + + return std::make_shared(settings); +} + + LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &name, const LLSD &legacy) { @@ -253,6 +530,19 @@ LLSettingsVOWater::LLSettingsVOWater() : } +LLSettingsWater::ptr_t LLSettingsVOWater::buildWater(LLSD settings) +{ + LLSettingsWater::validation_list_t validations = LLSettingsWater::validationList(); + LLSD results = LLSettingsWater::settingValidation(settings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Water setting validation failed!\n" << results << LL_ENDL; + LLSettingsWater::ptr_t(); + } + + return std::make_shared(settings); +} + //------------------------------------------------------------------------- LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::string &name, const LLSD &legacy) { @@ -410,6 +700,23 @@ LLSettingsVODay::LLSettingsVODay(): LLSettingsDay() {} +LLSettingsDay::ptr_t LLSettingsVODay::buildDay(LLSD settings) +{ + LLSettingsDay::validation_list_t validations = LLSettingsDay::validationList(); + LLSD results = LLSettingsDay::settingValidation(settings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Day setting validation failed!\n" << results << LL_ENDL; + LLSettingsDay::ptr_t(); + } + + LLSettingsDay::ptr_t pday = std::make_shared(settings); + if (pday) + pday->initialize(); + + return pday; +} + //------------------------------------------------------------------------- LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings) { diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h index ba96a19d3e..55e04b5f3a 100644 --- a/indra/newview/llsettingsvo.h +++ b/indra/newview/llsettingsvo.h @@ -33,11 +33,56 @@ #include "llsettingswater.h" #include "llsettingsdaycycle.h" +#include "llsdserialize.h" + +#include "llextendedstatus.h" + +//========================================================================= +class LLSettingsVOBase : public LLSettingsBase +{ +public: +#if 0 + static void storeAsAsset(const LLSettingsBase::ptr_t &settings); +#endif + + static void createInventoryItem(const LLSettingsBase::ptr_t &settings); + + static void uploadSettingsAsset(const LLSettingsBase::ptr_t &settings, LLUUID inv_item_id); + static void uploadSettingsAsset(const LLSettingsBase::ptr_t &settings, LLUUID object_id, LLUUID inv_item_id); + + + static bool exportFile(const LLSettingsBase::ptr_t &settings, const std::string &filename, LLSDSerialize::ELLSD_Serialize format = LLSDSerialize::LLSD_NOTATION); + static LLSettingsBase::ptr_t importFile(const std::string &filename); + +private: + struct SettingsSaveData + { + typedef std::shared_ptr ptr_t; + std::string mType; + std::string mTempFile; + LLSettingsBase::ptr_t mSettings; + LLTransactionID mTransId; + }; + + LLSettingsVOBase() {} + + static void onInventoryItemCreated(const LLUUID &inventoryId, LLSettingsBase::ptr_t settings); + +#if 0 + static void onSaveNewAssetComplete(const LLUUID& new_asset_id, const SettingsSaveData::ptr_t &savedata, S32 status, LLExtStat ext_status); +#endif + static void onAgentAssetUploadComplete(LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD response, LLSettingsBase::ptr_t psettings); + static void onTaskAssetUploadComplete(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, LLSettingsBase::ptr_t psettings); +}; + +//========================================================================= class LLSettingsVOSky : public LLSettingsSky { public: LLSettingsVOSky(const LLSD &data); + static ptr_t buildSky(LLSD settings); + static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings); static ptr_t buildDefaultSky(); virtual ptr_t buildClone(); @@ -46,9 +91,9 @@ public: protected: LLSettingsVOSky(); - virtual void updateSettings(); + virtual void updateSettings(); - virtual void applySpecial(void *); + virtual void applySpecial(void *); virtual parammapping_t getParameterMap() const; @@ -60,6 +105,8 @@ class LLSettingsVOWater : public LLSettingsWater public: LLSettingsVOWater(const LLSD &data); + static ptr_t buildWater(LLSD settings); + static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings); static ptr_t buildDefaultWater(); virtual ptr_t buildClone(); @@ -68,8 +115,8 @@ public: protected: LLSettingsVOWater(); - virtual void updateSettings(); - virtual void applySpecial(void *); + virtual void updateSettings(); + virtual void applySpecial(void *); virtual parammapping_t getParameterMap() const; @@ -85,6 +132,8 @@ class LLSettingsVODay : public LLSettingsDay public: LLSettingsVODay(const LLSD &data); + static ptr_t buildDay(LLSD settings); + static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings); static ptr_t buildFromLegacyMessage(const LLUUID ®ionId, LLSD daycycle, LLSD skys, LLSD water); static ptr_t buildDefaultDayCycle(); diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h index 50131682e7..cefe215431 100644 --- a/indra/newview/llviewerassetstorage.h +++ b/indra/newview/llviewerassetstorage.h @@ -69,14 +69,14 @@ protected: // virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type, - void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), + LLGetAssetCallback callback, void *user_data, BOOL duplicate, BOOL is_priority); void queueRequestHttp(const LLUUID& uuid, LLAssetType::EType type, - void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), + LLGetAssetCallback callback, void *user_data, BOOL duplicate, BOOL is_priority); @@ -86,7 +86,7 @@ protected: void assetRequestCoro(LLViewerAssetRequest *req, const LLUUID uuid, LLAssetType::EType atype, - void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), + LLGetAssetCallback callback, void *user_data); std::string getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype); diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 01b4fcfbe1..fcb1bd40c7 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -482,7 +482,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType: mTaskId(LLUUID::null), mContents(buffer), mInvnFinishFn(finish), - mTaskFinishFn(NULL), + mTaskFinishFn(nullptr), mStoredToVFS(false) { setItemId(itemId); @@ -496,7 +496,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLPointer ptr_t; + typedef std::shared_ptr ptr_t; LLResourceUploadInfo( LLTransactionID transactId, @@ -165,8 +165,8 @@ private: class LLBufferedAssetUploadInfo : public LLResourceUploadInfo { public: - typedef boost::function invnUploadFinish_f; - typedef boost::function taskUploadFinish_f; + typedef std::function invnUploadFinish_f; + typedef std::function taskUploadFinish_f; LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish); LLBufferedAssetUploadInfo(LLUUID itemId, LLPointer image, invnUploadFinish_f finish); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 1ab7ec0156..d6f48a4c55 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1097,7 +1097,7 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, const LLUUID& parent, const LLTransactionID& transaction_id, const std::string& name, const std::string& desc, LLAssetType::EType asset_type, - LLInventoryType::EType inv_type, LLWearableType::EType wtype, + LLInventoryType::EType inv_type, U8 subtype, U32 next_owner_perm, LLPointer cb) { @@ -1132,7 +1132,7 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, msg->addU32Fast(_PREHASH_NextOwnerMask, next_owner_perm); msg->addS8Fast(_PREHASH_Type, (S8)asset_type); msg->addS8Fast(_PREHASH_InvType, (S8)inv_type); - msg->addU8Fast(_PREHASH_WearableType, (U8)wtype); + msg->addU8Fast(_PREHASH_WearableType, (U8)subtype); msg->addStringFast(_PREHASH_Name, server_name); msg->addStringFast(_PREHASH_Description, desc); @@ -1146,9 +1146,36 @@ void create_inventory_callingcard(const LLUUID& avatar_id, const LLUUID& parent LLAvatarNameCache::get(avatar_id, &av_name); create_inventory_item(gAgent.getID(), gAgent.getSessionID(), parent, LLTransactionID::tnull, av_name.getUserName(), item_desc, LLAssetType::AT_CALLINGCARD, - LLInventoryType::IT_CALLINGCARD, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, cb); + LLInventoryType::IT_CALLINGCARD, NO_INV_SUBTYPE, PERM_MOVE | PERM_TRANSFER, cb); } +void create_inventory_wearable(const LLUUID& agent_id, const LLUUID& session_id, + const LLUUID& parent, const LLTransactionID& transaction_id, + const std::string& name, + const std::string& desc, LLAssetType::EType asset_type, + LLWearableType::EType wtype, + U32 next_owner_perm, + LLPointer cb) +{ + create_inventory_item(agent_id, session_id, parent, transaction_id, + name, desc, asset_type, LLInventoryType::IT_WEARABLE, static_cast(wtype), + next_owner_perm, cb); +} + +void create_inventory_settings(const LLUUID& agent_id, const LLUUID& session_id, + const LLUUID& parent, const LLTransactionID& transaction_id, + const std::string& name, + const std::string& desc, + LLSettingsType settype, + U32 next_owner_perm, + LLPointer cb) +{ + create_inventory_item(agent_id, session_id, parent, transaction_id, + name, desc, LLAssetType::AT_SETTINGS, LLInventoryType::IT_SETTINGS, + static_cast(settype), next_owner_perm, cb); +} + + void copy_inventory_item( const LLUUID& agent_id, const LLUUID& current_owner, @@ -1700,7 +1727,7 @@ void create_new_item(const std::string& name, desc, asset_type, inv_type, - NOT_WEARABLE, + NO_INV_SUBTYPE, next_owner_perm, cb); } diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index b3053e365b..b89ed42829 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -31,6 +31,7 @@ #include "llframetimer.h" #include "llwearable.h" #include "llinitdestroyclass.h" //for LLDestroyClass +#include "llinventorysettings.h" #include // boost::signals2::trackable @@ -295,7 +296,7 @@ public: // virtual void fire(const LLUUID& item_id) -{ + { mFireFunc(item_id); } @@ -336,17 +337,32 @@ public: extern LLInventoryCallbackManager gInventoryCallbacks; -#define NOT_WEARABLE (LLWearableType::EType)0 +const U8 NO_INV_SUBTYPE{ 0 }; // *TODO: Find a home for these void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, const LLUUID& parent, const LLTransactionID& transaction_id, const std::string& name, const std::string& desc, LLAssetType::EType asset_type, - LLInventoryType::EType inv_type, LLWearableType::EType wtype, + LLInventoryType::EType inv_type, U8 subtype, U32 next_owner_perm, LLPointer cb); +void create_inventory_wearable(const LLUUID& agent_id, const LLUUID& session_id, + const LLUUID& parent, const LLTransactionID& transaction_id, + const std::string& name, + const std::string& desc, LLAssetType::EType asset_type, + LLWearableType::EType wtype, + U32 next_owner_perm, + LLPointer cb); + +void create_inventory_settings(const LLUUID& agent_id, const LLUUID& session_id, + const LLUUID& parent, const LLTransactionID& transaction_id, + const std::string& name, const std::string& desc, + LLSettingsType settype, + U32 next_owner_perm, LLPointer cb); + + void create_inventory_callingcard(const LLUUID& avatar_id, const LLUUID& parent = LLUUID::null, LLPointer cb=NULL); /** diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 90355b7166..482de8a722 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -441,7 +441,7 @@ class LLFileUploadBulk : public view_listener_t LLStringUtil::stripNonprintable(asset_name); LLStringUtil::trim(asset_name); - LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( + LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared( filename, asset_name, asset_name, 0, @@ -451,7 +451,7 @@ class LLFileUploadBulk : public view_listener_t LLFloaterPerms::getEveryonePerms("Uploads"), expected_upload_cost)); - upload_new_resource(uploadInfo, NULL, NULL); + upload_new_resource(uploadInfo); filename = picker.getNextFile(); } @@ -647,7 +647,7 @@ LLUUID upload_new_resource( void *userdata) { - LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( + LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared( src_filename, name, desc, compression_info, destination_folder_type, inv_type, @@ -730,7 +730,7 @@ void upload_done_callback( create_inventory_item(gAgent.getID(), gAgent.getSessionID(), folder_id, data->mAssetInfo.mTransactionID, data->mAssetInfo.getName(), data->mAssetInfo.getDescription(), data->mAssetInfo.mType, - data->mInventoryType, NOT_WEARABLE, next_owner_perms, + data->mInventoryType, NO_INV_SUBTYPE, next_owner_perms, LLPointer(NULL)); } else @@ -766,7 +766,7 @@ void upload_done_callback( LLStringUtil::trim(asset_name); std::string display_name = LLStringUtil::null; - LLAssetStorage::LLStoreAssetCallback callback = NULL; + LLAssetStorage::LLStoreAssetCallback callback; void *userdata = NULL; upload_new_resource( next_file, diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index 6941b4dc0e..973739d7ac 100644 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -59,7 +59,7 @@ LLUUID upload_new_resource( void upload_new_resource( LLResourceUploadInfo::ptr_t &uploadInfo, - LLAssetStorage::LLStoreAssetCallback callback = NULL, + LLAssetStorage::LLStoreAssetCallback callback = LLAssetStorage::LLStoreAssetCallback(), void *userdata = NULL); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b272595d79..1520ef7a2f 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2895,9 +2895,13 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("UpdateGestureTaskInventory"); capabilityNames.append("UpdateNotecardAgentInventory"); capabilityNames.append("UpdateNotecardTaskInventory"); + capabilityNames.append("UpdateSettingsAgentInventory"); + capabilityNames.append("UpdateSettingsTaskInventory"); capabilityNames.append("UpdateScriptAgent"); capabilityNames.append("UpdateScriptTask"); - capabilityNames.append("UploadBakedTexture"); + capabilityNames.append("UpdateSettingsAgentInventory"); + capabilityNames.append("UpdateSettingsTaskInventory"); + capabilityNames.append("UploadBakedTexture"); capabilityNames.append("UserInfo"); capabilityNames.append("ViewerAsset"); capabilityNames.append("ViewerMetrics"); diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml index 0f0acea832..88423ad023 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml @@ -24,8 +24,8 @@ border="false" auto_resize="false" user_resize="true" - height="30" - min_height="30" + height="45" + min_height="45" background_visible="false"> Preset Name: @@ -138,6 +137,15 @@ name="cancel_btn" width="100" /> + + + + + + + + + + + + + - Time Line Goes here - + left="10" + max_sliders="20" + max_val="24" + name="WLTimeSlider" + show_text="false" + top_pad="0" + use_triangle="true" + width="525" + min_width="525"/> + + + + + + + + + + top="0"> + + + top="0"> + + + name="skip_forward" + mouse_opaque="false" + auto_resize="false" + layout="topleft" + top="0" + height="25" + min_width="25" + width="25"> @@ -505,15 +512,6 @@ name="cancel_btn" width="100" /> - - -- cgit v1.2.3 From fbaa01d9a0c63386f13f0e43437c69f700950fd6 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 23 May 2018 09:30:39 -0700 Subject: Removed mSavedEnvironment so the Mac build will be happy. --- indra/newview/llfloatereditextdaycycle.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 3a1f29382a..6ef3563e8f 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -129,8 +129,6 @@ private: // data for restoring previous displayed environment - S32 mSavedEnvironment; - LLSettingsDay::ptr_t mEditDay; // edited copy LLSettingsDay::ptr_t mOriginalDay; // the one we are editing S64Seconds mDayLength; -- cgit v1.2.3 From fa4ac065cb332c8c90fb59eeff0b983a1fd56691 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 24 May 2018 13:11:33 -0700 Subject: Enable sky changes with altitude. --- indra/llinventory/llsettingsbase.cpp | 13 +++- indra/llinventory/llsettingsbase.h | 22 +++++- indra/llinventory/llsettingsdaycycle.h | 2 + indra/llinventory/llsettingssky.h | 2 + indra/llinventory/llsettingswater.h | 2 + indra/newview/llagent.cpp | 14 ++++ indra/newview/llagent.h | 10 ++- indra/newview/llenvironment.cpp | 126 ++++++++++++++++++++++++++------- indra/newview/llenvironment.h | 9 ++- 9 files changed, 168 insertions(+), 32 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index f870ec8904..411eaff8e3 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -547,8 +547,11 @@ F64 LLSettingsBlender::setPosition(F64 blendf) } blendf = llclamp(blendf, 0.0, 1.0); - //_WARNS("LAPRAS") << "blending at " << (blendf * 100.0f) << "%" << LL_ENDL; mTarget->replaceSettings(mInitial->getSettings()); + if (mIsTrivial || (blendf == 0.0)) + { // this is a trivial blend. Results will be identical to the initial. + return blendf; + } mTarget->blend(mFinal, blendf); return blendf; @@ -562,6 +565,11 @@ void LLSettingsBlender::triggerComplete() } //------------------------------------------------------------------------- +F64 LLSettingsBlenderTimeDelta::calculateBlend(F64 spanpos, F64 spanlen) const +{ + return fmod(spanpos, spanlen) / spanlen; +} + void LLSettingsBlenderTimeDelta::update(F64 timedelta) { mTimeSpent += F64Seconds(timedelta); @@ -572,8 +580,7 @@ void LLSettingsBlenderTimeDelta::update(F64 timedelta) return; } - F64 blendf = fmod(mTimeSpent.value(), mBlendSpan.value()) / mBlendSpan.value(); - + F64 blendf = calculateBlend(mTimeSpent.value(), mBlendSpan.value()); // Note no clamp here. setPosition(blendf); diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index d00e340b4b..71358d6a49 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -166,6 +166,8 @@ public: virtual bool validate(); + virtual ptr_t buildDerivedClone() = 0; + class Validator { public: @@ -269,10 +271,15 @@ public: mOnFinished(), mTarget(target), mInitial(initsetting), - mFinal(endsetting) + mFinal(endsetting), + mIsTrivial(false) { if (mInitial) mTarget->replaceSettings(mInitial->getSettings()); + + if (!mFinal) + mFinal = mInitial; + mIsTrivial = (mFinal == mInitial); } virtual ~LLSettingsBlender() {} @@ -280,8 +287,16 @@ public: virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 /*span*/ = 1.0) { // note: the 'span' reset parameter is unused by the base class. + if (!mInitial) + LL_WARNS("BLENDER") << "Reseting blender with empty initial setting. Expect badness in the future." << LL_ENDL; + mInitial = initsetting; mFinal = endsetting; + + if (!mFinal) + mFinal = mInitial; + mIsTrivial = (mFinal == mInitial); + mTarget->replaceSettings(mInitial->getSettings()); } @@ -308,6 +323,8 @@ public: virtual void update(F64 blendf); virtual F64 setPosition(F64 blendf); + virtual void switchTrack(S32 trackno, F64 position = -1.0) { /*NoOp*/ } + protected: void triggerComplete(); @@ -316,6 +333,7 @@ protected: LLSettingsBase::ptr_t mTarget; LLSettingsBase::ptr_t mInitial; LLSettingsBase::ptr_t mFinal; + bool mIsTrivial; }; class LLSettingsBlenderTimeDelta : public LLSettingsBlender @@ -349,6 +367,8 @@ public: virtual void update(F64 timedelta) override; protected: + F64 calculateBlend(F64 spanpos, F64 spanlen) const; + F64Seconds mBlendSpan; F64Seconds mLastUpdate; F64Seconds mTimeSpent; diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 9a89031aed..336a00f386 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -114,6 +114,8 @@ public: virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); + virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + protected: LLSettingsDay(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 59a9dc9a43..9379cd37c3 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -479,6 +479,8 @@ public: return mNextCloudTextureId; } + virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 64de4486ca..acae903e92 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -211,6 +211,8 @@ public: static LLSD translateLegacySettings(LLSD legacy); + virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + protected: static const std::string SETTING_LEGACY_BLUR_MULTIPILER; static const std::string SETTING_LEGACY_FOG_COLOR; diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 80e5647ace..b413c21033 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -381,6 +381,7 @@ LLAgent::LLAgent() : mAgentOriginGlobal(), mPositionGlobal(), + mLastTestGlobal(), mDistanceTraveled(0.F), mLastPositionGlobal(LLVector3d::zero), @@ -1070,6 +1071,13 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent) pos_agent_d.setVec(pos_agent); mPositionGlobal = pos_agent_d + mAgentOriginGlobal; } + + if (((mLastTestGlobal - mPositionGlobal).lengthSquared() > 1.0) && !mOnPositionChanged.empty()) + { // If the position has changed my more than 1 meter since the last time we triggered. + // filters out some noise. + mLastTestGlobal = mPositionGlobal; + mOnPositionChanged(mFrameAgent.getOrigin(), mPositionGlobal); + } } //----------------------------------------------------------------------------- @@ -1110,6 +1118,12 @@ const LLVector3 &LLAgent::getPositionAgent() return mFrameAgent.getOrigin(); } +boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot_type fn) +{ + return mOnPositionChanged.connect(fn); +} + + //----------------------------------------------------------------------------- // getRegionsVisited() //----------------------------------------------------------------------------- diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 4bb4d317e8..477ec88be4 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -189,6 +189,8 @@ private: // Position //-------------------------------------------------------------------- public: + typedef boost::signals2::signal position_signal_t; + LLVector3 getPosAgentFromGlobal(const LLVector3d &pos_global) const; LLVector3d getPosGlobalFromAgent(const LLVector3 &pos_agent) const; const LLVector3d &getPositionGlobal() const; @@ -196,10 +198,16 @@ public: // Call once per frame to update position, angles (radians). void updateAgentPosition(const F32 dt, const F32 yaw, const S32 mouse_x, const S32 mouse_y); void setPositionAgent(const LLVector3 ¢er); + + boost::signals2::connection whenPositionChanged(position_signal_t::slot_type fn); + protected: void propagate(const F32 dt); // ! BUG ! Should roll into updateAgentPosition private: - mutable LLVector3d mPositionGlobal; + mutable LLVector3d mPositionGlobal; + + position_signal_t mOnPositionChanged; + LLVector3d mLastTestGlobal; //-------------------------------------------------------------------- // Velocity diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 9bc3f65c79..11347917c3 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -124,7 +124,7 @@ namespace LLTrackBlenderLoopingTime(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno, F64Seconds cyclelength, F64Seconds cycleoffset) : LLSettingsBlenderTimeDelta(target, LLSettingsBase::ptr_t(), LLSettingsBase::ptr_t(), F64Seconds(1.0)), mDay(day), - mTrackNo(trackno), + mTrackNo(0), mCycleLength(cyclelength), mCycleOffset(cycleoffset) { @@ -134,10 +134,57 @@ namespace mFinal = (*initial.second).second; mBlendSpan = getSpanTime(initial); + mTrackNo = selectTrackNumber(trackno); + setOnFinished([this](const LLSettingsBlender::ptr_t &){ onFinishedSpan(); }); } + + void switchTrack(S32 trackno, F64) override + { + S32 use_trackno = selectTrackNumber(trackno); + + if (use_trackno == mTrackNo) + { // results in no change + return; + } + + mTrackTransitionStart = mTarget->buildDerivedClone(); + mTrackNo = use_trackno; + + F64Seconds now = getAdjustedNow() + LLEnvironment::TRANSITION_ALTITUDE; + LLSettingsDay::TrackBound_t bounds = getBoundingEntries(now); + + LLSettingsBase::ptr_t pendsetting = (*bounds.first).second->buildDerivedClone(); + F64 targetpos = convertTimeToPosition(now) - (*bounds.first).first; + F64 targetspan = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); + + F64 blendf = calculateBlend(targetpos, targetspan); + pendsetting->blend((*bounds.second).second, blendf); + + reset(mTrackTransitionStart, pendsetting, LLEnvironment::TRANSITION_ALTITUDE.value()); + } + + protected: + S32 selectTrackNumber(S32 trackno) + { + if (trackno == 0) + { // We are dealing with the water track. There is only ever one. + return 0; + } + + for (S32 test = trackno; test == 0; --test) + { // Find the track below the requested one with data. + LLSettingsDay::CycleTrack_t &track = mDay->getCycleTrack(mTrackNo); + + if (!track.empty()) + return test; + } + + return 1; + } + LLSettingsDay::TrackBound_t getBoundingEntries(F64Seconds time) { LLSettingsDay::CycleTrack_t &wtrack = mDay->getCycleTrack(mTrackNo); @@ -170,6 +217,7 @@ namespace S32 mTrackNo; F64Seconds mCycleLength; F64Seconds mCycleOffset; + LLSettingsBase::ptr_t mTrackTransitionStart; void onFinishedSpan() { @@ -186,6 +234,7 @@ const F32Seconds LLEnvironment::TRANSITION_INSTANT(0.0f); const F32Seconds LLEnvironment::TRANSITION_FAST(1.0f); const F32Seconds LLEnvironment::TRANSITION_DEFAULT(5.0f); const F32Seconds LLEnvironment::TRANSITION_SLOW(10.0f); +const F32Seconds LLEnvironment::TRANSITION_ALTITUDE(5.0f); const F32 LLEnvironment::SUN_DELTA_YAW(F_PI); // 180deg const F32 LLEnvironment::NIGHTTIME_ELEVATION_COS(LLSky::NIGHTTIME_ELEVATION_COS); @@ -202,7 +251,8 @@ LLEnvironment::LLEnvironment(): mDayCycleByName(), mDayCycleById(), mUserPrefs(), - mSelectedEnvironment(LLEnvironment::ENV_LOCAL) + mSelectedEnvironment(LLEnvironment::ENV_LOCAL), + mCurrentTrack(1) { } @@ -228,11 +278,13 @@ void LLEnvironment::initSingleton() requestRegionEnvironment(); - LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLEnvironment::onParcelChange, this)); - gAgent.addParcelChangedCallback(boost::bind(&LLEnvironment::onParcelChange, this)); + LLRegionInfoModel::instance().setUpdateCallback([this]() { onParcelChange(); }); + gAgent.addParcelChangedCallback([this]() { onParcelChange(); }); //TODO: This frequently results in one more request than we need. It isn't breaking, but should be nicer. - gAgent.addRegionChangedCallback(boost::bind(&LLEnvironment::requestRegionEnvironment, this)); + gAgent.addRegionChangedCallback([this]() { requestRegionEnvironment(); }); + + gAgent.whenPositionChanged([this](const LLVector3 &localpos, const LLVector3d &) { onAgentPositionHasChanged(localpos); }); } LLEnvironment::~LLEnvironment() @@ -374,6 +426,7 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, const LLSe environment->clear(); environment->setDay(pday, daylength, dayoffset); + environment->setSkyTrack(mCurrentTrack); environment->animate(); /*TODO: readjust environment*/ } @@ -1435,6 +1488,29 @@ void LLEnvironment::legacyLoadAllPresets() } } +void LLEnvironment::onAgentPositionHasChanged(const LLVector3 &localpos) +{ + S32 trackno = calculateSkyTrackForAltitude(localpos.mV[VZ]); + if (trackno == mCurrentTrack) + return; + + LL_WARNS("LAPRAS") << "Wants to switch to track #" << trackno << LL_ENDL; + + mCurrentTrack = trackno; + for (S32 env = ENV_LOCAL; env < ENV_DEFAULT; ++env) + { + if (mEnvironments[env]) + mEnvironments[env]->setSkyTrack(mCurrentTrack); + } +} + +S32 LLEnvironment::calculateSkyTrackForAltitude(F64 altitude) +{ + //*LAPRAS* temp base on region's response. + return llmin((static_cast(altitude) / 100) + 1, (LLSettingsDay::TRACK_MAX - 1)); +} + + //========================================================================= LLEnvironment::DayInstance::DayInstance() : mDayCycle(), @@ -1533,13 +1609,11 @@ void LLEnvironment::DayInstance::clear() void LLEnvironment::DayInstance::setSkyTrack(S32 trackno) { - /*TODO*/ -// if (trackno != mSkyTrack) -// { -// mSkyTrack = trackno; -// -// // *TODO*: Pick the sky track based on the skytrack. -// } + mSkyTrack = trackno; + if (mBlenderSky) + { + mBlenderSky->switchTrack(trackno); + } } @@ -1572,35 +1646,35 @@ void LLEnvironment::DayInstance::animate() mWater.reset(); mBlenderWater.reset(); } - else if (wtrack.size() == 1) - { - mWater = std::static_pointer_cast((*(wtrack.begin())).second); - mBlenderWater.reset(); - } +// else if (wtrack.size() == 1) +// { +// mWater = std::static_pointer_cast((*(wtrack.begin())).second); +// mBlenderWater.reset(); +// } else { mWater = LLSettingsVOWater::buildDefaultWater(); mBlenderWater = std::make_shared(mWater, mDayCycle, 0, mDayLength, mDayOffset); } - // Day track 1 only for the moment - // sky - LLSettingsDay::CycleTrack_t &track = mDayCycle->getCycleTrack(mSkyTrack); + // sky, initalize to track 1 + LLSettingsDay::CycleTrack_t &track = mDayCycle->getCycleTrack(1); if (track.empty()) { mSky.reset(); mBlenderSky.reset(); } - else if (track.size() == 1) - { - mSky = std::static_pointer_cast((*(track.begin())).second); - mBlenderSky.reset(); - } +// else if (track.size() == 1) +// { +// mSky = std::static_pointer_cast((*(track.begin())).second); +// mBlenderSky.reset(); +// } else { mSky = LLSettingsVOSky::buildDefaultSky(); - mBlenderSky = std::make_shared(mSky, mDayCycle, mSkyTrack, mDayLength, mDayOffset); + mBlenderSky = std::make_shared(mSky, mDayCycle, 1, mDayLength, mDayOffset); + mBlenderSky->switchTrack(mSkyTrack); } } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index e8e5a74196..cdfac34d90 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -53,6 +53,7 @@ public: static const F32Seconds TRANSITION_FAST; static const F32Seconds TRANSITION_DEFAULT; static const F32Seconds TRANSITION_SLOW; + static const F32Seconds TRANSITION_ALTITUDE; struct EnvironmentInfo { @@ -214,6 +215,8 @@ public: void selectAgentEnvironment(); + S32 calculateSkyTrackForAltitude(F64 altitude); + protected: virtual void initSingleton(); @@ -267,6 +270,7 @@ private: S64Seconds mDayLength; S64Seconds mDayOffset; + S32 mLastTrackAltitude; LLSettingsBlender::ptr_t mBlenderSky; LLSettingsBlender::ptr_t mBlenderWater; @@ -333,6 +337,8 @@ private: change_signal_t mWaterListChange; change_signal_t mDayCycleListChange; + S32 mCurrentTrack; + DayInstance::ptr_t getEnvironmentInstance(EnvSelection_t env, bool create = false); DayInstance::ptr_t getSelectedEnvironmentInstance(); @@ -364,6 +370,7 @@ private: void recordEnvironment(S32 parcel_id, EnvironmentInfo::ptr_t environment); + void onAgentPositionHasChanged(const LLVector3 &localpos); //========================================================================= void legacyLoadAllPresets(); static LLSD legacyLoadPreset(const std::string& path); @@ -378,7 +385,7 @@ public: LLTrackBlenderLoopingManual(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno); F64 setPosition(F64 position) override; - void switchTrack(S32 trackno, F64 position = -1.0); + virtual void switchTrack(S32 trackno, F64 position) override; S32 getTrack() const { return mTrackNo; } typedef std::shared_ptr ptr_t; -- cgit v1.2.3 From acaf57100eade61262d73cf5b318c4545e921bd5 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 24 May 2018 17:09:01 -0700 Subject: switch track based on altitudes sent from region. --- indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsbase.h | 6 +----- indra/newview/llenvironment.cpp | 30 ++++++++++++++++++++++++++---- indra/newview/llenvironment.h | 21 +++++++++++---------- indra/newview/llfloatereditextdaycycle.cpp | 11 +++++------ indra/newview/llfloatereditextdaycycle.h | 2 +- 6 files changed, 45 insertions(+), 27 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 411eaff8e3..d8e337e231 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -548,7 +548,7 @@ F64 LLSettingsBlender::setPosition(F64 blendf) blendf = llclamp(blendf, 0.0, 1.0); mTarget->replaceSettings(mInitial->getSettings()); - if (mIsTrivial || (blendf == 0.0)) + if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) { // this is a trivial blend. Results will be identical to the initial. return blendf; } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 71358d6a49..1ef7df79ad 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -271,15 +271,13 @@ public: mOnFinished(), mTarget(target), mInitial(initsetting), - mFinal(endsetting), - mIsTrivial(false) + mFinal(endsetting) { if (mInitial) mTarget->replaceSettings(mInitial->getSettings()); if (!mFinal) mFinal = mInitial; - mIsTrivial = (mFinal == mInitial); } virtual ~LLSettingsBlender() {} @@ -295,7 +293,6 @@ public: if (!mFinal) mFinal = mInitial; - mIsTrivial = (mFinal == mInitial); mTarget->replaceSettings(mInitial->getSettings()); } @@ -333,7 +330,6 @@ protected: LLSettingsBase::ptr_t mTarget; LLSettingsBase::ptr_t mInitial; LLSettingsBase::ptr_t mFinal; - bool mIsTrivial; }; class LLSettingsBlenderTimeDelta : public LLSettingsBlender diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 11347917c3..e0cfbbf79e 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -961,6 +961,10 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI LL_WARNS("LAPRAS") << "Had requested parcel environment #" << parcel_id << " but got region." << LL_ENDL; clearEnvironment(ENV_PARCEL); } + + mTrackAltitudes = envinfo->mAltitudes; + + LL_WARNS("LAPRAS") << "Altitudes set to {" << mTrackAltitudes[0] << ", "<< mTrackAltitudes[1] << ", " << mTrackAltitudes[2] << ", " << mTrackAltitudes[3] << LL_ENDL; } else { @@ -1250,7 +1254,7 @@ LLEnvironment::EnvironmentInfo::EnvironmentInfo(): mDayOffset(0), mDayHash(0), mDaycycleData(), - mAltitudes(), + mAltitudes({ { 0.0, 0.0, 0.0, 0.0 } }), mIsDefault(false), mIsRegion(false) { @@ -1275,7 +1279,16 @@ LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extract(LL if (environment.has("is_default")) pinfo->mIsDefault = environment["is_default"].asBoolean(); if (environment.has("track_altitudes")) - pinfo->mAltitudes = environment["track_altitudes"]; + { + LL_WARNS("LAPRAS") << "track_altitudes=" << environment["track_altitudes"] << LL_ENDL; + + /*LAPRAS: TODO: Fix the simulator message. Shouldn't be 5, just 4*/ + int idx = 1; + for (F32 &altitude : pinfo->mAltitudes) + { + altitude = environment["track_altitudes"][idx++].asReal(); + } + } return pinfo; } @@ -1506,8 +1519,17 @@ void LLEnvironment::onAgentPositionHasChanged(const LLVector3 &localpos) S32 LLEnvironment::calculateSkyTrackForAltitude(F64 altitude) { - //*LAPRAS* temp base on region's response. - return llmin((static_cast(altitude) / 100) + 1, (LLSettingsDay::TRACK_MAX - 1)); +// //*LAPRAS* temp base on region's response. +// return llmin((static_cast(altitude) / 100) + 1, (LLSettingsDay::TRACK_MAX - 1)); + + auto it = std::find_if_not(mTrackAltitudes.begin(), mTrackAltitudes.end(), [altitude](F32 test) { return altitude > test; }); + + if (it == mTrackAltitudes.begin()) + return 1; + else if (it == mTrackAltitudes.end()) + return 4; + + return std::min(std::distance(mTrackAltitudes.begin(), it), 4LL); } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index cdfac34d90..398c97ebe9 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -61,18 +61,18 @@ public: typedef std::shared_ptr ptr_t; - S32 mParcelId; - LLUUID mRegionId; - S64Seconds mDayLength; - S64Seconds mDayOffset; - size_t mDayHash; - LLSD mDaycycleData; - LLSD mAltitudes; - bool mIsDefault; - bool mIsRegion; + S32 mParcelId; + LLUUID mRegionId; + S64Seconds mDayLength; + S64Seconds mDayOffset; + size_t mDayHash; + LLSD mDaycycleData; + std::array mAltitudes; + bool mIsDefault; + bool mIsRegion; - static ptr_t extract(LLSD); + static ptr_t extract(LLSD); }; @@ -338,6 +338,7 @@ private: change_signal_t mDayCycleListChange; S32 mCurrentTrack; + std::array mTrackAltitudes; DayInstance::ptr_t getEnvironmentInstance(EnvSelection_t env, bool create = false); diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 277f2fab52..f4de71426e 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -852,6 +852,7 @@ void LLFloaterEditExtDayCycle::syncronizeTabs() panel->setSettings(psettingWater); panel->setEnabled(canedit); panel->setAllChildrenEnabled(canedit); + panel->refresh(); } } @@ -883,6 +884,7 @@ void LLFloaterEditExtDayCycle::syncronizeTabs() panel->setSettings(psettingSky); panel->setEnabled(canedit); panel->setAllChildrenEnabled(canedit); + panel->refresh(); } } @@ -1041,13 +1043,10 @@ void LLFloaterEditExtDayCycle::onIdlePlay(void* user_data) F32 new_frame = fmod(self->mPlayStartFrame + prcnt_played, 1.f); self->mTimeSlider->setCurSliderValue(new_frame); // will do the rounding - self->selectFrame(self->mTimeSlider->getCurSliderValue()); + self->mSkyBlender->setPosition(new_frame); + self->mWaterBlender->setPosition(new_frame); + self->syncronizeTabs(); - if (self->mPlayTimer.getElapsedTimeF32() > DAY_CYCLE_PLAY_TIME_SECONDS) - { - // Nothing to do anymore. - self->stopPlay(); - } } diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index c68e189cae..f2462ee1cc 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -132,7 +132,7 @@ private: // play functions void startPlay(); void stopPlay(); - static void onIdlePlay(void* user_data); + static void onIdlePlay(void *); LLSettingsDay::ptr_t mEditDay; // edited copy S64Seconds mDayLength; -- cgit v1.2.3 From 2ddad24c4d5e64711cdbffd98e290d3da8e9714a Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 30 May 2018 17:08:28 -0700 Subject: Timeline behavior in day cycle edit. --- indra/llui/llmultislider.cpp | 30 +- indra/llui/llmultislider.h | 1 + indra/llui/llmultisliderctrl.h | 4 +- indra/newview/llenvironment.h | 6 +- indra/newview/llfloatereditextdaycycle.cpp | 358 +++++++++++---------- indra/newview/llfloatereditextdaycycle.h | 22 +- indra/newview/llsettingsvo.cpp | 2 +- .../default/xui/en/floater_edit_ext_day_cycle.xml | 2 +- .../skins/default/xui/en/menu_save_settings.xml | 2 +- 9 files changed, 240 insertions(+), 187 deletions(-) (limited to 'indra') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 93045a6578..5cfe79267f 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -210,6 +210,19 @@ void LLMultiSlider::setCurSlider(const std::string& name) } } +F32 LLMultiSlider::getSliderValueFromX(S32 xpos) const +{ + S32 left_edge = mThumbWidth / 2; + S32 right_edge = getRect().getWidth() - (mThumbWidth / 2); + + xpos += mMouseOffset; + xpos = llclamp(xpos, left_edge, right_edge); + + F32 t = F32(xpos - left_edge) / (right_edge - left_edge); + + return((t * (mMaxValue - mMinValue)) + mMinValue); +} + void LLMultiSlider::resetCurSlider() { mCurSlider = LLStringUtil::null; @@ -359,14 +372,15 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) { if( gFocusMgr.getMouseCapture() == this ) { - S32 left_edge = mThumbWidth/2; - S32 right_edge = getRect().getWidth() - (mThumbWidth/2); - - x += mMouseOffset; - x = llclamp( x, left_edge, right_edge ); - - F32 t = F32(x - left_edge) / (right_edge - left_edge); - setCurSliderValue(t * (mMaxValue - mMinValue) + mMinValue ); +// S32 left_edge = mThumbWidth/2; +// S32 right_edge = getRect().getWidth() - (mThumbWidth/2); +// +// x += mMouseOffset; +// x = llclamp( x, left_edge, right_edge ); +// +// F32 t = F32(x - left_edge) / (right_edge - left_edge); +// setCurSliderValue(t * (mMaxValue - mMinValue) + mMinValue ); + setCurSliderValue(getSliderValueFromX(x)); onCommit(); getWindow()->setCursor(UI_CURSOR_ARROW); diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 927063a5fd..0177597da2 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -72,6 +72,7 @@ public: virtual ~LLMultiSlider(); void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); F32 getSliderValue(const std::string& name) const; + F32 getSliderValueFromX(S32 xpos) const; const std::string& getCurSlider() const { return mCurSlider; } F32 getCurSliderValue() const { return getSliderValue(mCurSlider); } diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index 84378ff7b2..5c4777ebd0 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -74,7 +74,7 @@ protected: public: virtual ~LLMultiSliderCtrl(); - F32 getSliderValue(const std::string& name) const; + F32 getSliderValue(const std::string& name) const { return mMultiSlider->getSliderValue(name); } void setSliderValue(const std::string& name, F32 v, BOOL from_event = FALSE); virtual void setValue(const LLSD& value ); @@ -99,6 +99,8 @@ public: void setMaxValue(F32 max_value) {mMultiSlider->setMaxValue(max_value);} void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);} + F32 getSliderValueFromX(S32 x) const { return mMultiSlider->getSliderValueFromX(x); } + /// for adding and deleting sliders const std::string& addSlider(); const std::string& addSlider(F32 val); diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 398c97ebe9..32ce99ccc9 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -129,6 +129,8 @@ public: typedef boost::signals2::signal change_signal_t; typedef std::function environment_apply_fn; + typedef std::array altitude_list_t; + virtual ~LLEnvironment(); void loadPreferences(); @@ -217,6 +219,8 @@ public: S32 calculateSkyTrackForAltitude(F64 altitude); + const altitude_list_t & getRegionAltitudes() const { return mTrackAltitudes; } + protected: virtual void initSingleton(); @@ -338,7 +342,7 @@ private: change_signal_t mDayCycleListChange; S32 mCurrentTrack; - std::array mTrackAltitudes; + altitude_list_t mTrackAltitudes; DayInstance::ptr_t getEnvironmentInstance(EnvSelection_t env, bool create = false); diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index f4de71426e..706dd99fc9 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -58,36 +58,37 @@ #include "llenvironment.h" #include "lltrans.h" -static const std::string track_tabs[] = { - "water_track", - "sky1_track", - "sky2_track", - "sky3_track", - "sky4_track", -}; - -// For flyout -const std::string XML_FLYOUTMENU_FILE("menu_save_settings.xml"); -// From menu_save_settings.xml, consider moving into flyout since it should be supported by flyout either way -const std::string ACTION_SAVE("save_settings"); -const std::string ACTION_SAVEAS("save_as_new_settings"); -const std::string ACTION_APPLY_LOCAL("apply_local"); -const std::string ACTION_APPLY_PARCEL("apply_parcel"); -const std::string ACTION_APPLY_REGION("apply_region"); - -const F32 DAY_CYCLE_PLAY_TIME_SECONDS = 60; - - //========================================================================= -// **RIDER** +namespace { + const std::string track_tabs[] = { + "water_track", + "sky1_track", + "sky2_track", + "sky3_track", + "sky4_track", + }; + + // For flyout + const std::string XML_FLYOUTMENU_FILE("menu_save_settings.xml"); + // From menu_save_settings.xml, consider moving into flyout since it should be supported by flyout either way + const std::string ACTION_SAVE("save_settings"); + const std::string ACTION_SAVEAS("save_as_new_settings"); + const std::string ACTION_APPLY_LOCAL("apply_local"); + const std::string ACTION_APPLY_PARCEL("apply_parcel"); + const std::string ACTION_APPLY_REGION("apply_region"); + + const F32 DAY_CYCLE_PLAY_TIME_SECONDS = 60; + + const F32 FRAME_SLOP_FACTOR = 0.025f; +} +//========================================================================= const std::string LLFloaterEditExtDayCycle::KEY_INVENTORY_ID("inventory_id"); const std::string LLFloaterEditExtDayCycle::KEY_LIVE_ENVIRONMENT("live_environment"); const std::string LLFloaterEditExtDayCycle::KEY_DAY_LENGTH("day_length"); -// **RIDER** - -LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key): +//========================================================================= +LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) : LLFloater(key), mFlyoutControl(NULL), mCancelButton(NULL), @@ -96,15 +97,14 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key): mTimeSlider(NULL), mFramesSlider(NULL), mCurrentTimeLabel(NULL), - // **RIDER** mImportButton(nullptr), mInventoryId(), mInventoryItem(nullptr), mSkyBlender(), mWaterBlender(), mScratchSky(), - mScratchWater() - // **RIDER** + mScratchWater(), + mIsPlaying(false) { mCommitCallbackRegistrar.add("DayCycle.Track", [this](LLUICtrl *ctrl, const LLSD &data) { onTrackSelectionCallback(data); }); @@ -139,17 +139,20 @@ BOOL LLFloaterEditExtDayCycle::postBuild() mFlyoutControl = new LLFlyoutComboBtnCtrl(this, "save_btn", "btn_flyout", XML_FLYOUTMENU_FILE); mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); - mCancelButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnCancel, this)); - mTimeSlider->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onTimeSliderMoved, this)); - mFramesSlider->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onFrameSliderCallback, this)); - mAddFrameButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onAddTrack, this)); - mDeleteFrameButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onRemoveTrack, this)); + mCancelButton->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onBtnCancel(); }); + mTimeSlider->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onTimeSliderMoved(); }); + mAddFrameButton->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onAddTrack(); }); + mDeleteFrameButton->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onRemoveTrack(); }); mImportButton->setCommitCallback([this](LLUICtrl *, const LLSD &){ onButtonImport(); }); - mTimeSlider->addSlider(0); + mFramesSlider->setCommitCallback([this](LLUICtrl *, const LLSD &data) { onFrameSliderCallback(data); }); + mFramesSlider->setDoubleClickCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask){ onFrameSliderDoubleClick(x, y, mask); }); + mFramesSlider->setMouseDownCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask){ onFrameSliderMouseDown(x, y, mask); }); + mFramesSlider->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask){ onFrameSliderMouseUp(x, y, mask); }); + mTimeSlider->addSlider(0); - getChild("sky4_track", true)->setToggleState(true); + //getChild("sky1_track", true)->setToggleState(true); return TRUE; } @@ -159,8 +162,6 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT); LLEnvironment::instance().updateEnvironment(); - // **RIDER** - mEditingEnv = LLEnvironment::ENV_NONE; mEditDay.reset(); if (key.has(KEY_INVENTORY_ID)) @@ -184,10 +185,6 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) mDayLength.value(key[KEY_DAY_LENGTH].asReal()); } - // **RIDER** - - selectTrack(mCurrentTrack); - // time labels mCurrentTimeLabel->setTextArg("[PRCNT]", std::string("0")); const S32 max_elm = 5; @@ -221,6 +218,16 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) } mCurrentTimeLabel->setTextArg("[DSC]", std::string()); } + + const LLEnvironment::altitude_list_t &altitudes = LLEnvironment::instance().getRegionAltitudes(); + + for (S32 idx = 1; idx < 4; ++idx) + { + std::stringstream label; + label << altitudes[idx] << "m"; + getChild(track_tabs[idx + 1], true)->setTextArg("[DSC]", label.str()); + } + } void LLFloaterEditExtDayCycle::onClose(bool app_quitting) @@ -313,49 +320,14 @@ void LLFloaterEditExtDayCycle::onAddTrack() if (mCurrentTrack == LLSettingsDay::TRACK_WATER) { - // **RIDER** // scratch water should always have the current water settings. setting = mScratchWater->buildClone(); -// if (mSliderKeyMap.empty()) -// { -// // No existing points, use defaults -// setting = LLSettingsVOWater::buildDefaultWater(); -// } -// else -// { -// // clone existing element, since we are intentionally dropping slider on time selection, copy from tab panels -// LLView* tab_container = mWaterTabLayoutContainer->getChild("water_tabs"); //can't extract panels directly, since it is in 'tuple' -// LLPanelSettingsWaterMainTab* panel = dynamic_cast(tab_container->getChildView("water_panel")); -// if (panel) -// { -// setting = panel->getWater()->buildClone(); -// } -// } - // **RIDER** mEditDay->setWaterAtKeyframe(std::dynamic_pointer_cast(setting), frame); } else { - // **RIDER** // scratch sky should always have the current sky settings. setting = mScratchSky->buildClone(); -// if (mSliderKeyMap.empty()) -// { -// // No existing points, use defaults -// setting = LLSettingsVOSky::buildDefaultSky(); -// } -// else -// { -// // clone existing element, since we are intentionally dropping slider on time selection, copy from tab panels -// LLView* tab_container = mSkyTabLayoutContainer->getChild("sky_tabs"); //can't extract panels directly, since they are in 'tuple' -// -// LLPanelSettingsSky* panel = dynamic_cast(tab_container->getChildView("atmosphere_panel")); -// if (panel) -// { -// setting = panel->getSky()->buildClone(); -// } -// } - // **RIDER** mEditDay->setSkyAtKeyframe(std::dynamic_pointer_cast(setting), frame, mCurrentTrack); } @@ -413,77 +385,132 @@ void LLFloaterEditExtDayCycle::onPlayActionCallback(const LLSD& user_data) } } -void LLFloaterEditExtDayCycle::onFrameSliderCallback() +void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data) { - if (mSliderKeyMap.size() == 0) + //LL_WARNS("LAPRAS") << "LLFloaterEditExtDayCycle::onFrameSliderCallback(" << data << ")" << LL_ENDL; + + std::string curslider = mFramesSlider->getCurSlider(); + + LL_WARNS("LAPRAS") << "Current slider set to \"" << curslider << "\"" << LL_ENDL; + F32 sliderpos(0.0); + + if (curslider.empty()) { - mLastFrameSlider.clear(); - return; + S32 x(0), y(0); + LLUI::getMousePositionLocal(mFramesSlider, &x, &y); + + sliderpos = mFramesSlider->getSliderValueFromX(x); } - // make sure we have a slider - const std::string& cur_sldr = mFramesSlider->getCurSlider(); - if (cur_sldr.empty()) + else { - mLastFrameSlider.clear(); - return; + sliderpos = mFramesSlider->getCurSliderValue(); } - F32 new_frame = mFramesSlider->getCurSliderValue(); - // todo: add safety 2.5% checks - keymap_t::iterator iter = mSliderKeyMap.find(cur_sldr); - if (iter != mSliderKeyMap.end() && mEditDay->getSettingsAtKeyframe(new_frame, mCurrentTrack).get() == NULL) + mTimeSlider->setCurSliderValue(sliderpos); +// if (mSliderKeyMap.size() == 0) +// { +// mLastFrameSlider.clear(); +// return; +// } +// // make sure we have a slider +// const std::string& cur_sldr = mFramesSlider->getCurSlider(); +// if (cur_sldr.empty()) +// { +// mLastFrameSlider.clear(); +// return; +// } +// +// F32 new_frame = mFramesSlider->getCurSliderValue(); +// // todo: add safety 2.5% checks +// keymap_t::iterator iter = mSliderKeyMap.find(cur_sldr); +// if (iter != mSliderKeyMap.end() && mEditDay->getSettingsAtKeyframe(new_frame, mCurrentTrack).get() == NULL) +// { +// if (gKeyboard->currentMask(TRUE) == MASK_SHIFT) +// { +// LL_DEBUGS() << "Copying frame from " << iter->second.mFrame << " to " << new_frame << LL_ENDL; +// LLSettingsBase::ptr_t new_settings; +// +// // mEditDay still remembers old position, add copy at new position +// if (mCurrentTrack == LLSettingsDay::TRACK_WATER) +// { +// LLSettingsWaterPtr_t water_ptr = std::dynamic_pointer_cast(iter->second.pSettings)->buildClone(); +// mEditDay->setWaterAtKeyframe(water_ptr, new_frame); +// new_settings = water_ptr; +// } +// else +// { +// LLSettingsSkyPtr_t sky_ptr = std::dynamic_pointer_cast(iter->second.pSettings)->buildClone(); +// mEditDay->setSkyAtKeyframe(sky_ptr, new_frame, mCurrentTrack); +// new_settings = sky_ptr; +// } +// +// // mSliderKeyMap still remembers old position, for simplicity, just move it to be identical to slider +// F32 old_frame = iter->second.mFrame; +// iter->second.mFrame = new_frame; +// // slider already moved old frame, create new one in old place +// addSliderFrame(old_frame, new_settings, false /*because we are going to reselect new one*/); +// // reselect new frame +// mFramesSlider->setCurSlider(iter->first); +// } +// else +// { +// LL_DEBUGS() << "Moving frame from " << iter->second.mFrame << " to " << new_frame << LL_ENDL; +// if (mEditDay->moveTrackKeyframe(mCurrentTrack, iter->second.mFrame, new_frame)) +// { +// iter->second.mFrame = new_frame; +// } +// } +// } +// +// mTimeSlider->setCurSliderValue(new_frame); +// +// if (mLastFrameSlider != cur_sldr) +// { +// // technically should not be possible for both frame and slider to change +// // but for safety, assume that they can change independently and both +// mLastFrameSlider = cur_sldr; +// updateTabs(); +// } +// else +// { +// updateButtons(); +// updateTimeAndLabel(); +// } +} + +void LLFloaterEditExtDayCycle::onFrameSliderDoubleClick(S32 x, S32 y, MASK mask) +{ + onAddTrack(); +} + +void LLFloaterEditExtDayCycle::onFrameSliderMouseDown(S32 x, S32 y, MASK mask) +{ + stopPlay(); + F32 sliderpos = mFramesSlider->getSliderValueFromX(x); + + std::string slidername = mFramesSlider->getCurSlider(); + + if (!slidername.empty()) { - if (gKeyboard->currentMask(TRUE) == MASK_SHIFT) - { - LL_DEBUGS() << "Copying frame from " << iter->second.mFrame << " to " << new_frame << LL_ENDL; - LLSettingsBase::ptr_t new_settings; - - // mEditDay still remembers old position, add copy at new position - if (mCurrentTrack == LLSettingsDay::TRACK_WATER) - { - LLSettingsWaterPtr_t water_ptr = std::dynamic_pointer_cast(iter->second.pSettings)->buildClone(); - mEditDay->setWaterAtKeyframe(water_ptr, new_frame); - new_settings = water_ptr; - } - else - { - LLSettingsSkyPtr_t sky_ptr = std::dynamic_pointer_cast(iter->second.pSettings)->buildClone(); - mEditDay->setSkyAtKeyframe(sky_ptr, new_frame, mCurrentTrack); - new_settings = sky_ptr; - } - - // mSliderKeyMap still remembers old position, for simplicity, just move it to be identical to slider - F32 old_frame = iter->second.mFrame; - iter->second.mFrame = new_frame; - // slider already moved old frame, create new one in old place - addSliderFrame(old_frame, new_settings, false /*because we are going to reselect new one*/); - // reselect new frame - mFramesSlider->setCurSlider(iter->first); - } - else + F32 sliderval = mFramesSlider->getSliderValue(slidername); + + LL_WARNS("LAPRAS") << "Selected vs mouse delta = " << (sliderval - sliderpos) << LL_ENDL; + + if (fabs(sliderval - sliderpos) > FRAME_SLOP_FACTOR) { - LL_DEBUGS() << "Moving frame from " << iter->second.mFrame << " to " << new_frame << LL_ENDL; - if (mEditDay->moveTrackKeyframe(mCurrentTrack, iter->second.mFrame, new_frame)) - { - iter->second.mFrame = new_frame; - } + mFramesSlider->resetCurSlider(); } } + LL_WARNS("LAPRAS") << "DOWN: X=" << x << " Y=" << y << " MASK=" << mask << " Position=" << sliderpos << LL_ENDL; +} - mTimeSlider->setCurSliderValue(new_frame); +void LLFloaterEditExtDayCycle::onFrameSliderMouseUp(S32 x, S32 y, MASK mask) +{ + F32 sliderpos = mFramesSlider->getSliderValueFromX(x); - if (mLastFrameSlider != cur_sldr) - { - // technically should not be possible for both frame and slider to change - // but for safety, assume that they can change independently and both - mLastFrameSlider = cur_sldr; - updateTabs(); - } - else - { - updateButtons(); - updateTimeAndLabel(); - } + LL_WARNS("LAPRAS") << " UP: X=" << x << " Y=" << y << " MASK=" << mask << " Position=" << sliderpos << LL_ENDL; + mTimeSlider->setCurSliderValue(sliderpos); + selectFrame(sliderpos); } void LLFloaterEditExtDayCycle::onTimeSliderMoved() @@ -491,23 +518,21 @@ void LLFloaterEditExtDayCycle::onTimeSliderMoved() selectFrame(mTimeSlider->getCurSliderValue()); } -void LLFloaterEditExtDayCycle::selectTrack(U32 track_index) +void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force ) { mCurrentTrack = track_index; LLButton* button = getChild(track_tabs[track_index], true); - if (button->getToggleState()) + if (button->getToggleState() && !force) { return; } for (int i = 0; i < LLSettingsDay::TRACK_MAX; i++) // use max value { - getChild(track_tabs[i], true)->setToggleState(false); + getChild(track_tabs[i], true)->setToggleState(i == track_index); } - button->setToggleState(true); - - bool show_water = mCurrentTrack == LLSettingsDay::TRACK_WATER; + bool show_water = (mCurrentTrack == LLSettingsDay::TRACK_WATER); mSkyTabLayoutContainer->setVisible(!show_water); mWaterTabLayoutContainer->setVisible(show_water); updateSlider(); @@ -517,20 +542,21 @@ void LLFloaterEditExtDayCycle::selectFrame(F32 frame) { mFramesSlider->resetCurSlider(); - mTimeSlider->setCurSliderValue(frame); keymap_t::iterator iter = mSliderKeyMap.begin(); keymap_t::iterator end_iter = mSliderKeyMap.end(); while (iter != end_iter) { - if (iter->second.mFrame == frame) + if (fabs(iter->second.mFrame - frame) <= FRAME_SLOP_FACTOR) { mFramesSlider->setCurSlider(iter->first); + frame = iter->second.mFrame; break; } iter++; } + mTimeSlider->setCurSliderValue(frame); // block or update tabs according to new selection updateTabs(); } @@ -554,24 +580,6 @@ void LLFloaterEditExtDayCycle::clearTabs() void LLFloaterEditExtDayCycle::updateTabs() { -// std::string sldr = mFramesSlider->getCurSlider(); -// if (sldr.empty()) -// { -// // keep old settings for duplicating if there are any -// setWaterTabsEnabled(FALSE); -// setSkyTabsEnabled(FALSE); -// } -// else if (mCurrentTrack == LLSettingsDay::TRACK_WATER) -// { -// const LLSettingsWaterPtr_t p_water = sldr.empty() ? LLSettingsWaterPtr_t(NULL) : mEditDay->getWaterAtKeyframe(mFramesSlider->getCurSliderValue()); -// updateWaterTabs(p_water); -// } -// else -// { -// const LLSettingsSkyPtr_t p_sky = sldr.empty() ? LLSettingsSkyPtr_t(NULL) : mEditDay->getSkyAtKeyframe(mFramesSlider->getCurSliderValue(), mCurrentTrack); -// updateSkyTabs(p_sky); -// } - reblendSettings(); syncronizeTabs(); @@ -658,6 +666,7 @@ void LLFloaterEditExtDayCycle::updateButtons() void LLFloaterEditExtDayCycle::updateSlider() { + F32 frame_position = mTimeSlider->getCurSliderValue(); mFramesSlider->clear(); mSliderKeyMap.clear(); @@ -671,7 +680,6 @@ void LLFloaterEditExtDayCycle::updateSlider() { // update positions mLastFrameSlider = mFramesSlider->getCurSlider(); - mTimeSlider->setCurSliderValue(mFramesSlider->getCurSliderValue()); updateTabs(); } else @@ -680,6 +688,8 @@ void LLFloaterEditExtDayCycle::updateSlider() clearTabs(); mLastFrameSlider.clear(); } + + selectFrame(frame_position); } void LLFloaterEditExtDayCycle::updateTimeAndLabel() @@ -749,11 +759,11 @@ LLFloaterEditExtDayCycle::connection_t LLFloaterEditExtDayCycle::setEditCommitSi return mCommitSignal.connect(cb); } -// **RIDER** void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId) { if (inventoryId.isNull()) { + LL_WARNS("SETTINGS") << "Attempt to load NULL inventory ID" << LL_ENDL; mInventoryItem = nullptr; mInventoryId.setNull(); return; @@ -771,6 +781,14 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId) return; } + if (mInventoryItem->getAssetUUID().isNull()) + { + LL_WARNS("SETTINGS") << "Asset ID in inventory item is NULL (" << mInventoryId << ")" << LL_ENDL; + mInventoryId.setNull(); + mInventoryItem = nullptr; + return; + } + LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), [this](LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status, LLExtStat) { onAssetLoaded(asset_id, settins, status); }); } @@ -810,10 +828,13 @@ void LLFloaterEditExtDayCycle::loadLiveEnvironment(LLEnvironment::EnvSelection_t void LLFloaterEditExtDayCycle::updateEditEnvironment(void) { + S32 skytrack = (mCurrentTrack) ? mCurrentTrack : 1; mSkyBlender = std::make_shared(mScratchSky, mEditDay, skytrack); mWaterBlender = std::make_shared(mScratchWater, mEditDay, LLSettingsDay::TRACK_WATER); + selectTrack(1, true); + reblendSettings(); LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mScratchSky, mScratchWater); @@ -978,7 +999,8 @@ void LLFloaterEditExtDayCycle::doImportFromDisk() } mEditDay = legacyday; - + mCurrentTrack = 1; + updateSlider(); updateEditEnvironment(); syncronizeTabs(); refresh(); @@ -1012,10 +1034,10 @@ bool LLFloaterEditExtDayCycle::canApplyParcel() const LLEnvironment::instance().isExtendedEnvironmentEnabled(); } -// **RIDER** - void LLFloaterEditExtDayCycle::startPlay() { + mIsPlaying = true; + mFramesSlider->resetCurSlider(); mPlayTimer.reset(); mPlayTimer.start(); gIdleCallbacks.addFunction(onIdlePlay, this); @@ -1027,8 +1049,14 @@ void LLFloaterEditExtDayCycle::startPlay() void LLFloaterEditExtDayCycle::stopPlay() { + if (!mIsPlaying) + return; + + mIsPlaying = false; gIdleCallbacks.deleteFunction(onIdlePlay, this); mPlayTimer.stop(); + F32 frame = mTimeSlider->getCurSliderValue(); + selectFrame(frame); getChild("play_layout", true)->setVisible(TRUE); getChild("pause_layout", true)->setVisible(FALSE); diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index f2462ee1cc..bee5e17b95 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -91,9 +91,12 @@ private: // time slider moved void onTimeSliderMoved(); // a frame moved or frame selection changed - void onFrameSliderCallback(); + void onFrameSliderCallback(const LLSD &); + void onFrameSliderDoubleClick(S32 x, S32 y, MASK mask); + void onFrameSliderMouseDown(S32 x, S32 y, MASK mask); + void onFrameSliderMouseUp(S32 x, S32 y, MASK mask); - void selectTrack(U32 track_index); + void selectTrack(U32 track_index, bool force = false); void selectFrame(F32 frame); void clearTabs(); void updateTabs(); @@ -139,10 +142,10 @@ private: U32 mCurrentTrack; std::string mLastFrameSlider; - LLButton* mCancelButton; - LLButton* mAddFrameButton; - LLButton* mDeleteFrameButton; - LLButton* mImportButton; + LLButton* mCancelButton; + LLButton* mAddFrameButton; + LLButton* mDeleteFrameButton; + LLButton* mImportButton; LLMultiSliderCtrl* mTimeSlider; LLMultiSliderCtrl* mFramesSlider; @@ -160,10 +163,11 @@ private: LLSettingsWater::ptr_t mScratchWater; // **RIDER** - LLFlyoutComboBtnCtrl * mFlyoutControl; + LLFlyoutComboBtnCtrl * mFlyoutControl; - LLFrameTimer mPlayTimer; - F32 mPlayStartFrame; // an env frame + LLFrameTimer mPlayTimer; + F32 mPlayStartFrame; // an env frame + bool mIsPlaying; edit_commit_signal_t mCommitSignal; diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index ed3c18ef4e..1ac607cd1f 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -240,7 +240,7 @@ void LLSettingsVOBase::onAssetDownloadComplete(LLVFS *vfs, const LLUUID &asset_i } else { - LL_WARNS("SETTINGS") << "Error retrieving asset asset_id. Status code=" << status << " ext_status=" << ext_status << LL_ENDL; + LL_WARNS("SETTINGS") << "Error retrieving asset asset_id. Status code=" << status << "(" << LLAssetStorage::getErrorString(status) << ") ext_status=" << ext_status << LL_ENDL; } callback(asset_id, settings, status, ext_status); } diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml index 1b07d1aa27..86c580f354 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml @@ -121,7 +121,7 @@ - + + follows="left|top" + height="15" + layout="topleft" + left="10" + name="p0" + top_pad="5" + value="0%[DSC]" + width="80" /> + follows="left|top|right" + height="15" + layout="topleft" + left_pad="39" + name="p1" + top_delta="0" + value="25%[DSC]" + width="80" /> + follows="left|top|right" + height="15" + layout="topleft" + left_pad="39" + name="p2" + top_delta="0" + value="50%[DSC]" + width="80" /> + follows="left|top|right" + height="15" + layout="topleft" + left_pad="39" + name="p3" + top_delta="0" + value="75%[DSC]" + width="80" /> + follows="left|top|right" + height="15" + layout="topleft" + left_pad="39" + name="p4" + top_delta="0" + value="100%[DSC]" + width="80" /> + decimal_digits="0" + draw_track="false" + follows="bottom" + height="10" + increment="0.01" + initial_value="0" + layout="topleft" + left="10" + max_sliders="1" + max_val="1" + name="WLTimeSlider" + show_text="false" + top_pad="0" + use_triangle="true" + width="525" /> + decimal_digits="0" + follows="bottom" + height="10" + increment="0.01" + initial_value="0" + layout="topleft" + left="10" + max_sliders="20" + max_val="1" + name="WLDayCycleFrames" + show_text="false" + top_pad="15" + width="525" /> + follows="left|bottom" + height="20" + layout="topleft" + left_pad="0" + name="current_time" + value="[PRCNT]%[DSC]" + top_delta="-5" + width="70" /> + name="progress_control" + follows="top|left" + height="25" + width="83" + layout="topleft" + animate="false" + left="225" + top_pad="40" + orientation="horizontal"> + name="skip_back" + mouse_opaque="false" + auto_resize="false" + layout="topleft" + top="0" + height="25" + min_width="25" + width="25"> + name="play_layout" + mouse_opaque="false" + auto_resize="false" + layout="topleft" + top="0" + height="25" + min_width="25" + width="25"> + name="pause_layout" + mouse_opaque="false" + auto_resize="false" + layout="topleft" + top="0" + height="25" + min_width="25" + width="25" + visible="false"> + name="skip_forward" + mouse_opaque="false" + auto_resize="false" + layout="topleft" + top="0" + height="25" + min_width="25" + width="25"> - - - - - - - - - - - - - - - - - - - - - + background_visible="false"> + + + - - - - - - - - - - - + + + + + + + + + + - + follows="top|left" + height="23" + width="90" + label="Clone From" + left="10" + top_pad="10" + name="copy_track" /> + - + width="83" + layout="topleft" + animate="false" + left="31" + top="40" + orientation="horizontal"> + + + + + + + + + + + + + + + + + + user_resize="false" + width="190" + height="150" + min_height="0" + visible="true"> - - + follows="top|right" + height="23" + width="90" + right="-10" + top_pad="10" + label="Add [FRAME]" + name="add_frame" /> + follows="top|left" + height="23" + width="90" + label="Load [FRAME]" + top_pad="0" + left_delta="0" + name="btn_load_frame" /> + + diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp index d7e87ed52e..a1005c654c 100644 --- a/indra/newview/tests/llsecapi_test.cpp +++ b/indra/newview/tests/llsecapi_test.cpp @@ -60,12 +60,21 @@ LLPointer LLSecAPIBasicHandler::getCertificate(X509* openssl_cert LLPointer LLSecAPIBasicHandler::getCertificateChain(const X509_STORE_CTX* chain) { return NULL; } LLPointer LLSecAPIBasicHandler::getCertificateStore(const std::string& store_id) { return NULL; } void LLSecAPIBasicHandler::setProtectedData(const std::string& data_type, const std::string& data_id, const LLSD& data) {} +void LLSecAPIBasicHandler::addToProtectedMap(const std::string& data_type, const std::string& data_id, const std::string& map_elem, const LLSD& data) {} +void LLSecAPIBasicHandler::removeFromProtectedMap(const std::string& data_type, const std::string& data_id, const std::string& map_elem) {} LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type, const std::string& data_id) { return LLSD(); } void LLSecAPIBasicHandler::deleteProtectedData(const std::string& data_type, const std::string& data_id) {} LLPointer LLSecAPIBasicHandler::createCredential(const std::string& grid, const LLSD& identifier, const LLSD& authenticator) { return NULL; } LLPointer LLSecAPIBasicHandler::loadCredential(const std::string& grid) { return NULL; } void LLSecAPIBasicHandler::saveCredential(LLPointer cred, bool save_authenticator) {} void LLSecAPIBasicHandler::deleteCredential(LLPointer cred) {} +bool LLSecAPIBasicHandler::hasCredentialMap(const std::string& storage, const std::string& grid) { return false; } +void LLSecAPIBasicHandler::loadCredentialMap(const std::string& storage, const std::string& grid, credential_map_t& credential_map) {} +LLPointer LLSecAPIBasicHandler::loadFromCredentialMap(const std::string& storage, const std::string& grid, const std::string& userkey) { return NULL; } +void LLSecAPIBasicHandler::addToCredentialMap(const std::string& storage, LLPointer cred, bool save_authenticator) {} +void LLSecAPIBasicHandler::removeFromCredentialMap(const std::string& storage, LLPointer cred) {} +void LLSecAPIBasicHandler::removeFromCredentialMap(const std::string& storage, const std::string& grid, const std::string& userkey) {} +void LLSecAPIBasicHandler::removeCredentialMap(const std::string& storage, const std::string& grid) {} // ------------------------------------------------------------------------------------------- // TUT -- cgit v1.2.3 From 41c7523e08aab7f2bf4a040ac1c1c8a1d24babed Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 12 Aug 2019 13:44:59 -0700 Subject: SL-11676 Make sun/moon textures render on Low/Low-Mid again. Fix solar additive being present when moon was only heavenly body in sky. --- indra/newview/lldrawpoolsky.cpp | 55 +++++++++++++++++++++------------- indra/newview/lldrawpoolsky.h | 2 +- indra/newview/lllegacyatmospherics.cpp | 2 +- indra/newview/llvosky.cpp | 22 ++++++++------ indra/newview/llvosky.h | 7 ++--- 5 files changed, 52 insertions(+), 36 deletions(-) (limited to 'indra') diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp index 12614b5e2d..dbe8724088 100644 --- a/indra/newview/lldrawpoolsky.cpp +++ b/indra/newview/lldrawpoolsky.cpp @@ -111,37 +111,52 @@ void LLDrawPoolSky::render(S32 pass) LLVertexBuffer::unbind(); gGL.diffuseColor4f(1,1,1,1); - for (S32 i = 0; i < llmin(6, face_count); ++i) + for (S32 i = 0; i < face_count; ++i) { - renderSkyCubeFace(i); + renderSkyFace(i); } gGL.popMatrix(); } -void LLDrawPoolSky::renderSkyCubeFace(U8 side) +void LLDrawPoolSky::renderSkyFace(U8 index) { - LLFace &face = *mDrawFace[LLVOSky::FACE_SIDE0 + side]; - if (!face.getGeomCount()) + LLFace* face = mDrawFace[index]; + + if (!face || !face->getGeomCount()) { return; } - llassert(mSkyTex); - mSkyTex[side].bindTexture(TRUE); - - gGL.getTexUnit(0)->setTextureColorSpace(LLTexUnit::TCS_SRGB); - - face.renderIndexed(); - - if (LLSkyTex::doInterpolate()) - { - - LLGLEnable blend(GL_BLEND); - mSkyTex[side].bindTexture(FALSE); - gGL.diffuseColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled - face.renderIndexed(); - } + F32 interp_val = gSky.mVOSkyp ? gSky.mVOSkyp->getInterpVal() : 0.0f; + + if (index < 6) // sky tex...interp + { + llassert(mSkyTex); + mSkyTex[index].bindTexture(true); // bind the current tex + + face->renderIndexed(); + + if (interp_val > 0.01f) // iff, we've got enough info to lerp (a to and a from) + { + LLGLEnable blend(GL_BLEND); + llassert(mSkyTex); + mSkyTex[index].bindTexture(false); // bind the "other" texture + gGL.diffuseColor4f(1, 1, 1, interp_val); // lighting is disabled + face->renderIndexed(); + } + } + else // heavenly body faces, no interp... + { + LLGLEnable blend(GL_BLEND); + + LLViewerTexture* tex = face->getTexture(LLRender::DIFFUSE_MAP); + if (tex) + { + gGL.getTexUnit(0)->bind(tex, true); + face->renderIndexed(); + } + } } void LLDrawPoolSky::endRenderPass( S32 pass ) diff --git a/indra/newview/lldrawpoolsky.h b/indra/newview/lldrawpoolsky.h index 098bd2134a..916d8c1cbe 100644 --- a/indra/newview/lldrawpoolsky.h +++ b/indra/newview/lldrawpoolsky.h @@ -61,7 +61,7 @@ public: /*virtual*/ void endRenderPass(S32 pass); void setSkyTex(LLSkyTex* const st) { mSkyTex = st; } - void renderSkyCubeFace(U8 side); + void renderSkyFace(U8 index); void renderHeavenlyBody(U8 hb, LLFace* face); void renderSunHalo(LLFace* face); diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index 1660a1897e..720c7e2388 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -442,7 +442,7 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) vars.density_multiplier = psky->getDensityMultiplier(); vars.distance_multiplier = psky->getDistanceMultiplier(); vars.max_y = psky->getMaxY(); - vars.sun_norm = LLEnvironment::instance().getLightDirectionCFR(); + vars.sun_norm = LLEnvironment::instance().getSunDirectionCFR(); vars.sunlight = psky->getSunlightColor(); vars.ambient = psky->getAmbientColor(); vars.glow = psky->getGlow(); diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index ad452659c6..8d5c0f04cd 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -90,7 +90,6 @@ namespace S32 LLSkyTex::sComponents = 4; S32 LLSkyTex::sResolution = 64; -F32 LLSkyTex::sInterpVal = 0.f; S32 LLSkyTex::sCurrent = 0; @@ -479,7 +478,7 @@ void LLVOSky::init() m_atmosphericsVars.haze_horizon = psky->getHazeHorizon(); m_atmosphericsVars.density_multiplier = psky->getDensityMultiplier(); m_atmosphericsVars.max_y = psky->getMaxY(); - m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedLightNorm(); + m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedSunNorm(); m_atmosphericsVars.sunlight = psky->getSunlightColor(); m_atmosphericsVars.ambient = psky->getAmbientColor(); m_atmosphericsVars.glow = psky->getGlow(); @@ -531,7 +530,7 @@ void LLVOSky::calc() m_atmosphericsVars.density_multiplier = psky->getDensityMultiplier(); m_atmosphericsVars.distance_multiplier = psky->getDistanceMultiplier(); m_atmosphericsVars.max_y = psky->getMaxY(); - m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedLightNorm(); + m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedSunNorm(); m_atmosphericsVars.sunlight = psky->getSunlightColor(); m_atmosphericsVars.ambient = psky->getAmbientColor(); m_atmosphericsVars.glow = psky->getGlow(); @@ -725,8 +724,6 @@ bool LLVOSky::updateSky() next_frame = next_frame % cycle_frame_no; mInterpVal = (!mInitialized) ? 1 : (F32)next_frame / cycle_frame_no; - // sInterpVal = (F32)next_frame / cycle_frame_no; - LLSkyTex::setInterpVal( mInterpVal ); LLHeavenBody::setInterpVal( mInterpVal ); updateDirections(); @@ -912,6 +909,8 @@ void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_textur mSunTexturep[0] = sun_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); mSunTexturep[1] = sun_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + bool can_use_wl = gPipeline.canUseWindLightShaders(); + if (mFace[FACE_SUN]) { if (mSunTexturep[0]) @@ -934,11 +933,14 @@ void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_textur mFace[FACE_SUN]->setTexture(LLRender::DIFFUSE_MAP, mSunTexturep[0]); - if (mSunTexturep[1]) + if (can_use_wl) { - mSunTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP); + if (mSunTexturep[1]) + { + mSunTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP); + } + mFace[FACE_SUN]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mSunTexturep[1]); } - mFace[FACE_SUN]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mSunTexturep[1]); } } @@ -946,6 +948,8 @@ void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_tex { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + bool can_use_wl = gPipeline.canUseWindLightShaders(); + mMoonTexturep[0] = moon_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); mMoonTexturep[1] = moon_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); @@ -957,7 +961,7 @@ void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_tex } mFace[FACE_MOON]->setTexture(LLRender::DIFFUSE_MAP, mMoonTexturep[0]); - if (mMoonTexturep[1]) + if (mMoonTexturep[1] && can_use_wl) { mMoonTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP); mFace[FACE_MOON]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mMoonTexturep[1]); diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index 8c2817e1ed..5f27085599 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -57,13 +57,8 @@ private: LLColor4 *mSkyData; LLVector3 *mSkyDirs; // Cache of sky direction vectors static S32 sCurrent; - static F32 sInterpVal; public: - static F32 getInterpVal() { return sInterpVal; } - static void setInterpVal(const F32 v) { sInterpVal = v; } - static BOOL doInterpolate() { return sInterpVal > 0.001f; } - void bindTexture(BOOL curr = TRUE); protected: @@ -299,6 +294,8 @@ public: LLFace *mFace[FACE_COUNT]; LLVector3 mBumpSunDir; + F32 getInterpVal() const { return mInterpVal; } + protected: ~LLVOSky(); -- cgit v1.2.3 From 5937a4222473131d0cec4238fc234646e9aba91e Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 12 Aug 2019 14:25:35 -0700 Subject: SL-10566, SL-10677 Make sky updates only occur if the input atmospherics values have actually changed (perf optimization). Make water rendering use specular color for coloring spec. --- indra/newview/lldrawpoolwater.cpp | 3 + indra/newview/lllegacyatmospherics.h | 111 +++++++++++++++++++++++++++++++++++ indra/newview/llvosky.cpp | 10 +++- 3 files changed, 121 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 1b5c154378..13420fc001 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -500,6 +500,9 @@ void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& li } } + LLColor4 specular(psky->getIsSunUp() ? psky->getSunlightColor() : psky->getMoonlightColor()); + shader->uniform4fv(LLShaderMgr::SPECULAR_COLOR, 1, specular.mV); + sTime = (F32)LLFrameTimer::getElapsedSeconds() * 0.5f; S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX); diff --git a/indra/newview/lllegacyatmospherics.h b/indra/newview/lllegacyatmospherics.h index e304ac3043..95700227f9 100644 --- a/indra/newview/lllegacyatmospherics.h +++ b/indra/newview/lllegacyatmospherics.h @@ -206,6 +206,8 @@ public: { } + LL_FORCE_INLINE friend bool operator==(const AtmosphericsVars& a, const AtmosphericsVars& b); + LLColor3 hazeColor; LLColor3 hazeColorBelowCloud; LLColor3 cloudColorSun; @@ -231,6 +233,115 @@ public: LLColor3 total_density; }; +bool operator==(const AtmosphericsVars& a, const AtmosphericsVars& b) +{ + if (a.hazeColor != b.hazeColor) + { + return false; + } + + if (a.hazeColorBelowCloud != b.hazeColorBelowCloud) + { + return false; + } + + if (a.cloudColorSun != b.cloudColorSun) + { + return false; + } + + if (a.cloudColorAmbient != b.cloudColorAmbient) + { + return false; + } + + if (a.cloudDensity != b.cloudDensity) + { + return false; + } + + if (a.density_multiplier != b.density_multiplier) + { + return false; + } + + if (a.haze_horizon != b.haze_horizon) + { + return false; + } + + if (a.haze_density != b.haze_density) + { + return false; + } + + if (a.blue_horizon != b.blue_horizon) + { + return false; + } + + if (a.blue_density != b.blue_density) + { + return false; + } + + if (a.dome_offset != b.dome_offset) + { + return false; + } + + if (a.dome_radius != b.dome_radius) + { + return false; + } + + if (a.cloud_shadow != b.cloud_shadow) + { + return false; + } + + if (a.glow != b.glow) + { + return false; + } + + if (a.ambient != b.ambient) + { + return false; + } + + if (a.sunlight != b.sunlight) + { + return false; + } + + if (a.sun_norm != b.sun_norm) + { + return false; + } + + if (a.gamma != b.gamma) + { + return false; + } + + if (a.max_y != b.max_y) + { + return false; + } + + if (a.distance_multiplier != b.distance_multiplier) + { + return false; + } + + // light_atten, light_transmittance, total_density + // are ignored as they always change when the values above do + // they're just shared calc across the sky map generation to save cycles + + return true; +} + class LLAtmospherics { public: diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 8d5c0f04cd..78c782eb5f 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -479,7 +479,7 @@ void LLVOSky::init() m_atmosphericsVars.density_multiplier = psky->getDensityMultiplier(); m_atmosphericsVars.max_y = psky->getMaxY(); m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedSunNorm(); - m_atmosphericsVars.sunlight = psky->getSunlightColor(); + m_atmosphericsVars.sunlight = psky->getIsSunUp() ? psky->getSunlightColor() : psky->getMoonlightColor(); m_atmosphericsVars.ambient = psky->getAmbientColor(); m_atmosphericsVars.glow = psky->getGlow(); m_atmosphericsVars.cloud_shadow = psky->getCloudShadow(); @@ -531,7 +531,7 @@ void LLVOSky::calc() m_atmosphericsVars.distance_multiplier = psky->getDistanceMultiplier(); m_atmosphericsVars.max_y = psky->getMaxY(); m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedSunNorm(); - m_atmosphericsVars.sunlight = psky->getSunlightColor(); + m_atmosphericsVars.sunlight = psky->getIsSunUp() ? psky->getSunlightColor() : psky->getMoonlightColor(); m_atmosphericsVars.ambient = psky->getAmbientColor(); m_atmosphericsVars.glow = psky->getGlow(); m_atmosphericsVars.cloud_shadow = psky->getCloudShadow(); @@ -750,7 +750,9 @@ bool LLVOSky::updateSky() calc(); - if (mForceUpdate && mForceUpdateThrottle.hasExpired()) + bool same_atmospherics = m_lastAtmosphericsVars == m_atmosphericsVars; + + if (mForceUpdate && mForceUpdateThrottle.hasExpired() && !same_atmospherics) { LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED); @@ -758,6 +760,8 @@ bool LLVOSky::updateSky() LLSkyTex::stepCurrent(); + m_lastAtmosphericsVars = m_atmosphericsVars; + if (!direction.isExactlyZero()) { mLastTotalAmbient = total_ambient; -- cgit v1.2.3 From 6fbb35b712d25843d9fe10945a232749a89601c5 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 12 Aug 2019 14:39:24 -0700 Subject: Fix line-endings on new inline file. --- indra/llrender/lluiimage.inl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/llrender/lluiimage.inl b/indra/llrender/lluiimage.inl index 3b23d77d62..f5227556f0 100644 --- a/indra/llrender/lluiimage.inl +++ b/indra/llrender/lluiimage.inl @@ -64,14 +64,14 @@ void LLUIImage::drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& } // returns dimensions of underlying textures, which might not be equal to ui image portion -S32 LLUIImage::getTextureWidth() const -{ - mCachedW = (mCachedW == -1) ? getWidth() : mCachedW; - return mCachedW; -} - -S32 LLUIImage::getTextureHeight() const -{ - mCachedH = (mCachedH == -1) ? getHeight() : mCachedH; - return mCachedH; -} +S32 LLUIImage::getTextureWidth() const +{ + mCachedW = (mCachedW == -1) ? getWidth() : mCachedW; + return mCachedW; +} + +S32 LLUIImage::getTextureHeight() const +{ + mCachedH = (mCachedH == -1) ? getHeight() : mCachedH; + return mCachedH; +} -- cgit v1.2.3 From cd25ae3e083e34acfa659ac78c0ae3fb246ee630 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 13 Aug 2019 12:40:32 +0300 Subject: SL-11707 FIXED [Maint] Incorrect sound length limit referenced. --- indra/newview/skins/default/xui/en/notifications.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 30e8f7cedc..ab80e0fc46 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2180,7 +2180,7 @@ Wrong chunk size in WAV file: icon="alertmodal.tga" name="SoundFileInvalidTooLong" type="alertmodal"> -Audio file is too long (10 second maximum): +Audio file is too long (30 second maximum): [FILE] fail -- cgit v1.2.3 From 4e4011cddc4c6edf797bd3ff7950fb02d178a2e2 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 13 Aug 2019 08:14:14 -0700 Subject: SL-11589 Modify altitude blend factor in cloud shaders to fade more aggressively and fix cloud rendering artifacts when at altitude. --- indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl | 2 +- indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index 20ab0fb171..8e90c1481f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -78,7 +78,7 @@ void main() // Get relative position vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); - altitude_blend_factor = (P.y > -4096.0) ? 1.0 : 1.0 - clamp(abs(P.y) / max_y, 0.0, 1.0); + altitude_blend_factor = clamp((P.y + 512.0) / max_y, 0.0, 1.0); // Set altitude if (P.y > 0.) diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index 18daa5a242..2c1475d547 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -78,7 +78,7 @@ void main() vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); // fade clouds beyond a certain point so the bottom of the sky dome doesn't look silly at high altitude - altitude_blend_factor = (P.y > -4096.0) ? 1.0 : 1.0 - clamp(abs(P.y) / max_y, 0.0, 1.0); + altitude_blend_factor = clamp((P.y + 512.0) / max_y, 0.0, 1.0); // Set altitude if (P.y > 0.) -- cgit v1.2.3 From fac181b179c60f0ca0fcc6ed3a97e022bbaa51ef Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 13 Aug 2019 08:39:55 -0700 Subject: SL-11212 Calculate sunAngle2 correctly given light dir in new coord space. --- indra/newview/lldrawpoolwater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 13420fc001..073adfb627 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -600,7 +600,7 @@ void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& li shader->uniform1f(LLShaderMgr::WATER_FRESNEL_OFFSET, pwater->getFresnelOffset()); shader->uniform1f(LLShaderMgr::WATER_BLUR_MULTIPLIER, pwater->getBlurMultiplier()); - F32 sunAngle = llmax(0.f, light_dir.mV[2]); + F32 sunAngle = llmax(0.f, light_dir.mV[1]); F32 scaledAngle = 1.f - sunAngle; shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); -- cgit v1.2.3 From b1cab5d24687b07c124e0dcd61485fa9e368c882 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 13 Aug 2019 09:20:37 -0700 Subject: SL-11212 Remove color clamping in determining sun diffuse and moonlight diffuse color from atmo settings. --- indra/llinventory/llsettingssky.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 434270d178..35bd9a2254 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1313,23 +1313,10 @@ void LLSettingsSky::calculateLightSettings() const componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); componentMultBy(sunlight, light_transmittance); - F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); - if (max_color > 1.0f) - { - sunlight *= 1.0f/max_color; - } - //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; componentMultBy(tmpAmbient, light_transmittance); - //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f); - max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]); - if (max_color > 1.0f) - { - tmpAmbient *= 1.0f/max_color; - } - //brightness of surface both sunlight and ambient mSunDiffuse = sunlight; mSunAmbient = tmpAmbient; @@ -1347,7 +1334,6 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - clampColor(moonlight, getGamma(), 1.0f); mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; -- cgit v1.2.3 From 9773e06cc12b432772eda856c5281c749caec988 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 21 Aug 2019 16:22:43 +0300 Subject: SL-11753 FIXED Group & Resident with the same name share chat history. --- indra/newview/llfloaterconversationpreview.cpp | 7 ++++ indra/newview/llfloaterconversationpreview.h | 1 + indra/newview/llimview.cpp | 11 +++++- indra/newview/llimview.h | 1 + indra/newview/lllogchat.cpp | 47 ++++++++++++++++++++++---- indra/newview/lllogchat.h | 3 +- 6 files changed, 61 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp index 66198b3bf6..37186ce3d5 100644 --- a/indra/newview/llfloaterconversationpreview.cpp +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -50,6 +50,7 @@ LLFloaterConversationPreview::LLFloaterConversationPreview(const LLSD& session_i mShowHistory(false), mMessages(NULL), mHistoryThreadsBusy(false), + mIsGroup(false), mOpened(false) { } @@ -75,6 +76,7 @@ BOOL LLFloaterConversationPreview::postBuild() { name = conv->getConversationName(); file = conv->getHistoryFileName(); + mIsGroup = (LLIMModel::LLIMSession::GROUP_SESSION == conv->getConversationType()); } else { @@ -82,6 +84,10 @@ BOOL LLFloaterConversationPreview::postBuild() file = "chat"; } mChatHistoryFileName = file; + if (mIsGroup) + { + mChatHistoryFileName += GROUP_CHAT_SUFFIX; + } LLStringUtil::format_map_t args; args["[NAME]"] = name; std::string title = getString("Title", args); @@ -145,6 +151,7 @@ void LLFloaterConversationPreview::onOpen(const LLSD& key) LLSD load_params; load_params["load_all_history"] = true; load_params["cut_off_todays_date"] = false; + load_params["is_group"] = mIsGroup; // The temporary message list with "Loading..." text // Will be deleted upon loading completion in setPages() method diff --git a/indra/newview/llfloaterconversationpreview.h b/indra/newview/llfloaterconversationpreview.h index a8dbbc9ffe..7ca4ee6945 100644 --- a/indra/newview/llfloaterconversationpreview.h +++ b/indra/newview/llfloaterconversationpreview.h @@ -66,6 +66,7 @@ private: bool mShowHistory; bool mHistoryThreadsBusy; bool mOpened; + bool mIsGroup; }; #endif /* LLFLOATERCONVERSATIONPREVIEW_H_ */ diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 0f5d514660..c07064389b 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -848,7 +848,7 @@ void LLIMModel::LLIMSession::loadHistory() std::list chat_history; //involves parsing of a chat history - LLLogChat::loadChatHistory(mHistoryFileName, chat_history); + LLLogChat::loadChatHistory(mHistoryFileName, chat_history, LLSD(), isGroupChat()); addMessagesFromHistory(chat_history); } } @@ -912,6 +912,11 @@ bool LLIMModel::LLIMSession::isP2P() return IM_NOTHING_SPECIAL == mType; } +bool LLIMModel::LLIMSession::isGroupChat() +{ + return IM_SESSION_GROUP_START == mType || (IM_SESSION_INVITE == mType && gAgent.isInGroup(mSessionID)); +} + bool LLIMModel::LLIMSession::isOtherParticipantAvaline() { return !mOtherParticipantIsAvatar; @@ -969,6 +974,10 @@ void LLIMModel::LLIMSession::buildHistoryFileName() mHistoryFileName = LLCacheName::buildUsername(mName); } } + else if (isGroupChat()) + { + mHistoryFileName = mName + GROUP_CHAT_SUFFIX; + } } //static diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 81d3ffa1a6..344f6d9a83 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -91,6 +91,7 @@ public: bool isOutgoingAdHoc() const; bool isAdHoc(); bool isP2P(); + bool isGroupChat(); bool isOtherParticipantAvaline(); bool isP2PSessionType() const { return mSessionType == P2P_SESSION;} diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 1bdeddbcfe..e2f253d2bd 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -67,6 +67,8 @@ const std::string LL_IM_FROM("from"); const std::string LL_IM_FROM_ID("from_id"); const std::string LL_TRANSCRIPT_FILE_EXTENSION("txt"); +const std::string GROUP_CHAT_SUFFIX(" (group)"); + const static char IM_SYMBOL_SEPARATOR(':'); const static std::string IM_SEPARATOR(std::string() + IM_SYMBOL_SEPARATOR + " "); const static std::string NEW_LINE("\n"); @@ -345,7 +347,7 @@ void LLLogChat::saveHistory(const std::string& filename, } // static -void LLLogChat::loadChatHistory(const std::string& file_name, std::list& messages, const LLSD& load_params) +void LLLogChat::loadChatHistory(const std::string& file_name, std::list& messages, const LLSD& load_params, bool is_group) { if (file_name.empty()) { @@ -358,10 +360,25 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list& m LLFILE* fptr = LLFile::fopen(LLLogChat::makeLogFileName(file_name), "r");/*Flawfinder: ignore*/ if (!fptr) { - fptr = LLFile::fopen(LLLogChat::oldLogFileName(file_name), "r");/*Flawfinder: ignore*/ + if (is_group) + { + std::string old_name(file_name); + old_name.erase(old_name.size() - GROUP_CHAT_SUFFIX.size()); + fptr = LLFile::fopen(LLLogChat::makeLogFileName(old_name), "r"); + if (fptr) + { + fclose(fptr); + LLFile::copy(LLLogChat::makeLogFileName(old_name), LLLogChat::makeLogFileName(file_name)); + } + fptr = LLFile::fopen(LLLogChat::makeLogFileName(file_name), "r"); + } if (!fptr) { - return; //No previous conversation with this name. + fptr = LLFile::fopen(LLLogChat::oldLogFileName(file_name), "r");/*Flawfinder: ignore*/ + if (!fptr) + { + return; //No previous conversation with this name. + } } } @@ -1047,12 +1064,28 @@ void LLLoadHistoryThread::loadHistory(const std::string& file_name, std::list& list); static void getListOfTranscriptBackupFiles(std::vector& list_of_transcriptions); - static void loadChatHistory(const std::string& file_name, std::list& messages, const LLSD& load_params = LLSD()); + static void loadChatHistory(const std::string& file_name, std::list& messages, const LLSD& load_params = LLSD(), bool is_group = false); typedef boost::signals2::signal save_history_signal_t; static boost::signals2::connection setSaveHistorySignal(const save_history_signal_t::slot_type& cb); @@ -192,6 +192,7 @@ protected: virtual ~LLChatLogParser() {}; }; +extern const std::string GROUP_CHAT_SUFFIX; // LLSD map lookup constants extern const std::string LL_IM_TIME; //("time"); -- cgit v1.2.3 From 01e6839f21becca6ade3fe723cebc26a7f10de8e Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 22 Aug 2019 10:11:59 -0700 Subject: SL-11779 Make changing shadow res scale not instantly drop/realloc buffers but wait until display gets to it. --- indra/newview/llviewercontrol.cpp | 11 +++++++++-- indra/newview/llviewerdisplay.cpp | 2 +- indra/newview/pipeline.cpp | 5 +++++ indra/newview/pipeline.h | 1 + 4 files changed, 16 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index a699491e1b..b1d47b7d75 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -190,6 +190,13 @@ bool handleRenderTransparentWaterChanged(const LLSD& newvalue) return true; } + +static bool handleWindowResized(const LLSD& newvalue) +{ + gPipeline.requestResizeScreenTexture(); + return true; +} + static bool handleReleaseGLBufferChanged(const LLSD& newvalue) { if (gPipeline.isInit()) @@ -609,14 +616,14 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); - gSavedSettings.getControl("RenderUIBuffer")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); + gSavedSettings.getControl("RenderUIBuffer")->getSignal()->connect(boost::bind(&handleWindowResized, _2)); gSavedSettings.getControl("RenderDepthOfField")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderSpecularResX")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2)); gSavedSettings.getControl("RenderSpecularResY")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2)); gSavedSettings.getControl("RenderSpecularExponent")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2)); gSavedSettings.getControl("RenderAnisotropic")->getSignal()->connect(boost::bind(&handleAnisotropicChanged, _2)); - gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); + gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleWindowResized, _2)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderGlowResolutionPow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index ddce419f19..0fb687aead 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -249,7 +249,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { LL_RECORD_BLOCK_TIME(FTM_RENDER); - if (gWindowResized) + if (gWindowResized || gResizeScreenTexture) { //skip render on frames where window has been resized LL_RECORD_BLOCK_TIME(FTM_RESIZE_WINDOW); gGL.flush(); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 448b65272b..9b6bf9bfc3 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -735,6 +735,11 @@ void LLPipeline::throttleNewMemoryAllocation(bool disable) } } +void LLPipeline::requestResizeScreenTexture() +{ + gResizeScreenTexture = TRUE; +} + void LLPipeline::resizeScreenTexture() { LL_RECORD_BLOCK_TIME(FTM_RESIZE_SCREEN_TEXTURE); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index cc9ec06f80..44aa9d85fa 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -100,6 +100,7 @@ public: void restoreGL(); void resetVertexBuffers(); void doResetVertexBuffers(bool forced = false); + void requestResizeScreenTexture(); // set flag only, no work, safer for callbacks... void resizeScreenTexture(); void releaseGLBuffers(); void releaseLUTBuffers(); -- cgit v1.2.3 From be74485334267339dee14018aa82f84cc34b0ecb Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 22 Aug 2019 20:33:34 +0300 Subject: SL-11776 Compensate freeze by spreading calculations --- indra/newview/llvosky.cpp | 218 ++++++++++++++++++++++++++-------------------- indra/newview/llvosky.h | 3 +- 2 files changed, 126 insertions(+), 95 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 78c782eb5f..408da88c3f 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -64,6 +64,7 @@ namespace const S32 NUM_TILES_X = 8; const S32 NUM_TILES_Y = 4; const S32 NUM_TILES = NUM_TILES_X * NUM_TILES_Y; + const S32 NUM_CUBEMAP_FACES = 6; // Heavenly body constants const F32 SUN_DISK_RADIUS = 0.5f; @@ -80,6 +81,8 @@ namespace const F32 COLOR_CHANGE_THRESHOLD = 0.01f; LLTrace::BlockTimerStatHandle FTM_VOSKY_UPDATETIMER("VOSky Update Timer Tick"); + LLTrace::BlockTimerStatHandle FTM_VOSKY_CALC("VOSky Update Calculations"); + LLTrace::BlockTimerStatHandle FTM_VOSKY_CREATETEXTURES("VOSky Update Textures"); LLTrace::BlockTimerStatHandle FTM_VOSKY_UPDATEFORCED("VOSky Update Forced"); F32Seconds UPDATE_EXPRY(2.0f); @@ -416,6 +419,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) mCloudDensity(0.2f), mWind(0.f), mForceUpdate(FALSE), + mCubeMapUpdateStage(-1), mWorldScale(1.f), mBumpSunDir(0.f, 0.f, 1.f) { @@ -428,7 +432,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY); mForceUpdateThrottle.reset(); - for (S32 i = 0; i < 6; i++) + for (S32 i = 0; i < NUM_CUBEMAP_FACES; i++) { mSkyTex[i].init(false); mShinyTex[i].init(true); @@ -491,20 +495,16 @@ void LLVOSky::init() m_atmosphericsVars.gamma = psky->getGamma(); // Initialize the cached normalized direction vectors - for (S32 side = 0; side < 6; ++side) + for (S32 side = 0; side < NUM_CUBEMAP_FACES; ++side) { for (S32 tile = 0; tile < NUM_TILES; ++tile) { initSkyTextureDirs(side, tile); createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex); createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, true); - } - } - - for (S32 i = 0; i < 6; ++i) - { - mSkyTex[i].create(1.0f); - mShinyTex[i].create(1.0f); + } + mSkyTex[side].create(1.0f); + mShinyTex[side].create(1.0f); } initCubeMap(); @@ -553,7 +553,7 @@ void LLVOSky::calc() void LLVOSky::initCubeMap() { std::vector > images; - for (S32 side = 0; side < 6; side++) + for (S32 side = 0; side < NUM_CUBEMAP_FACES; side++) { images.push_back(mShinyTex[side].getImageRaw()); } @@ -575,7 +575,7 @@ void LLVOSky::initCubeMap() void LLVOSky::cleanupGL() { S32 i; - for (i = 0; i < 6; i++) + for (i = 0; i < NUM_CUBEMAP_FACES; i++) { mSkyTex[i].cleanupGL(); } @@ -588,7 +588,7 @@ void LLVOSky::cleanupGL() void LLVOSky::restoreGL() { S32 i; - for (i = 0; i < 6; i++) + for (i = 0; i < NUM_CUBEMAP_FACES; i++) { mSkyTex[i].restoreGL(); } @@ -608,7 +608,8 @@ void LLVOSky::restoreGL() initCubeMap(); } - mForceUpdate = TRUE; + mForceUpdate = TRUE; + mCubeMapUpdateStage = -1; if (mDrawable) { @@ -713,7 +714,7 @@ bool LLVOSky::updateSky() } static S32 next_frame = 0; - const S32 total_no_tiles = 6 * NUM_TILES; + const S32 total_no_tiles = NUM_CUBEMAP_FACES * NUM_TILES; const S32 cycle_frame_no = total_no_tiles + 1; const S32 frame = next_frame; @@ -727,112 +728,141 @@ bool LLVOSky::updateSky() LLHeavenBody::setInterpVal( mInterpVal ); updateDirections(); - LLVector3 direction = mSun.getDirection(); - direction.normalize(); - const F32 dot_sun = direction * mLastSunLightingDirection; - const F32 dot_moon = direction * mLastMoonLightingDirection; + if (mCubeMapUpdateStage < 0) + { + LL_RECORD_BLOCK_TIME(FTM_VOSKY_CALC); + calc(); - LLColor3 delta_color; - delta_color.setVec(mLastTotalAmbient.mV[0] - total_ambient.mV[0], - mLastTotalAmbient.mV[1] - total_ambient.mV[1], - mLastTotalAmbient.mV[2] - total_ambient.mV[2]); + LLVector3 direction = mSun.getDirection(); + direction.normalize(); + const F32 dot_sun = direction * mLastSunLightingDirection; + const F32 dot_moon = direction * mLastMoonLightingDirection; - bool sun_direction_changed = (dot_sun < LIGHT_DIRECTION_THRESHOLD); - bool moon_direction_changed = (dot_moon < LIGHT_DIRECTION_THRESHOLD); - bool color_changed = (delta_color.length() >= COLOR_CHANGE_THRESHOLD); + LLColor3 delta_color; + delta_color.setVec(mLastTotalAmbient.mV[0] - total_ambient.mV[0], + mLastTotalAmbient.mV[1] - total_ambient.mV[1], + mLastTotalAmbient.mV[2] - total_ambient.mV[2]); - mForceUpdate = mForceUpdate || sun_direction_changed; - mForceUpdate = mForceUpdate || moon_direction_changed; - mForceUpdate = mForceUpdate || color_changed; - mForceUpdate = mForceUpdate || !mInitialized; + bool sun_direction_changed = (dot_sun < LIGHT_DIRECTION_THRESHOLD); + bool moon_direction_changed = (dot_moon < LIGHT_DIRECTION_THRESHOLD); + bool color_changed = (delta_color.length() >= COLOR_CHANGE_THRESHOLD); - bool is_alm_wl_sky = gPipeline.canUseWindLightShaders(); + mForceUpdate = mForceUpdate || sun_direction_changed; + mForceUpdate = mForceUpdate || moon_direction_changed; + mForceUpdate = mForceUpdate || color_changed; + mForceUpdate = mForceUpdate || !mInitialized; - calc(); + bool same_atmospherics = m_lastAtmosphericsVars == m_atmosphericsVars; - bool same_atmospherics = m_lastAtmosphericsVars == m_atmosphericsVars; + if (mForceUpdate && mForceUpdateThrottle.hasExpired() && !same_atmospherics) + { + // start updating cube map sides + if (mCubeMap && !direction.isExactlyZero()) + { + updateFog(LLViewerCamera::getInstance()->getFar()); - if (mForceUpdate && mForceUpdateThrottle.hasExpired() && !same_atmospherics) - { + mCubeMapUpdateStage = 0; + } + else + { + mCubeMapUpdateStage = NUM_CUBEMAP_FACES; + } + mForceUpdate = FALSE; + } + } + else if (mCubeMapUpdateStage == NUM_CUBEMAP_FACES) + { LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED); + LLSkyTex::stepCurrent(); - mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY); - - LLSkyTex::stepCurrent(); - - m_lastAtmosphericsVars = m_atmosphericsVars; - - if (!direction.isExactlyZero()) - { - mLastTotalAmbient = total_ambient; - mInitialized = TRUE; - - if (mCubeMap) - { - updateFog(LLViewerCamera::getInstance()->getFar()); - - for (int side = 0; side < 6; side++) - { - for (int tile = 0; tile < NUM_TILES; tile++) - { - createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex); - createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, true); - } - } - } - + LLVector3 direction = mSun.getDirection(); + if (!direction.isExactlyZero()) + { + bool is_alm_wl_sky = gPipeline.canUseWindLightShaders(); int tex = mSkyTex[0].getWhich(TRUE); - for (int side = 0; side < 6; side++) - { + for (int side = 0; side < NUM_CUBEMAP_FACES; side++) + { LLImageRaw* raw1 = nullptr; LLImageRaw* raw2 = nullptr; if (!is_alm_wl_sky) { - raw1 = mSkyTex[side].getImageRaw(TRUE); - raw2 = mSkyTex[side].getImageRaw(FALSE); - raw2->copy(raw1); - mSkyTex[side].createGLImage(tex); + raw1 = mSkyTex[side].getImageRaw(TRUE); + raw2 = mSkyTex[side].getImageRaw(FALSE); + raw2->copy(raw1); + mSkyTex[side].createGLImage(tex); } - raw1 = mShinyTex[side].getImageRaw(TRUE); - raw2 = mShinyTex[side].getImageRaw(FALSE); - raw2->copy(raw1); - mShinyTex[side].createGLImage(tex); - } - next_frame = 0; + raw1 = mShinyTex[side].getImageRaw(TRUE); + raw2 = mShinyTex[side].getImageRaw(FALSE); + raw2->copy(raw1); + mShinyTex[side].createGLImage(tex); + } + next_frame = 0; - // update the sky texture + // update the sky texture if (!is_alm_wl_sky) { - for (S32 i = 0; i < 6; ++i) - { + for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i) + { mSkyTex[i].create(1.0f); - } + } } - for (S32 i = 0; i < 6; ++i) - { - mShinyTex[i].create(1.0f); - } + for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i) + { + mShinyTex[i].create(1.0f); + } - // update the environment map - if (mCubeMap) - { - std::vector > images; - images.reserve(6); - for (S32 side = 0; side < 6; side++) - { - images.push_back(mShinyTex[side].getImageRaw(TRUE)); - } - mCubeMap->init(images); - gGL.getTexUnit(0)->disable(); - } - } + // update the environment map + if (mCubeMap) + { + std::vector > images; + images.reserve(NUM_CUBEMAP_FACES); + for (S32 side = 0; side < NUM_CUBEMAP_FACES; side++) + { + images.push_back(mShinyTex[side].getImageRaw(TRUE)); + } + mCubeMap->init(images); + gGL.getTexUnit(0)->disable(); + } + } + + m_lastAtmosphericsVars = m_atmosphericsVars; + mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY); + gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); + mCubeMapUpdateStage = -1; + } + else if (mCubeMapUpdateStage >= 0 && mCubeMapUpdateStage < NUM_CUBEMAP_FACES) + { + LL_RECORD_BLOCK_TIME(FTM_VOSKY_CREATETEXTURES); + + LLVector3 direction = mSun.getDirection(); + if (!direction.isExactlyZero()) + { + mLastTotalAmbient = total_ambient; + mInitialized = TRUE; - gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); - mForceUpdate = FALSE; + if (mCubeMap) + { + S32 side = mCubeMapUpdateStage; + for (int tile = 0; tile < NUM_TILES; tile++) + { + createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex); + createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, true); + } + mCubeMapUpdateStage++; + } + else + { + mCubeMapUpdateStage = NUM_CUBEMAP_FACES; + } + } + else + { + mCubeMapUpdateStage = NUM_CUBEMAP_FACES; + } } if (mDrawable.notNull() && mDrawable->getFace(0) && !mDrawable->getFace(0)->getVertexBuffer()) diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index 5f27085599..c3a04e12e5 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -337,7 +337,8 @@ protected: F32 mWind; bool mInitialized; - bool mForceUpdate; //flag to force instantaneous update of cubemap + bool mForceUpdate; // flag to force update of cubemap + S32 mCubeMapUpdateStage; // state of cubemap uodate: -1 idle; 0-5 per-face updates; 6 finalizing LLVector3 mLastSunLightingDirection; LLVector3 mLastMoonLightingDirection; LLColor3 mLastTotalAmbient; -- cgit v1.2.3 From 440a40c8f9fd35577470aee193a4b7dd128d80bb Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 22 Aug 2019 10:41:55 -0700 Subject: SL-11406 Restore code to stomp emissive in the absence of a normal map (to avoid fullbright implying full emissive). --- indra/newview/app_settings/shaders/class1/deferred/materialF.glsl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index a13c8de43e..023172c844 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -276,6 +276,10 @@ void main() #endif final_color.a = max(final_color.a, emissive_brightness); +#if !defined(HAS_NORMAL_MAP) + final_color.a = 0.0f; +#endif + vec4 final_specular = spec; final_specular.a = specular_color.a; #ifdef HAS_SPECULAR_MAP -- cgit v1.2.3 From 8960a56f531745bc2d434bdddb6c65731621f596 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 22 Aug 2019 11:19:04 -0700 Subject: SL-11776 Fix false alarming sky updates and doing expensive CPU work for same sky pixels. --- indra/llinventory/llsettingssky.cpp | 41 ++++++++++ indra/llinventory/llsettingssky.h | 3 + indra/newview/lllegacyatmospherics.cpp | 117 ++++++++++++++++++++++++++- indra/newview/lllegacyatmospherics.h | 111 +------------------------- indra/newview/llviewershadermgr.cpp | 2 +- indra/newview/llvosky.cpp | 140 +++++++++++++++++---------------- indra/newview/llvosky.h | 3 +- 7 files changed, 234 insertions(+), 183 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 35bd9a2254..9bbeb00efe 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1051,6 +1051,19 @@ LLColor3 LLSettingsSky::getAmbientColor() const return getColor(SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f)); } +LLColor3 LLSettingsSky::getAmbientColorClamped() const +{ + LLColor3 ambient = getAmbientColor(); + + F32 max_color = llmax(ambient.mV[0], ambient.mV[1], ambient.mV[2]); + if (max_color > 1.0f) + { + ambient *= 1.0f/max_color; + } + + return ambient; +} + LLColor3 LLSettingsSky::getBlueDensity() const { return getColor(SETTING_BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f)); @@ -1313,10 +1326,23 @@ void LLSettingsSky::calculateLightSettings() const componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); componentMultBy(sunlight, light_transmittance); + //F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); + //if (max_color > 1.0f) + //{ + // sunlight *= 1.0f/max_color; + //} + //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; componentMultBy(tmpAmbient, light_transmittance); + //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f); + //max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]); + //if (max_color > 1.0f) + //{ + // tmpAmbient *= 1.0f/max_color; + //} + //brightness of surface both sunlight and ambient mSunDiffuse = sunlight; mSunAmbient = tmpAmbient; @@ -1334,6 +1360,7 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); + //clampColor(moonlight, getGamma(), 1.0f); mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; @@ -1676,6 +1703,20 @@ LLColor3 LLSettingsSky::getSunlightColor() const return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]); } +LLColor3 LLSettingsSky::getSunlightColorClamped() const +{ + LLColor3 sunlight = getSunlightColor(); + //clampColor(sunlight, getGamma(), 3.0f); + + F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); + if (max_color > 1.0f) + { + sunlight *= 1.0f/max_color; + } + + return sunlight; +} + void LLSettingsSky::setSunlightColor(const LLColor3 &val) { setValue(SETTING_SUNLIGHT_COLOR, val); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e562fe38ff..4127911643 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -292,6 +292,9 @@ public: LLColor4 getTotalAmbient() const; LLColor4 getHazeColor() const; + LLColor3 getSunlightColorClamped() const; + LLColor3 getAmbientColorClamped() const; + virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); } static LLUUID GetDefaultAssetId(); diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index 720c7e2388..a1093df7e1 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -242,8 +242,10 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(AtmosphericsVars& vars, const LLVecto calcSkyColorWLVert(Pn, vars); + bool low_end = !gPipeline.canUseWindLightShaders(); + LLColor3 sky_color = isShiny ? vars.hazeColor : - !gPipeline.canUseWindLightShaders() ? vars.hazeColor * 2.0f : psky->gammaCorrect(vars.hazeColor * 2.0f); + low_end ? vars.hazeColor * 2.0f : psky->gammaCorrect(vars.hazeColor * 2.0f); if (isShiny) { @@ -443,8 +445,8 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) vars.distance_multiplier = psky->getDistanceMultiplier(); vars.max_y = psky->getMaxY(); vars.sun_norm = LLEnvironment::instance().getSunDirectionCFR(); - vars.sunlight = psky->getSunlightColor(); - vars.ambient = psky->getAmbientColor(); + vars.sunlight = psky->getSunlightColorClamped(); + vars.ambient = psky->getAmbientColorClamped(); vars.glow = psky->getGlow(); vars.cloud_shadow = psky->getCloudShadow(); vars.dome_radius = psky->getDomeRadius(); @@ -605,3 +607,112 @@ F32 azimuth(const LLVector3 &v) } return azimuth; } + +bool operator==(const AtmosphericsVars& a, const AtmosphericsVars& b) +{ + if (a.hazeColor != b.hazeColor) + { + return false; + } + + if (a.hazeColorBelowCloud != b.hazeColorBelowCloud) + { + return false; + } + + if (a.cloudColorSun != b.cloudColorSun) + { + return false; + } + + if (a.cloudColorAmbient != b.cloudColorAmbient) + { + return false; + } + + if (a.cloudDensity != b.cloudDensity) + { + return false; + } + + if (a.density_multiplier != b.density_multiplier) + { + return false; + } + + if (a.haze_horizon != b.haze_horizon) + { + return false; + } + + if (a.haze_density != b.haze_density) + { + return false; + } + + if (a.blue_horizon != b.blue_horizon) + { + return false; + } + + if (a.blue_density != b.blue_density) + { + return false; + } + + if (a.dome_offset != b.dome_offset) + { + return false; + } + + if (a.dome_radius != b.dome_radius) + { + return false; + } + + if (a.cloud_shadow != b.cloud_shadow) + { + return false; + } + + if (a.glow != b.glow) + { + return false; + } + + if (a.ambient != b.ambient) + { + return false; + } + + if (a.sunlight != b.sunlight) + { + return false; + } + + if (a.sun_norm != b.sun_norm) + { + return false; + } + + if (a.gamma != b.gamma) + { + return false; + } + + if (a.max_y != b.max_y) + { + return false; + } + + if (a.distance_multiplier != b.distance_multiplier) + { + return false; + } + + // light_atten, light_transmittance, total_density + // are ignored as they always change when the values above do + // they're just shared calc across the sky map generation to save cycles + + return true; +} diff --git a/indra/newview/lllegacyatmospherics.h b/indra/newview/lllegacyatmospherics.h index 95700227f9..cdfcead7a4 100644 --- a/indra/newview/lllegacyatmospherics.h +++ b/indra/newview/lllegacyatmospherics.h @@ -206,7 +206,7 @@ public: { } - LL_FORCE_INLINE friend bool operator==(const AtmosphericsVars& a, const AtmosphericsVars& b); + friend bool operator==(const AtmosphericsVars& a, const AtmosphericsVars& b); LLColor3 hazeColor; LLColor3 hazeColorBelowCloud; @@ -233,115 +233,6 @@ public: LLColor3 total_density; }; -bool operator==(const AtmosphericsVars& a, const AtmosphericsVars& b) -{ - if (a.hazeColor != b.hazeColor) - { - return false; - } - - if (a.hazeColorBelowCloud != b.hazeColorBelowCloud) - { - return false; - } - - if (a.cloudColorSun != b.cloudColorSun) - { - return false; - } - - if (a.cloudColorAmbient != b.cloudColorAmbient) - { - return false; - } - - if (a.cloudDensity != b.cloudDensity) - { - return false; - } - - if (a.density_multiplier != b.density_multiplier) - { - return false; - } - - if (a.haze_horizon != b.haze_horizon) - { - return false; - } - - if (a.haze_density != b.haze_density) - { - return false; - } - - if (a.blue_horizon != b.blue_horizon) - { - return false; - } - - if (a.blue_density != b.blue_density) - { - return false; - } - - if (a.dome_offset != b.dome_offset) - { - return false; - } - - if (a.dome_radius != b.dome_radius) - { - return false; - } - - if (a.cloud_shadow != b.cloud_shadow) - { - return false; - } - - if (a.glow != b.glow) - { - return false; - } - - if (a.ambient != b.ambient) - { - return false; - } - - if (a.sunlight != b.sunlight) - { - return false; - } - - if (a.sun_norm != b.sun_norm) - { - return false; - } - - if (a.gamma != b.gamma) - { - return false; - } - - if (a.max_y != b.max_y) - { - return false; - } - - if (a.distance_multiplier != b.distance_multiplier) - { - return false; - } - - // light_atten, light_transmittance, total_density - // are ignored as they always change when the values above do - // they're just shared calc across the sky map generation to save cycles - - return true; -} - class LLAtmospherics { public: diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index c874b3cf59..aca236cdfd 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -528,7 +528,7 @@ void LLViewerShaderMgr::setShaders() } // Trigger a full rebuild of the fallback skybox / cubemap if we've toggled windlight shaders - if (mShaderLevel[SHADER_WINDLIGHT] != wl_class && gSky.mVOSkyp.notNull()) + if (!wl_class || (mShaderLevel[SHADER_WINDLIGHT] != wl_class && gSky.mVOSkyp.notNull())) { gSky.mVOSkyp->forceSkyUpdate(); } diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 78c782eb5f..ae63a9921c 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -416,6 +416,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) mCloudDensity(0.2f), mWind(0.f), mForceUpdate(FALSE), + mNeedUpdate(TRUE), mWorldScale(1.f), mBumpSunDir(0.f, 0.f, 1.f) { @@ -608,7 +609,7 @@ void LLVOSky::restoreGL() initCubeMap(); } - mForceUpdate = TRUE; + forceSkyUpdate(); if (mDrawable) { @@ -690,6 +691,13 @@ void LLVOSky::idleUpdate(LLAgent &agent, const F64 &time) { } +void LLVOSky::forceSkyUpdate() +{ + mForceUpdate = TRUE; + + memset(&m_lastAtmosphericsVars, 0x00, sizeof(AtmosphericsVars)); +} + bool LLVOSky::updateSky() { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); @@ -718,7 +726,7 @@ bool LLVOSky::updateSky() const S32 frame = next_frame; - mForceUpdate = mForceUpdate || (total_no_tiles == frame); + mNeedUpdate = mForceUpdate || (total_no_tiles == frame); ++next_frame; next_frame = next_frame % cycle_frame_no; @@ -727,10 +735,13 @@ bool LLVOSky::updateSky() LLHeavenBody::setInterpVal( mInterpVal ); updateDirections(); - LLVector3 direction = mSun.getDirection(); - direction.normalize(); - const F32 dot_sun = direction * mLastSunLightingDirection; - const F32 dot_moon = direction * mLastMoonLightingDirection; + LLVector3 sun_dir = mSun.getDirection(); + sun_dir.normalize(); + LLVector3 moon_dir = mMoon.getDirection(); + moon_dir.normalize(); + + const F32 dot_sun = sun_dir * mLastSunLightingDirection; + const F32 dot_moon = moon_dir * mLastMoonLightingDirection; LLColor3 delta_color; delta_color.setVec(mLastTotalAmbient.mV[0] - total_ambient.mV[0], @@ -741,10 +752,10 @@ bool LLVOSky::updateSky() bool moon_direction_changed = (dot_moon < LIGHT_DIRECTION_THRESHOLD); bool color_changed = (delta_color.length() >= COLOR_CHANGE_THRESHOLD); - mForceUpdate = mForceUpdate || sun_direction_changed; - mForceUpdate = mForceUpdate || moon_direction_changed; - mForceUpdate = mForceUpdate || color_changed; - mForceUpdate = mForceUpdate || !mInitialized; + mNeedUpdate = mNeedUpdate || sun_direction_changed; + mNeedUpdate = mNeedUpdate || moon_direction_changed; + mNeedUpdate = mNeedUpdate || color_changed; + mNeedUpdate = mNeedUpdate || !mInitialized; bool is_alm_wl_sky = gPipeline.canUseWindLightShaders(); @@ -752,7 +763,7 @@ bool LLVOSky::updateSky() bool same_atmospherics = m_lastAtmosphericsVars == m_atmosphericsVars; - if (mForceUpdate && mForceUpdateThrottle.hasExpired() && !same_atmospherics) + if (mNeedUpdate && mForceUpdateThrottle.hasExpired() && (mForceUpdate || !same_atmospherics)) { LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED); @@ -762,77 +773,76 @@ bool LLVOSky::updateSky() m_lastAtmosphericsVars = m_atmosphericsVars; - if (!direction.isExactlyZero()) + mLastTotalAmbient = total_ambient; + mInitialized = TRUE; + + if (mCubeMap) { - mLastTotalAmbient = total_ambient; - mInitialized = TRUE; + updateFog(LLViewerCamera::getInstance()->getFar()); - if (mCubeMap) + for (int side = 0; side < 6; side++) { - updateFog(LLViewerCamera::getInstance()->getFar()); - - for (int side = 0; side < 6; side++) + for (int tile = 0; tile < NUM_TILES; tile++) { - for (int tile = 0; tile < NUM_TILES; tile++) - { - createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex); - createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, true); - } + createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex); + createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, true); } } + } - int tex = mSkyTex[0].getWhich(TRUE); - - for (int side = 0; side < 6; side++) - { - LLImageRaw* raw1 = nullptr; - LLImageRaw* raw2 = nullptr; - - if (!is_alm_wl_sky) - { - raw1 = mSkyTex[side].getImageRaw(TRUE); - raw2 = mSkyTex[side].getImageRaw(FALSE); - raw2->copy(raw1); - mSkyTex[side].createGLImage(tex); - } + int tex = mSkyTex[0].getWhich(TRUE); - raw1 = mShinyTex[side].getImageRaw(TRUE); - raw2 = mShinyTex[side].getImageRaw(FALSE); - raw2->copy(raw1); - mShinyTex[side].createGLImage(tex); - } - next_frame = 0; + for (int side = 0; side < 6; side++) + { + LLImageRaw* raw1 = nullptr; + LLImageRaw* raw2 = nullptr; - // update the sky texture if (!is_alm_wl_sky) { - for (S32 i = 0; i < 6; ++i) - { - mSkyTex[i].create(1.0f); - } + raw1 = mSkyTex[side].getImageRaw(TRUE); + raw2 = mSkyTex[side].getImageRaw(FALSE); + raw2->copy(raw1); + mSkyTex[side].createGLImage(tex); } - for (S32 i = 0; i < 6; ++i) + raw1 = mShinyTex[side].getImageRaw(TRUE); + raw2 = mShinyTex[side].getImageRaw(FALSE); + raw2->copy(raw1); + mShinyTex[side].createGLImage(tex); + } + next_frame = 0; + + // update the sky texture + if (!is_alm_wl_sky) + { + for (S32 i = 0; i < 6; ++i) { - mShinyTex[i].create(1.0f); + mSkyTex[i].create(1.0f); } + } + + for (S32 i = 0; i < 6; ++i) + { + mShinyTex[i].create(1.0f); + } - // update the environment map - if (mCubeMap) + // update the environment map + if (mCubeMap) + { + std::vector > images; + images.reserve(6); + for (S32 side = 0; side < 6; side++) { - std::vector > images; - images.reserve(6); - for (S32 side = 0; side < 6; side++) - { - images.push_back(mShinyTex[side].getImageRaw(TRUE)); - } - mCubeMap->init(images); - gGL.getTexUnit(0)->disable(); - } + images.push_back(mShinyTex[side].getImageRaw(TRUE)); + } + mCubeMap->init(images); + gGL.getTexUnit(0)->disable(); } gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); - mForceUpdate = FALSE; + + mNeedUpdate = FALSE; + mForceUpdate = FALSE; } if (mDrawable.notNull() && mDrawable->getFace(0) && !mDrawable->getFace(0)->getVertexBuffer()) @@ -1605,8 +1615,6 @@ void LLVOSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir_cfr, const LLV } updateDirections(); - - mForceUpdate = true; } void LLVOSky::setSunDirectionCFR(const LLVector3 &sun_dir_cfr) @@ -1630,8 +1638,6 @@ void LLVOSky::setSunDirectionCFR(const LLVector3 &sun_dir_cfr) } updateDirections(); - - mForceUpdate = true; } void LLVOSky::setMoonDirectionCFR(const LLVector3 &moon_dir_cfr) @@ -1639,6 +1645,4 @@ void LLVOSky::setMoonDirectionCFR(const LLVector3 &moon_dir_cfr) mMoon.setDirection(moon_dir_cfr); updateDirections(); - - mForceUpdate = true; } diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index 5f27085599..6c9d6dc8be 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -288,7 +288,7 @@ public: void setSunScale(F32 sun_scale); void setMoonScale(F32 sun_scale); - void forceSkyUpdate(void) { mForceUpdate = TRUE; } + void forceSkyUpdate(void); public: LLFace *mFace[FACE_COUNT]; @@ -337,6 +337,7 @@ protected: F32 mWind; bool mInitialized; + bool mNeedUpdate; //flag to mark update being necessary (input has changed) bool mForceUpdate; //flag to force instantaneous update of cubemap LLVector3 mLastSunLightingDirection; LLVector3 mLastMoonLightingDirection; -- cgit v1.2.3 From 413884dfc5b0a0eb38a025685e0e3da5a9f1efce Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 22 Aug 2019 21:48:20 +0300 Subject: SL-11776 Fixed moon's comparison condition --- indra/newview/llvosky.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 408da88c3f..37b685f731 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -736,7 +736,9 @@ bool LLVOSky::updateSky() LLVector3 direction = mSun.getDirection(); direction.normalize(); const F32 dot_sun = direction * mLastSunLightingDirection; - const F32 dot_moon = direction * mLastMoonLightingDirection; + LLVector3 moon_direction = mMoon.getDirection(); + moon_direction.normalize(); + const F32 dot_moon = moon_direction * mLastMoonLightingDirection; LLColor3 delta_color; delta_color.setVec(mLastTotalAmbient.mV[0] - total_ambient.mV[0], -- cgit v1.2.3 From 6932fa60d6aff2a413078663cc1100d2f9d87cbf Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 22 Aug 2019 15:25:07 -0700 Subject: Best of both worlds for 11776. --- indra/newview/llvosky.cpp | 144 +++++++++++++++++++++++----------------------- 1 file changed, 72 insertions(+), 72 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 28ad3d0877..41440ca6ed 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -420,6 +420,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) mWind(0.f), mForceUpdate(FALSE), mNeedUpdate(TRUE), + mCubeMapUpdateStage(-1), mWorldScale(1.f), mBumpSunDir(0.f, 0.f, 1.f) { @@ -502,13 +503,9 @@ void LLVOSky::init() initSkyTextureDirs(side, tile); createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex); createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, true); - } - } - - for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i) - { - mSkyTex[i].create(1.0f); - mShinyTex[i].create(1.0f); + } + mSkyTex[side].create(1.0f); + mShinyTex[side].create(1.0f); } initCubeMap(); @@ -692,6 +689,8 @@ void LLVOSky::forceSkyUpdate() mForceUpdate = TRUE; memset(&m_lastAtmosphericsVars, 0x00, sizeof(AtmosphericsVars)); + + mCubeMapUpdateStage = -1; } bool LLVOSky::updateSky() @@ -720,9 +719,7 @@ bool LLVOSky::updateSky() const S32 total_no_tiles = NUM_CUBEMAP_FACES * NUM_TILES; const S32 cycle_frame_no = total_no_tiles + 1; - const S32 frame = next_frame; - - mNeedUpdate = mForceUpdate || (total_no_tiles == frame); + mNeedUpdate = mForceUpdate; ++next_frame; next_frame = next_frame % cycle_frame_no; @@ -731,95 +728,98 @@ bool LLVOSky::updateSky() LLHeavenBody::setInterpVal( mInterpVal ); updateDirections(); - // Note: must be before comparison of old/current env settings below to be an effective optimization - calc(); - - bool same_atmospherics = m_lastAtmosphericsVars == m_atmosphericsVars; - - if (mNeedUpdate && mForceUpdateThrottle.hasExpired() && (mForceUpdate || !same_atmospherics)) - { - LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED); - - mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY); + if (!mCubeMap) + { + mCubeMapUpdateStage = NUM_CUBEMAP_FACES; + mForceUpdate = FALSE; + return TRUE; + } - LLSkyTex::stepCurrent(); - - m_lastAtmosphericsVars = m_atmosphericsVars; + if (mCubeMapUpdateStage < 0) + { + LL_RECORD_BLOCK_TIME(FTM_VOSKY_CALC); + calc(); - mInitialized = TRUE; + bool same_atmospherics = m_lastAtmosphericsVars == m_atmosphericsVars; - if (mCubeMap) - { - updateFog(LLViewerCamera::getInstance()->getFar()); + mNeedUpdate = mNeedUpdate || !same_atmospherics; - for (int side = 0; side < NUM_CUBEMAP_FACES; side++) - { - for (int tile = 0; tile < NUM_TILES; tile++) - { - createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex); - createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, true); - } - } - } + if (mNeedUpdate && (mForceUpdateThrottle.hasExpired() || mForceUpdate)) + { + // start updating cube map sides + updateFog(LLViewerCamera::getInstance()->getFar()); + mCubeMapUpdateStage = 0; + mForceUpdate = FALSE; + } + } + else if (mCubeMapUpdateStage == NUM_CUBEMAP_FACES) + { + LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED); + LLSkyTex::stepCurrent(); int tex = mSkyTex[0].getWhich(TRUE); - for (int side = 0; side < NUM_CUBEMAP_FACES; side++) - { + for (int side = 0; side < NUM_CUBEMAP_FACES; side++) + { LLImageRaw* raw1 = nullptr; LLImageRaw* raw2 = nullptr; if (!is_alm_wl_sky) { - raw1 = mSkyTex[side].getImageRaw(TRUE); - raw2 = mSkyTex[side].getImageRaw(FALSE); - raw2->copy(raw1); - mSkyTex[side].createGLImage(tex); + raw1 = mSkyTex[side].getImageRaw(TRUE); + raw2 = mSkyTex[side].getImageRaw(FALSE); + raw2->copy(raw1); + mSkyTex[side].createGLImage(tex); } - raw1 = mShinyTex[side].getImageRaw(TRUE); - raw2 = mShinyTex[side].getImageRaw(FALSE); - raw2->copy(raw1); - mShinyTex[side].createGLImage(tex); - } - next_frame = 0; + raw1 = mShinyTex[side].getImageRaw(TRUE); + raw2 = mShinyTex[side].getImageRaw(FALSE); + raw2->copy(raw1); + mShinyTex[side].createGLImage(tex); + } + next_frame = 0; - // update the sky texture + // update the sky texture if (!is_alm_wl_sky) { - for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i) - { + for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i) + { mSkyTex[i].create(1.0f); - } + } } for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i) - { - mShinyTex[i].create(1.0f); - } + { + mShinyTex[i].create(1.0f); + } - // update the environment map - if (mCubeMap) - { - std::vector > images; - images.reserve(6); - for (S32 side = 0; side < NUM_CUBEMAP_FACES; side++) - { - images.push_back(mShinyTex[side].getImageRaw(TRUE)); - } - mCubeMap->init(images); - gGL.getTexUnit(0)->disable(); - } + // update the environment map + initCubeMap(); - gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); + m_lastAtmosphericsVars = m_atmosphericsVars; - mNeedUpdate = FALSE; + mNeedUpdate = FALSE; mForceUpdate = FALSE; - } - if (mDrawable.notNull() && mDrawable->getFace(0) && !mDrawable->getFace(0)->getVertexBuffer()) + mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY); + gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); + + if (mDrawable.notNull() && mDrawable->getFace(0) && !mDrawable->getFace(0)->getVertexBuffer()) + { + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); + } + mCubeMapUpdateStage = -1; + } + else if (mCubeMapUpdateStage >= 0 && mCubeMapUpdateStage < NUM_CUBEMAP_FACES) { - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); + LL_RECORD_BLOCK_TIME(FTM_VOSKY_CREATETEXTURES); + S32 side = mCubeMapUpdateStage; + for (int tile = 0; tile < NUM_TILES; tile++) + { + createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex); + createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, true); + } + mCubeMapUpdateStage++; } return TRUE; -- cgit v1.2.3 From 82c3bf0a9881e29745851b1c0baa3ed69ecc4735 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 23 Aug 2019 17:31:09 +0300 Subject: SL-11736 FIXED "Stand" button disappears if "Restore down" UI button is pressed while sitting. --- indra/newview/llmoveview.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 19f238d99a..28201b7345 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -574,6 +574,8 @@ BOOL LLPanelStandStopFlying::postBuild() //mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::setFlyingMode, FALSE)); mStopFlyingButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStopFlyingButtonClick, this)); mStopFlyingButton->setVisible(FALSE); + + gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLPanelStandStopFlying::updatePosition, this)); return TRUE; } -- cgit v1.2.3 From a645648ffc7d7bd665e13c0ed73e70ac06cebe29 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 23 Aug 2019 09:04:28 -0700 Subject: Remove unused vars to appease Clang. --- indra/newview/llvosky.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 41440ca6ed..19299f55a2 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -77,9 +77,6 @@ namespace const LLVector2 TEX10 = LLVector2(1.f, 0.f); const LLVector2 TEX11 = LLVector2(1.f, 1.f); - const F32 LIGHT_DIRECTION_THRESHOLD = (F32) cosf(DEG_TO_RAD * 1.f); - const F32 COLOR_CHANGE_THRESHOLD = 0.01f; - LLTrace::BlockTimerStatHandle FTM_VOSKY_UPDATETIMER("VOSky Update Timer Tick"); LLTrace::BlockTimerStatHandle FTM_VOSKY_CALC("VOSky Update Calculations"); LLTrace::BlockTimerStatHandle FTM_VOSKY_CREATETEXTURES("VOSky Update Textures"); -- cgit v1.2.3 From 2329beb3d3e3ad6501b6614578861012e4d9f4b0 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 23 Aug 2019 12:34:22 -0700 Subject: SL-11774 Fix diffuse boost when water fog is enabled and make deferred underwater shader participate in EEP/WL param updates by marking it as a water shader. --- .../shaders/class1/deferred/softenLightF.glsl | 4 ++- .../shaders/class1/deferred/underWaterF.glsl | 41 +--------------------- indra/newview/llviewershadermgr.cpp | 1 + 3 files changed, 5 insertions(+), 41 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 269b76a19f..09b1813ebe 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -158,7 +158,9 @@ vec3 post_diffuse = color.rgb; vec3 post_spec = color.rgb; -#ifndef WATER_FOG +#ifdef WATER_FOG + color.rgb += diffuse_srgb.rgb * diffuse_srgb.a * 0.25; +#else color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); #endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl index 641c6fbd36..9a5debb3c1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl @@ -58,45 +58,8 @@ VARYING vec4 refCoord; VARYING vec4 littleWave; VARYING vec4 view; -vec3 srgb_to_linear(vec3 c); vec2 encode_normal(vec3 n); -vec4 applyWaterFog(vec4 color, vec3 viewVec) -{ - //normalize view vector - vec3 view = normalize(viewVec); - float es = -view.z; - - //find intersection point with water plane and eye vector - - //get eye depth - float e0 = max(-waterPlane.w, 0.0); - - //get object depth - float depth = length(viewVec); - - //get "thickness" of water - float l = max(depth, 0.1); - - float kd = waterFogDensity; - float ks = waterFogKS; - vec4 kc = waterFogColor; - - float F = 0.98; - - float t1 = -kd * pow(F, ks * e0); - float t2 = kd + ks * es; - float t3 = pow(F, t2*l) - 1.0; - - float L = min(t1/t2*t3, 1.0); - - float D = pow(0.98, l*kd); - //return vec4(1.0, 0.0, 1.0, 1.0); - return color * D + kc * L; - //depth /= 10.0; - //return vec4(depth,depth,depth,0.0); -} - void main() { vec4 color; @@ -113,9 +76,7 @@ void main() vec4 fb = texture2D(screenTex, distort); - fb.rgb = srgb_to_linear(fb.rgb); - frag_data[0] = vec4(fb.rgb, 1.0); // diffuse frag_data[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec - frag_data[2] = vec4(encode_normal(wavef), 0.0, 0.0); // normalxyz, displace + frag_data[2] = vec4(encode_normal(wavef), 0.0, 0.0); // normalxyz, env intens, atmo kill } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index aca236cdfd..bdd0330cca 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -2281,6 +2281,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredUnderWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredUnderWaterProgram.mShaderFiles.push_back(make_pair("deferred/underWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredUnderWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + gDeferredUnderWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; success = gDeferredUnderWaterProgram.createShader(NULL, NULL); llassert(success); } -- cgit v1.2.3 From d195a3b08d664a98c17a81ec43aa84707631a234 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 23 Aug 2019 18:36:56 -0700 Subject: SL-11778 Make RenderShadowResolutionScale work again, also decoupling shadow buffer alloc/release/resize from screen buffer resize function. --- indra/newview/llviewercontrol.cpp | 9 ++- indra/newview/llviewerdisplay.cpp | 9 ++- indra/newview/llviewerdisplay.h | 1 + indra/newview/pipeline.cpp | 119 ++++++++++++++++++++++---------------- indra/newview/pipeline.h | 7 +++ 5 files changed, 94 insertions(+), 51 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index b1d47b7d75..e2da4f63fb 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -94,6 +94,7 @@ LLControlGroup gWarningSettings("Warnings"); // persists ignored dialogs/warning std::string gLastRunVersion; extern BOOL gResizeScreenTexture; +extern BOOL gResizeShadowTexture; extern BOOL gDebugGL; //////////////////////////////////////////////////////////////////////////// // Listeners @@ -191,6 +192,12 @@ bool handleRenderTransparentWaterChanged(const LLSD& newvalue) } +static bool handleShadowsResized(const LLSD& newvalue) +{ + gPipeline.requestResizeShadowTexture(); + return true; +} + static bool handleWindowResized(const LLSD& newvalue) { gPipeline.requestResizeScreenTexture(); @@ -623,7 +630,7 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderSpecularResY")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2)); gSavedSettings.getControl("RenderSpecularExponent")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2)); gSavedSettings.getControl("RenderAnisotropic")->getSignal()->connect(boost::bind(&handleAnisotropicChanged, _2)); - gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleWindowResized, _2)); + gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleShadowsResized, _2)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderGlowResolutionPow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 0fb687aead..09b9d5f836 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -94,6 +94,7 @@ BOOL gForceRenderLandFence = FALSE; BOOL gDisplaySwapBuffers = FALSE; BOOL gDepthDirty = FALSE; BOOL gResizeScreenTexture = FALSE; +BOOL gResizeShadowTexture = FALSE; BOOL gWindowResized = FALSE; BOOL gSnapshot = FALSE; BOOL gShaderProfileFrame = FALSE; @@ -249,7 +250,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { LL_RECORD_BLOCK_TIME(FTM_RENDER); - if (gWindowResized || gResizeScreenTexture) + if (gWindowResized) { //skip render on frames where window has been resized LL_RECORD_BLOCK_TIME(FTM_RESIZE_WINDOW); gGL.flush(); @@ -262,6 +263,12 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) return; } + if (gResizeShadowTexture) + { //skip render on frames where window has been resized + gPipeline.resizeShadowTexture(); + gResizeShadowTexture = FALSE; + } + if (LLPipeline::sRenderDeferred) { //hack to make sky show up in deferred snapshots for_snapshot = FALSE; diff --git a/indra/newview/llviewerdisplay.h b/indra/newview/llviewerdisplay.h index f6467d7f93..e8072193ea 100644 --- a/indra/newview/llviewerdisplay.h +++ b/indra/newview/llviewerdisplay.h @@ -40,6 +40,7 @@ extern BOOL gTeleportDisplay; extern LLFrameTimer gTeleportDisplayTimer; extern BOOL gForceRenderLandFence; extern BOOL gResizeScreenTexture; +extern BOOL gResizeShadowTexture; extern BOOL gWindowResized; #endif // LL_LLVIEWERDISPLAY_H diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 9b6bf9bfc3..7048b921b0 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -740,6 +740,18 @@ void LLPipeline::requestResizeScreenTexture() gResizeScreenTexture = TRUE; } +void LLPipeline::requestResizeShadowTexture() +{ + gResizeShadowTexture = TRUE; +} + +void LLPipeline::resizeShadowTexture() +{ + releaseShadowTargets(); + allocateShadowBuffer(mScreenWidth, mScreenHeight); + gResizeShadowTexture = FALSE; +} + void LLPipeline::resizeScreenTexture() { LL_RECORD_BLOCK_TIME(FTM_RESIZE_SCREEN_TEXTURE); @@ -748,23 +760,12 @@ void LLPipeline::resizeScreenTexture() GLuint resX = gViewerWindow->getWorldViewWidthRaw(); GLuint resY = gViewerWindow->getWorldViewHeightRaw(); - if ((resX != mScreen.getWidth()) || (resY != mScreen.getHeight())) + if (gResizeScreenTexture || (resX != mScreen.getWidth()) || (resY != mScreen.getHeight())) { releaseScreenBuffers(); - if (!allocateScreenBuffer(resX,resY)) - { -#if PROBABLE_FALSE_DISABLES_OF_ALM_HERE - //FAILSAFE: screen buffer allocation failed, disable deferred rendering if it's enabled - //NOTE: if the session closes successfully after this call, deferred rendering will be - // disabled on future sessions - if (LLPipeline::sRenderDeferred) - { - gSavedSettings.setBOOL("RenderDeferred", FALSE); - LLPipeline::refreshCachedSettings(); - - } -#endif - } + releaseShadowTargets(); + allocateScreenBuffer(resX,resY); + gResizeScreenTexture = FALSE; } } } @@ -869,9 +870,6 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY) return ret; } - // must be even to avoid a stripe in the horizontal shadow blur -inline U32 BlurHappySize(U32 x, U32 scale) { return (((x*scale)+1)&~1); } - bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) { refreshCachedSettings(); @@ -939,6 +937,54 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) mDeferredLight.release(); } + allocateShadowBuffer(resX, resY); + + //HACK make screenbuffer allocations start failing after 30 seconds + if (gSavedSettings.getBOOL("SimulateFBOFailure")) + { + return false; + } + } + else + { + mDeferredLight.release(); + + releaseShadowTargets(); + + mFXAABuffer.release(); + mScreen.release(); + mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first + mDeferredDepth.release(); + mOcclusionDepth.release(); + + if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false; + } + + if (LLPipeline::sRenderDeferred) + { //share depth buffer between deferred targets + mDeferredScreen.shareDepthBuffer(mScreen); + } + + gGL.getTexUnit(0)->disable(); + + stop_glerror(); + + return true; +} + +// must be even to avoid a stripe in the horizontal shadow blur +inline U32 BlurHappySize(U32 x, F32 scale) { return U32( x * scale + 16.0f) & ~0xF; } + +bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY) +{ + refreshCachedSettings(); + + if (LLPipeline::sRenderDeferred) + { + S32 shadow_detail = RenderShadowDetail; + + const U32 occlusion_divisor = 3; + F32 scale = RenderShadowResolutionScale; U32 sun_shadow_map_width = BlurHappySize(resX, scale); U32 sun_shadow_map_height = BlurHappySize(resY, scale); @@ -992,36 +1038,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) releaseShadowTarget(i); } } - - //HACK make screenbuffer allocations start failing after 30 seconds - if (gSavedSettings.getBOOL("SimulateFBOFailure")) - { - return false; - } } - else - { - mDeferredLight.release(); - - releaseShadowTargets(); - - mFXAABuffer.release(); - mScreen.release(); - mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first - mDeferredDepth.release(); - mOcclusionDepth.release(); - - if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false; - } - - if (LLPipeline::sRenderDeferred) - { //share depth buffer between deferred targets - mDeferredScreen.shareDepthBuffer(mScreen); - } - - gGL.getTexUnit(0)->disable(); - - stop_glerror(); return true; } @@ -1190,6 +1207,11 @@ void LLPipeline::releaseLUTBuffers() } } +void LLPipeline::releaseShadowBuffers() +{ + releaseShadowTargets(); +} + void LLPipeline::releaseScreenBuffers() { mUIScreen.release(); @@ -1199,8 +1221,7 @@ void LLPipeline::releaseScreenBuffers() mDeferredScreen.release(); mDeferredDepth.release(); mDeferredLight.release(); - mOcclusionDepth.release(); - releaseShadowTargets(); + mOcclusionDepth.release(); } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 44aa9d85fa..e75a09d753 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -101,10 +101,16 @@ public: void resetVertexBuffers(); void doResetVertexBuffers(bool forced = false); void requestResizeScreenTexture(); // set flag only, no work, safer for callbacks... + void requestResizeShadowTexture(); // set flag only, no work, safer for callbacks... + void resizeScreenTexture(); + void resizeShadowTexture(); + void releaseGLBuffers(); void releaseLUTBuffers(); void releaseScreenBuffers(); + void releaseShadowBuffers(); + void createGLBuffers(); void createLUTBuffers(); @@ -126,6 +132,7 @@ public: //attempt to allocate screen buffers at resX, resY //returns true if allocation successful, false otherwise bool allocateScreenBuffer(U32 resX, U32 resY, U32 samples); + bool allocateShadowBuffer(U32 resX, U32 resY); void allocatePhysicsBuffer(); -- cgit v1.2.3 From 1f656735d339fc4d83da86efbb400af1361c27db Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 26 Aug 2019 11:43:45 -0700 Subject: SL-11705, SL-11706: New flags in llsettings base for tracking by simulator. --- indra/llinventory/llsettingsbase.cpp | 7 ++- indra/llinventory/llsettingsbase.h | 1 + indra/newview/llenvironment.cpp | 12 ++++-- indra/newview/llenvironment.h | 16 ++++--- indra/newview/llfloatereditextdaycycle.cpp | 66 +++++++++++++++++++++-------- indra/newview/llfloatereditextdaycycle.h | 1 + indra/newview/llfloaterfixedenvironment.cpp | 17 +++++++- indra/newview/llfloatermyenvironment.cpp | 11 ++++- indra/newview/llinventorybridge.cpp | 9 +++- indra/newview/llpanelenvironment.cpp | 12 ++++++ indra/newview/llsettingsvo.cpp | 7 ++- 11 files changed, 126 insertions(+), 33 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index e8fdd017e3..af3e84fd0f 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -59,6 +59,7 @@ const std::string LLSettingsBase::SETTING_FLAGS("flags"); const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0); const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1); const U32 LLSettingsBase::FLAG_NOTRANS(0x01 << 2); +const U32 LLSettingsBase::FLAG_NOSAVE(0x01 << 3); const U32 LLSettingsBase::Validator::VALIDATION_PARTIAL(0x01 << 0); @@ -354,7 +355,11 @@ LLSD LLSettingsBase::getSettings() const LLSD LLSettingsBase::cloneSettings() const { - return combineSDMaps(getSettings(), LLSD()); + U32 flags = getFlags(); + LLSD settings (combineSDMaps(getSettings(), LLSD())); + if (flags) + settings[SETTING_FLAGS] = LLSD::Integer(flags); + return settings; } size_t LLSettingsBase::getHash() const diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index afb5014409..8b969d81a6 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -75,6 +75,7 @@ public: static const U32 FLAG_NOCOPY; static const U32 FLAG_NOMOD; static const U32 FLAG_NOTRANS; + static const U32 FLAG_NOSAVE; class DefaultParam { diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index daff4b7186..782077b9a2 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -81,6 +81,7 @@ namespace const std::string KEY_PARCELID("parcel_id"); const std::string KEY_REGIONID("region_id"); const std::string KEY_TRACKALTS("track_altitudes"); + const std::string KEY_FLAGS("flags"); const std::string MESSAGE_PUSHENVIRONMENT("PushExpEnvironment"); @@ -1696,7 +1697,7 @@ void LLEnvironment::updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_lengt updateParcel(INVALID_PARCEL_ID, pday, day_length, day_offset, altitudes, cb); } -void LLEnvironment::updateRegion(const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) +void LLEnvironment::updateRegion(const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, U32 flags, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { if (!isExtendedEnvironmentEnabled()) { @@ -1705,7 +1706,7 @@ void LLEnvironment::updateRegion(const LLUUID &asset_id, std::string display_nam return; } - updateParcel(INVALID_PARCEL_ID, asset_id, display_name, track_num, day_length, day_offset, altitudes, cb); + updateParcel(INVALID_PARCEL_ID, asset_id, display_name, track_num, day_length, day_offset, flags, altitudes, cb); } void LLEnvironment::updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) @@ -1758,9 +1759,9 @@ void LLEnvironment::requestParcel(S32 parcel_id, environment_apply_fn cb) [this, parcel_id, cb]() { coroRequestEnvironment(parcel_id, cb); }); } -void LLEnvironment::updateParcel(S32 parcel_id, const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) +void LLEnvironment::updateParcel(S32 parcel_id, const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, U32 flags, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { - UpdateInfo::ptr_t updates(std::make_shared(asset_id, display_name, day_length, day_offset, altitudes)); + UpdateInfo::ptr_t updates(std::make_shared(asset_id, display_name, day_length, day_offset, altitudes, flags)); std::string coroname = LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment", [this, parcel_id, track_num, updates, cb]() { coroUpdateEnvironment(parcel_id, track_num, updates, cb); }); @@ -1797,12 +1798,14 @@ void LLEnvironment::onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::p void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { LLSettingsDay::ptr_t pday = createDayCycleFromEnvironment((parcel_id == INVALID_PARCEL_ID) ? ENV_REGION : ENV_PARCEL, psky); + pday->setFlag(psky->getFlags()); updateParcel(parcel_id, pday, day_length, day_offset, altitudes, cb); } void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { LLSettingsDay::ptr_t pday = createDayCycleFromEnvironment((parcel_id == INVALID_PARCEL_ID) ? ENV_REGION : ENV_PARCEL, pwater); + pday->setFlag(pwater->getFlags()); updateParcel(parcel_id, pday, day_length, day_offset, altitudes, cb); } @@ -1911,6 +1914,7 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInf body[KEY_ENVIRONMENT][KEY_DAYNAME] = updates->mDayName; } + body[KEY_ENVIRONMENT][KEY_FLAGS] = LLSD::Integer(updates->mFlags); //_WARNS("ENVIRONMENT") << "Body = " << body << LL_ENDL; if ((parcel_id != INVALID_PARCEL_ID) || (track_no != NO_TRACK)) diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 0e23693c86..3ae1d37a8c 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -208,13 +208,13 @@ public: connection_t setEnvironmentChanged(env_changed_fn cb) { return mSignalEnvChanged.connect(cb); } void requestRegion(environment_apply_fn cb = environment_apply_fn()); - void updateRegion(const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); + void updateRegion(const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, U32 flags, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateRegion(const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void resetRegion(environment_apply_fn cb = environment_apply_fn()); void requestParcel(S32 parcel_id, environment_apply_fn cb = environment_apply_fn()); - void updateParcel(S32 parcel_id, const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); + void updateParcel(S32 parcel_id, const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, U32 flags, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 track_num, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateParcel(S32 parcel_id, const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); @@ -399,19 +399,24 @@ private: mDayLength(day_length), mDayOffset(day_offset), mAltitudes(altitudes), - mDayName() + mDayName(), + mFlags(0) { if (mDayp) + { mDayName = mDayp->getName(); + mFlags = mDayp->getFlags(); + } } - UpdateInfo(LLUUID settings_asset, std::string name, S32 day_length, S32 day_offset, altitudes_vect_t altitudes) : + UpdateInfo(LLUUID settings_asset, std::string name, S32 day_length, S32 day_offset, altitudes_vect_t altitudes, U32 flags) : mDayp(), mSettingsAsset(settings_asset), mDayLength(day_length), mDayOffset(day_offset), mAltitudes(altitudes), - mDayName(name) + mDayName(name), + mFlags(flags) {} LLSettingsDay::ptr_t mDayp; @@ -420,6 +425,7 @@ private: S32 mDayOffset; altitudes_vect_t mAltitudes; std::string mDayName; + U32 mFlags; }; void coroRequestEnvironment(S32 parcel_id, environment_apply_fn apply); diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 0fb7fee8cb..cb2f5dbb1d 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -179,6 +179,7 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) : mScratchWater(), mIsPlaying(false), mIsDirty(false), + mCanSave(false), mCanCopy(false), mCanMod(false), mCanTrans(false), @@ -305,6 +306,7 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) } else { + mCanSave = true; mCanCopy = true; mCanMod = true; mCanTrans = true; @@ -475,8 +477,8 @@ void LLFloaterEditExtDayCycle::refresh() mFlyoutControl->setMenuItemVisible(ACTION_APPLY_REGION, show_apply); mFlyoutControl->setMenuItemEnabled(ACTION_COMMIT, show_commit && !mCommitSignal.empty()); - mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail && mCanMod && !mInventoryId.isNull()); - mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail && mCanCopy); + mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail && mCanMod && !mInventoryId.isNull() && mCanSave); + mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail && mCanCopy && mCanSave); mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_LOCAL, true); mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_PARCEL, canApplyParcel() && show_apply); mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_REGION, canApplyRegion() && show_apply); @@ -504,6 +506,11 @@ void LLFloaterEditExtDayCycle::setEditDayCycle(const LLSettingsDay::ptr_t &pday) mEditDay->setSkyAtKeyframe(LLSettingsVOSky::buildDefaultSky(), .5f, LLSettingsDay::TRACK_GROUND_LEVEL); } + mCanSave = !pday->getFlag(LLSettingsBase::FLAG_NOSAVE); + mCanCopy = !pday->getFlag(LLSettingsBase::FLAG_NOCOPY) && mCanSave; + mCanMod = !pday->getFlag(LLSettingsBase::FLAG_NOMOD) && mCanSave; + mCanTrans = !pday->getFlag(LLSettingsBase::FLAG_NOTRANS) && mCanSave; + updateEditEnvironment(); LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_INSTANT); LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_INSTANT); @@ -1427,6 +1434,7 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId) { mInventoryItem = nullptr; mInventoryId.setNull(); + mCanSave = true; mCanCopy = true; mCanMod = true; mCanTrans = true; @@ -1460,6 +1468,7 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId) return; } + mCanSave = true; mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID()); mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID()); mCanTrans = mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); @@ -1488,23 +1497,33 @@ void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::pt return; } - if (mCanCopy) - settings->clearFlag(LLSettingsBase::FLAG_NOCOPY); + if (settings->getFlag(LLSettingsBase::FLAG_NOSAVE)) + { + mCanSave = false; + mCanCopy = false; + mCanMod = false; + mCanTrans = false; + } else - settings->setFlag(LLSettingsBase::FLAG_NOCOPY); + { + if (mCanCopy) + settings->clearFlag(LLSettingsBase::FLAG_NOCOPY); + else + settings->setFlag(LLSettingsBase::FLAG_NOCOPY); - if (mCanMod) - settings->clearFlag(LLSettingsBase::FLAG_NOMOD); - else - settings->setFlag(LLSettingsBase::FLAG_NOMOD); + if (mCanMod) + settings->clearFlag(LLSettingsBase::FLAG_NOMOD); + else + settings->setFlag(LLSettingsBase::FLAG_NOMOD); - if (mCanTrans) - settings->clearFlag(LLSettingsBase::FLAG_NOTRANS); - else - settings->setFlag(LLSettingsBase::FLAG_NOTRANS); + if (mCanTrans) + settings->clearFlag(LLSettingsBase::FLAG_NOTRANS); + else + settings->setFlag(LLSettingsBase::FLAG_NOTRANS); - if (mInventoryItem) - settings->setName(mInventoryItem->getName()); + if (mInventoryItem) + settings->setName(mInventoryItem->getName()); + } setEditDayCycle(std::dynamic_pointer_cast(settings)); } @@ -1674,6 +1693,19 @@ void LLFloaterEditExtDayCycle::doApplyUpdateInventory(const LLSettingsDay::ptr_t void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day) { + U32 flags(0); + + if (mInventoryItem) + { + if (!mInventoryItem->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOMOD; + if (!mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOTRANS; + } + + flags |= day->getFlags(); + day->setFlag(flags); + if (where == ACTION_APPLY_LOCAL) { LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, day); @@ -1691,7 +1723,7 @@ void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where, cons if (mInventoryItem && !isDirty()) { - LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1); + LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); } else { @@ -1702,7 +1734,7 @@ void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where, cons { if (mInventoryItem && !isDirty()) { - LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1); + LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); } else { diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index c271f15840..83ce69cff3 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -240,6 +240,7 @@ private: bool mCanCopy; bool mCanMod; bool mCanTrans; + bool mCanSave; edit_commit_signal_t mCommitSignal; diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 05da640258..dccfca62a4 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -560,6 +560,19 @@ void LLFloaterFixedEnvironment::doApplyUpdateInventory(const LLSettingsBase::ptr void LLFloaterFixedEnvironment::doApplyEnvironment(const std::string &where, const LLSettingsBase::ptr_t &settings) { + U32 flags(0); + + if (mInventoryItem) + { + if (!mInventoryItem->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOMOD; + if (!mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOTRANS; + } + + flags |= settings->getFlags(); + settings->setFlag(flags); + if (where == ACTION_APPLY_LOCAL) { LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, settings); @@ -577,7 +590,7 @@ void LLFloaterFixedEnvironment::doApplyEnvironment(const std::string &where, con if (mInventoryItem && !isDirty()) { - LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1); + LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); } else if (settings->getSettingsType() == "sky") { @@ -592,7 +605,7 @@ void LLFloaterFixedEnvironment::doApplyEnvironment(const std::string &where, con { if (mInventoryItem && !isDirty()) { - LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1); + LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); } else if (settings->getSettingsType() == "sky") { diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp index 1d2f14532d..21d106c8b1 100644 --- a/indra/newview/llfloatermyenvironment.cpp +++ b/indra/newview/llfloatermyenvironment.cpp @@ -277,9 +277,16 @@ void LLFloaterMyEnvironment::onDoApply(const std::string &context) LLUUID asset_id = itemp->getAssetUUID(); std::string name = itemp->getName(); + U32 flags(0); + + if (!itemp->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOMOD; + if (!itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOTRANS; + if (context == PARAMETER_REGION) { - LLEnvironment::instance().updateRegion(asset_id, name, LLEnvironment::NO_TRACK, -1, -1); + LLEnvironment::instance().updateRegion(asset_id, name, LLEnvironment::NO_TRACK, -1, -1, flags); LLEnvironment::instance().setSharedEnvironment(); } else if (context == PARAMETER_PARCEL) @@ -290,7 +297,7 @@ void LLFloaterMyEnvironment::onDoApply(const std::string &context) LL_WARNS("ENVIRONMENT") << "Unable to determine parcel." << LL_ENDL; return; } - LLEnvironment::instance().updateParcel(parcel->getLocalID(), asset_id, name, LLEnvironment::NO_TRACK, -1, -1); + LLEnvironment::instance().updateParcel(parcel->getLocalID(), asset_id, name, LLEnvironment::NO_TRACK, -1, -1, flags); LLEnvironment::instance().setSharedEnvironment(); } else if (context == PARAMETER_LOCAL) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ee9dfbc376..97260fba4c 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -6948,6 +6948,13 @@ void LLSettingsBridge::performAction(LLInventoryModel* model, std::string action LLUUID asset_id = item->getAssetUUID(); std::string name = item->getName(); + U32 flags(0); + + if (!item->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOMOD; + if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOTRANS; + LLParcel *parcel = LLViewerParcelMgr::instance().getAgentOrSelectedParcel(); if (!parcel) { @@ -6957,7 +6964,7 @@ void LLSettingsBridge::performAction(LLInventoryModel* model, std::string action S32 parcel_id = parcel->getLocalID(); LL_DEBUGS("ENVIRONMENT") << "Applying asset ID " << asset_id << " to parcel " << parcel_id << LL_ENDL; - LLEnvironment::instance().updateParcel(parcel_id, asset_id, name, LLEnvironment::NO_TRACK, -1, -1); + LLEnvironment::instance().updateParcel(parcel_id, asset_id, name, LLEnvironment::NO_TRACK, -1, -1, flags); LLEnvironment::instance().setSharedEnvironment(); } else diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index d63ae4e434..c4fa4244b1 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -440,6 +440,7 @@ void LLPanelEnvironmentInfo::updateEditFloater(const LLEnvironment::EnvironmentI // old settings will be invalid. mEditorLastParcelId = nextenv->mParcelId; mEditorLastRegionId = nextenv->mRegionId; + dayeditor->setEditDayCycle(nextenv->mDayCycle); } } @@ -967,12 +968,23 @@ void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id, S32 track_num) clearDirtyFlag(DIRTY_FLAG_DAYLENGTH); clearDirtyFlag(DIRTY_FLAG_DAYOFFSET); + U32 flags(0); + + if (itemp) + { + if (!itemp->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOMOD; + if (!itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOTRANS; + } + LLEnvironment::instance().updateParcel(getParcelId(), itemp->getAssetUUID(), itemp->getName(), track_num, mCurrentEnvironment ? mCurrentEnvironment->mDayLength.value() : -1, mCurrentEnvironment ? mCurrentEnvironment->mDayOffset.value() : -1, + flags, LLEnvironment::altitudes_vect_t(), [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 5b336f0870..11bb732be8 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -532,6 +532,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky() LLSettingsSky::ptr_t LLSettingsVOSky::buildClone() const { LLSD settings = cloneSettings(); + U32 flags = getFlags(); LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList(); LLSD results = LLSettingsBase::settingValidation(settings, validations); @@ -542,6 +543,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildClone() const } LLSettingsSky::ptr_t skyp = std::make_shared(settings); + skyp->setFlags(flags); return skyp; } @@ -866,6 +868,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater() LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() const { LLSD settings = cloneSettings(); + U32 flags = getFlags(); LLSettingsWater::validation_list_t validations = LLSettingsWater::validationList(); LLSD results = LLSettingsWater::settingValidation(settings, validations); if (!results["success"].asBoolean()) @@ -875,7 +878,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() const } LLSettingsWater::ptr_t waterp = std::make_shared(settings); - + waterp->setFlags(flags); return waterp; } @@ -1273,6 +1276,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() const // no need for SETTING_TRACKS or SETTING_FRAMES, so take base LLSD LLSD settings = llsd_clone(mSettings); + U32 flags = getFlags(); LLSettingsDay::ptr_t day_clone = std::make_shared(settings); for (S32 i = 0; i < LLSettingsDay::TRACK_MAX; ++i) @@ -1289,6 +1293,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() const iter++; } } + day_clone->setFlags(flags); return day_clone; } -- cgit v1.2.3 From 8f02fc8a66c51df6d71d1d04020f283c0fcb1a24 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 26 Aug 2019 13:23:25 -0700 Subject: Fix llavatarappearance merge to not use iterator in favor of C++11 lingo. --- indra/llappearance/llavatarappearance.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index 6882d2a553..f7fbb6fda1 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -1743,10 +1743,9 @@ void LLAvatarAppearance::makeJointAliases(LLAvatarBoneInfo *bone_info) mJointAliasMap[*i] = bone_name; } - LLAvatarBoneInfo::child_list_t::const_iterator iter; - for (iter = bone_info->mChildList.begin(); iter != bone_info->mChildList.end(); ++iter) + for (LLAvatarBoneInfo* bone : bone_info->mChildren) { - makeJointAliases( *iter ); + makeJointAliases(bone); } } -- cgit v1.2.3 From 3dff18eb6981dec4231437b5fd67a4f7e6b4d9a2 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 26 Aug 2019 14:20:04 -0700 Subject: Fix merged code use of obsoleted vars and other merge errors. --- indra/newview/lltexturectrl.cpp | 27 ++++++++++++++++----------- indra/newview/llvoavatar.cpp | 4 ++-- 2 files changed, 18 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 801d0f0893..3830e11893 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -73,6 +73,10 @@ #include "llavatarappearancedefines.h" +static const F32 CONTEXT_CONE_IN_ALPHA = 0.0f; +static const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; +static const F32 CONTEXT_FADE_TIME = 0.08f; + static const S32 LOCAL_TRACKING_ID_COLUMN = 1; //static const char CURRENT_IMAGE_NAME[] = "Current Texture"; @@ -391,6 +395,9 @@ BOOL LLFloaterTexturePicker::postBuild() // don't put keyboard focus on selected item, because the selection callback // will assume that this was user input + + + if(!mImageAssetID.isNull()) { mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO); @@ -437,9 +444,6 @@ void LLFloaterTexturePicker::draw() { if (mOwner) { - static LLCachedControl max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); - drawConeToOwner(mContextConeOpacity, max_opacity, mOwner); - // draw cone of context pointing back to texture swatch LLRect owner_rect; mOwner->localRectToOtherView(mOwner->getLocalRect(), &owner_rect, this); @@ -742,6 +746,7 @@ void LLFloaterTexturePicker::onBtnSelect(void* userdata) local_id = LLLocalBitmapMgr::getWorldID(temp_id); } } + if (self->mOnFloaterCommitCallback) { self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_SELECT, local_id); @@ -805,14 +810,14 @@ void LLFloaterTexturePicker::onSelectionChange(const std::dequemModeSelector->getSelectedIndex() == 0); - - self->getChild("Default")->setVisible(mode); - self->getChild("Blank")->setVisible(mode); - self->getChild("None")->setVisible(mode); - self->getChild("Pipette")->setVisible(mode); - self->getChild("inventory search editor")->setVisible(mode); - self->getChild("inventory panel")->setVisible(mode); + int mode = self->mModeSelector->getSelectedIndex(); + + self->getChild("Default")->setVisible(mode == 0); + self->getChild("Blank")->setVisible(mode == 0); + self->getChild("None")->setVisible(mode == 0); + self->getChild("Pipette")->setVisible(mode == 0); + self->getChild("inventory search editor")->setVisible(mode == 0); + self->getChild("inventory panel")->setVisible(mode == 0); /*self->getChild("show_folders_check")->setVisible(mode); no idea under which conditions the above is even shown, needs testing. */ diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5584efeb7b..7a79bd996f 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2952,7 +2952,7 @@ void LLVOAvatar::idleUpdateLoadingEffect() void LLVOAvatar::idleUpdateWindEffect() { // update wind effect - if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH)) + if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH)) { F32 hover_strength = 0.f; F32 time_delta = mRippleTimer.getElapsedTimeF32() - mRippleTimeLast; @@ -4654,7 +4654,7 @@ U32 LLVOAvatar::renderSkinned() } } - if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) <= 0) + if (LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) <= 0) { if (mNeedsSkin) { -- cgit v1.2.3 From f79fc96d08e37f119653f7db5a299a05454ff79c Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 26 Aug 2019 14:20:59 -0700 Subject: SL-11706: Correctly load settings when pushing the Load button in the fixed environment editor. --- indra/newview/llfloaterfixedenvironment.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index dccfca62a4..f564dce629 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -321,11 +321,16 @@ void LLFloaterFixedEnvironment::checkAndConfirmSettingsLoss(LLFloaterFixedEnviro void LLFloaterFixedEnvironment::onPickerCommitSetting(LLUUID item_id) { - mInventoryId = item_id; - mInventoryItem = gInventory.getItem(mInventoryId); - - LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), - [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); + loadInventoryItem(item_id); +// mInventoryId = item_id; +// mInventoryItem = gInventory.getItem(mInventoryId); +// +// mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID()); +// mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID()); +// mCanTrans = mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); +// +// LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), +// [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); } void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status) -- cgit v1.2.3 From 1cf1459cbc261c3512ebd6f07ce7b1d0f078f627 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 26 Aug 2019 14:34:15 -0700 Subject: Make texture ctrl visibility set respect BOOL vs bool and use better naming. --- indra/newview/lltexturectrl.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'indra') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 3830e11893..395e83a036 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -810,27 +810,27 @@ void LLFloaterTexturePicker::onSelectionChange(const std::dequemModeSelector->getSelectedIndex(); + int index = self->mModeSelector->getSelectedIndex(); - self->getChild("Default")->setVisible(mode == 0); - self->getChild("Blank")->setVisible(mode == 0); - self->getChild("None")->setVisible(mode == 0); - self->getChild("Pipette")->setVisible(mode == 0); - self->getChild("inventory search editor")->setVisible(mode == 0); - self->getChild("inventory panel")->setVisible(mode == 0); + self->getChild("Default")->setVisible(index == 0 ? TRUE : FALSE); + self->getChild("Blank")->setVisible(index == 0 ? TRUE : FALSE); + self->getChild("None")->setVisible(index == 0 ? TRUE : FALSE); + self->getChild("Pipette")->setVisible(index == 0 ? TRUE : FALSE); + self->getChild("inventory search editor")->setVisible(index == 0 ? TRUE : FALSE); + self->getChild("inventory panel")->setVisible(index == 0 ? TRUE : FALSE); /*self->getChild("show_folders_check")->setVisible(mode); no idea under which conditions the above is even shown, needs testing. */ - self->getChild("l_add_btn")->setVisible(mode == 1); - self->getChild("l_rem_btn")->setVisible(mode == 1); - self->getChild("l_upl_btn")->setVisible(mode == 1); - self->getChild("l_name_list")->setVisible(mode == 1); + self->getChild("l_add_btn")->setVisible(index == 1 ? TRUE : FALSE); + self->getChild("l_rem_btn")->setVisible(index == 1 ? TRUE : FALSE); + self->getChild("l_upl_btn")->setVisible(index == 1 ? TRUE : FALSE); + self->getChild("l_name_list")->setVisible(index == 1 ? TRUE : FALSE); - self->getChild("l_bake_use_texture_combo_box")->setVisible(mode == 2); - self->getChild("hide_base_mesh_region")->setVisible(false);// mode == 2); + self->getChild("l_bake_use_texture_combo_box")->setVisible(index == 2 ? TRUE : FALSE); + self->getChild("hide_base_mesh_region")->setVisible(FALSE);// index == 2 ? TRUE : FALSE); - if (mode == 2) + if (index == 2) { self->stopUsingPipette(); -- cgit v1.2.3 From 9c3c8450a64cd644966f3242af0a2dbde0eacab9 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 27 Aug 2019 17:40:33 +0300 Subject: SL-11782 FIXED Light is still visible when it's out of the draw distance --- indra/newview/pipeline.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index bd73c234a6..a5f99676b4 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8686,7 +8686,8 @@ void LLPipeline::renderDeferredLighting() const LLViewerObject *vobj = drawablep->getVObj(); if(vobj && vobj->getAvatar() - && (vobj->getAvatar()->isTooComplex() || vobj->getAvatar()->isInMuteList())) + && (vobj->getAvatar()->isTooComplex() || vobj->getAvatar()->isInMuteList()) + || (vobj && dist_vec(vobj->getPosition(), LLViewerCamera::getInstance()->getOrigin()) > RenderFarClip)) { continue; } -- cgit v1.2.3 From 2cd01c8e92e2ecf4402a3a075ec8bdc6a8f20470 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 27 Aug 2019 08:59:48 -0700 Subject: Move decl of statics inside func to appease Clang, maybe. --- indra/newview/lltexturectrl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 395e83a036..e0ae8aaacb 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -73,10 +73,6 @@ #include "llavatarappearancedefines.h" -static const F32 CONTEXT_CONE_IN_ALPHA = 0.0f; -static const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; -static const F32 CONTEXT_FADE_TIME = 0.08f; - static const S32 LOCAL_TRACKING_ID_COLUMN = 1; //static const char CURRENT_IMAGE_NAME[] = "Current Texture"; @@ -442,6 +438,10 @@ BOOL LLFloaterTexturePicker::postBuild() // virtual void LLFloaterTexturePicker::draw() { + static const F32 CONTEXT_CONE_IN_ALPHA = 0.0f; + static const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; + static const F32 CONTEXT_FADE_TIME = 0.08f; + if (mOwner) { // draw cone of context pointing back to texture swatch -- cgit v1.2.3 From b660db7324387e2fcc55312e2c4f05897ca2c0eb Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 27 Aug 2019 19:21:05 +0200 Subject: Merge fix --- indra/newview/lltexturectrl.cpp | 59 ++--------------------------------------- 1 file changed, 2 insertions(+), 57 deletions(-) (limited to 'indra') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index e0ae8aaacb..ab7d1b26ed 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -438,63 +438,8 @@ BOOL LLFloaterTexturePicker::postBuild() // virtual void LLFloaterTexturePicker::draw() { - static const F32 CONTEXT_CONE_IN_ALPHA = 0.0f; - static const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; - static const F32 CONTEXT_FADE_TIME = 0.08f; - - if (mOwner) - { - // draw cone of context pointing back to texture swatch - LLRect owner_rect; - mOwner->localRectToOtherView(mOwner->getLocalRect(), &owner_rect, this); - LLRect local_rect = getLocalRect(); - if (gFocusMgr.childHasKeyboardFocus(this) && mOwner->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - } - gGL.end(); - } - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } + static LLCachedControl max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, mOwner); updateImageStats(); -- cgit v1.2.3 From ad26896a1086536cf47d3cb0041b0410aebf2119 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 27 Aug 2019 12:49:18 -0700 Subject: SL-11055 Remedy cloud_shadow and hack halving being done twice to ambient in some cases (i.e. artificial dimunition of necessary bullshit factor). --- indra/llinventory/llsettingsbase.h | 2 +- indra/llinventory/llsettingssky.cpp | 20 ++----------- indra/newview/llsettingsvo.cpp | 56 ++++++++++++++++--------------------- indra/newview/llsettingsvo.h | 8 +++--- indra/newview/pipeline.cpp | 19 ++++++------- 5 files changed, 41 insertions(+), 64 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 8b969d81a6..26e2901968 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -353,7 +353,7 @@ protected: virtual validation_list_t getValidationList() const = 0; // Apply any settings that need special handling. - virtual void applySpecial(void *) { }; + virtual void applySpecial(void *, bool force = false) { }; virtual parammapping_t getParameterMap() const { return parammapping_t(); } diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 9bbeb00efe..c4ce3af157 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1326,26 +1326,13 @@ void LLSettingsSky::calculateLightSettings() const componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); componentMultBy(sunlight, light_transmittance); - //F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); - //if (max_color > 1.0f) - //{ - // sunlight *= 1.0f/max_color; - //} - //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; - componentMultBy(tmpAmbient, light_transmittance); - - //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f); - //max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]); - //if (max_color > 1.0f) - //{ - // tmpAmbient *= 1.0f/max_color; - //} //brightness of surface both sunlight and ambient mSunDiffuse = sunlight; mSunAmbient = tmpAmbient; + F32 haze_horizon = getHazeHorizon(); sunlight *= 1.0 - cloud_shadow; @@ -1360,12 +1347,11 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - //clampColor(moonlight, getGamma(), 1.0f); mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; - mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; + mMoonAmbient = moonlight_b * 0.0125f; - mTotalAmbient = mSunAmbient; + mTotalAmbient = ambient; } LLUUID LLSettingsSky::GetDefaultAssetId() diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 11bb732be8..bbee94287d 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -663,7 +663,7 @@ void LLSettingsVOSky::updateSettings() gSky.setMoonScale(getMoonScale()); } -void LLSettingsVOSky::applySpecial(void *ptarget) +void LLSettingsVOSky::applySpecial(void *ptarget, bool force) { LLGLSLShader *shader = (LLGLSLShader *)ptarget; @@ -671,46 +671,38 @@ void LLSettingsVOSky::applySpecial(void *ptarget) if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT) { - shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); - shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); + shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); + shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); } else if (shader->mShaderGroup == LLGLSLShader::SG_SKY) { - shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); + shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); - LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]); - vect_c_p_d1 += LLVector4(LLEnvironment::instance().getCloudScrollDelta()); - shader->uniform4fv(LLShaderMgr::CLOUD_POS_DENSITY1, 1, vect_c_p_d1.mV); + LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]); + vect_c_p_d1 += LLVector4(LLEnvironment::instance().getCloudScrollDelta()); + shader->uniform4fv(LLShaderMgr::CLOUD_POS_DENSITY1, 1, vect_c_p_d1.mV); - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - LLColor4 sunDiffuse = psky->getSunlightColor(); - LLColor4 moonDiffuse = psky->getMoonlightColor(); + LLColor4 sunDiffuse = psky->getSunlightColor(); + LLColor4 moonDiffuse = psky->getMoonlightColor(); - F32 max_color = llmax(sunDiffuse.mV[0], sunDiffuse.mV[1], sunDiffuse.mV[2]); - if (max_color > 1.f) - { - sunDiffuse *= 1.f/max_color; - } - sunDiffuse.clamp(); - - max_color = llmax(moonDiffuse.mV[0], moonDiffuse.mV[1], moonDiffuse.mV[2]); - if (max_color > 1.f) - { - moonDiffuse *= 1.f/max_color; - } - moonDiffuse.clamp(); + shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, sunDiffuse.mV); + shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, moonDiffuse.mV); - shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, sunDiffuse.mV); - shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, moonDiffuse.mV); - - LLColor4 cloud_color(psky->getCloudColor(), 1.0); - shader->uniform4fv(LLShaderMgr::CLOUD_COLOR, 1, cloud_color.mV); + LLColor4 cloud_color(psky->getCloudColor(), 1.0); + shader->uniform4fv(LLShaderMgr::CLOUD_COLOR, 1, cloud_color.mV); } - - shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, mSceneLightStrength); + + LLColor4 ambient(getTotalAmbient()); + shader->uniform4fv(LLShaderMgr::AMBIENT, 1, ambient.mV); + + shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, getIsSunUp() ? 1 : 0); + shader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, getSunMoonGlowFactor()); + shader->uniform1f(LLShaderMgr::DENSITY_MULTIPLIER, getDensityMultiplier()); + shader->uniform1f(LLShaderMgr::DISTANCE_MULTIPLIER, getDistanceMultiplier()); F32 g = getGamma(); F32 display_gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma"); @@ -904,13 +896,13 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater) } //------------------------------------------------------------------------- //------------------------------------------------------------------------- -void LLSettingsVOWater::applySpecial(void *ptarget) +void LLSettingsVOWater::applySpecial(void *ptarget, bool force) { LLGLSLShader *shader = (LLGLSLShader *)ptarget; LLEnvironment& env = LLEnvironment::instance(); - if (shader->mShaderGroup == LLGLSLShader::SG_WATER) + if (force || (shader->mShaderGroup == LLGLSLShader::SG_WATER)) { F32 water_height = env.getWaterHeight(); diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h index 6f105c9d61..1f29013ecf 100644 --- a/indra/newview/llsettingsvo.h +++ b/indra/newview/llsettingsvo.h @@ -102,7 +102,7 @@ public: bool isAdvanced() const { return m_isAdvanced; } - virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader); } + virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader, true); } protected: LLSettingsVOSky(); @@ -112,7 +112,7 @@ protected: virtual void updateSettings() override; - virtual void applySpecial(void *) override; + virtual void applySpecial(void *, bool) override; virtual parammapping_t getParameterMap() const override; @@ -136,13 +136,13 @@ public: static LLSD convertToLegacy(const ptr_t &); - virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader); } + virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader, true); } protected: LLSettingsVOWater(); virtual void updateSettings() override; - virtual void applySpecial(void *) override; + virtual void applySpecial(void *, bool) override; virtual parammapping_t getParameterMap() const override; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 7048b921b0..33847b097b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -116,6 +116,7 @@ #include "llcleanup.h" #include "llenvironment.h" +#include "llsettingsvo.h" #ifdef _DEBUG // Debug indices is disabled for now for debug performance - djs 4/24/02 @@ -8424,21 +8425,19 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff); shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff); - shader.uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV); - shader.uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV); - - - LLEnvironment& environment = LLEnvironment::instance(); - LLColor4 ambient(environment.getCurrentSky()->getTotalAmbient()); - shader.uniform4fv(LLShaderMgr::AMBIENT, 1, ambient.mV); - shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); - shader.uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, environment.getCurrentSky()->getSunMoonGlowFactor()); - if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0) { glh::matrix4f norm_mat = get_current_modelview().inverse().transpose(); shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m); } + + shader.uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV); + shader.uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV); + + LLEnvironment& environment = LLEnvironment::instance(); + LLSettingsSky::ptr_t sky = environment.getCurrentSky(); + + static_cast(sky.get())->updateShader(&shader); } LLColor3 pow3f(LLColor3 v, F32 f) -- cgit v1.2.3 From 24537889fb444315b4074195f25d91919fbea36f Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 27 Aug 2019 13:05:04 -0700 Subject: SL-11550 Restore mul by light_transmittance in CPU version of atmospherics. --- indra/newview/lllegacyatmospherics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index a1093df7e1..13d5eb96c4 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -329,7 +329,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars) temp2.mV[1] = 1.f / temp2.mV[1]; componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1])); - //componentMultBy(sunlight, light_transmittance); + componentMultBy(sunlight, light_transmittance); // Distance temp2.mV[2] = Plen * density_multiplier; @@ -445,8 +445,8 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) vars.distance_multiplier = psky->getDistanceMultiplier(); vars.max_y = psky->getMaxY(); vars.sun_norm = LLEnvironment::instance().getSunDirectionCFR(); - vars.sunlight = psky->getSunlightColorClamped(); - vars.ambient = psky->getAmbientColorClamped(); + vars.sunlight = psky->getSunlightColor(); + vars.ambient = psky->getAmbientColor(); vars.glow = psky->getGlow(); vars.cloud_shadow = psky->getCloudShadow(); vars.dome_radius = psky->getDomeRadius(); -- cgit v1.2.3 From e2a84c9d105b90836cb85aa03a16f36f77604cb0 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 27 Aug 2019 13:17:26 -0700 Subject: SL-11519 Remove code for fixing 11370. We *do* want objects in distortion map in Low-Mid after all. --- indra/newview/pipeline.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 33847b097b..99d11b7104 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9495,14 +9495,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) clip_plane.disable(); } - // SL-11370 prevent Low/Low-Mid graphics from rendering distortion map contents it should not - if (!canUseWindLightShaders()) - { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); - clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, END_RENDER_TYPES); - clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); - } - updateCull(camera, mRefractedObjects, water_clip, &plane); stateSort(camera, mRefractedObjects); renderGeom(camera); -- cgit v1.2.3 From e5879090a72cfb3139b6c6734f4a823ef54dfbf4 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 28 Aug 2019 11:17:01 +0300 Subject: SL-11795 Rename Load/Clone/Clear buttons --- .../skins/default/xui/en/floater_edit_ext_day_cycle.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml index 4332e0565b..18ab69bd5e 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml @@ -287,24 +287,24 @@ - - - + left_pad="2" + name="buttons_panel" + top="22" + width="212"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml index 5b2cbee914..3826ead5c2 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml @@ -1,10 +1,10 @@ @@ -113,28 +113,4 @@ - - - diff --git a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml index a9cda26f0b..178ecad0f3 100644 --- a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml +++ b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml @@ -1,51 +1,71 @@ + width="280"> Save Graphic Preset Save Camera Preset - - Save + Replace + - Type a name for the preset or choose an existing preset. - + top="15" + width="150" + name="radio_save_preset"> + + + + - diff --git a/indra/newview/skins/default/xui/en/panel_preferences_view.xml b/indra/newview/skins/default/xui/en/panel_preferences_view.xml deleted file mode 100644 index a7a69eb829..0000000000 --- a/indra/newview/skins/default/xui/en/panel_preferences_view.xml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - Preset in use: - - - - (None) - - - - - - Automatic position for: - - - - - - - - - - - - - - - -- cgit v1.2.3 From bf5ee32838b9d4c53ff1ab709e2935d8d0b4ec0b Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 8 Nov 2019 16:47:11 +0200 Subject: SL-12186 WIP Add new icons --- .../skins/default/textures/icons/Presets_Icon.png | Bin 0 -> 1293 bytes indra/newview/skins/default/textures/textures.xml | 2 ++ .../newview/skins/default/textures/windows/Icon_Gear.png | Bin 0 -> 6229 bytes indra/newview/skins/default/xui/en/panel_status_bar.xml | 10 +++++----- 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 indra/newview/skins/default/textures/icons/Presets_Icon.png create mode 100644 indra/newview/skins/default/textures/windows/Icon_Gear.png (limited to 'indra') diff --git a/indra/newview/skins/default/textures/icons/Presets_Icon.png b/indra/newview/skins/default/textures/icons/Presets_Icon.png new file mode 100644 index 0000000000..503ee892a5 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Presets_Icon.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 40f1d8b88f..b086f7dfa8 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -206,6 +206,7 @@ with the same filename but different name + @@ -256,6 +257,7 @@ with the same filename but different name + diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear.png b/indra/newview/skins/default/textures/windows/Icon_Gear.png new file mode 100644 index 0000000000..e1e89b8f32 Binary files /dev/null and b/indra/newview/skins/default/textures/windows/Icon_Gear.png differ diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index ffcfc3ae91..ada980cda1 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -148,19 +148,19 @@ + width="16" /> + + -- cgit v1.2.3 From 4aa9dfec746f28696a195fe81aed9b6ef0791954 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Sun, 10 Nov 2019 15:18:01 +0200 Subject: SL-9699 Fixed tooltip warning --- indra/newview/skins/default/xui/en/floater_forget_user.xml | 2 +- indra/newview/skins/default/xui/en/panel_login.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_forget_user.xml b/indra/newview/skins/default/xui/en/floater_forget_user.xml index f2e894733f..0673901a96 100644 --- a/indra/newview/skins/default/xui/en/floater_forget_user.xml +++ b/indra/newview/skins/default/xui/en/floater_forget_user.xml @@ -36,5 +36,5 @@ top_pad="5" width="260" initial_value="1" - tooltip="Deletes local files: chat history, last session screenshot, browser cookies, teleport history, toolbar settings, e t c"/> + tool_tip="Deletes local files: chat history, last session screenshot, browser cookies, teleport history, toolbar settings, e t c"/> diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index d601b36ce5..873f03aae9 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -137,7 +137,7 @@ label="Remember me" check_button.bottom="3" name="remember_name" - tooltip="Already recorded user can be forgotten from preferences." + tool_tip="Already recorded user can be forgotten from preferences." width="145" /> Date: Tue, 12 Nov 2019 04:21:49 +0200 Subject: Post-merge fixes --- indra/newview/llviewermedia.h | 1 + indra/newview/llviewerparcelmediaautoplay.cpp | 2 +- indra/newview/llviewerwindow.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 2b604d3a7a..9467a138f0 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -79,6 +79,7 @@ class LLViewerMedia: public LLSingleton public: // String to get/set media autoplay in gSavedSettings + static const char* AUTO_PLAY_MEDIA_SETTING; static const char* SHOW_MEDIA_ON_OTHERS_SETTING; static const char* SHOW_MEDIA_WITHIN_PARCEL_SETTING; static const char* SHOW_MEDIA_OUTSIDE_PARCEL_SETTING; diff --git a/indra/newview/llviewerparcelmediaautoplay.cpp b/indra/newview/llviewerparcelmediaautoplay.cpp index 54d9804b9c..36c7d436f6 100644 --- a/indra/newview/llviewerparcelmediaautoplay.cpp +++ b/indra/newview/llviewerparcelmediaautoplay.cpp @@ -169,7 +169,7 @@ void LLViewerParcelMediaAutoPlay::onStartMusicResponse(const LLUUID ®ion_id, // make sure we are still there if (parcel->getLocalID() == parcel_id && gAgent.getRegion()->getRegionID() == region_id) { - LLViewerParcelMedia::play(parcel); + LLViewerParcelMedia::getInstance()->play(parcel); } } } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 3b0acf81e0..f4c2e93a45 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -3009,7 +3009,7 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) void LLViewerWindow::handleScrollHWheel(S32 clicks) { - LLUI::resetMouseIdleTimer(); + LLUI::getInstance()->resetMouseIdleTimer(); LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); if (mouse_captor) -- cgit v1.2.3 From ac0bbba7a554834f763a0ffcd03fd25897bc374e Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 12 Nov 2019 11:45:39 +0200 Subject: SL-9699 Updated tooltip and initial checkbox value --- indra/newview/llfloaterforgetuser.cpp | 4 +++- indra/newview/skins/default/xui/en/floater_forget_user.xml | 1 - indra/newview/skins/default/xui/en/panel_login.xml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterforgetuser.cpp b/indra/newview/llfloaterforgetuser.cpp index 5659cb2f79..55e25ace9a 100644 --- a/indra/newview/llfloaterforgetuser.cpp +++ b/indra/newview/llfloaterforgetuser.cpp @@ -99,7 +99,9 @@ BOOL LLFloaterForgetUser::postBuild() } bool enable_button = scroll_list->getFirstSelectedIndex() != -1; - getChild("delete_data")->setEnabled(enable_button); + LLCheckBoxCtrl *chk_box = getChild("delete_data"); + chk_box->setEnabled(enable_button); + chk_box->set(FALSE); LLButton *button = getChild("forget"); button->setEnabled(enable_button); button->setCommitCallback(boost::bind(&LLFloaterForgetUser::onForgetClicked, this)); diff --git a/indra/newview/skins/default/xui/en/floater_forget_user.xml b/indra/newview/skins/default/xui/en/floater_forget_user.xml index 0673901a96..86228d49ee 100644 --- a/indra/newview/skins/default/xui/en/floater_forget_user.xml +++ b/indra/newview/skins/default/xui/en/floater_forget_user.xml @@ -35,6 +35,5 @@ name="delete_data" top_pad="5" width="260" - initial_value="1" tool_tip="Deletes local files: chat history, last session screenshot, browser cookies, teleport history, toolbar settings, e t c"/> diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 873f03aae9..766406e1d8 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -137,7 +137,7 @@ label="Remember me" check_button.bottom="3" name="remember_name" - tool_tip="Already recorded user can be forgotten from preferences." + tool_tip="Already remembered user can be forgotten from Me > Preferences > Advanced > Remembered Usernames." width="145" /> Date: Tue, 12 Nov 2019 16:07:36 +0200 Subject: Fix instance existance check --- indra/llrender/llrender2dutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 4eb0203245..801b945806 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -1650,7 +1650,7 @@ LLPointer LLRender2D::getUIImage(const std::string& name, S32 priorit // static void LLRender2D::resetProvider() { - if (LLRender2D::instanceExists) + if (LLRender2D::instanceExists()) { LLRender2D::getInstance()->mImageProvider = NULL; } -- cgit v1.2.3 From 382c1845012cc4e2be78a5a03334b4157a732349 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 12 Nov 2019 16:26:34 +0200 Subject: SL-12186 WIP Added ability to reset default presets and updated item list in 'My camera presets' floater --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llfloatercamera.cpp | 7 ++- indra/newview/llfloatercamerapresets.cpp | 32 ++++++++++- indra/newview/llfloatercamerapresets.h | 4 ++ indra/newview/llpresetsmanager.cpp | 65 ++++++++++++++++++++-- indra/newview/llpresetsmanager.h | 9 +++ .../default/xui/en/panel_camera_preset_item.xml | 20 +++++++ 7 files changed, 126 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f44185340a..04ab620b3a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1565,7 +1565,7 @@ CameraPreset Comment - Preset camera position - view (0 - rear, 1 - front, 2 - group) + Preset camera position - view (0 - rear, 1 - front, 2 - group, 3 - custom) Persist 1 Type diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 2f85e7db34..47f05884b3 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -550,17 +550,17 @@ void LLFloaterCamera::switchToPreset(const std::string& name) if ("rear_view" == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); - LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_REAR); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_REAR_VIEW); } else if ("group_view" == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW); - LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_SIDE); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_SIDE_VIEW); } else if ("front_view" == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW); - LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_FRONT); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_FRONT_VIEW); } } @@ -590,6 +590,7 @@ void LLFloaterCamera::populatePresetCombo() { mPresetCombo->setLabel(getString("inactive_combo_text")); } + updateItemsSelection(); } void LLFloaterCamera::onSavePreset() diff --git a/indra/newview/llfloatercamerapresets.cpp b/indra/newview/llfloatercamerapresets.cpp index 6a9df5d067..75660e590a 100644 --- a/indra/newview/llfloatercamerapresets.cpp +++ b/indra/newview/llfloatercamerapresets.cpp @@ -58,7 +58,10 @@ void LLFloaterCameraPresets::populateList() std::string presets_dir = presetsMgr->getPresetsDir(PRESETS_CAMERA); std::list preset_names; - presetsMgr->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_TOP); + presetsMgr->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_VIEWS_HIDE); + preset_names.push_back(PRESETS_FRONT_VIEW); + preset_names.push_back(PRESETS_REAR_VIEW); + preset_names.push_back(PRESETS_SIDE_VIEW); for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) { const std::string& name = *it; @@ -86,10 +89,10 @@ LLCameraPresetFlatItem::~LLCameraPresetFlatItem() BOOL LLCameraPresetFlatItem::postBuild() { mDeleteBtn = getChild("delete_btn"); - mDeleteBtn->setVisible(!mIsDefaultPrest); + mDeleteBtn->setVisible(false); mResetBtn = getChild("reset_btn"); - mResetBtn->setVisible(mIsDefaultPrest); + mResetBtn->setVisible(false); LLStyle::Params style; LLTextBox* name_text = getChild("preset_name"); @@ -102,6 +105,29 @@ BOOL LLCameraPresetFlatItem::postBuild() return true; } +void LLCameraPresetFlatItem::onMouseEnter(S32 x, S32 y, MASK mask) +{ + mDeleteBtn->setVisible(!mIsDefaultPrest); + mResetBtn->setVisible(mIsDefaultPrest); + getChildView("hovered_icon")->setVisible(true); + LLPanel::onMouseEnter(x, y, mask); +} + +void LLCameraPresetFlatItem::onMouseLeave(S32 x, S32 y, MASK mask) +{ + mDeleteBtn->setVisible(false); + mResetBtn->setVisible(false); + getChildView("hovered_icon")->setVisible(false); + LLPanel::onMouseLeave(x, y, mask); +} + +void LLCameraPresetFlatItem::setValue(const LLSD& value) +{ + if (!value.isMap()) return;; + if (!value.has("selected")) return; + getChildView("selected_icon")->setVisible(value["selected"]); +} + void LLCameraPresetFlatItem::onDeleteBtnClick() { if (!LLPresetsManager::getInstance()->deletePreset(PRESETS_CAMERA, mPresetName)) diff --git a/indra/newview/llfloatercamerapresets.h b/indra/newview/llfloatercamerapresets.h index 8c293c57de..66430fa399 100644 --- a/indra/newview/llfloatercamerapresets.h +++ b/indra/newview/llfloatercamerapresets.h @@ -52,7 +52,11 @@ public: LLCameraPresetFlatItem(const std::string &preset_name, bool is_default); virtual ~LLCameraPresetFlatItem(); + void setValue(const LLSD& value); + virtual BOOL postBuild(); + virtual void onMouseEnter(S32 x, S32 y, MASK mask); + virtual void onMouseLeave(S32 x, S32 y, MASK mask); private: void onDeleteBtnClick(); diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index ab4f60d486..057f60a015 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -65,7 +65,13 @@ void LLPresetsManager::createMissingDefault(const std::string& subdirectory) { if(gDirUtilp->getLindenUserDir().empty()) { -return; + return; + } + + if (PRESETS_CAMERA == subdirectory) + { + createCameraDefaultPresets(); + return; } std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, @@ -83,6 +89,13 @@ return; } } +void LLPresetsManager::createCameraDefaultPresets() +{ + createDefaultCameraPreset(PRESETS_REAR_VIEW); + createDefaultCameraPreset(PRESETS_FRONT_VIEW); + createDefaultCameraPreset(PRESETS_SIDE_VIEW); +} + void LLPresetsManager::startWatching(const std::string& subdirectory) { if (PRESETS_CAMERA == subdirectory) @@ -163,6 +176,10 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true)); LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL; + if (isTemplateCameraPreset(name)) + { + continue; + } if (default_option == DEFAULT_VIEWS_HIDE) { if (isDefaultCameraPreset(name)) @@ -198,6 +215,7 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam } bool LLPresetsManager::mCameraDirty = false; +bool LLPresetsManager::mIgnoreChangedSignal = false; void LLPresetsManager::setCameraDirty(bool dirty) { @@ -215,7 +233,7 @@ void LLPresetsManager::settingChanged() static LLCachedControl preset_camera_active(gSavedSettings, "PresetCameraActive", ""); std::string preset_name = preset_camera_active; - if (!preset_name.empty()) + if (!preset_name.empty() && !mIgnoreChangedSignal) { gSavedSettings.setString("PresetCameraActive", ""); @@ -267,6 +285,12 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n return false; } + if (isTemplateCameraPreset(name)) + { + LL_WARNS() << "Should not overwrite template presets" << LL_ENDL; + return false; + } + bool saved = false; std::vector name_list; @@ -434,8 +458,10 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, std::string n LL_DEBUGS() << "attempting to load preset '"< 0) { + mIgnoreChangedSignal = false; if(PRESETS_GRAPHIC == subdirectory) { gSavedSettings.setString("PresetGraphicActive", name); @@ -453,10 +479,11 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, std::string n triggerChangeCameraSignal(); } } - else - { - LL_WARNS("Presets") << "failed to load preset '"<getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, + PRESETS_CAMERA, LLURI::escape(preset_name) + ".xml"); + if (!gDirUtilp->fileExists(preset_file) || force_reset) + { + std::string template_name = preset_name.substr(0, preset_name.size() - PRESETS_VIEW_SUFFIX.size()); + std::string default_template_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, + PRESETS_CAMERA, template_name + ".xml"); + LLFile::copy(default_template_file, preset_file); + } } boost::signals2::connection LLPresetsManager::setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb) diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 9964cc0fcf..d489a0ad5a 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -39,6 +39,10 @@ static const std::string PRESETS_CAMERA = "camera"; static const std::string PRESETS_REAR = "Rear"; static const std::string PRESETS_FRONT = "Front"; static const std::string PRESETS_SIDE = "Side"; +static const std::string PRESETS_VIEW_SUFFIX = " View"; +static const std::string PRESETS_REAR_VIEW = PRESETS_REAR + PRESETS_VIEW_SUFFIX; +static const std::string PRESETS_FRONT_VIEW = PRESETS_FRONT + PRESETS_VIEW_SUFFIX; +static const std::string PRESETS_SIDE_VIEW = PRESETS_SIDE + PRESETS_VIEW_SUFFIX; enum EDefaultOptions { @@ -71,8 +75,12 @@ public: bool isCameraDirty(); static void setCameraDirty(bool dirty); + void createCameraDefaultPresets(); + + bool isTemplateCameraPreset(std::string preset_name); bool isDefaultCameraPreset(std::string preset_name); void resetCameraPreset(std::string preset_name); + void createDefaultCameraPreset(std::string preset_name, bool force_reset = false); // Emitted when a preset gets loaded, deleted, or saved. boost::signals2::connection setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb); @@ -95,6 +103,7 @@ public: boost::signals2::connection mCameraChangedSignal; static bool mCameraDirty; + static bool mIgnoreChangedSignal; }; #endif // LL_PRESETSMANAGER_H diff --git a/indra/newview/skins/default/xui/en/panel_camera_preset_item.xml b/indra/newview/skins/default/xui/en/panel_camera_preset_item.xml index 187f5889eb..9417ab4ac2 100644 --- a/indra/newview/skins/default/xui/en/panel_camera_preset_item.xml +++ b/indra/newview/skins/default/xui/en/panel_camera_preset_item.xml @@ -7,6 +7,26 @@ name="camera_preset_item" top="0" width="280"> + + Date: Tue, 12 Nov 2019 22:26:10 +0000 Subject: SL-10498 - benefits info received at login, persisted in new LLAgentBenefits singleton. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llagentbenefits.cpp | 112 ++++++++++++++++++++++++++++++++++++++ indra/newview/llagentbenefits.h | 57 +++++++++++++++++++ indra/newview/llstartup.cpp | 7 +++ 4 files changed, 178 insertions(+) create mode 100644 indra/newview/llagentbenefits.cpp create mode 100644 indra/newview/llagentbenefits.h (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 694e89ab99..5423ddb684 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -115,6 +115,7 @@ set(viewer_SOURCE_FILES llaisapi.cpp llagent.cpp llagentaccess.cpp + llagentbenefits.cpp llagentcamera.cpp llagentdata.cpp llagentlanguage.cpp @@ -739,6 +740,7 @@ set(viewer_HEADER_FILES llaisapi.h llagent.h llagentaccess.h + llagentbenefits.h llagentcamera.h llagentdata.h llagentlanguage.h diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp new file mode 100644 index 0000000000..724b2e1dc1 --- /dev/null +++ b/indra/newview/llagentbenefits.cpp @@ -0,0 +1,112 @@ +/** +* @file llagentbenefits.cpp +* +* $LicenseInfo:firstyear=2019&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2019, 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 "llagentbenefits.h" + +LLAgentBenefits::LLAgentBenefits() +{ +} + +LLAgentBenefits::~LLAgentBenefits() +{ +} + +// This could be extended to a template scheme or otherwise modified +// to support other types, if and when needed. Currently all fields +// the viewer cares about are integer. +bool get_required_S32(const LLSD& sd, const LLSD::String& key, S32& value) +{ + value = -1; + if (sd.has(key)) + { + value = sd[key].asInteger(); + return true; + } + + LL_WARNS("Benefits") << "Missing required benefit field " << key << LL_ENDL; + return false; +} + +bool LLAgentBenefits::init(const LLSD& benefits_sd) +{ + LL_DEBUGS("Benefits") << "initializing benefits from " << benefits_sd << LL_ENDL; + + if (!get_required_S32(benefits_sd, "animated_object_limit", m_animated_object_limit)) + { + return false; + } + if (!get_required_S32(benefits_sd, "animation_upload_cost", m_animation_upload_cost)) + { + return false; + } + if (!get_required_S32(benefits_sd, "attachment_limit", m_attachment_limit)) + { + return false; + } + if (!get_required_S32(benefits_sd, "group_membership_limit", m_group_membership_limit)) + { + return false; + } + if (!get_required_S32(benefits_sd, "sound_upload_cost", m_sound_upload_cost)) + { + return false; + } + if (!get_required_S32(benefits_sd, "texture_upload_cost", m_texture_upload_cost)) + { + return false; + } + return true; +} + +S32 LLAgentBenefits::getAnimatedObjectLimit() const +{ + return m_animated_object_limit; +} + +S32 LLAgentBenefits::getAnimationUploadCost() const +{ + return m_animation_upload_cost; +} + +S32 LLAgentBenefits::getAttachmentLimit() const +{ + return m_attachment_limit; +} + +S32 LLAgentBenefits::getGroupMembershipLimit() const +{ + return m_group_membership_limit; +} + +S32 LLAgentBenefits::getSoundUploadCost() const +{ + return m_sound_upload_cost; +} + +S32 LLAgentBenefits::getTextureUploadCost() const +{ + return m_texture_upload_cost; +} diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h new file mode 100644 index 0000000000..0a8e33af28 --- /dev/null +++ b/indra/newview/llagentbenefits.h @@ -0,0 +1,57 @@ +/** +* @file llagentbenefits.h +* +* $LicenseInfo:firstyear=2019&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2019, 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_AGENTBENEFITS_H +#define LL_AGENTBENEFITS_H + +#include "llsingleton.h" +#include "llsd.h" + +class LLAgentBenefits: public LLSingleton +{ + LLSINGLETON(LLAgentBenefits); + ~LLAgentBenefits(); + LOG_CLASS(LLAgentBenefits); + +public: + bool init(const LLSD& benefits_sd); + + S32 getAnimatedObjectLimit() const; + S32 getAnimationUploadCost() const; + S32 getAttachmentLimit() const; + S32 getGroupMembershipLimit() const; + S32 getSoundUploadCost() const; + S32 getTextureUploadCost() const; + +private: + S32 m_animated_object_limit; + S32 m_animation_upload_cost; + S32 m_attachment_limit; + S32 m_group_membership_limit; + S32 m_sound_upload_cost; + S32 m_texture_upload_cost; +}; + +#endif diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index c8c39ae00f..73e8d3cf5f 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -88,6 +88,7 @@ #include "v3math.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentpicksinfo.h" #include "llagentwearables.h" @@ -3258,6 +3259,12 @@ bool process_login_success_response() { LLSD response = LLLoginInstance::getInstance()->getResponse(); + //LL_INFOS() << "login success response:" << ll_pretty_print_sd(response) << LL_ENDL; + if (!LLAgentBenefits::instance().init(response["account_level_benefits"])) + { + LL_ERRS() << "Benefits error" << LL_ENDL; + } + std::string text(response["udp_blacklist"]); if(!text.empty()) { -- cgit v1.2.3 From f9fdae67789c87ad2a6a062570236b5140ccc112 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 13 Nov 2019 12:56:07 +0200 Subject: SL-9699 Field should be populated as long as there is data, regardless of 'remember password' --- indra/newview/llpanellogin.cpp | 25 ++++++++++--------------- indra/newview/llpanellogin.h | 4 ++-- 2 files changed, 12 insertions(+), 17 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index d7c189271e..4f050a9748 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -554,12 +554,12 @@ void LLPanelLogin::populateFields(LLPointer credential, bool remem if (sInstance->mFirstLoginThisInstall) { // no list to populate - setFields(credential, remember_psswrd); + setFields(credential); } else { sInstance->getChild("remember_name")->setValue(remember_user); - sInstance->populateUserList(credential, remember_psswrd); + sInstance->populateUserList(credential); remember_check->setEnabled(remember_user); } } @@ -580,16 +580,13 @@ void LLPanelLogin::resetFields() } else { - LLUICtrl* remember_check = sInstance->getChild("remember_check"); - bool remember_psswrd = remember_check->getValue(); LLPointer cred = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); - sInstance->populateUserList(cred, remember_psswrd); + sInstance->populateUserList(cred); } } // static -void LLPanelLogin::setFields(LLPointer credential, - bool remember_psswrd) +void LLPanelLogin::setFields(LLPointer credential) { if (!sInstance) { @@ -631,7 +628,7 @@ void LLPanelLogin::setFields(LLPointer credential, LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL; if(authenticator.isMap() && authenticator.has("secret") && - (authenticator["secret"].asString().size() > 0) && remember_psswrd) + (authenticator["secret"].asString().size() > 0)) { // This is a MD5 hex digest of a password. @@ -1096,8 +1093,7 @@ void LLPanelLogin::onUserListCommit(void*) { std::string user_key = username_combo->getSelectedValue(); LLPointer cred = gSecAPIHandler->loadFromCredentialMap("login_list", LLGridManager::getInstance()->getGrid(), user_key); - bool remember_psswrd = sInstance->getChild("remember_check")->getValue(); - setFields(cred, remember_psswrd); + setFields(cred); sInstance->mPasswordModified = false; } else @@ -1156,10 +1152,9 @@ void LLPanelLogin::updateServer() if(!sInstance->areCredentialFieldsDirty()) { // populate dropbox and setFields - bool remember_psswrd = sInstance->getChild("remember_check")->getValue(); // Note: following call is related to initializeLoginInfo() LLPointer credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); - sInstance->populateUserList(credential, remember_psswrd); + sInstance->populateUserList(credential); } // update the login panel links @@ -1198,7 +1193,7 @@ void LLPanelLogin::updateLoginButtons() } } -void LLPanelLogin::populateUserList(LLPointer credential, bool remember_psswrd) +void LLPanelLogin::populateUserList(LLPointer credential) { LLComboBox* user_combo = getChild("username_combo"); user_combo->removeall(); @@ -1228,7 +1223,7 @@ void LLPanelLogin::populateUserList(LLPointer credential, bool rem } else { - setFields(credential, remember_psswrd); + setFields(credential); } } else @@ -1236,7 +1231,7 @@ void LLPanelLogin::populateUserList(LLPointer credential, bool rem if (credential.notNull()) { user_combo->add(LLPanelLogin::getUserName(credential), credential->userID(), ADD_BOTTOM, TRUE); - setFields(credential, remember_psswrd); + setFields(credential); } } } diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 3eb7b68949..c9b8e1b6fc 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -96,7 +96,7 @@ private: void onSelectServer(); void onLocationSLURL(); - static void setFields(LLPointer credential, bool remember_psswrd); + static void setFields(LLPointer credential); static void onClickConnect(void*); static void onClickNewAccount(void*); @@ -113,7 +113,7 @@ private: boost::scoped_ptr mListener; void updateLoginButtons(); - void populateUserList(LLPointer credential, bool remember_psswrd); + void populateUserList(LLPointer credential); void (*mCallback)(S32 option, void *userdata); void* mCallbackData; -- cgit v1.2.3 From 4778417f25f070e9019e975c979d93fb8881b5ac Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 13 Nov 2019 15:55:02 +0200 Subject: SL-12186 WIP Use appropriate offset names when saving presets --- indra/newview/llagentcamera.cpp | 10 ++++ indra/newview/llagentcamera.h | 2 + indra/newview/llpanelpresetscamerapulldown.cpp | 16 +----- indra/newview/llpresetsmanager.cpp | 63 ++++++++++++++++------ .../xui/en/panel_presets_camera_pulldown.xml | 6 +-- 5 files changed, 64 insertions(+), 33 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 3e56c1dd71..882e3cee55 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1948,11 +1948,21 @@ std::string LLAgentCamera::getCameraOffsetCtrlName() return mCameraOffsetInitial[mCameraPreset]->getName(); } +std::string LLAgentCamera::getCameraOffsetCtrlName(ECameraPreset preset) +{ + return mCameraOffsetInitial[preset]->getName(); +} + std::string LLAgentCamera::getFocusOffsetCtrlName() { return mFocusOffsetInitial[mCameraPreset]->getName(); } +std::string LLAgentCamera::getFocusOffsetCtrlName(ECameraPreset preset) +{ + return mFocusOffsetInitial[preset]->getName(); +} + F32 LLAgentCamera::getCameraMaxZoomDistance() { // Ignore "DisableCameraConstraints", we don't want to be out of draw range when we focus onto objects or avatars diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 294e81c2e1..5c8172bbfc 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -118,7 +118,9 @@ public: LLVector3d getFocusOffsetInitial(); std::string getCameraOffsetCtrlName(); + std::string getCameraOffsetCtrlName(ECameraPreset preset); std::string getFocusOffsetCtrlName(); + std::string getFocusOffsetCtrlName(ECameraPreset preset); private: /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */ F32 getCameraMaxZoomDistance(); diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp index 7612c428d9..1ac105e1c8 100644 --- a/indra/newview/llpanelpresetscamerapulldown.cpp +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -52,7 +52,7 @@ LLPanelPresetsCameraPulldown::LLPanelPresetsCameraPulldown() { mHoverTimer.stop(); - mCommitCallbackRegistrar.add("Presets.GoViewPrefs", boost::bind(&LLPanelPresetsCameraPulldown::onViewButtonClick, this, _2)); + mCommitCallbackRegistrar.add("Presets.toggleCameraFloater", boost::bind(&LLPanelPresetsCameraPulldown::onViewButtonClick, this, _2)); mCommitCallbackRegistrar.add("PresetsCamera.RowClick", boost::bind(&LLPanelPresetsCameraPulldown::onRowClick, this, _2)); buildFromFile( "panel_presets_camera_pulldown.xml"); @@ -205,19 +205,7 @@ void LLPanelPresetsCameraPulldown::onViewButtonClick(const LLSD& user_data) // close the minicontrol, we're bringing up the big one setVisible(FALSE); - // bring up the prefs floater - LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences"); - if (prefsfloater) - { - // grab the 'view' panel from the preferences floater and - // bring it the front! - LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); - LLPanel* graphicspanel = prefsfloater->getChild("view"); - if (tabcontainer && graphicspanel) - { - tabcontainer->selectTabPanel(graphicspanel); - } - } + LLFloaterReg::toggleInstanceOrBringToFront("camera"); } //virtual diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 057f60a015..71f0cd72d4 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -275,6 +275,9 @@ void LLPresetsManager::getOffsetControlNames(std::vector& names) bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name, bool createDefault) { + bool IS_CAMERA = (PRESETS_CAMERA == subdirectory); + bool IS_GRAPHIC = (PRESETS_GRAPHIC == subdirectory); + if (LLTrans::getString(PRESETS_DEFAULT) == name) { name = PRESETS_DEFAULT; @@ -294,7 +297,7 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n bool saved = false; std::vector name_list; - if(PRESETS_GRAPHIC == subdirectory) + if (IS_GRAPHIC) { LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); if (instance && !createDefault) @@ -309,11 +312,13 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n LL_WARNS("Presets") << "preferences floater instance not found" << LL_ENDL; } } - else if(PRESETS_CAMERA == subdirectory) + else if (IS_CAMERA) { name_list.clear(); getControlNames(name_list); name_list.push_back("PresetCameraActive"); + name_list.push_back(gAgentCamera.getCameraOffsetCtrlName()); + name_list.push_back(gAgentCamera.getFocusOffsetCtrlName()); } else { @@ -324,7 +329,7 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n LLSD paramsData(LLSD::emptyMap()); // Create a default graphics preset from hw recommended settings - if (createDefault && name == PRESETS_DEFAULT && subdirectory == PRESETS_GRAPHIC) + if (IS_GRAPHIC && createDefault && name == PRESETS_DEFAULT) { paramsData = LLFeatureManager::getInstance()->getRecommendedSettingsMap(); if (gSavedSettings.getU32("RenderAvatarMaxComplexity") == 0) @@ -335,25 +340,47 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n } else { - bool custom_camera_offsets = false; - if (subdirectory == PRESETS_CAMERA) + ECameraPreset new_camera_preset = (ECameraPreset)gSavedSettings.getU32("CameraPreset"); + bool new_camera_offsets = false; + if (IS_CAMERA) { - name_list.push_back(gAgentCamera.getCameraOffsetCtrlName()); - name_list.push_back(gAgentCamera.getFocusOffsetCtrlName()); - custom_camera_offsets = !isDefaultCameraPreset(name); + if (isDefaultCameraPreset(name)) + { + if (PRESETS_REAR_VIEW == name) + { + new_camera_preset = CAMERA_PRESET_REAR_VIEW; + } + else if (PRESETS_SIDE_VIEW == name) + { + new_camera_preset = CAMERA_PRESET_GROUP_VIEW; + } + else if (PRESETS_FRONT_VIEW == name) + { + new_camera_preset = CAMERA_PRESET_FRONT_VIEW; + } + } + else + { + new_camera_preset = CAMERA_PRESET_CUSTOM; + } + new_camera_offsets = (!isDefaultCameraPreset(name) || (ECameraPreset)gSavedSettings.getU32("CameraPreset") != new_camera_preset); } for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) { std::string ctrl_name = *it; std::string dest_ctrl_name = ctrl_name; - if (custom_camera_offsets && ctrl_name == gAgentCamera.getCameraOffsetCtrlName()) - { - dest_ctrl_name = "CameraOffsetCustomPreset"; - } - if (custom_camera_offsets && ctrl_name == gAgentCamera.getFocusOffsetCtrlName()) + if (IS_CAMERA && new_camera_offsets) { - dest_ctrl_name = "FocusOffsetCustomPreset"; + if (ctrl_name == gAgentCamera.getCameraOffsetCtrlName()) + { + dest_ctrl_name = gAgentCamera.getCameraOffsetCtrlName(new_camera_preset); + } + if (ctrl_name == gAgentCamera.getFocusOffsetCtrlName()) + { + dest_ctrl_name = gAgentCamera.getFocusOffsetCtrlName(new_camera_preset); + } } + LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); if (ctrl) { @@ -367,6 +394,10 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n paramsData[dest_ctrl_name]["Value"] = value; } } + if (IS_CAMERA) + { + gSavedSettings.setU32("CameraPreset", new_camera_preset); + } } std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); @@ -385,14 +416,14 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n LL_DEBUGS() << "saved preset '" << name << "'; " << paramsData.size() << " parameters" << LL_ENDL; - if (subdirectory == PRESETS_GRAPHIC) + if (IS_GRAPHIC) { gSavedSettings.setString("PresetGraphicActive", name); // signal interested parties triggerChangeSignal(); } - if (subdirectory == PRESETS_CAMERA) + if (IS_CAMERA) { gSavedSettings.setString("PresetCameraActive", name); setCameraDirty(false); diff --git a/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml b/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml index dc37270751..25d9c47449 100644 --- a/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml +++ b/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml @@ -57,13 +57,13 @@ width="215" /> -- cgit v1.2.3 From b52f8573e454287556e00c1eda4765073e203308 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 13 Nov 2019 16:17:16 +0200 Subject: SL-12272 Ordered Shutdown log spam --- indra/llappearance/llwearabletype.cpp | 17 ++++++++--------- indra/llappearance/llwearabletype.h | 1 - 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/llappearance/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp index 6b7dc41ffd..dc02b5e225 100644 --- a/indra/llappearance/llwearabletype.cpp +++ b/indra/llappearance/llwearabletype.cpp @@ -56,7 +56,7 @@ struct WearableEntry : public LLDictionaryEntry BOOL mAllowMultiwear; }; -class LLWearableDictionary : public LLParamSingleton, +class LLWearableDictionary : public LLSingleton, public LLDictionary { LLSINGLETON(LLWearableDictionary); @@ -64,6 +64,12 @@ class LLWearableDictionary : public LLParamSingleton, LLWearableDictionary::LLWearableDictionary() { + if (!LLWearableType::instanceExists()) + { + // LLWearableType is effectively a wrapper around LLWearableDictionary and is used as storage for LLTranslationBridge + // Todo: consider merging LLWearableType and LLWearableDictionary + LL_WARNS() << "Initing LLWearableDictionary without LLWearableType" << LL_ENDL; + } addEntry(LLWearableType::WT_SHAPE, new WearableEntry("shape", "New Shape", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SHAPE, FALSE, FALSE)); addEntry(LLWearableType::WT_SKIN, new WearableEntry("skin", "New Skin", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SKIN, FALSE, FALSE)); addEntry(LLWearableType::WT_HAIR, new WearableEntry("hair", "New Hair", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_HAIR, FALSE, FALSE)); @@ -92,6 +98,7 @@ LLWearableDictionary::LLWearableDictionary() LLWearableType::LLWearableType(LLTranslationBridge* trans) { + // LLTranslationBridge exists, but is not ready at this point in time since strings.xml is not yet loaded mTrans = trans; } @@ -100,14 +107,6 @@ LLWearableType::~LLWearableType() delete mTrans; } -void LLWearableType::initSingleton() -{ - // To make sure all wrapping functions will crash without initing LLWearableType; - LLWearableDictionary::initParamSingleton(); - - // Todo: consider merging LLWearableType and LLWearableDictionary -} - // static LLWearableType::EType LLWearableType::typeNameToType(const std::string& type_name) { diff --git a/indra/llappearance/llwearabletype.h b/indra/llappearance/llwearabletype.h index 80bb9a10b4..5fe969822a 100644 --- a/indra/llappearance/llwearabletype.h +++ b/indra/llappearance/llwearabletype.h @@ -47,7 +47,6 @@ class LLWearableType : public LLParamSingleton LLSINGLETON(LLWearableType, LLTranslationBridge* trans); ~LLWearableType(); friend struct WearableEntry; - void initSingleton(); public: enum EType { -- cgit v1.2.3 From 7637f343865960ee509ae31205c097f0bb04aac1 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 13 Nov 2019 17:39:40 +0200 Subject: SL-12186 WIP Get rid of excessive offset settings as we moved to store data in xml --- indra/newview/app_settings/camera/Front.xml | 4 +-- indra/newview/app_settings/camera/Side.xml | 4 +-- indra/newview/llagentcamera.cpp | 37 +++------------------ indra/newview/llagentcamera.h | 12 +++---- indra/newview/llfloaterpreferenceviewadvanced.cpp | 4 +-- indra/newview/llpresetsmanager.cpp | 40 ++++------------------- indra/newview/llpresetsmanager.h | 1 - indra/newview/llviewermenu.cpp | 8 ----- 8 files changed, 21 insertions(+), 89 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/camera/Front.xml b/indra/newview/app_settings/camera/Front.xml index a4b5ace33c..cb3380589e 100644 --- a/indra/newview/app_settings/camera/Front.xml +++ b/indra/newview/app_settings/camera/Front.xml @@ -37,7 +37,7 @@ 6 - CameraOffsetFrontView + CameraOffsetRearView Comment Initial camera offset from avatar in Front View @@ -74,7 +74,7 @@ Value 0 - FocusOffsetFrontView + FocusOffsetRearView Comment Initial focus point offset relative to avatar for the camera preset Front View (x-axis is forward) diff --git a/indra/newview/app_settings/camera/Side.xml b/indra/newview/app_settings/camera/Side.xml index 677fd47e20..49582a8a3c 100644 --- a/indra/newview/app_settings/camera/Side.xml +++ b/indra/newview/app_settings/camera/Side.xml @@ -37,7 +37,7 @@ 6 - CameraOffsetGroupView + CameraOffsetRearView Comment Initial camera offset from avatar in Side View @@ -74,7 +74,7 @@ Value 0 - FocusOffsetGroupView + FocusOffsetRearView Comment Initial focus point offset relative to avatar for the camera preset Side View (x-axis is forward) diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 882e3cee55..285a1509cd 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -207,15 +207,8 @@ void LLAgentCamera::init() mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); - mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("CameraOffsetRearView"); - mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("CameraOffsetFrontView"); - mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("CameraOffsetGroupView"); - mCameraOffsetInitial[CAMERA_PRESET_CUSTOM] = gSavedSettings.getControl("CameraOffsetCustomPreset"); - - mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView"); - mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView"); - mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView"); - mFocusOffsetInitial[CAMERA_PRESET_CUSTOM] = gSavedSettings.getControl("FocusOffsetCustomPreset"); + mCameraOffsetInitial = gSavedSettings.getControl("CameraOffsetRearView"); + mFocusOffsetInitial = gSavedSettings.getControl("FocusOffsetRearView"); mCameraCollidePlane.clearVec(); mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); @@ -1603,7 +1596,7 @@ LLVector3d LLAgentCamera::calcThirdPersonFocusOffset() agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); } - focus_offset = convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, ""); + focus_offset = convert_from_llsd(mFocusOffsetInitial->get(), TYPE_VEC3D, ""); return focus_offset * agent_rot; } @@ -1935,32 +1928,12 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) LLVector3 LLAgentCamera::getCameraOffsetInitial() { - return convert_from_llsd(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, ""); + return convert_from_llsd(mCameraOffsetInitial->get(), TYPE_VEC3, ""); } LLVector3d LLAgentCamera::getFocusOffsetInitial() { - return convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, ""); -} - -std::string LLAgentCamera::getCameraOffsetCtrlName() -{ - return mCameraOffsetInitial[mCameraPreset]->getName(); -} - -std::string LLAgentCamera::getCameraOffsetCtrlName(ECameraPreset preset) -{ - return mCameraOffsetInitial[preset]->getName(); -} - -std::string LLAgentCamera::getFocusOffsetCtrlName() -{ - return mFocusOffsetInitial[mCameraPreset]->getName(); -} - -std::string LLAgentCamera::getFocusOffsetCtrlName(ECameraPreset preset) -{ - return mFocusOffsetInitial[preset]->getName(); + return convert_from_llsd(mFocusOffsetInitial->get(), TYPE_VEC3D, ""); } F32 LLAgentCamera::getCameraMaxZoomDistance() diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 5c8172bbfc..8a922bf678 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -117,10 +117,6 @@ public: /** Determines default focus offset depending on the current camera preset */ LLVector3d getFocusOffsetInitial(); - std::string getCameraOffsetCtrlName(); - std::string getCameraOffsetCtrlName(ECameraPreset preset); - std::string getFocusOffsetCtrlName(); - std::string getFocusOffsetCtrlName(ECameraPreset preset); private: /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */ F32 getCameraMaxZoomDistance(); @@ -128,11 +124,11 @@ private: /** Camera preset in Third Person Mode */ ECameraPreset mCameraPreset; - /** Initial camera offsets */ - std::map > mCameraOffsetInitial; + /** Initial camera offset */ + LLPointer mCameraOffsetInitial; - /** Initial focus offsets */ - std::map > mFocusOffsetInitial; + /** Initial focus offset */ + LLPointer mFocusOffsetInitial; //-------------------------------------------------------------------- // Position diff --git a/indra/newview/llfloaterpreferenceviewadvanced.cpp b/indra/newview/llfloaterpreferenceviewadvanced.cpp index 57484d0d0a..f8db738923 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.cpp +++ b/indra/newview/llfloaterpreferenceviewadvanced.cpp @@ -73,10 +73,10 @@ void LLFloaterPreferenceViewAdvanced::onCommitSettings() vector.mV[VX] = (F32)getChild("camera_x")->getValue().asReal(); vector.mV[VY] = (F32)getChild("camera_y")->getValue().asReal(); vector.mV[VZ] = (F32)getChild("camera_z")->getValue().asReal(); - gSavedSettings.setVector3(gAgentCamera.getCameraOffsetCtrlName(), vector); + gSavedSettings.setVector3("CameraOffsetRearView", vector); vector3d.mdV[VX] = (F32)getChild("focus_x")->getValue().asReal(); vector3d.mdV[VY] = (F32)getChild("focus_y")->getValue().asReal(); vector3d.mdV[VZ] = (F32)getChild("focus_z")->getValue().asReal(); - gSavedSettings.setVector3d(gAgentCamera.getFocusOffsetCtrlName(), vector3d); + gSavedSettings.setVector3d("FocusOffsetRearView", vector3d); } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 71f0cd72d4..4f25e93ebd 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -102,7 +102,6 @@ void LLPresetsManager::startWatching(const std::string& subdirectory) { std::vector name_list; getControlNames(name_list); - getOffsetControlNames(name_list); for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) { @@ -254,23 +253,10 @@ void LLPresetsManager::getControlNames(std::vector& names) ("CameraOffsetBuild") ("CameraOffsetScale") ("TrackFocusObject") - ; - names = camera_controls; -} - -void LLPresetsManager::getOffsetControlNames(std::vector& names) -{ - const std::vector offset_controls = boost::assign::list_of ("CameraOffsetRearView") - ("CameraOffsetFrontView") - ("CameraOffsetGroupView") - ("CameraOffsetCustomPreset") ("FocusOffsetRearView") - ("FocusOffsetFrontView") - ("FocusOffsetGroupView") - ("FocusOffsetCustomPreset") - ; - names.insert(std::end(names), std::begin(offset_controls), std::end(offset_controls)); + ; + names = camera_controls; } bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name, bool createDefault) @@ -317,8 +303,6 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n name_list.clear(); getControlNames(name_list); name_list.push_back("PresetCameraActive"); - name_list.push_back(gAgentCamera.getCameraOffsetCtrlName()); - name_list.push_back(gAgentCamera.getFocusOffsetCtrlName()); } else { @@ -368,18 +352,6 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) { std::string ctrl_name = *it; - std::string dest_ctrl_name = ctrl_name; - if (IS_CAMERA && new_camera_offsets) - { - if (ctrl_name == gAgentCamera.getCameraOffsetCtrlName()) - { - dest_ctrl_name = gAgentCamera.getCameraOffsetCtrlName(new_camera_preset); - } - if (ctrl_name == gAgentCamera.getFocusOffsetCtrlName()) - { - dest_ctrl_name = gAgentCamera.getFocusOffsetCtrlName(new_camera_preset); - } - } LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); if (ctrl) @@ -388,10 +360,10 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n std::string type = LLControlGroup::typeEnumToString(ctrl->type()); LLSD value = ctrl->getValue(); - paramsData[dest_ctrl_name]["Comment"] = comment; - paramsData[dest_ctrl_name]["Persist"] = 1; - paramsData[dest_ctrl_name]["Type"] = type; - paramsData[dest_ctrl_name]["Value"] = value; + paramsData[ctrl_name]["Comment"] = comment; + paramsData[ctrl_name]["Persist"] = 1; + paramsData[ctrl_name]["Type"] = type; + paramsData[ctrl_name]["Value"] = value; } } if (IS_CAMERA) diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index d489a0ad5a..09010413a9 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -97,7 +97,6 @@ public: LOG_CLASS(LLPresetsManager); void getControlNames(std::vector& names); - void getOffsetControlNames(std::vector& names); static void settingChanged(); boost::signals2::connection mCameraChangedSignal; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index c18d63d72b..7dfb6a6ac2 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4109,14 +4109,6 @@ void handle_reset_view() // switching to outfit selector should automagically save any currently edited wearable LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits")); } - if ((ECameraPreset)gSavedSettings.getU32("CameraPreset") == CAMERA_PRESET_CUSTOM) - { - gAgentCamera.switchCameraPreset(CAMERA_PRESET_CUSTOM); - } - else - { - gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); - } reset_view_final( TRUE ); LLFloaterCamera::resetCameraMode(); -- cgit v1.2.3 From 7df0a4ddd0c48358e7152733aaba01464f2620be Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 14 Nov 2019 15:01:50 +0000 Subject: SL-10499, SL-10497 - use LLAgentBenefits info --- indra/newview/llagentbenefits.cpp | 17 ++++++- indra/newview/llagentbenefits.h | 2 + indra/newview/llfloaterbvhpreview.cpp | 11 +++-- indra/newview/llfloaternamedesc.cpp | 1 + indra/newview/llfloaterreporter.cpp | 6 --- indra/newview/lloutfitgallery.cpp | 3 +- indra/newview/llpanelmaininventory.cpp | 48 +++++++++---------- indra/newview/llpanelpeople.cpp | 1 + indra/newview/llpanelsnapshotoptions.cpp | 8 ++-- indra/newview/llstartup.cpp | 24 ++-------- indra/newview/llviewerassetupload.cpp | 18 +------- indra/newview/llviewerassetupload.h | 1 - indra/newview/llviewermenu.cpp | 54 +++++++++++++++------- indra/newview/llvoavatar.cpp | 35 ++------------ indra/newview/skins/default/xui/en/menu_viewer.xml | 9 ++-- 15 files changed, 105 insertions(+), 133 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp index 724b2e1dc1..09be8f46c1 100644 --- a/indra/newview/llagentbenefits.cpp +++ b/indra/newview/llagentbenefits.cpp @@ -26,7 +26,14 @@ #include "llviewerprecompiledheaders.h" #include "llagentbenefits.h" -LLAgentBenefits::LLAgentBenefits() +LLAgentBenefits::LLAgentBenefits(): + m_initalized(false), + m_animated_object_limit(-1), + m_animation_upload_cost(-1), + m_attachment_limit(-1), + m_group_membership_limit(-1), + m_sound_upload_cost(-1), + m_texture_upload_cost(-1) { } @@ -78,35 +85,43 @@ bool LLAgentBenefits::init(const LLSD& benefits_sd) { return false; } + + m_initalized = true; return true; } S32 LLAgentBenefits::getAnimatedObjectLimit() const { + //llassert(m_initalized); return m_animated_object_limit; } S32 LLAgentBenefits::getAnimationUploadCost() const { + //llassert(m_initalized); return m_animation_upload_cost; } S32 LLAgentBenefits::getAttachmentLimit() const { + //llassert(m_initalized); return m_attachment_limit; } S32 LLAgentBenefits::getGroupMembershipLimit() const { + //llassert(m_initalized); return m_group_membership_limit; } S32 LLAgentBenefits::getSoundUploadCost() const { + //llassert(m_initalized); return m_sound_upload_cost; } S32 LLAgentBenefits::getTextureUploadCost() const { + //llassert(m_initalized); return m_texture_upload_cost; } diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h index 0a8e33af28..995833149c 100644 --- a/indra/newview/llagentbenefits.h +++ b/indra/newview/llagentbenefits.h @@ -52,6 +52,8 @@ private: S32 m_group_membership_limit; S32 m_sound_upload_cost; S32 m_texture_upload_cost; + + bool m_initalized; }; #endif diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index ee7e6f8562..91a6e63665 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -38,6 +38,7 @@ #include "llstring.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llanimationstates.h" #include "llbbox.h" #include "llbutton.h" @@ -1004,16 +1005,18 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) { std::string name = floaterp->getChild("name_form")->getValue().asString(); std::string desc = floaterp->getChild("description_form")->getValue().asString(); - S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); + S32 expected_upload_cost = LLAgentBenefits::instance().getAnimationUploadCost(); - LLResourceUploadInfo::ptr_t assetUpdloadInfo(new LLResourceUploadInfo( + LLResourceUploadInfo::ptr_t assetUploadInfo(new LLResourceUploadInfo( floaterp->mTransactionID, LLAssetType::AT_ANIMATION, name, desc, 0, LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION, - LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), expected_upload_cost)); - upload_new_resource(assetUpdloadInfo); + upload_new_resource(assetUploadInfo); } else { diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index c9a689281e..33dfae8be8 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -161,6 +161,7 @@ void LLFloaterNameDesc::onBtnOK( ) { getChildView("ok_btn")->setEnabled(FALSE); // don't allow inadvertent extra uploads + // FIXME PREMIUM - upload cost. Need to know which asset type this is, use agent benefits. LLAssetStorage::LLStoreAssetCallback callback = NULL; S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 960fd9620d..4cc43254a5 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -102,7 +102,6 @@ public: virtual LLSD prepareUpload(); virtual LLSD generatePostBody(); - virtual S32 getEconomyUploadCost(); virtual LLUUID finishUpload(LLSD &result); virtual bool showInventoryPanel() const { return false; } @@ -129,11 +128,6 @@ LLSD LLARScreenShotUploader::generatePostBody() return mReport; } -S32 LLARScreenShotUploader::getEconomyUploadCost() -{ // Abuse report screen shots do not cost anything to upload. - return 0; -} - LLUUID LLARScreenShotUploader::finishUpload(LLSD &result) { /* *TODO$: Report success or failure. Carried over from previous todo on responder*/ diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index b2b6de94b3..8f5626bd7a 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -36,6 +36,7 @@ #include "llaccordionctrltab.h" #include "llappearancemgr.h" +#include "llagentbenefits.h" #include "lleconomy.h" #include "llerror.h" #include "llfilepicker.h" @@ -1205,7 +1206,7 @@ void LLOutfitGallery::uploadOutfitImage(const std::vector& filename return; } - S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). + S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); void *nruserdata = NULL; nruserdata = (void *)&outfit_id; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index f63e604927..7404798589 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -28,6 +28,7 @@ #include "llpanelmaininventory.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llavataractions.h" #include "llcheckboxctrl.h" @@ -227,16 +228,21 @@ BOOL LLPanelMainInventory::postBuild() initListCommandsHandlers(); - // *TODO:Get the cost info from the server - const std::string upload_cost("10"); + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost()); LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get(); if (menu) { - menu->getChild("Upload Image")->setLabelArg("[COST]", upload_cost); - menu->getChild("Upload Sound")->setLabelArg("[COST]", upload_cost); - menu->getChild("Upload Animation")->setLabelArg("[COST]", upload_cost); - menu->getChild("Bulk Upload")->setLabelArg("[COST]", upload_cost); + menu->getChild("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str); + menu->getChild("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str); + menu->getChild("Upload Animation")->setLabelArg("[COST]", animation_upload_cost_str); + + // FIXME PREMIUM - bulk upload of what? This doesn't work with + // mixed items if costs aren't all the same. For now treating + // as textures. + menu->getChild("Bulk Upload")->setLabelArg("[COST]", texture_upload_cost_str); } // Trigger callback for focus received so we can deselect items in inbox/outbox @@ -1512,28 +1518,18 @@ void LLPanelMainInventory::setUploadCostIfNeeded() LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get(); if(mNeedUploadCost && menu) { - LLMenuItemBranchGL* upload_menu = menu->findChild("upload"); - if(upload_menu) - { - S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); - std::string cost_str; + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost()); - // getPriceUpload() returns -1 if no data available yet. - if(upload_cost >= 0) - { - mNeedUploadCost = false; - cost_str = llformat("%d", upload_cost); - } - else - { - cost_str = llformat("%d", gSavedSettings.getU32("DefaultUploadCost")); - } + menu->getChild("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str); + menu->getChild("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str); + menu->getChild("Upload Animation")->setLabelArg("[COST]", animation_upload_cost_str); - upload_menu->getChild("Upload Image")->setLabelArg("[COST]", cost_str); - upload_menu->getChild("Upload Sound")->setLabelArg("[COST]", cost_str); - upload_menu->getChild("Upload Animation")->setLabelArg("[COST]", cost_str); - upload_menu->getChild("Bulk Upload")->setLabelArg("[COST]", cost_str); - } + // FIXME PREMIUM - bulk upload of what? This doesn't work with + // mixed items if costs aren't all the same. For now treating + // as textures. + menu->getChild("Bulk Upload")->setLabelArg("[COST]", texture_upload_cost_str); } } diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index be174475e1..d138433ed8 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -612,6 +612,7 @@ void LLPanelPeople::removePicker() BOOL LLPanelPeople::postBuild() { + // FIXME PREMIUM - need to get premium vs. basic info via BaaS S32 max_premium = PREMIUM_MAX_AGENT_GROUPS; if (gAgent.getRegion()) { diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 23747a8efd..63206e2780 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -35,12 +35,13 @@ #include "llfloaterflickr.h" #include "llfloatertwitter.h" +#include "llagentbenefits.h" + /** * Provides several ways to save a snapshot. */ class LLPanelSnapshotOptions : public LLPanel -, public LLEconomyObserver { LOG_CLASS(LLPanelSnapshotOptions); @@ -49,7 +50,6 @@ public: ~LLPanelSnapshotOptions(); /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onEconomyDataChange() { updateUploadCost(); } private: void updateUploadCost(); @@ -74,12 +74,10 @@ LLPanelSnapshotOptions::LLPanelSnapshotOptions() mCommitCallbackRegistrar.add("Snapshot.SaveToComputer", boost::bind(&LLPanelSnapshotOptions::onSaveToComputer, this)); mCommitCallbackRegistrar.add("Snapshot.SendToTwitter", boost::bind(&LLPanelSnapshotOptions::onSendToTwitter, this)); mCommitCallbackRegistrar.add("Snapshot.SendToFlickr", boost::bind(&LLPanelSnapshotOptions::onSendToFlickr, this)); - LLGlobalEconomy::getInstance()->addObserver(this); } LLPanelSnapshotOptions::~LLPanelSnapshotOptions() { - LLGlobalEconomy::getInstance()->removeObserver(this); } // virtual @@ -97,7 +95,7 @@ void LLPanelSnapshotOptions::onOpen(const LLSD& key) void LLPanelSnapshotOptions::updateUploadCost() { - S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); + S32 upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); getChild("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d", upload_cost)); } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 73e8d3cf5f..979fe63432 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -247,7 +247,6 @@ static std::string gAgentStartLocation = "safe"; static bool mLoginStatePastUI = false; const S32 DEFAULT_MAX_AGENT_GROUPS = 42; -const S32 ALLOWED_MAX_AGENT_GROUPS = 500; const F32 STATE_AGENT_WAIT_TIMEOUT = 240; //seconds boost::scoped_ptr LLStartUp::sStateWatcher(new LLEventStream("StartupState")); @@ -3607,26 +3606,9 @@ bool process_login_success_response() LLViewerMedia::getInstance()->openIDSetup(openid_url, openid_token); } - gMaxAgentGroups = DEFAULT_MAX_AGENT_GROUPS; - if(response.has("max-agent-groups")) - { - S32 agent_groups = atoi(std::string(response["max-agent-groups"]).c_str()); - if (agent_groups > 0 && agent_groups <= ALLOWED_MAX_AGENT_GROUPS) - { - gMaxAgentGroups = agent_groups; - LL_INFOS("LLStartup") << "gMaxAgentGroups read from login.cgi: " - << gMaxAgentGroups << LL_ENDL; - } - else - { - LL_INFOS("LLStartup") << "Invalid value received, using defaults for gMaxAgentGroups: " - << gMaxAgentGroups << LL_ENDL; - } - } - else { - LL_INFOS("LLStartup") << "Missing max-agent-groups, using default value for gMaxAgentGroups: " - << gMaxAgentGroups << LL_ENDL; - } + gMaxAgentGroups = LLAgentBenefits::instance().getGroupMembershipLimit(); + LL_INFOS("LLStartup") << "gMaxAgentGroups set from agent benefits: " + << gMaxAgentGroups << LL_ENDL; bool success = false; // JC: gesture loading done below, when we have an asset system diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 97fbb8c601..a919362321 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -171,22 +171,6 @@ void LLResourceUploadInfo::logPreparedUpload() "Asset Type: " << LLAssetType::lookup(mAssetType) << LL_ENDL; } -S32 LLResourceUploadInfo::getEconomyUploadCost() -{ - // Update L$ and ownership credit information - // since it probably changed on the server - if (getAssetType() == LLAssetType::AT_TEXTURE || - getAssetType() == LLAssetType::AT_SOUND || - getAssetType() == LLAssetType::AT_ANIMATION || - getAssetType() == LLAssetType::AT_MESH) - { - return LLGlobalEconomy::instance().getPriceUpload(); - } - - return 0; -} - - LLUUID LLResourceUploadInfo::finishUpload(LLSD &result) { if (getFolderId().isNull()) @@ -740,7 +724,7 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti return; } - S32 uploadPrice = result["upload_price"].asInteger();//uploadInfo->getEconomyUploadCost(); + S32 uploadPrice = result["upload_price"].asInteger(); if (uploadPrice > 0) { diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h index ee1806b782..0ba16dce1d 100644 --- a/indra/newview/llviewerassetupload.h +++ b/indra/newview/llviewerassetupload.h @@ -62,7 +62,6 @@ public: virtual LLSD prepareUpload(); virtual LLSD generatePostBody(); virtual void logPreparedUpload(); - virtual S32 getEconomyUploadCost(); virtual LLUUID finishUpload(LLSD &result); LLTransactionID getTransactionId() const { return mTransactionId; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index dc82719109..0fda4d3df8 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -45,6 +45,7 @@ // newview includes #include "llagent.h" #include "llagentaccess.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentui.h" #include "llagentwearables.h" @@ -134,6 +135,7 @@ #include "llstartup.h" #include "boost/unordered_map.hpp" #include +#include #include "llcleanup.h" using namespace LLAvatarAppearanceDefines; @@ -508,13 +510,15 @@ void init_menus() gViewerWindow->setMenuBackgroundColor(false, LLGridManager::getInstance()->isInProductionGrid()); - // Assume L$10 for now, the server will tell us the real cost at login // *TODO:Also fix cost in llfolderview.cpp for Inventory menus - const std::string upload_cost("10"); - gMenuHolder->childSetLabelArg("Upload Image", "[COST]", upload_cost); - gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", upload_cost); - gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost); - gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", upload_cost); + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost()); + gMenuHolder->childSetLabelArg("Upload Image", "[COST]", texture_upload_cost_str); + gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", sound_upload_cost_str); + gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", animation_upload_cost_str); + // FIXME PREMIUM - do we need to handle non-texture bulk uploads? + gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", texture_upload_cost_str); gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE); gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE); @@ -8665,18 +8669,30 @@ class LLUploadCostCalculator : public view_listener_t bool handleEvent(const LLSD& userdata) { - std::string menu_name = userdata.asString(); + std::vector fields; + boost::split(fields, userdata.asString(), boost::is_any_of(",")); + if (fields.size()<1) + { + return false; + } + std::string menu_name = fields[0]; + std::string asset_type_str = "texture"; + if (fields.size()>1) + { + asset_type_str = fields[1]; + } + LL_DEBUGS("Benefits") << "userdata " << userdata << " menu_name " << menu_name << " asset_type_str " << asset_type_str << LL_ENDL; + calculateCost(asset_type_str); gMenuHolder->childSetLabelArg(menu_name, "[COST]", mCostStr); return true; } - void calculateCost(); + void calculateCost(const std::string& asset_type_str); public: LLUploadCostCalculator() { - calculateCost(); } }; @@ -8702,19 +8718,24 @@ class LLToggleUIHints : public view_listener_t } }; -void LLUploadCostCalculator::calculateCost() +void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str) { - S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); + // FIXME PREMIUM reasonable default? + S32 upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); - // getPriceUpload() returns -1 if no data available yet. - if(upload_cost >= 0) + if (asset_type_str == "texture") { - mCostStr = llformat("%d", upload_cost); + upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); } - else + else if (asset_type_str == "animation") + { + upload_cost = LLAgentBenefits::instance().getAnimationUploadCost(); + } + else if (asset_type_str == "sound") { - mCostStr = llformat("%d", gSavedSettings.getU32("DefaultUploadCost")); + upload_cost = LLAgentBenefits::instance().getSoundUploadCost(); } + mCostStr = std::to_string(upload_cost); } void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y) @@ -8819,6 +8840,7 @@ void initialize_menus() enable.add("displayViewerEventRecorderMenuItems",boost::bind(&LLViewerEventRecorder::displayViewerEventRecorderMenuItems,&LLViewerEventRecorder::instance())); + // FIXME PREMIUM these need to be distinguished by asset type - see menu_viewer.xml view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts"); enable.add("Conversation.IsConversationLoggingAllowed", boost::bind(&LLFloaterIMContainer::isConversationLoggingAllowed)); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ca1216b89d..f8ff71911e 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -38,6 +38,7 @@ #include "raytrace.h" #include "llagent.h" // Get state values from here +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentwearables.h" #include "llanimationstates.h" @@ -7060,20 +7061,7 @@ U32 LLVOAvatar::getNumAttachments() const //----------------------------------------------------------------------------- S32 LLVOAvatar::getMaxAttachments() const { - const S32 MAX_AGENT_ATTACHMENTS = 38; - - S32 max_attach = MAX_AGENT_ATTACHMENTS; - - if (gAgent.getRegion()) - { - LLSD features; - gAgent.getRegion()->getSimulatorFeatures(features); - if (features.has("MaxAgentAttachments")) - { - max_attach = features["MaxAgentAttachments"].asInteger(); - } - } - return max_attach; + return LLAgentBenefits::instance().getAttachmentLimit(); } //----------------------------------------------------------------------------- @@ -7107,24 +7095,7 @@ U32 LLVOAvatar::getNumAnimatedObjectAttachments() const //----------------------------------------------------------------------------- S32 LLVOAvatar::getMaxAnimatedObjectAttachments() const { - S32 max_attach = 0; - if (gSavedSettings.getBOOL("AnimatedObjectsIgnoreLimits")) - { - max_attach = getMaxAttachments(); - } - else - { - if (gAgent.getRegion()) - { - LLSD features; - gAgent.getRegion()->getSimulatorFeatures(features); - if (features.has("AnimatedObjects")) - { - max_attach = features["AnimatedObjects"]["MaxAgentAnimatedObjectAttachments"].asInteger(); - } - } - } - return max_attach; + return LLAgentBenefits::instance().getAnimatedObjectLimit(); } //----------------------------------------------------------------------------- diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 7bb7b5d62c..165986448f 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1306,7 +1306,7 @@ function="File.EnableUpload" /> + parameter="Upload Image,texture" /> + parameter="Upload Sound,sound" /> + parameter="Upload Animation,animation" /> + -- cgit v1.2.3 From 16015cfb9f1e7d9983057e35c5ab41c92271b9a5 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 14 Nov 2019 17:51:58 +0200 Subject: SL-12186 Buildfix and update for creation of default presets --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llfloatersaveprefpreset.cpp | 2 +- indra/newview/llstartup.cpp | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 04ab620b3a..2fe5817772 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16349,7 +16349,7 @@ Type String Value - + Rear View CefVerboseLog diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index c8d6513f4d..3142991704 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -112,7 +112,7 @@ void LLFloaterSavePrefPreset::onOpen(const LLSD& key) void LLFloaterSavePrefPreset::onBtnSave() { bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0; - std::string name = is_saving_new ? mNameEditor->getValue() : mPresetCombo->getSimple(); + std::string name = is_saving_new ? mNameEditor->getText() : mPresetCombo->getSimple(); if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT)) { diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6e0a36be49..8a5dbf317a 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -71,6 +71,7 @@ #include "llnotifications.h" #include "llnotificationsutil.h" #include "llpersistentnotificationstorage.h" +#include "llpresetsmanager.h" #include "llteleporthistory.h" #include "llregionhandle.h" #include "llsd.h" @@ -1960,6 +1961,8 @@ bool idle_startup() // JC - 7/20/2002 gViewerWindow->sendShapeToSim(); + LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA); + // The reason we show the alert is because we want to // reduce confusion for when you log in and your provided // location is not your expected location. So, if this is -- cgit v1.2.3 From 26732bc576f86fde532e1f9448bd127515f70612 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 14 Nov 2019 23:43:52 +0200 Subject: Line endings fix --- .../default/xui/en/floater_camera_presets.xml | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_camera_presets.xml b/indra/newview/skins/default/xui/en/floater_camera_presets.xml index 0d9a6bb16a..930357f568 100644 --- a/indra/newview/skins/default/xui/en/floater_camera_presets.xml +++ b/indra/newview/skins/default/xui/en/floater_camera_presets.xml @@ -1,23 +1,23 @@ - - - - + + + + -- cgit v1.2.3 From e9c0a93f99c4e6a4844da1a93ac261c4b206b79b Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 14 Nov 2019 15:19:55 -0700 Subject: Fix merge-related compile errors --- indra/newview/llfloatereditextdaycycle.cpp | 12 ++++++------ indra/newview/llfloaterfixedenvironment.cpp | 12 ++++++------ indra/newview/llflyoutcombobtn.cpp | 2 +- indra/newview/lllocalbitmaps.cpp | 2 +- indra/newview/lllocalbitmaps.h | 1 + 5 files changed, 15 insertions(+), 14 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index c92eed42cd..2c10835fb0 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -619,12 +619,12 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data) if (water) { // LLViewerFetchedTexture and check for FTT_LOCAL_FILE or check LLLocalBitmapMgr - if (LLLocalBitmapMgr::isLocal(water->getNormalMapID())) + if (LLLocalBitmapMgr::getInstance()->isLocal(water->getNormalMapID())) { desc = LLTrans::getString("EnvironmentNormalMap"); is_local = true; } - else if (LLLocalBitmapMgr::isLocal(water->getTransparentTextureID())) + else if (LLLocalBitmapMgr::getInstance()->isLocal(water->getTransparentTextureID())) { desc = LLTrans::getString("EnvironmentTransparent"); is_local = true; @@ -636,22 +636,22 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data) LLSettingsSky::ptr_t sky = std::static_pointer_cast(iter->second); if (sky) { - if (LLLocalBitmapMgr::isLocal(sky->getSunTextureId())) + if (LLLocalBitmapMgr::getInstance()->isLocal(sky->getSunTextureId())) { desc = LLTrans::getString("EnvironmentSun"); is_local = true; } - else if (LLLocalBitmapMgr::isLocal(sky->getMoonTextureId())) + else if (LLLocalBitmapMgr::getInstance()->isLocal(sky->getMoonTextureId())) { desc = LLTrans::getString("EnvironmentMoon"); is_local = true; } - else if (LLLocalBitmapMgr::isLocal(sky->getCloudNoiseTextureId())) + else if (LLLocalBitmapMgr::getInstance()->isLocal(sky->getCloudNoiseTextureId())) { desc = LLTrans::getString("EnvironmentCloudNoise"); is_local = true; } - else if (LLLocalBitmapMgr::isLocal(sky->getBloomTextureId())) + else if (LLLocalBitmapMgr::getInstance()->isLocal(sky->getBloomTextureId())) { desc = LLTrans::getString("EnvironmentBloom"); is_local = true; diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 38b1f5066d..41d9a6d99b 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -402,12 +402,12 @@ void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data) { setting_clone = water->buildClone(); // LLViewerFetchedTexture and check for FTT_LOCAL_FILE or check LLLocalBitmapMgr - if (LLLocalBitmapMgr::isLocal(water->getNormalMapID())) + if (LLLocalBitmapMgr::getInstance()->isLocal(water->getNormalMapID())) { local_desc = LLTrans::getString("EnvironmentNormalMap"); is_local = true; } - else if (LLLocalBitmapMgr::isLocal(water->getTransparentTextureID())) + else if (LLLocalBitmapMgr::getInstance()->isLocal(water->getTransparentTextureID())) { local_desc = LLTrans::getString("EnvironmentTransparent"); is_local = true; @@ -420,22 +420,22 @@ void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data) if (sky) { setting_clone = sky->buildClone(); - if (LLLocalBitmapMgr::isLocal(sky->getSunTextureId())) + if (LLLocalBitmapMgr::getInstance()->isLocal(sky->getSunTextureId())) { local_desc = LLTrans::getString("EnvironmentSun"); is_local = true; } - else if (LLLocalBitmapMgr::isLocal(sky->getMoonTextureId())) + else if (LLLocalBitmapMgr::getInstance()->isLocal(sky->getMoonTextureId())) { local_desc = LLTrans::getString("EnvironmentMoon"); is_local = true; } - else if (LLLocalBitmapMgr::isLocal(sky->getCloudNoiseTextureId())) + else if (LLLocalBitmapMgr::getInstance()->isLocal(sky->getCloudNoiseTextureId())) { local_desc = LLTrans::getString("EnvironmentCloudNoise"); is_local = true; } - else if (LLLocalBitmapMgr::isLocal(sky->getBloomTextureId())) + else if (LLLocalBitmapMgr::getInstance()->isLocal(sky->getBloomTextureId())) { local_desc = LLTrans::getString("EnvironmentBloom"); is_local = true; diff --git a/indra/newview/llflyoutcombobtn.cpp b/indra/newview/llflyoutcombobtn.cpp index 48bfb85072..e4f1d9fcaa 100644 --- a/indra/newview/llflyoutcombobtn.cpp +++ b/indra/newview/llflyoutcombobtn.cpp @@ -121,7 +121,7 @@ void LLFlyoutComboBtnCtrl::setMenuItemLabel(const std::string &item, const std:: void LLFlyoutComboBtnCtrl::onFlyoutButton(LLUICtrl *ctrl, const LLSD &data) { S32 x, y; - LLUI::getMousePositionLocal(mParent, &x, &y); + LLUI::getInstance()->getMousePositionLocal(mParent, &x, &y); mFlyoutMenu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(mParent, mFlyoutMenu, x, y); diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 3c667c2219..5a17332fde 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -1040,7 +1040,7 @@ LLUUID LLLocalBitmapMgr::getWorldID(LLUUID tracking_id) bool LLLocalBitmapMgr::isLocal(const LLUUID world_id) { - for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++) + for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++) { LLLocalBitmap* unit = *iter; if (unit->getWorldID() == world_id) diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h index f6cc1e919e..d5ee7efdc6 100644 --- a/indra/newview/lllocalbitmaps.h +++ b/indra/newview/lllocalbitmaps.h @@ -120,6 +120,7 @@ public: bool checkTextureDimensions(std::string filename); LLUUID getWorldID(LLUUID tracking_id); + bool isLocal(LLUUID world_id); std::string getFilename(LLUUID tracking_id); void feedScrollList(LLScrollListCtrl* ctrl); -- cgit v1.2.3 From cf9014602df4efb863053acd24cfdabf3338b6ba Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 14 Nov 2019 16:26:37 -0700 Subject: Fix merge-related unitialized ptr deref crash on login --- indra/newview/llappviewer.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 32ee632838..3d5722353a 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -774,6 +774,10 @@ bool LLAppViewer::init() // Memory will be cleaned up in ::cleanupClass() LLWearableType::initParamSingleton(new LLUITranslationBridge()); + // initialize the LLSettingsType translation bridge. + LLTranslationBridge::ptr_t trans = std::make_shared(); + LLSettingsType::initClass(trans); + // initialize SSE options LLVector4a::initClass(); -- cgit v1.2.3 From f21da58f05d70c44d810323a533f8b11c8fafb5e Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Fri, 15 Nov 2019 01:47:20 +0200 Subject: Post-merge build fix --- indra/newview/llstatusbar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 359615d46a..3d31aa7003 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -513,8 +513,8 @@ void LLStatusBar::onMouseEnterPresetsCamera() mPanelPresetsCameraPulldown->setShape(pulldown_rect); // show the master presets pull-down - LLUI::clearPopups(); - LLUI::addPopup(mPanelPresetsCameraPulldown); + LLUI::getInstance()->clearPopups(); + LLUI::getInstance()->addPopup(mPanelPresetsCameraPulldown); mPanelNearByMedia->setVisible(FALSE); mPanelVolumePulldown->setVisible(FALSE); mPanelPresetsPulldown->setVisible(FALSE); -- cgit v1.2.3 From 3824624ab1df4eb8809ec31965f251cda74c8d23 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 15 Nov 2019 14:16:12 +0200 Subject: SL-12186 Correctly populate list after creating default presets --- indra/newview/llpresetsmanager.cpp | 16 +++++++++++----- indra/newview/llpresetsmanager.h | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 4f25e93ebd..88b24265e3 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -91,9 +91,14 @@ void LLPresetsManager::createMissingDefault(const std::string& subdirectory) void LLPresetsManager::createCameraDefaultPresets() { - createDefaultCameraPreset(PRESETS_REAR_VIEW); - createDefaultCameraPreset(PRESETS_FRONT_VIEW); - createDefaultCameraPreset(PRESETS_SIDE_VIEW); + bool is_default_created = createDefaultCameraPreset(PRESETS_REAR_VIEW); + is_default_created |= createDefaultCameraPreset(PRESETS_FRONT_VIEW); + is_default_created |= createDefaultCameraPreset(PRESETS_SIDE_VIEW); + + if (is_default_created) + { + triggerChangeCameraSignal(); + } } void LLPresetsManager::startWatching(const std::string& subdirectory) @@ -558,7 +563,7 @@ void LLPresetsManager::resetCameraPreset(std::string preset_name) } } -void LLPresetsManager::createDefaultCameraPreset(std::string preset_name, bool force_reset) +bool LLPresetsManager::createDefaultCameraPreset(std::string preset_name, bool force_reset) { std::string preset_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, LLURI::escape(preset_name) + ".xml"); @@ -567,8 +572,9 @@ void LLPresetsManager::createDefaultCameraPreset(std::string preset_name, bool f std::string template_name = preset_name.substr(0, preset_name.size() - PRESETS_VIEW_SUFFIX.size()); std::string default_template_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, template_name + ".xml"); - LLFile::copy(default_template_file, preset_file); + return LLFile::copy(default_template_file, preset_file); } + return false; } boost::signals2::connection LLPresetsManager::setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb) diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 09010413a9..d9ca178dd7 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -80,7 +80,7 @@ public: bool isTemplateCameraPreset(std::string preset_name); bool isDefaultCameraPreset(std::string preset_name); void resetCameraPreset(std::string preset_name); - void createDefaultCameraPreset(std::string preset_name, bool force_reset = false); + bool createDefaultCameraPreset(std::string preset_name, bool force_reset = false); // Emitted when a preset gets loaded, deleted, or saved. boost::signals2::connection setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb); -- cgit v1.2.3 From 65550520ed00699098b221a1166e4c1763333d58 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 15 Nov 2019 15:13:11 +0000 Subject: SL-10499 - benefits. Removed no-longer-needed lleconomy files and classes. Group-related costs and limits via benefits. --- indra/llinventory/CMakeLists.txt | 2 - indra/llinventory/lleconomy.cpp | 287 --------------------- indra/llinventory/lleconomy.h | 157 ----------- indra/newview/llagent.cpp | 3 +- indra/newview/llagentbenefits.cpp | 16 +- indra/newview/llagentbenefits.h | 2 + indra/newview/llfloaterbvhpreview.cpp | 1 - indra/newview/llfloatergroups.cpp | 5 +- indra/newview/llfloatermodelpreview.cpp | 1 - indra/newview/llfloaternamedesc.cpp | 7 +- indra/newview/llgroupmgr.cpp | 1 - indra/newview/llmeshrepository.cpp | 1 - indra/newview/lloutfitgallery.cpp | 1 - indra/newview/llpanelcontents.cpp | 1 - indra/newview/llpanelgroupgeneral.cpp | 5 +- indra/newview/llpanelmaininventory.cpp | 6 - indra/newview/llpanelobject.cpp | 1 - indra/newview/llpanelpeople.cpp | 12 +- indra/newview/llpanelsnapshotinventory.cpp | 9 +- indra/newview/llpanelsnapshotoptions.cpp | 1 - indra/newview/llpanelvolume.cpp | 1 - indra/newview/llselectmgr.cpp | 1 - indra/newview/llsnapshotlivepreview.cpp | 4 +- indra/newview/llstartup.cpp | 8 - indra/newview/llstartup.h | 1 - indra/newview/llviewerassetupload.cpp | 1 - indra/newview/llviewermenu.cpp | 1 - indra/newview/llviewermenufile.cpp | 7 +- indra/newview/llviewermessage.cpp | 15 +- .../newview/skins/default/xui/en/notifications.xml | 4 +- 30 files changed, 47 insertions(+), 515 deletions(-) delete mode 100644 indra/llinventory/lleconomy.cpp delete mode 100644 indra/llinventory/lleconomy.h (limited to 'indra') diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index 68dd00d880..32a83a88d9 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -19,7 +19,6 @@ include_directories( set(llinventory_SOURCE_FILES llcategory.cpp - lleconomy.cpp llfoldertype.cpp llinventory.cpp llinventorydefines.cpp @@ -37,7 +36,6 @@ set(llinventory_HEADER_FILES CMakeLists.txt llcategory.h - lleconomy.h llfoldertype.h llinventory.h llinventorydefines.h diff --git a/indra/llinventory/lleconomy.cpp b/indra/llinventory/lleconomy.cpp deleted file mode 100644 index 2a023d8c24..0000000000 --- a/indra/llinventory/lleconomy.cpp +++ /dev/null @@ -1,287 +0,0 @@ -/** - * @file lleconomy.cpp - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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 "linden_common.h" - -#include "lleconomy.h" -#include "llerror.h" -#include "message.h" -#include "v3math.h" - - -LLBaseEconomy::LLBaseEconomy() -: mObjectCount( -1 ), - mObjectCapacity( -1 ), - mPriceObjectClaim( -1 ), - mPricePublicObjectDecay( -1 ), - mPricePublicObjectDelete( -1 ), - mPriceEnergyUnit( -1 ), - mPriceUpload( -1 ), - mPriceRentLight( -1 ), - mTeleportMinPrice( -1 ), - mTeleportPriceExponent( -1 ), - mPriceGroupCreate( -1 ) -{ } - -LLBaseEconomy::~LLBaseEconomy() -{ } - -void LLBaseEconomy::addObserver(LLEconomyObserver* observer) -{ - mObservers.push_back(observer); -} - -void LLBaseEconomy::removeObserver(LLEconomyObserver* observer) -{ - std::list::iterator it = - std::find(mObservers.begin(), mObservers.end(), observer); - if (it != mObservers.end()) - { - mObservers.erase(it); - } -} - -void LLBaseEconomy::notifyObservers() -{ - for (std::list::iterator it = mObservers.begin(); - it != mObservers.end(); - ++it) - { - (*it)->onEconomyDataChange(); - } -} - -// static -void LLBaseEconomy::processEconomyData(LLMessageSystem *msg, LLBaseEconomy* econ_data) -{ - S32 i; - F32 f; - - msg->getS32Fast(_PREHASH_Info, _PREHASH_ObjectCapacity, i); - econ_data->setObjectCapacity(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_ObjectCount, i); - econ_data->setObjectCount(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceEnergyUnit, i); - econ_data->setPriceEnergyUnit(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceObjectClaim, i); - econ_data->setPriceObjectClaim(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PricePublicObjectDecay, i); - econ_data->setPricePublicObjectDecay(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PricePublicObjectDelete, i); - econ_data->setPricePublicObjectDelete(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceUpload, i); - econ_data->setPriceUpload(i); -#if LL_LINUX - // We can optionally fake the received upload price for testing. - // Note that the server is within its rights to not obey our fake - // price. :) - const char* fakeprice_str = getenv("LL_FAKE_UPLOAD_PRICE"); - if (fakeprice_str) - { - S32 fakeprice = (S32)atoi(fakeprice_str); - LL_WARNS() << "LL_FAKE_UPLOAD_PRICE: Faking upload price as L$" << fakeprice << LL_ENDL; - econ_data->setPriceUpload(fakeprice); - } -#endif - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceRentLight, i); - econ_data->setPriceRentLight(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_TeleportMinPrice, i); - econ_data->setTeleportMinPrice(i); - msg->getF32Fast(_PREHASH_Info, _PREHASH_TeleportPriceExponent, f); - econ_data->setTeleportPriceExponent(f); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceGroupCreate, i); - econ_data->setPriceGroupCreate(i); - - econ_data->notifyObservers(); -} - -S32 LLBaseEconomy::calculateTeleportCost(F32 distance) const -{ - S32 min_cost = getTeleportMinPrice(); - F32 exponent = getTeleportPriceExponent(); - F32 divisor = 100.f * pow(3.f, exponent); - S32 cost = (U32)(distance * pow(log10(distance), exponent) / divisor); - if (cost < 0) - { - cost = 0; - } - else if (cost < min_cost) - { - cost = min_cost; - } - - return cost; -} - -S32 LLBaseEconomy::calculateLightRent(const LLVector3& object_size) const -{ - F32 intensity_mod = llmax(object_size.magVec(), 1.f); - return (S32)(intensity_mod * getPriceRentLight()); -} - -void LLBaseEconomy::print() -{ - LL_INFOS() << "Global Economy Settings: " << LL_ENDL; - LL_INFOS() << "Object Capacity: " << mObjectCapacity << LL_ENDL; - LL_INFOS() << "Object Count: " << mObjectCount << LL_ENDL; - LL_INFOS() << "Claim Price Per Object: " << mPriceObjectClaim << LL_ENDL; - LL_INFOS() << "Claim Price Per Public Object: " << mPricePublicObjectDecay << LL_ENDL; - LL_INFOS() << "Delete Price Per Public Object: " << mPricePublicObjectDelete << LL_ENDL; - LL_INFOS() << "Release Price Per Public Object: " << getPricePublicObjectRelease() << LL_ENDL; - LL_INFOS() << "Price Per Energy Unit: " << mPriceEnergyUnit << LL_ENDL; - LL_INFOS() << "Price Per Upload: " << mPriceUpload << LL_ENDL; - LL_INFOS() << "Light Base Price: " << mPriceRentLight << LL_ENDL; - LL_INFOS() << "Teleport Min Price: " << mTeleportMinPrice << LL_ENDL; - LL_INFOS() << "Teleport Price Exponent: " << mTeleportPriceExponent << LL_ENDL; - LL_INFOS() << "Price for group creation: " << mPriceGroupCreate << LL_ENDL; -} - -LLRegionEconomy::LLRegionEconomy() -: mPriceObjectRent( -1.f ), - mPriceObjectScaleFactor( -1.f ), - mEnergyEfficiency( -1.f ), - mBasePriceParcelClaimDefault(-1), - mBasePriceParcelClaimActual(-1), - mPriceParcelClaimFactor(-1.f), - mBasePriceParcelRent(-1), - mAreaOwned(-1.f), - mAreaTotal(-1.f) -{ } - -LLRegionEconomy::~LLRegionEconomy() -{ } - -BOOL LLRegionEconomy::hasData() const -{ - return (mBasePriceParcelRent != -1); -} - -// static -void LLRegionEconomy::processEconomyData(LLMessageSystem *msg, void** user_data) -{ - S32 i; - F32 f; - - LLRegionEconomy *this_ptr = (LLRegionEconomy*)user_data; - - LLBaseEconomy::processEconomyData(msg, this_ptr); - - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceParcelClaim, i); - this_ptr->setBasePriceParcelClaimDefault(i); - msg->getF32(_PREHASH_Info, _PREHASH_PriceParcelClaimFactor, f); - this_ptr->setPriceParcelClaimFactor(f); - msg->getF32Fast(_PREHASH_Info, _PREHASH_EnergyEfficiency, f); - this_ptr->setEnergyEfficiency(f); - msg->getF32Fast(_PREHASH_Info, _PREHASH_PriceObjectRent, f); - this_ptr->setPriceObjectRent(f); - msg->getF32Fast(_PREHASH_Info, _PREHASH_PriceObjectScaleFactor, f); - this_ptr->setPriceObjectScaleFactor(f); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceParcelRent, i); - this_ptr->setBasePriceParcelRent(i); -} - -// static -void LLRegionEconomy::processEconomyDataRequest(LLMessageSystem *msg, void **user_data) -{ - LLRegionEconomy *this_ptr = (LLRegionEconomy*)user_data; - if (!this_ptr->hasData()) - { - LL_WARNS() << "Dropping EconomyDataRequest, because EconomyData message " - << "has not been processed" << LL_ENDL; - } - - msg->newMessageFast(_PREHASH_EconomyData); - msg->nextBlockFast(_PREHASH_Info); - msg->addS32Fast(_PREHASH_ObjectCapacity, this_ptr->getObjectCapacity()); - msg->addS32Fast(_PREHASH_ObjectCount, this_ptr->getObjectCount()); - msg->addS32Fast(_PREHASH_PriceEnergyUnit, this_ptr->getPriceEnergyUnit()); - msg->addS32Fast(_PREHASH_PriceObjectClaim, this_ptr->getPriceObjectClaim()); - msg->addS32Fast(_PREHASH_PricePublicObjectDecay, this_ptr->getPricePublicObjectDecay()); - msg->addS32Fast(_PREHASH_PricePublicObjectDelete, this_ptr->getPricePublicObjectDelete()); - msg->addS32Fast(_PREHASH_PriceParcelClaim, this_ptr->mBasePriceParcelClaimActual); - msg->addF32Fast(_PREHASH_PriceParcelClaimFactor, this_ptr->mPriceParcelClaimFactor); - msg->addS32Fast(_PREHASH_PriceUpload, this_ptr->getPriceUpload()); - msg->addS32Fast(_PREHASH_PriceRentLight, this_ptr->getPriceRentLight()); - msg->addS32Fast(_PREHASH_TeleportMinPrice, this_ptr->getTeleportMinPrice()); - msg->addF32Fast(_PREHASH_TeleportPriceExponent, this_ptr->getTeleportPriceExponent()); - - msg->addF32Fast(_PREHASH_EnergyEfficiency, this_ptr->getEnergyEfficiency()); - msg->addF32Fast(_PREHASH_PriceObjectRent, this_ptr->getPriceObjectRent()); - msg->addF32Fast(_PREHASH_PriceObjectScaleFactor, this_ptr->getPriceObjectScaleFactor()); - msg->addS32Fast(_PREHASH_PriceParcelRent, this_ptr->getPriceParcelRent()); - msg->addS32Fast(_PREHASH_PriceGroupCreate, this_ptr->getPriceGroupCreate()); - - msg->sendReliable(msg->getSender()); -} - - -S32 LLRegionEconomy::getPriceParcelClaim() const -{ - //return (S32)((F32)mBasePriceParcelClaim * (mAreaTotal / (mAreaTotal - mAreaOwned))); - return (S32)((F32)mBasePriceParcelClaimActual * mPriceParcelClaimFactor); -} - -S32 LLRegionEconomy::getPriceParcelRent() const -{ - return mBasePriceParcelRent; -} - - -void LLRegionEconomy::print() -{ - this->LLBaseEconomy::print(); - - LL_INFOS() << "Region Economy Settings: " << LL_ENDL; - LL_INFOS() << "Land (square meters): " << mAreaTotal << LL_ENDL; - LL_INFOS() << "Owned Land (square meters): " << mAreaOwned << LL_ENDL; - LL_INFOS() << "Daily Object Rent: " << mPriceObjectRent << LL_ENDL; - LL_INFOS() << "Daily Land Rent (per meter): " << getPriceParcelRent() << LL_ENDL; - LL_INFOS() << "Energey Efficiency: " << mEnergyEfficiency << LL_ENDL; -} - - -void LLRegionEconomy::setBasePriceParcelClaimDefault(S32 val) -{ - mBasePriceParcelClaimDefault = val; - if(mBasePriceParcelClaimActual == -1) - { - mBasePriceParcelClaimActual = val; - } -} - -void LLRegionEconomy::setBasePriceParcelClaimActual(S32 val) -{ - mBasePriceParcelClaimActual = val; -} - -void LLRegionEconomy::setPriceParcelClaimFactor(F32 val) -{ - mPriceParcelClaimFactor = val; -} - -void LLRegionEconomy::setBasePriceParcelRent(S32 val) -{ - mBasePriceParcelRent = val; -} diff --git a/indra/llinventory/lleconomy.h b/indra/llinventory/lleconomy.h deleted file mode 100644 index cdfde171c1..0000000000 --- a/indra/llinventory/lleconomy.h +++ /dev/null @@ -1,157 +0,0 @@ -/** - * @file lleconomy.h - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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_LLECONOMY_H -#define LL_LLECONOMY_H - -#include "llsingleton.h" -#include - -class LLMessageSystem; -class LLVector3; - -/** - * Register an observer to be notified of economy data updates coming from server. - */ -class LLEconomyObserver -{ -public: - virtual ~LLEconomyObserver() {} - virtual void onEconomyDataChange() = 0; -}; - -class LLBaseEconomy -{ -public: - LLBaseEconomy(); - virtual ~LLBaseEconomy(); - - virtual void print(); - - void addObserver(LLEconomyObserver* observer); - void removeObserver(LLEconomyObserver* observer); - void notifyObservers(); - - static void processEconomyData(LLMessageSystem *msg, LLBaseEconomy* econ_data); - - S32 calculateTeleportCost(F32 distance) const; - S32 calculateLightRent(const LLVector3& object_size) const; - - S32 getObjectCount() const { return mObjectCount; } - S32 getObjectCapacity() const { return mObjectCapacity; } - S32 getPriceObjectClaim() const { return mPriceObjectClaim; } - S32 getPricePublicObjectDecay() const { return mPricePublicObjectDecay; } - S32 getPricePublicObjectDelete() const { return mPricePublicObjectDelete; } - S32 getPricePublicObjectRelease() const { return mPriceObjectClaim - mPricePublicObjectDelete; } - S32 getPriceEnergyUnit() const { return mPriceEnergyUnit; } - S32 getPriceUpload() const { return mPriceUpload; } - S32 getPriceRentLight() const { return mPriceRentLight; } - S32 getTeleportMinPrice() const { return mTeleportMinPrice; } - F32 getTeleportPriceExponent() const { return mTeleportPriceExponent; } - S32 getPriceGroupCreate() const { return mPriceGroupCreate; } - - - void setObjectCount(S32 val) { mObjectCount = val; } - void setObjectCapacity(S32 val) { mObjectCapacity = val; } - void setPriceObjectClaim(S32 val) { mPriceObjectClaim = val; } - void setPricePublicObjectDecay(S32 val) { mPricePublicObjectDecay = val; } - void setPricePublicObjectDelete(S32 val) { mPricePublicObjectDelete = val; } - void setPriceEnergyUnit(S32 val) { mPriceEnergyUnit = val; } - void setPriceUpload(S32 val) { mPriceUpload = val; } - void setPriceRentLight(S32 val) { mPriceRentLight = val; } - void setTeleportMinPrice(S32 val) { mTeleportMinPrice = val; } - void setTeleportPriceExponent(F32 val) { mTeleportPriceExponent = val; } - void setPriceGroupCreate(S32 val) { mPriceGroupCreate = val; } - -private: - S32 mObjectCount; - S32 mObjectCapacity; - S32 mPriceObjectClaim; // per primitive - S32 mPricePublicObjectDecay; // per primitive - S32 mPricePublicObjectDelete; // per primitive - S32 mPriceEnergyUnit; - S32 mPriceUpload; - S32 mPriceRentLight; - S32 mTeleportMinPrice; - F32 mTeleportPriceExponent; - S32 mPriceGroupCreate; - - std::list mObservers; -}; - -class LLGlobalEconomy: public LLSingleton, public LLBaseEconomy -{ - LLSINGLETON_EMPTY_CTOR(LLGlobalEconomy); -}; - -class LLRegionEconomy : public LLBaseEconomy -{ -public: - LLRegionEconomy(); - ~LLRegionEconomy(); - - static void processEconomyData(LLMessageSystem *msg, void **user_data); - static void processEconomyDataRequest(LLMessageSystem *msg, void **user_data); - - void print(); - - BOOL hasData() const; - F32 getPriceObjectRent() const { return mPriceObjectRent; } - F32 getPriceObjectScaleFactor() const {return mPriceObjectScaleFactor;} - F32 getEnergyEfficiency() const { return mEnergyEfficiency; } - S32 getPriceParcelClaim() const; - S32 getPriceParcelRent() const; - F32 getAreaOwned() const { return mAreaOwned; } - F32 getAreaTotal() const { return mAreaTotal; } - S32 getBasePriceParcelClaimActual() const { return mBasePriceParcelClaimActual; } - - void setPriceObjectRent(F32 val) { mPriceObjectRent = val; } - void setPriceObjectScaleFactor(F32 val) { mPriceObjectScaleFactor = val; } - void setEnergyEfficiency(F32 val) { mEnergyEfficiency = val; } - - void setBasePriceParcelClaimDefault(S32 val); - void setBasePriceParcelClaimActual(S32 val); - void setPriceParcelClaimFactor(F32 val); - void setBasePriceParcelRent(S32 val); - - void setAreaOwned(F32 val) { mAreaOwned = val; } - void setAreaTotal(F32 val) { mAreaTotal = val; } - -private: - F32 mPriceObjectRent; - F32 mPriceObjectScaleFactor; - F32 mEnergyEfficiency; - - S32 mBasePriceParcelClaimDefault; - S32 mBasePriceParcelClaimActual; - F32 mPriceParcelClaimFactor; - S32 mBasePriceParcelRent; - - F32 mAreaOwned; - F32 mAreaTotal; - -}; - -#endif diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 31b8b90518..1b622de847 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -32,6 +32,7 @@ #include "pipeline.h" #include "llagentaccess.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentlistener.h" #include "llagentwearables.h" @@ -2984,7 +2985,7 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO BOOL LLAgent::canJoinGroups() const { - return (S32)mGroups.size() < gMaxAgentGroups; + return (S32)mGroups.size() < LLAgentBenefits::instance().getGroupMembershipLimit(); } LLQuaternion LLAgent::getHeadRotation() diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp index 09be8f46c1..5ca4ecb456 100644 --- a/indra/newview/llagentbenefits.cpp +++ b/indra/newview/llagentbenefits.cpp @@ -73,6 +73,10 @@ bool LLAgentBenefits::init(const LLSD& benefits_sd) { return false; } + if (!get_required_S32(benefits_sd, "create_group_cost", m_create_group_cost)) + { + return false; + } if (!get_required_S32(benefits_sd, "group_membership_limit", m_group_membership_limit)) { return false; @@ -86,42 +90,42 @@ bool LLAgentBenefits::init(const LLSD& benefits_sd) return false; } + // FIXME PREMIUM - either use this field or get rid of it m_initalized = true; return true; } S32 LLAgentBenefits::getAnimatedObjectLimit() const { - //llassert(m_initalized); return m_animated_object_limit; } S32 LLAgentBenefits::getAnimationUploadCost() const { - //llassert(m_initalized); return m_animation_upload_cost; } S32 LLAgentBenefits::getAttachmentLimit() const { - //llassert(m_initalized); return m_attachment_limit; } +S32 LLAgentBenefits::getCreateGroupCost() const +{ + return m_create_group_cost; +} + S32 LLAgentBenefits::getGroupMembershipLimit() const { - //llassert(m_initalized); return m_group_membership_limit; } S32 LLAgentBenefits::getSoundUploadCost() const { - //llassert(m_initalized); return m_sound_upload_cost; } S32 LLAgentBenefits::getTextureUploadCost() const { - //llassert(m_initalized); return m_texture_upload_cost; } diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h index 995833149c..b21048e38b 100644 --- a/indra/newview/llagentbenefits.h +++ b/indra/newview/llagentbenefits.h @@ -41,6 +41,7 @@ public: S32 getAnimatedObjectLimit() const; S32 getAnimationUploadCost() const; S32 getAttachmentLimit() const; + S32 getCreateGroupCost() const; S32 getGroupMembershipLimit() const; S32 getSoundUploadCost() const; S32 getTextureUploadCost() const; @@ -49,6 +50,7 @@ private: S32 m_animated_object_limit; S32 m_animation_upload_cost; S32 m_attachment_limit; + S32 m_create_group_cost; S32 m_group_membership_limit; S32 m_sound_upload_cost; S32 m_texture_upload_cost; diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 91a6e63665..6d7d3c8556 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -31,7 +31,6 @@ #include "llbvhloader.h" #include "lldatapacker.h" #include "lldir.h" -#include "lleconomy.h" #include "llnotificationsutil.h" #include "llvfile.h" #include "llapr.h" diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index dbe7fee108..a32b01679a 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -38,6 +38,7 @@ #include "roles_constants.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llbutton.h" #include "llgroupactions.h" #include "llscrolllistctrl.h" @@ -172,7 +173,7 @@ void LLPanelGroups::reset() group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); } getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); + getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefits::instance().getGroupMembershipLimit())); init_group_list(getChild("group list"), gAgent.getGroupID()); enableButtons(); @@ -183,7 +184,7 @@ BOOL LLPanelGroups::postBuild() childSetCommitCallback("group list", onGroupList, this); getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); + getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefits::instance().getGroupMembershipLimit())); LLScrollListCtrl *list = getChild("group list"); if (list) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b6efc1590e..dfed11f1b0 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -44,7 +44,6 @@ #include "lldrawable.h" #include "llrender.h" #include "llface.h" -#include "lleconomy.h" #include "llfocusmgr.h" #include "llfloaterperms.h" #include "lliconctrl.h" diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 33dfae8be8..fa1ed57d1f 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -46,12 +46,12 @@ #include "llnotificationsutil.h" #include "lluictrlfactory.h" #include "llstring.h" -#include "lleconomy.h" #include "llpermissions.h" // linden includes #include "llassetstorage.h" #include "llinventorytype.h" +#include "llagentbenefits.h" const S32 PREVIEW_LINE_HEIGHT = 19; const S32 PREVIEW_BORDER_WIDTH = 2; @@ -123,7 +123,8 @@ BOOL LLFloaterNameDesc::postBuild() // Cancel button getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this)); - getChild("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", LLGlobalEconomy::getInstance()->getPriceUpload() )); + // FIXME PREMIUM - depends - what are we uploading here? + getChild("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost())); setDefaultBtn("ok_btn"); @@ -163,7 +164,7 @@ void LLFloaterNameDesc::onBtnOK( ) // FIXME PREMIUM - upload cost. Need to know which asset type this is, use agent benefits. LLAssetStorage::LLStoreAssetCallback callback = NULL; - S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). + S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). if (can_afford_transaction(expected_upload_cost)) { diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 088d052533..e384019a43 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -44,7 +44,6 @@ #include "roles_constants.h" #include "lltransactiontypes.h" #include "llstatusbar.h" -#include "lleconomy.h" #include "llviewerwindow.h" #include "llpanelgroup.h" #include "llgroupactions.h" diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 31e3d408d7..be05ba9207 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -41,7 +41,6 @@ #include "lldeadmantimer.h" #include "llfloatermodelpreview.h" #include "llfloaterperms.h" -#include "lleconomy.h" #include "llimagej2c.h" #include "llhost.h" #include "llmath.h" diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 8f5626bd7a..35b83880d9 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -37,7 +37,6 @@ #include "llaccordionctrltab.h" #include "llappearancemgr.h" #include "llagentbenefits.h" -#include "lleconomy.h" #include "llerror.h" #include "llfilepicker.h" #include "llfloaterperms.h" diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index 451f41cd3b..3bae0cebfb 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -30,7 +30,6 @@ #include "llpanelcontents.h" // linden library includes -#include "lleconomy.h" #include "llerror.h" #include "llfloaterreg.h" #include "llfontgl.h" diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index b53cd222e7..2d0a09b469 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -30,6 +30,7 @@ #include "llavatarnamecache.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llsdparam.h" #include "lluictrlfactory.h" #include "roles_constants.h" @@ -339,7 +340,9 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) return false; } - LLNotificationsUtil::add("CreateGroupCost", LLSD(), LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2)); + LLSD args; + args["COST"] = LLAgentBenefits::instance().getCreateGroupCost(); + LLNotificationsUtil::add("CreateGroupCost", args, LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2)); return false; } diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 7404798589..b81dce4e31 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -34,7 +34,6 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "lldndbutton.h" -#include "lleconomy.h" #include "llfilepicker.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" @@ -1510,11 +1509,6 @@ bool LLPanelMainInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType void LLPanelMainInventory::setUploadCostIfNeeded() { - // *NOTE dzaporozhan - // Upload cost is set in process_economy_data() (llviewermessage.cpp). But since we - // have two instances of Inventory panel at the moment(and two instances of context menu), - // call to gMenuHolder->childSetLabelArg() sets upload cost only for one of the instances. - LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get(); if(mNeedUploadCost && menu) { diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 3665910c63..6bff95ab36 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -30,7 +30,6 @@ #include "llpanelobject.h" // linden library includes -#include "lleconomy.h" #include "llerror.h" #include "llfontgl.h" #include "llpermissionsflags.h" diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index d138433ed8..0a41018293 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -47,6 +47,7 @@ #include "llaccordionctrl.h" #include "llaccordionctrltab.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llavataractions.h" #include "llavatarlist.h" #include "llavatarlistitem.h" @@ -85,11 +86,10 @@ static const std::string RECENT_TAB_NAME = "recent_panel"; static const std::string BLOCKED_TAB_NAME = "blocked_panel"; // blocked avatars static const std::string COLLAPSED_BY_USER = "collapsed_by_user"; +// FIXME PREMIUM - these should come from package info, once viewer is receiving it all. const S32 BASE_MAX_AGENT_GROUPS = 42; const S32 PREMIUM_MAX_AGENT_GROUPS = 60; -extern S32 gMaxAgentGroups; - /** Comparator for comparing avatar items by last interaction date */ class LLAvatarItemRecentComparator : public LLAvatarItemComparator { @@ -629,7 +629,7 @@ BOOL LLPanelPeople::postBuild() getChild("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); getChild("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - if(gMaxAgentGroups < max_premium) + if(LLAgentBenefits::instance().getGroupMembershipLimit() < max_premium) { getChild("groupcount")->setText(getString("GroupCountWithInfo")); getChild("groupcount")->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this)); @@ -877,9 +877,10 @@ void LLPanelPeople::updateButtons() groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected U32 groups_count = gAgent.mGroups.size(); - U32 groups_ramaining = gMaxAgentGroups > groups_count ? gMaxAgentGroups - groups_count : 0; + S32 max_groups = LLAgentBenefits::instance().getGroupMembershipLimit(); + U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0; groups_panel->getChild("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count)); - groups_panel->getChild("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_ramaining)); + groups_panel->getChild("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining)); } else { @@ -1092,6 +1093,7 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) } } +// FIXME PREMIUM this should be coming from LLAgentBenefits info about the various packages. void LLPanelPeople::onGroupLimitInfo() { LLSD args; diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 21ac7604ff..202f42c53a 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -27,7 +27,6 @@ #include "llviewerprecompiledheaders.h" #include "llcombobox.h" -#include "lleconomy.h" #include "llsidetraypanelcontainer.h" #include "llspinctrl.h" @@ -38,6 +37,8 @@ #include "llstatusbar.h" // can_afford_transaction() #include "llnotificationsutil.h" +#include "llagentbenefits.h" + /** * The panel provides UI for saving snapshot as an inventory texture. */ @@ -135,7 +136,7 @@ BOOL LLPanelSnapshotInventory::postBuild() // virtual void LLPanelSnapshotInventory::onOpen(const LLSD& key) { - getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLGlobalEconomy::getInstance()->getPriceUpload())); + getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost())); LLPanelSnapshot::onOpen(key); } @@ -155,7 +156,7 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl) void LLPanelSnapshotInventoryBase::onSend() { - S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); + S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); if (can_afford_transaction(expected_upload_cost)) { if (mSnapshotFloater) @@ -191,7 +192,7 @@ BOOL LLPanelOutfitSnapshotInventory::postBuild() // virtual void LLPanelOutfitSnapshotInventory::onOpen(const LLSD& key) { - getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLGlobalEconomy::getInstance()->getPriceUpload())); + getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost())); LLPanelSnapshot::onOpen(key); } diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 63206e2780..7932db8727 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -26,7 +26,6 @@ #include "llviewerprecompiledheaders.h" -#include "lleconomy.h" #include "llpanel.h" #include "llsidetraypanelcontainer.h" diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 735eaa423d..de2fa74803 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -31,7 +31,6 @@ // linden library includes #include "llclickaction.h" -#include "lleconomy.h" #include "llerror.h" #include "llfontgl.h" #include "llflexibleobject.h" diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 90f8f84ea4..00ff91634d 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -35,7 +35,6 @@ #include "llcachename.h" #include "llavatarnamecache.h" #include "lldbstrings.h" -#include "lleconomy.h" #include "llgl.h" #include "llmediaentry.h" #include "llrender.h" diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index f5fea9dece..430abba543 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -28,10 +28,10 @@ #include "llviewerprecompiledheaders.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentui.h" #include "llcombobox.h" -#include "lleconomy.h" #include "llfloaterperms.h" #include "llfloaterreg.h" #include "llfloaterflickr.h" @@ -1039,7 +1039,7 @@ void LLSnapshotLivePreview::saveTexture(BOOL outfit_snapshot, std::string name) LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL); std::string who_took_it; LLAgentUI::buildFullname(who_took_it); - S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); + S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); std::string res_name = outfit_snapshot ? name : "Snapshot : " + pos_string; std::string res_desc = outfit_snapshot ? "" : "Taken by " + who_took_it + " at " + pos_string; LLFolderType::EType folder_type = outfit_snapshot ? LLFolderType::FT_NONE : LLFolderType::FT_SNAPSHOT_CATEGORY; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 979fe63432..2f9bc786ca 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -209,7 +209,6 @@ // exported globals // bool gAgentMovementCompleted = false; -S32 gMaxAgentGroups; const std::string SCREEN_HOME_FILENAME = "screen_home%s.png"; const std::string SCREEN_LAST_FILENAME = "screen_last%s.png"; @@ -246,7 +245,6 @@ static LLVector3 gAgentStartLookAt(1.0f, 0.f, 0.f); static std::string gAgentStartLocation = "safe"; static bool mLoginStatePastUI = false; -const S32 DEFAULT_MAX_AGENT_GROUPS = 42; const F32 STATE_AGENT_WAIT_TIMEOUT = 240; //seconds boost::scoped_ptr LLStartUp::sStateWatcher(new LLEventStream("StartupState")); @@ -1574,8 +1572,6 @@ bool idle_startup() send_complete_agent_movement(regionp->getHost()); gAssetStorage->setUpstream(regionp->getHost()); gCacheName->setUpstream(regionp->getHost()); - msg->newMessageFast(_PREHASH_EconomyDataRequest); - gAgent.sendReliableMessage(); } display_startup(); @@ -3606,10 +3602,6 @@ bool process_login_success_response() LLViewerMedia::getInstance()->openIDSetup(openid_url, openid_token); } - gMaxAgentGroups = LLAgentBenefits::instance().getGroupMembershipLimit(); - LL_INFOS("LLStartup") << "gMaxAgentGroups set from agent benefits: " - << gMaxAgentGroups << LL_ENDL; - bool success = false; // JC: gesture loading done below, when we have an asset system // in place. Don't delete/clear gUserCredentials until then. diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index db37207022..e9d0498fcb 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -80,7 +80,6 @@ typedef enum { // exported symbols extern bool gAgentMovementCompleted; -extern S32 gMaxAgentGroups; extern LLPointer gStartTexture; class LLStartUp diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index a919362321..2a79eee80e 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -36,7 +36,6 @@ #include "lluploaddialog.h" #include "llpreviewscript.h" #include "llnotificationsutil.h" -#include "lleconomy.h" #include "llagent.h" #include "llfloaterreg.h" #include "llfloatersnapshot.h" diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0fda4d3df8..ef3c1f4c14 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -128,7 +128,6 @@ #include "lluilistener.h" #include "llappearancemgr.h" #include "lltrans.h" -#include "lleconomy.h" #include "lltoolgrab.h" #include "llwindow.h" #include "llpathfindingmanager.h" diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index a9a91b158b..b1606958e1 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -30,6 +30,7 @@ // project includes #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llfilepicker.h" #include "llfloaterreg.h" @@ -67,7 +68,6 @@ #include "llviewerassetupload.h" // linden libraries -#include "lleconomy.h" #include "llnotificationsutil.h" #include "llsdserialize.h" #include "llsdutil.h" @@ -85,8 +85,6 @@ class LLFileEnableUpload : public view_listener_t bool handleEvent(const LLSD& userdata) { return true; -// bool new_value = gStatusBar && LLGlobalEconomy::getInstance() && (gStatusBar->getBalance() >= LLGlobalEconomy::getInstance()->getPriceUpload()); -// return new_value; } }; @@ -417,7 +415,8 @@ const void upload_bulk(const std::vector& filenames, LLFilePicker:: // // Also fix single upload to charge first, then refund - S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); + // FIXME PREMIUM - upload_cost should be per-file, depends on asset type + S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); for (std::vector::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter) { std::string filename = (*in_iter); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index b0ad81614a..2cde93f471 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -32,7 +32,6 @@ #include "llaudioengine.h" #include "llavataractions.h" #include "llavatarnamecache.h" // IDEVO HACK -#include "lleconomy.h" #include "lleventtimer.h" #include "llfloaterreg.h" #include "llfolderview.h" @@ -51,6 +50,7 @@ #include "mean_collision_data.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llcallingcard.h" #include "llbuycurrencyhtml.h" @@ -903,7 +903,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response) if(option == 0 && !group_id.isNull()) { // check for promotion or demotion. - S32 max_groups = gMaxAgentGroups; + S32 max_groups = LLAgentBenefits::instance().getGroupMembershipLimit(); if(gAgent.isInGroup(group_id)) ++max_groups; if(gAgent.mGroups.size() < max_groups) @@ -5435,16 +5435,7 @@ void process_frozen_message(LLMessageSystem *msgsystem, void **user_data) // do some extra stuff once we get our economy data void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) { - LLGlobalEconomy::processEconomyData(msg, LLGlobalEconomy::getInstance()); - - S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); - - LL_INFOS_ONCE("Messaging") << "EconomyData message arrived; upload cost is L$" << upload_cost << LL_ENDL; - - gMenuHolder->getChild("Upload Image")->setLabelArg("[COST]", llformat("%d", upload_cost)); - gMenuHolder->getChild("Upload Sound")->setLabelArg("[COST]", llformat("%d", upload_cost)); - gMenuHolder->getChild("Upload Animation")->setLabelArg("[COST]", llformat("%d", upload_cost)); - gMenuHolder->getChild("Bulk Upload")->setLabelArg("[COST]", llformat("%d", upload_cost)); + LL_DEBUGS("Benefits") << "Received economy data, not currently used" << LL_ENDL; } void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, BOOL granted) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f72767cceb..e0fc6bb9a5 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -920,7 +920,7 @@ You do not have enough L$ to join this group. icon="alertmodal.tga" name="CreateGroupCost" type="alertmodal"> -Creating this group will cost L$100. +Creating this group will cost L$[COST]. Groups need more than one member, or they are deleted forever. Please invite members within 48 hours. group @@ -929,7 +929,7 @@ Please invite members within 48 hours. canceltext="Cancel" name="okcancelbuttons" notext="Cancel" - yestext="Create group for L$100"/> + yestext="Create group for L$[COST]"/> Date: Fri, 15 Nov 2019 19:47:03 +0200 Subject: SL-9699 First login panel checkbox was misinterpreted --- indra/newview/llpanellogin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 4f050a9748..cfd486f7f3 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -749,7 +749,7 @@ void LLPanelLogin::getFields(LLPointer& credential, } else { - remember_user = true; + remember_user = remember_psswrd; // on panel_login_first "remember_check" is named as 'remember me' } } -- cgit v1.2.3 From 18eb8ac90ce409ba620f6fe8ff487e6195d9c3eb Mon Sep 17 00:00:00 2001 From: "Michael Pohoreski (Ptolemy Linden)" Date: Fri, 15 Nov 2019 15:45:08 -0800 Subject: QoL fix: remove extra blank lines for every source line when dumping shader source --- indra/llrender/llshadermgr.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index bce3720d3b..dcb34c6761 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -570,9 +570,20 @@ static std::string get_object_log(GLhandleARB ret) //dump shader source for debugging void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text) { - for (GLuint i = 0; i < shader_code_count; i++) + for (U32 i = 0; i < shader_code_count; i++) { + GLcharARB *line = shader_code_text[i]; + size_t len = strlen( line ); + char last = len > 0 ? line[len - 1] : 0; + + // LL_ENDL already outputs a newline so temporarily strip off the end newline to prevent EVERY line outputting an (extra) blank line + if (last == '\n') + line[len - 1] = 0; + LL_SHADER_LOADING_WARNS() << i << ": " << shader_code_text[i] << LL_ENDL; + + if (last == '\n') + line[len - 1] = '\n'; } LL_SHADER_LOADING_WARNS() << LL_ENDL; } -- cgit v1.2.3 From e32a2e2f8ad072408cb9136d3d5fc5f02a232bef Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Sun, 17 Nov 2019 18:21:49 +0200 Subject: SL-9699 Fixed processing of placeholder --- indra/newview/llpanellogin.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index cfd486f7f3..4fd39d1211 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -1230,8 +1230,12 @@ void LLPanelLogin::populateUserList(LLPointer credential) { if (credential.notNull()) { - user_combo->add(LLPanelLogin::getUserName(credential), credential->userID(), ADD_BOTTOM, TRUE); - setFields(credential); + const LLSD &ident = credential->getIdentifier(); + if (ident.isMap() && ident.has("type")) + { + user_combo->add(LLPanelLogin::getUserName(credential), credential->userID(), ADD_BOTTOM, TRUE); + setFields(credential); + } } } } -- cgit v1.2.3 From d12e10be377e692f5164ba914b8f038e66b0d45c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 18 Nov 2019 17:15:11 +0000 Subject: SL-10499 - bulk upload behavior adjusted to account for possibly different upload prices for different asset types. Also added a confirmation dialog for bulk upload. --- indra/newview/llagentbenefits.cpp | 21 +++++ indra/newview/llagentbenefits.h | 3 + indra/newview/llviewerassetupload.cpp | 52 ++++++++--- indra/newview/llviewerassetupload.h | 2 + indra/newview/llviewermenufile.cpp | 104 ++++++++++++++++----- .../skins/default/xui/en/menu_inventory_add.xml | 4 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 2 +- .../newview/skins/default/xui/en/notifications.xml | 11 +++ .../skins/default/xui/it/menu_inventory_add.xml | 2 +- indra/newview/skins/default/xui/it/menu_viewer.xml | 2 +- indra/newview/skins/default/xui/pl/menu_viewer.xml | 2 +- .../skins/default/xui/pt/menu_inventory_add.xml | 2 +- 12 files changed, 163 insertions(+), 44 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp index 5ca4ecb456..eef644ccc0 100644 --- a/indra/newview/llagentbenefits.cpp +++ b/indra/newview/llagentbenefits.cpp @@ -129,3 +129,24 @@ S32 LLAgentBenefits::getTextureUploadCost() const { return m_texture_upload_cost; } + +bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) +{ + bool succ = false; + if (asset_type == LLAssetType::AT_TEXTURE) + { + cost = getTextureUploadCost(); + succ = true; + } + else if (asset_type == LLAssetType::AT_SOUND) + { + cost = getSoundUploadCost(); + succ = true; + } + else if (asset_type == LLAssetType::AT_ANIMATION) + { + cost = getAnimationUploadCost(); + succ = true; + } + return succ; +} diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h index b21048e38b..7ed6e169ce 100644 --- a/indra/newview/llagentbenefits.h +++ b/indra/newview/llagentbenefits.h @@ -28,6 +28,7 @@ #include "llsingleton.h" #include "llsd.h" +#include "llassettype.h" class LLAgentBenefits: public LLSingleton { @@ -45,6 +46,8 @@ public: S32 getGroupMembershipLimit() const; S32 getSoundUploadCost() const; S32 getTextureUploadCost() const; + + bool findUploadCost(LLAssetType::EType& asset_type, S32& cost); private: S32 m_animated_object_limit; diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 2a79eee80e..de35f9911c 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -306,6 +306,31 @@ std::string LLResourceUploadInfo::getDisplayName() const return (mName.empty()) ? mAssetId.asString() : mName; }; +// static +bool LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(const std::string& exten, LLAssetType::EType& asset_type, U32& codec) +{ + bool succ = false; + + codec = LLImageBase::getCodecFromExtension(exten); + if (codec != IMG_CODEC_INVALID) + { + asset_type = LLAssetType::AT_TEXTURE; + succ = true; + } + else if (exten == "wav") + { + asset_type = LLAssetType::AT_SOUND; + succ = true; + } + else if (exten == "anim") + { + asset_type = LLAssetType::AT_ANIMATION; + succ = true; + } + + return succ; +} + //========================================================================= LLNewFileResourceUploadInfo::LLNewFileResourceUploadInfo( std::string fileName, @@ -343,9 +368,11 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile() std::string filename = gDirUtilp->getTempFilename(); std::string exten = gDirUtilp->getExtension(getFileName()); - U32 codec = LLImageBase::getCodecFromExtension(exten); LLAssetType::EType assetType = LLAssetType::AT_NONE; + U32 codec = IMG_CODEC_INVALID; + bool found_type = findAssetTypeAndCodecOfExtension(exten, assetType, codec); + std::string errorMessage; std::string errorLabel; @@ -362,10 +389,16 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile() errorLabel = "NoFileExtension"; error = true; } - else if (codec != IMG_CODEC_INVALID) + else if (!found_type) + { + // Unknown extension + errorMessage = llformat(LLTrans::getString("UnknownFileExtension").c_str(), exten.c_str()); + errorLabel = "ErrorMessage"; + error = TRUE;; + } + else if (assetType == LLAssetType::AT_TEXTURE) { // It's an image file, the upload procedure is the same for all - assetType = LLAssetType::AT_TEXTURE; if (!LLViewerTextureList::createUploadFile(getFileName(), filename, codec)) { errorMessage = llformat("Problem with file %s:\n\n%s\n", @@ -374,9 +407,8 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile() error = true; } } - else if (exten == "wav") + else if (assetType == LLAssetType::AT_SOUND) { - assetType = LLAssetType::AT_SOUND; // tag it as audio S32 encodeResult = 0; LL_INFOS() << "Attempting to encode wav as an ogg file" << LL_ENDL; @@ -406,18 +438,10 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile() errorLabel = "DoNotSupportBulkAnimationUpload"; error = true; } - else if (exten == "anim") + else if (assetType == LLAssetType::AT_ANIMATION) { - assetType = LLAssetType::AT_ANIMATION; filename = getFileName(); } - else - { - // Unknown extension - errorMessage = llformat(LLTrans::getString("UnknownFileExtension").c_str(), exten.c_str()); - errorLabel = "ErrorMessage"; - error = TRUE;; - } if (error) { diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h index 0ba16dce1d..8ef25ad6fd 100644 --- a/indra/newview/llviewerassetupload.h +++ b/indra/newview/llviewerassetupload.h @@ -87,6 +87,8 @@ public: LLUUID getItemId() const { return mItemId; } LLAssetID getAssetId() const { return mAssetId; } + static bool findAssetTypeAndCodecOfExtension(const std::string& exten, LLAssetType::EType& asset_type, U32& codec); + protected: LLResourceUploadInfo( std::string name, diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index b1606958e1..90fbbcc8d2 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -404,24 +404,19 @@ const void upload_single_file(const std::vector& filenames, LLFileP return; } - -const void upload_bulk(const std::vector& filenames, LLFilePicker::ELoadFilter type) +void do_bulk_upload(std::vector filenames, const LLSD& notification, const LLSD& response) { - // TODO: - // Check user balance for entire cost - // Charge user entire cost - // Loop, uploading - // If an upload fails, refund the user for that one - // - // Also fix single upload to charge first, then refund + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option != 0) + { + // Cancel upload + return; + } - // FIXME PREMIUM - upload_cost should be per-file, depends on asset type - S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); for (std::vector::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter) { std::string filename = (*in_iter); - if (!check_file_extension(filename, type)) continue; - + std::string name = gDirUtilp->getBaseFileName(filename, true); std::string asset_name = name; LLStringUtil::replaceNonstandardASCII(asset_name, '?'); @@ -429,17 +424,80 @@ const void upload_bulk(const std::vector& filenames, LLFilePicker:: LLStringUtil::stripNonprintable(asset_name); LLStringUtil::trim(asset_name); - LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( - filename, - asset_name, - asset_name, 0, - LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - LLFloaterPerms::getNextOwnerPerms("Uploads"), - LLFloaterPerms::getGroupPerms("Uploads"), - LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost)); + std::string ext = gDirUtilp->getExtension(filename); + LLAssetType::EType asset_type; + U32 codec; + S32 expected_upload_cost; + if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) && + LLAgentBenefits::instance().findUploadCost(asset_type, expected_upload_cost)) + { + LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( + filename, + asset_name, + asset_name, 0, + LLFolderType::FT_NONE, LLInventoryType::IT_NONE, + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), + expected_upload_cost)); + + upload_new_resource(uploadInfo, NULL, NULL); + } + } +} - upload_new_resource(uploadInfo, NULL, NULL); +bool get_bulk_upload_expected_cost(const std::vector& filenames, S32& total_cost) +{ + bool succ = true; + total_cost = 0; + for (std::vector::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter) + { + std::string filename = (*in_iter); + std::string ext = gDirUtilp->getExtension(filename); + + LLAssetType::EType asset_type; + U32 codec; + S32 cost; + + if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) && + LLAgentBenefits::instance().findUploadCost(asset_type, cost)) + { + total_cost += cost; + } + } + + return succ; +} + +const void upload_bulk(const std::vector& filenames, LLFilePicker::ELoadFilter type) +{ + // TODO: + // Check user balance for entire cost + // Charge user entire cost + // Loop, uploading + // If an upload fails, refund the user for that one + // + // Also fix single upload to charge first, then refund + + // FIXME PREMIUM what about known types that can't be bulk uploaded + // (bvh)? These will fail in the item by item upload but won't be + // mentioned in the notification. + std::vector filtered_filenames; + for (std::vector::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter) + { + const std::string& filename = *in_iter; + if (check_file_extension(filename, type)) + { + filtered_filenames.push_back(filename); + } + } + S32 expected_upload_cost; + if (get_bulk_upload_expected_cost(filtered_filenames, expected_upload_cost)) + { + LLSD args; + args["COST"] = expected_upload_cost; + args["COUNT"] = (S32) filtered_filenames.size(); + LLNotificationsUtil::add("BulkUploadCostConfirmation", args, LLSD(), boost::bind(do_bulk_upload, filtered_filenames, _1, _2)); } } diff --git a/indra/newview/skins/default/xui/en/menu_inventory_add.xml b/indra/newview/skins/default/xui/en/menu_inventory_add.xml index 29724b0270..05dd8f827d 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory_add.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory_add.xml @@ -56,7 +56,7 @@ function="File.VisibleUploadModel"/> - \ No newline at end of file + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 165986448f..9b27e8b03d 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1347,7 +1347,7 @@ function="File.VisibleUploadModel"/> + +This will upload [COUNT] items at a total cost of L$[COST]. Do you wish to continue with the upload? + + + - + diff --git a/indra/newview/skins/default/xui/it/menu_viewer.xml b/indra/newview/skins/default/xui/it/menu_viewer.xml index ae82a89d28..795a23ca9b 100644 --- a/indra/newview/skins/default/xui/it/menu_viewer.xml +++ b/indra/newview/skins/default/xui/it/menu_viewer.xml @@ -168,7 +168,7 @@ - + diff --git a/indra/newview/skins/default/xui/pl/menu_viewer.xml b/indra/newview/skins/default/xui/pl/menu_viewer.xml index e6ad1faee6..2dfafff7f5 100644 --- a/indra/newview/skins/default/xui/pl/menu_viewer.xml +++ b/indra/newview/skins/default/xui/pl/menu_viewer.xml @@ -159,7 +159,7 @@ - + diff --git a/indra/newview/skins/default/xui/pt/menu_inventory_add.xml b/indra/newview/skins/default/xui/pt/menu_inventory_add.xml index 7a7ebc50af..92621e8493 100644 --- a/indra/newview/skins/default/xui/pt/menu_inventory_add.xml +++ b/indra/newview/skins/default/xui/pt/menu_inventory_add.xml @@ -6,7 +6,7 @@ - + -- cgit v1.2.3 From 5b20fca991c109df40b5e8ee0f750507c57f46a1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 18 Nov 2019 19:32:47 +0000 Subject: possible fix for mac compilation error --- indra/newview/llviewermenu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index ef3c1f4c14..c1de275174 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8669,7 +8669,8 @@ class LLUploadCostCalculator : public view_listener_t bool handleEvent(const LLSD& userdata) { std::vector fields; - boost::split(fields, userdata.asString(), boost::is_any_of(",")); + std::string str = userdata.asString(); + boost::split(fields, str, boost::is_any_of(",")); if (fields.size()<1) { return false; -- cgit v1.2.3 From fed4d3391cf704fb080cf95e15cd992351ba0575 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 18 Nov 2019 21:46:19 +0200 Subject: SL-9699 Fixed processing of placeholder #2 --- indra/newview/llfloaterforgetuser.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterforgetuser.cpp b/indra/newview/llfloaterforgetuser.cpp index 55e25ace9a..363951041a 100644 --- a/indra/newview/llfloaterforgetuser.cpp +++ b/indra/newview/llfloaterforgetuser.cpp @@ -54,7 +54,7 @@ LLFloaterForgetUser::~LLFloaterForgetUser() BOOL LLFloaterForgetUser::postBuild() { - // Note, storage works per grid, watever is selected currently in login screen or logged in. + // Note, storage works per grid, whatever is selected currently in login screen or logged in. // Since login screen can change grid, store the value. mGrid = LLGridManager::getInstance()->getGrid(); @@ -87,14 +87,18 @@ BOOL LLFloaterForgetUser::postBuild() LLPointer cred = gSecAPIHandler->loadCredential(mGrid); if (cred.notNull()) { - LLScrollListItem::Params item_params; - item_params.value(cred->userID()); - item_params.columns.add() - .value(LLPanelLogin::getUserName(cred)) - .column("user") - .font(LLFontGL::getFontSansSerifSmall()); - scroll_list->addRow(item_params, ADD_BOTTOM); - scroll_list->selectFirstItem(); + const LLSD &ident = cred->getIdentifier(); + if (ident.isMap() && ident.has("type")) + { + LLScrollListItem::Params item_params; + item_params.value(cred->userID()); + item_params.columns.add() + .value(LLPanelLogin::getUserName(cred)) + .column("user") + .font(LLFontGL::getFontSansSerifSmall()); + scroll_list->addRow(item_params, ADD_BOTTOM); + scroll_list->selectFirstItem(); + } } } -- cgit v1.2.3 From 716552a0c014455def500a669b916a68293187de Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 19 Nov 2019 11:55:02 +0200 Subject: SL-12186 Don't copy templates from app_settings directory, because it's excessive --- indra/newview/llpresetsmanager.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 88b24265e3..dda705eeca 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -138,26 +138,6 @@ std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory) if (!gDirUtilp->fileExists(dest_path)) LLFile::mkdir(dest_path); - if (PRESETS_CAMERA == subdirectory) - { - std::string source_dir = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA); - LLDirIterator dir_iter(source_dir, "*.xml"); - bool found = true; - while (found) - { - std::string file; - found = dir_iter.next(file); - - if (found) - { - std::string source = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, file); - file = LLURI::escape(file); - std::string dest = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, file); - LLFile::copy(source, dest); - } - } - } - return dest_path; } @@ -570,8 +550,7 @@ bool LLPresetsManager::createDefaultCameraPreset(std::string preset_name, bool f if (!gDirUtilp->fileExists(preset_file) || force_reset) { std::string template_name = preset_name.substr(0, preset_name.size() - PRESETS_VIEW_SUFFIX.size()); - std::string default_template_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, - PRESETS_CAMERA, template_name + ".xml"); + std::string default_template_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, template_name + ".xml"); return LLFile::copy(default_template_file, preset_file); } return false; -- cgit v1.2.3 From eb6e64ec401382fd2fbbbb27830e828035a6e5af Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 19 Nov 2019 16:15:19 +0000 Subject: SL-10499 - Fixes for benefits info and upload, especially bulk upload --- indra/newview/llfloaternamedesc.cpp | 31 +++++++++++++++++----- indra/newview/llfloaternamedesc.h | 3 +++ indra/newview/llpanelmaininventory.cpp | 10 ------- indra/newview/llstartup.cpp | 2 +- indra/newview/llviewerassetupload.cpp | 6 +++++ indra/newview/llviewerassetupload.h | 1 + indra/newview/llviewermenu.cpp | 10 +++---- indra/newview/skins/default/xui/en/menu_viewer.xml | 2 +- .../newview/skins/default/xui/en/notifications.xml | 8 ++++++ 9 files changed, 49 insertions(+), 24 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index fa1ed57d1f..937dd60f0f 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -63,7 +63,7 @@ const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; //----------------------------------------------------------------------------- LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& filename ) : LLFloater(filename), - mIsAudio(FALSE) + mIsAudio(FALSE) { mFilenameAndPath = filename.asString(); mFilename = gDirUtilp->getBaseFileName(mFilenameAndPath, false); @@ -123,14 +123,33 @@ BOOL LLFloaterNameDesc::postBuild() // Cancel button getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this)); - // FIXME PREMIUM - depends - what are we uploading here? - getChild("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost())); + S32 expected_upload_cost = getExpectedUploadCost(); + getChild("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", expected_upload_cost)); setDefaultBtn("ok_btn"); return TRUE; } +S32 LLFloaterNameDesc::getExpectedUploadCost() const +{ + std::string exten = gDirUtilp->getExtension(mFilename); + LLAssetType::EType asset_type; + S32 upload_cost = -1; + if (LLResourceUploadInfo::findAssetTypeOfExtension(exten, asset_type)) + { + if (!LLAgentBenefits::instance().findUploadCost(asset_type, upload_cost)) + { + LL_WARNS() << "Unable to find upload cost for asset type " << asset_type << LL_ENDL; + } + } + else + { + LL_WARNS() << "Unable to find upload cost for " << mFilename << LL_ENDL; + } + return upload_cost; +} + //----------------------------------------------------------------------------- // LLFloaterNameDesc() //----------------------------------------------------------------------------- @@ -162,10 +181,8 @@ void LLFloaterNameDesc::onBtnOK( ) { getChildView("ok_btn")->setEnabled(FALSE); // don't allow inadvertent extra uploads - // FIXME PREMIUM - upload cost. Need to know which asset type this is, use agent benefits. LLAssetStorage::LLStoreAssetCallback callback = NULL; - S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). - + S32 expected_upload_cost = getExpectedUploadCost(); if (can_afford_transaction(expected_upload_cost)) { void *nruserdata = NULL; @@ -187,7 +204,7 @@ void LLFloaterNameDesc::onBtnOK( ) { LLSD args; args["COST"] = llformat("%d", expected_upload_cost); - LLNotificationsUtil::add("ErrorTextureCannotAfford", args); + LLNotificationsUtil::add("ErrorCannotAffordUpload", args); } closeFloater(false); diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h index 41643681ac..589f470e82 100644 --- a/indra/newview/llfloaternamedesc.h +++ b/indra/newview/llfloaternamedesc.h @@ -30,6 +30,7 @@ #include "llfloater.h" #include "llresizehandle.h" #include "llstring.h" +#include "llassettype.h" class LLLineEditor; class LLButton; @@ -45,6 +46,8 @@ public: void onBtnOK(); void onBtnCancel(); void doCommit(); + + S32 getExpectedUploadCost() const; protected: virtual void onCommit(); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index b81dce4e31..a57ee83285 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -237,11 +237,6 @@ BOOL LLPanelMainInventory::postBuild() menu->getChild("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str); menu->getChild("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str); menu->getChild("Upload Animation")->setLabelArg("[COST]", animation_upload_cost_str); - - // FIXME PREMIUM - bulk upload of what? This doesn't work with - // mixed items if costs aren't all the same. For now treating - // as textures. - menu->getChild("Bulk Upload")->setLabelArg("[COST]", texture_upload_cost_str); } // Trigger callback for focus received so we can deselect items in inbox/outbox @@ -1519,11 +1514,6 @@ void LLPanelMainInventory::setUploadCostIfNeeded() menu->getChild("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str); menu->getChild("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str); menu->getChild("Upload Animation")->setLabelArg("[COST]", animation_upload_cost_str); - - // FIXME PREMIUM - bulk upload of what? This doesn't work with - // mixed items if costs aren't all the same. For now treating - // as textures. - menu->getChild("Bulk Upload")->setLabelArg("[COST]", texture_upload_cost_str); } } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 2f9bc786ca..c144ea2f8e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -3254,7 +3254,7 @@ bool process_login_success_response() { LLSD response = LLLoginInstance::getInstance()->getResponse(); - //LL_INFOS() << "login success response:" << ll_pretty_print_sd(response) << LL_ENDL; + LL_DEBUGS("Benefits") << "login success response:" << response << LL_ENDL; if (!LLAgentBenefits::instance().init(response["account_level_benefits"])) { LL_ERRS() << "Benefits error" << LL_ENDL; diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index de35f9911c..4cbb88d4f1 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -306,6 +306,12 @@ std::string LLResourceUploadInfo::getDisplayName() const return (mName.empty()) ? mAssetId.asString() : mName; }; +bool LLResourceUploadInfo::findAssetTypeOfExtension(const std::string& exten, LLAssetType::EType& asset_type) +{ + U32 codec; + return findAssetTypeAndCodecOfExtension(exten, asset_type, codec); +} + // static bool LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(const std::string& exten, LLAssetType::EType& asset_type, U32& codec) { diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h index 8ef25ad6fd..6301359021 100644 --- a/indra/newview/llviewerassetupload.h +++ b/indra/newview/llviewerassetupload.h @@ -87,6 +87,7 @@ public: LLUUID getItemId() const { return mItemId; } LLAssetID getAssetId() const { return mAssetId; } + static bool findAssetTypeOfExtension(const std::string& exten, LLAssetType::EType& asset_type); static bool findAssetTypeAndCodecOfExtension(const std::string& exten, LLAssetType::EType& asset_type, U32& codec); protected: diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index c1de275174..e88acc2ac4 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -516,8 +516,6 @@ void init_menus() gMenuHolder->childSetLabelArg("Upload Image", "[COST]", texture_upload_cost_str); gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", sound_upload_cost_str); gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", animation_upload_cost_str); - // FIXME PREMIUM - do we need to handle non-texture bulk uploads? - gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", texture_upload_cost_str); gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE); gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE); @@ -8720,8 +8718,7 @@ class LLToggleUIHints : public view_listener_t void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str) { - // FIXME PREMIUM reasonable default? - S32 upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + S32 upload_cost = -1; if (asset_type_str == "texture") { @@ -8735,6 +8732,10 @@ void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str) { upload_cost = LLAgentBenefits::instance().getSoundUploadCost(); } + if (upload_cost < 0) + { + LL_WARNS() << "Unable to find upload cost for asset_type_str " << asset_type_str << LL_ENDL; + } mCostStr = std::to_string(upload_cost); } @@ -8840,7 +8841,6 @@ void initialize_menus() enable.add("displayViewerEventRecorderMenuItems",boost::bind(&LLViewerEventRecorder::displayViewerEventRecorderMenuItems,&LLViewerEventRecorder::instance())); - // FIXME PREMIUM these need to be distinguished by asset type - see menu_viewer.xml view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts"); enable.add("Conversation.IsConversationLoggingAllowed", boost::bind(&LLFloaterIMContainer::isConversationLoggingAllowed)); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 9b27e8b03d..362ddfd27a 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1347,7 +1347,7 @@ function="File.VisibleUploadModel"/> fail + + You need L$[COST] to upload this item. + fail + + Date: Tue, 19 Nov 2019 12:15:45 -0700 Subject: SL-11055 Add back pre-EEP fog burnthrough for fullbrights --- .../app_settings/shaders/class2/windlight/transportF.glsl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index d2d839ed05..a06f4f22ad 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -51,7 +51,14 @@ vec3 atmosTransport(vec3 light) vec3 fullbrightAtmosTransport(vec3 light) { float brightness = dot(light.rgb * 0.5, vec3(0.3333)) + 0.1; - return atmosTransportFrag(light * 0.5, getAdditiveColor() * brightness, getAtmosAttenuation()); + vec3 attenColor = atmosTransportFrag(light * 0.5, getAdditiveColor() * brightness, getAtmosAttenuation()); + + // attenColor is an accurate fog-attenuated result for any brightness + // But, the pre-EEP shader included a brightness-indexed lerp to a non-attenuated version + // of the color - effectively a fog 'burn-through' for very bright pixels. To more closely + // match the pre-EEP behavior, we'll also lerp to the pre-EEP color, based on overall brightness + float preEepBright = dot(light.rgb, vec3(0.3333)); + retun mix(attenColor, (light.rgb + getAdditiveColor().rgb) * (2.0 - preEepBright), preEepBright * preEepBright); } vec3 fullbrightShinyAtmosTransport(vec3 light) -- cgit v1.2.3 From 4300b204f0fc519d3e2dabc7e1296284e5908611 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 20 Nov 2019 14:03:57 +0000 Subject: SL-10499 - handle package info from benefits service --- indra/newview/llagent.cpp | 2 +- indra/newview/llagentbenefits.cpp | 69 +++++++++++++++++++++- indra/newview/llagentbenefits.h | 28 +++++++-- indra/newview/llfloaterbvhpreview.cpp | 2 +- indra/newview/llfloatergroups.cpp | 4 +- indra/newview/llfloaternamedesc.cpp | 2 +- indra/newview/lloutfitgallery.cpp | 2 +- indra/newview/llpanelgroupgeneral.cpp | 2 +- indra/newview/llpanelmaininventory.cpp | 12 ++-- indra/newview/llpanelpeople.cpp | 39 ++---------- indra/newview/llpanelsnapshotinventory.cpp | 6 +- indra/newview/llpanelsnapshotoptions.cpp | 2 +- indra/newview/llsnapshotlivepreview.cpp | 2 +- indra/newview/llstartup.cpp | 59 +++++++++++++++++- indra/newview/llviewermenu.cpp | 12 ++-- indra/newview/llviewermenufile.cpp | 4 +- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llvoavatar.cpp | 4 +- .../newview/skins/default/xui/en/notifications.xml | 12 +++- 19 files changed, 194 insertions(+), 71 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 1b622de847..1545be3457 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2985,7 +2985,7 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO BOOL LLAgent::canJoinGroups() const { - return (S32)mGroups.size() < LLAgentBenefits::instance().getGroupMembershipLimit(); + return (S32)mGroups.size() < LLAgentBenefitsMgr::current().getGroupMembershipLimit(); } LLQuaternion LLAgent::getHeadRotation() diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp index eef644ccc0..a7f16b03d2 100644 --- a/indra/newview/llagentbenefits.cpp +++ b/indra/newview/llagentbenefits.cpp @@ -130,7 +130,7 @@ S32 LLAgentBenefits::getTextureUploadCost() const return m_texture_upload_cost; } -bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) +bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) const { bool succ = false; if (asset_type == LLAssetType::AT_TEXTURE) @@ -150,3 +150,70 @@ bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) } return succ; } + +LLAgentBenefitsMgr::LLAgentBenefitsMgr() +{ +} + +LLAgentBenefitsMgr::~LLAgentBenefitsMgr() +{ +} + +// static +const LLAgentBenefits& LLAgentBenefitsMgr::current() +{ + return instance().mCurrent; +} + +// static +const LLAgentBenefits& LLAgentBenefitsMgr::get(const std::string& package) +{ + if (instance().mPackageMap.find(package) != instance().mPackageMap.end()) + { + return instance().mPackageMap[package]; + } + else + { + return instance().mDefault; + } +} + +// static +bool LLAgentBenefitsMgr::init(const std::string& package, const LLSD& benefits_sd) +{ + LLAgentBenefits benefits; + if (!benefits.init(benefits_sd)) + { + LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL; + return false; + } + else + { + instance().mPackageMap[package] = benefits; + } + return true; + +} + +// static +bool LLAgentBenefitsMgr::initCurrent(const std::string& package, const LLSD& benefits_sd) +{ + LLAgentBenefits benefits; + if (!benefits.init(benefits_sd)) + { + LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL; + return false; + } + else + { + instance().mCurrent = benefits; + } + return true; + +} + +// static +bool LLAgentBenefitsMgr::has(const std::string& package) +{ + return instance().mPackageMap.find(package) != instance().mPackageMap.end(); +} diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h index 7ed6e169ce..9338bc1c26 100644 --- a/indra/newview/llagentbenefits.h +++ b/indra/newview/llagentbenefits.h @@ -30,13 +30,13 @@ #include "llsd.h" #include "llassettype.h" -class LLAgentBenefits: public LLSingleton +class LLAgentBenefits { - LLSINGLETON(LLAgentBenefits); +public: + LLAgentBenefits(); ~LLAgentBenefits(); LOG_CLASS(LLAgentBenefits); -public: bool init(const LLSD& benefits_sd); S32 getAnimatedObjectLimit() const; @@ -47,7 +47,7 @@ public: S32 getSoundUploadCost() const; S32 getTextureUploadCost() const; - bool findUploadCost(LLAssetType::EType& asset_type, S32& cost); + bool findUploadCost(LLAssetType::EType& asset_type, S32& cost) const; private: S32 m_animated_object_limit; @@ -61,4 +61,24 @@ private: bool m_initalized; }; +class LLAgentBenefitsMgr: public LLSingleton +{ + LLSINGLETON(LLAgentBenefitsMgr); + ~LLAgentBenefitsMgr(); + LOG_CLASS(LLAgentBenefitsMgr); + +public: + static const LLAgentBenefits& current(); + static const LLAgentBenefits& get(const std::string& package); + static bool init(const std::string& package, const LLSD& benefits_sd); + static bool initCurrent(const std::string& package, const LLSD& benefits_sd); + static bool has(const std::string& package); + +private: + LLAgentBenefits mCurrent; + LLAgentBenefits mDefault; + std::map mPackageMap; +}; + + #endif diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 6d7d3c8556..1f54b5f838 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -1004,7 +1004,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) { std::string name = floaterp->getChild("name_form")->getValue().asString(); std::string desc = floaterp->getChild("description_form")->getValue().asString(); - S32 expected_upload_cost = LLAgentBenefits::instance().getAnimationUploadCost(); + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost(); LLResourceUploadInfo::ptr_t assetUploadInfo(new LLResourceUploadInfo( floaterp->mTransactionID, LLAssetType::AT_ANIMATION, diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index a32b01679a..f341e2ebcb 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -173,7 +173,7 @@ void LLPanelGroups::reset() group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); } getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefits::instance().getGroupMembershipLimit())); + getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefitsMgr::current().getGroupMembershipLimit())); init_group_list(getChild("group list"), gAgent.getGroupID()); enableButtons(); @@ -184,7 +184,7 @@ BOOL LLPanelGroups::postBuild() childSetCommitCallback("group list", onGroupList, this); getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefits::instance().getGroupMembershipLimit())); + getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefitsMgr::current().getGroupMembershipLimit())); LLScrollListCtrl *list = getChild("group list"); if (list) diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 937dd60f0f..89e93102dd 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -138,7 +138,7 @@ S32 LLFloaterNameDesc::getExpectedUploadCost() const S32 upload_cost = -1; if (LLResourceUploadInfo::findAssetTypeOfExtension(exten, asset_type)) { - if (!LLAgentBenefits::instance().findUploadCost(asset_type, upload_cost)) + if (!LLAgentBenefitsMgr::current().findUploadCost(asset_type, upload_cost)) { LL_WARNS() << "Unable to find upload cost for asset type " << asset_type << LL_ENDL; } diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 35b83880d9..6c3d385811 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1205,7 +1205,7 @@ void LLOutfitGallery::uploadOutfitImage(const std::vector& filename return; } - S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); void *nruserdata = NULL; nruserdata = (void *)&outfit_id; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 2d0a09b469..18f38b0d12 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -341,7 +341,7 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) } LLSD args; - args["COST"] = LLAgentBenefits::instance().getCreateGroupCost(); + args["COST"] = LLAgentBenefitsMgr::current().getCreateGroupCost(); LLNotificationsUtil::add("CreateGroupCost", args, LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2)); return false; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index a57ee83285..be31a2ed5d 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -227,9 +227,9 @@ BOOL LLPanelMainInventory::postBuild() initListCommandsHandlers(); - const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost()); - const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost()); - const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost()); + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost()); LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get(); if (menu) @@ -1507,9 +1507,9 @@ void LLPanelMainInventory::setUploadCostIfNeeded() LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get(); if(mNeedUploadCost && menu) { - const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost()); - const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost()); - const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost()); + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost()); menu->getChild("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str); menu->getChild("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 0a41018293..2e991e425d 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -86,10 +86,6 @@ static const std::string RECENT_TAB_NAME = "recent_panel"; static const std::string BLOCKED_TAB_NAME = "blocked_panel"; // blocked avatars static const std::string COLLAPSED_BY_USER = "collapsed_by_user"; -// FIXME PREMIUM - these should come from package info, once viewer is receiving it all. -const S32 BASE_MAX_AGENT_GROUPS = 42; -const S32 PREMIUM_MAX_AGENT_GROUPS = 60; - /** Comparator for comparing avatar items by last interaction date */ class LLAvatarItemRecentComparator : public LLAvatarItemComparator { @@ -612,24 +608,14 @@ void LLPanelPeople::removePicker() BOOL LLPanelPeople::postBuild() { - // FIXME PREMIUM - need to get premium vs. basic info via BaaS - S32 max_premium = PREMIUM_MAX_AGENT_GROUPS; - if (gAgent.getRegion()) - { - LLSD features; - gAgent.getRegion()->getSimulatorFeatures(features); - if (features.has("MaxAgentGroupsPremium")) - { - max_premium = features["MaxAgentGroupsPremium"].asInteger(); - } - } + S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit(); getChild("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); getChild("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); getChild("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); getChild("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - if(LLAgentBenefits::instance().getGroupMembershipLimit() < max_premium) + if(LLAgentBenefitsMgr::current().getGroupMembershipLimit() < max_premium) { getChild("groupcount")->setText(getString("GroupCountWithInfo")); getChild("groupcount")->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this)); @@ -877,7 +863,7 @@ void LLPanelPeople::updateButtons() groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected U32 groups_count = gAgent.mGroups.size(); - S32 max_groups = LLAgentBenefits::instance().getGroupMembershipLimit(); + S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0; groups_panel->getChild("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count)); groups_panel->getChild("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining)); @@ -1093,26 +1079,13 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) } } -// FIXME PREMIUM this should be coming from LLAgentBenefits info about the various packages. void LLPanelPeople::onGroupLimitInfo() { LLSD args; - S32 max_basic = BASE_MAX_AGENT_GROUPS; - S32 max_premium = PREMIUM_MAX_AGENT_GROUPS; - if (gAgent.getRegion()) - { - LLSD features; - gAgent.getRegion()->getSimulatorFeatures(features); - if (features.has("MaxAgentGroupsBasic")) - { - max_basic = features["MaxAgentGroupsBasic"].asInteger(); - } - if (features.has("MaxAgentGroupsPremium")) - { - max_premium = features["MaxAgentGroupsPremium"].asInteger(); - } - } + S32 max_basic = LLAgentBenefitsMgr::get("Base").getGroupMembershipLimit(); + S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit(); + args["MAX_BASIC"] = max_basic; args["MAX_PREMIUM"] = max_premium; diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 202f42c53a..594cbed7ad 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -136,7 +136,7 @@ BOOL LLPanelSnapshotInventory::postBuild() // virtual void LLPanelSnapshotInventory::onOpen(const LLSD& key) { - getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost())); + getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost())); LLPanelSnapshot::onOpen(key); } @@ -156,7 +156,7 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl) void LLPanelSnapshotInventoryBase::onSend() { - S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); if (can_afford_transaction(expected_upload_cost)) { if (mSnapshotFloater) @@ -192,7 +192,7 @@ BOOL LLPanelOutfitSnapshotInventory::postBuild() // virtual void LLPanelOutfitSnapshotInventory::onOpen(const LLSD& key) { - getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost())); + getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost())); LLPanelSnapshot::onOpen(key); } diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 7932db8727..6ded46d690 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -94,7 +94,7 @@ void LLPanelSnapshotOptions::onOpen(const LLSD& key) void LLPanelSnapshotOptions::updateUploadCost() { - S32 upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); getChild("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d", upload_cost)); } diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 430abba543..3c8b405a67 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -1039,7 +1039,7 @@ void LLSnapshotLivePreview::saveTexture(BOOL outfit_snapshot, std::string name) LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL); std::string who_took_it; LLAgentUI::buildFullname(who_took_it); - S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); std::string res_name = outfit_snapshot ? name : "Snapshot : " + pos_string; std::string res_desc = outfit_snapshot ? "" : "Taken by " + who_took_it + " at " + pos_string; LLFolderType::EType folder_type = outfit_snapshot ? LLFolderType::FT_NONE : LLFolderType::FT_SNAPSHOT_CATEGORY; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index c144ea2f8e..3f65d69719 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -3250,14 +3250,67 @@ void apply_udp_blacklist(const std::string& csv) } +void on_benefits_failed_callback(const LLSD& notification, const LLSD& response) +{ + LL_WARNS("Benefits") << "Failed to load benefits information" << LL_ENDL; +} + +bool init_benefits(LLSD& response) +{ + LL_DEBUGS("Benefits") << "login success response:" << response << LL_ENDL; + + bool succ = true; + + std::string package_name = response["account_type"].asString(); + const LLSD& benefits_sd = response["account_level_benefits"]; + if (!LLAgentBenefitsMgr::init(package_name, benefits_sd) || + !LLAgentBenefitsMgr::initCurrent(package_name, benefits_sd)) + { + succ = false; + } + else + { + LL_DEBUGS("Benefits") << "Initialized current benefits, level " << package_name << " from " << benefits_sd << LL_ENDL; + } + const LLSD& packages_sd = response["premium_packages"]; + for(LLSD::map_const_iterator package_iter = packages_sd.beginMap(); + package_iter != packages_sd.endMap(); + ++package_iter) + { + std::string package_name = package_iter->first; + const LLSD& benefits_sd = package_iter->second["benefits"]; + if (LLAgentBenefitsMgr::init(package_name, benefits_sd)) + { + LL_DEBUGS("Benefits") << "Initialized benefits for package " << package_name << " from " << benefits_sd << LL_ENDL; + } + else + { + LL_WARNS("Benefits") << "Failed init for package " << package_name << " from " << benefits_sd << LL_ENDL; + succ = false; + } + } + + if (!LLAgentBenefitsMgr::has("Base")) + { + LL_WARNS("Benefits") << "Benefits info did not include required package Base" << LL_ENDL; + succ = false; + } + if (!LLAgentBenefitsMgr::has("Premium")) + { + LL_WARNS("Benefits") << "Benefits info did not include required package Premium" << LL_ENDL; + succ = false; + } + return succ; +} + bool process_login_success_response() { LLSD response = LLLoginInstance::getInstance()->getResponse(); - LL_DEBUGS("Benefits") << "login success response:" << response << LL_ENDL; - if (!LLAgentBenefits::instance().init(response["account_level_benefits"])) + bool benefits_ok = init_benefits(response); + if (!benefits_ok) { - LL_ERRS() << "Benefits error" << LL_ENDL; + LLNotificationsUtil::add("FailedToGetBenefits", LLSD(), LLSD(), boost::bind(on_benefits_failed_callback, _1, _2)); } std::string text(response["udp_blacklist"]); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index e88acc2ac4..49a4eb6a4d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -510,9 +510,9 @@ void init_menus() LLGridManager::getInstance()->isInProductionGrid()); // *TODO:Also fix cost in llfolderview.cpp for Inventory menus - const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost()); - const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost()); - const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost()); + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost()); gMenuHolder->childSetLabelArg("Upload Image", "[COST]", texture_upload_cost_str); gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", sound_upload_cost_str); gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", animation_upload_cost_str); @@ -8722,15 +8722,15 @@ void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str) if (asset_type_str == "texture") { - upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); } else if (asset_type_str == "animation") { - upload_cost = LLAgentBenefits::instance().getAnimationUploadCost(); + upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost(); } else if (asset_type_str == "sound") { - upload_cost = LLAgentBenefits::instance().getSoundUploadCost(); + upload_cost = LLAgentBenefitsMgr::current().getSoundUploadCost(); } if (upload_cost < 0) { diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 90fbbcc8d2..4ce39e715c 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -429,7 +429,7 @@ void do_bulk_upload(std::vector filenames, const LLSD& notification U32 codec; S32 expected_upload_cost; if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) && - LLAgentBenefits::instance().findUploadCost(asset_type, expected_upload_cost)) + LLAgentBenefitsMgr::current().findUploadCost(asset_type, expected_upload_cost)) { LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( filename, @@ -460,7 +460,7 @@ bool get_bulk_upload_expected_cost(const std::vector& filenames, S3 S32 cost; if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) && - LLAgentBenefits::instance().findUploadCost(asset_type, cost)) + LLAgentBenefitsMgr::current().findUploadCost(asset_type, cost)) { total_cost += cost; } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 2cde93f471..6e64ccc501 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -903,7 +903,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response) if(option == 0 && !group_id.isNull()) { // check for promotion or demotion. - S32 max_groups = LLAgentBenefits::instance().getGroupMembershipLimit(); + S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); if(gAgent.isInGroup(group_id)) ++max_groups; if(gAgent.mGroups.size() < max_groups) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f8ff71911e..e7ceec40ef 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7061,7 +7061,7 @@ U32 LLVOAvatar::getNumAttachments() const //----------------------------------------------------------------------------- S32 LLVOAvatar::getMaxAttachments() const { - return LLAgentBenefits::instance().getAttachmentLimit(); + return LLAgentBenefitsMgr::current().getAttachmentLimit(); } //----------------------------------------------------------------------------- @@ -7095,7 +7095,7 @@ U32 LLVOAvatar::getNumAnimatedObjectAttachments() const //----------------------------------------------------------------------------- S32 LLVOAvatar::getMaxAnimatedObjectAttachments() const { - return LLAgentBenefits::instance().getAnimatedObjectLimit(); + return LLAgentBenefitsMgr::current().getAnimatedObjectLimit(); } //----------------------------------------------------------------------------- diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f93113ebd0..c8db5d24dd 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -8410,7 +8410,17 @@ Your voice has been muted by moderator. name="okbutton" yestext="OK"/> - + + + Unfortunately, we were unable to get benefits information for this session. This should not happen in a normal production environment. Please contact support. This session will not work normally and we recommend that you restart. + + + Date: Wed, 20 Nov 2019 20:23:33 +0000 Subject: SL-10499 - Added picks_limit to benefits info. Will be needed in profiles eventually. --- indra/newview/llagentbenefits.cpp | 10 ++++++++++ indra/newview/llagentbenefits.h | 2 ++ 2 files changed, 12 insertions(+) (limited to 'indra') diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp index a7f16b03d2..fcb1600b1d 100644 --- a/indra/newview/llagentbenefits.cpp +++ b/indra/newview/llagentbenefits.cpp @@ -32,6 +32,7 @@ LLAgentBenefits::LLAgentBenefits(): m_animation_upload_cost(-1), m_attachment_limit(-1), m_group_membership_limit(-1), + m_picks_limit(-1), m_sound_upload_cost(-1), m_texture_upload_cost(-1) { @@ -81,6 +82,10 @@ bool LLAgentBenefits::init(const LLSD& benefits_sd) { return false; } + if (!get_required_S32(benefits_sd, "picks_limit", m_picks_limit)) + { + return false; + } if (!get_required_S32(benefits_sd, "sound_upload_cost", m_sound_upload_cost)) { return false; @@ -120,6 +125,11 @@ S32 LLAgentBenefits::getGroupMembershipLimit() const return m_group_membership_limit; } +S32 LLAgentBenefits::getPicksLimit() const +{ + return m_picks_limit; +} + S32 LLAgentBenefits::getSoundUploadCost() const { return m_sound_upload_cost; diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h index 9338bc1c26..680b1e7b07 100644 --- a/indra/newview/llagentbenefits.h +++ b/indra/newview/llagentbenefits.h @@ -44,6 +44,7 @@ public: S32 getAttachmentLimit() const; S32 getCreateGroupCost() const; S32 getGroupMembershipLimit() const; + S32 getPicksLimit() const; S32 getSoundUploadCost() const; S32 getTextureUploadCost() const; @@ -55,6 +56,7 @@ private: S32 m_attachment_limit; S32 m_create_group_cost; S32 m_group_membership_limit; + S32 m_picks_limit; S32 m_sound_upload_cost; S32 m_texture_upload_cost; -- cgit v1.2.3 From e1ea2c2b1eda89cf08fc31d3d1970446daea1883 Mon Sep 17 00:00:00 2001 From: "Michael Pohoreski (Ptolemy Linden)" Date: Thu, 21 Nov 2019 05:25:18 +0000 Subject: SL-11406 Fix fullbright to better match non-EEP. Minor optimization cleanup. --- .../shaders/class1/deferred/materialF.glsl | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 9505f2eb74..e640c2d7ae 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -264,8 +264,7 @@ void main() tnorm = vary_normal; #endif - norm.xyz = tnorm; - norm.xyz = normalize(norm.xyz); + norm.xyz = normalize(tnorm.xyz); vec2 abnormal = encode_normal(norm.xyz); @@ -277,7 +276,20 @@ void main() final_color.a = max(final_color.a, emissive_brightness); - vec4 final_normal = vec4(abnormal, env_intensity, 0.0); + // SL-11406 Fullbright: Object > Texture > Shininess > Environment Intensity = 1 + // NOTE: There are two shaders that are used depending on the EI byte value: + // EI = 0 fullbright + // EI > 0 .. 255 material + // When it is passed to us it is normalized. + // We can either modify the output environment intensity + // OR + // adjust the final color via: + // final_color *= 0.666666; + // We remap the environment intensity to closely simulate what non-EEP is doing. + // At midnight the brightness is exact. + // At midday the brightness is very close. + float ei = env_intensity*0.5 + 0.5; + vec4 final_normal = vec4(abnormal, ei, 0.0); vec4 final_specular = spec; final_specular.a = specular_color.a; @@ -316,11 +328,11 @@ void main() vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - float da = dot(normalize(norm.xyz), normalize(light_dir.xyz)); - da = clamp(da, -1.0, 1.0); + float da = dot(norm.xyz, normalize(light_dir.xyz)); + // Dot product is guaranteed to be in -1 <= da <= +1 range for normalized vectors + // da = clamp(da, -1.0, 1.0); - float final_da = da; - final_da = clamp(final_da, 0.0, 1.0); + float final_da = clamp(da, 0.0, 1.0); float ambient = da; ambient *= 0.5; @@ -458,3 +470,4 @@ vec3 post_atmo = color.rgb; #endif } + -- cgit v1.2.3 From f4d4fb2ad0927ebb8545bac1abd1b74918a006f5 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 22 Nov 2019 14:34:20 +0200 Subject: SL-12288 Enhancement for Rotate and Track camera controls --- indra/newview/llagentcamera.cpp | 58 ++++++++++++- indra/newview/llagentcamera.h | 13 ++- indra/newview/lljoystickbutton.cpp | 95 +++++++++++++++++---- indra/newview/lljoystickbutton.h | 9 +- .../textures/bottomtray/Cam_Rotate_Center.png | Bin 0 -> 10689 bytes .../textures/bottomtray/Cam_Tracking_Center.png | Bin 0 -> 1714 bytes indra/newview/skins/default/textures/textures.xml | 2 + 7 files changed, 155 insertions(+), 22 deletions(-) create mode 100644 indra/newview/skins/default/textures/bottomtray/Cam_Rotate_Center.png create mode 100644 indra/newview/skins/default/textures/bottomtray/Cam_Tracking_Center.png (limited to 'indra') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index e5fba7f28f..67b117657f 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -184,6 +184,9 @@ LLAgentCamera::LLAgentCamera() : clearGeneralKeys(); clearOrbitKeys(); clearPanKeys(); + + resetPanDiff(); + resetOrbitDiff(); } // Requires gSavedSettings to be initialized. @@ -343,7 +346,8 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) mCameraFOVZoomFactor = 0.f; } - + resetPanDiff(); + resetOrbitDiff(); mHUDTargetZoom = 1.f; } @@ -822,6 +826,7 @@ void LLAgentCamera::cameraOrbitAround(const F32 radians) } else { + mOrbitAroundRadians += radians; mCameraFocusOffsetTarget.rotVec(radians, 0.f, 0.f, 1.f); cameraZoomIn(1.f); @@ -853,12 +858,34 @@ void LLAgentCamera::cameraOrbitOver(const F32 angle) LLVector3d left_axis; left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); F32 new_angle = llclamp(angle_from_up - angle, 1.f * DEG_TO_RAD, 179.f * DEG_TO_RAD); + mOrbitOverAngle += angle_from_up - new_angle; mCameraFocusOffsetTarget.rotVec(angle_from_up - new_angle, left_axis); cameraZoomIn(1.f); } } +void LLAgentCamera::resetCameraOrbit() +{ + LLVector3 camera_offset_unit(mCameraFocusOffsetTarget); + camera_offset_unit.normalize(); + + LLVector3d left_axis; + left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); + mCameraFocusOffsetTarget.rotVec(-mOrbitOverAngle, left_axis); + + mCameraFocusOffsetTarget.rotVec(-mOrbitAroundRadians, 0.f, 0.f, 1.f); + + cameraZoomIn(1.f); + resetOrbitDiff(); +} + +void LLAgentCamera::resetOrbitDiff() +{ + mOrbitAroundRadians = 0; + mOrbitOverAngle = 0; +} + //----------------------------------------------------------------------------- // cameraZoomIn() //----------------------------------------------------------------------------- @@ -997,6 +1024,8 @@ void LLAgentCamera::cameraPanIn(F32 meters) LLVector3d at_axis; at_axis.setVec(LLViewerCamera::getInstance()->getAtAxis()); + mPanFocusDiff += meters * at_axis; + mFocusTargetGlobal += meters * at_axis; mFocusGlobal = mFocusTargetGlobal; // don't enforce zoom constraints as this is the only way for users to get past them easily @@ -1013,6 +1042,8 @@ void LLAgentCamera::cameraPanLeft(F32 meters) LLVector3d left_axis; left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); + mPanFocusDiff += meters * left_axis; + mFocusTargetGlobal += meters * left_axis; mFocusGlobal = mFocusTargetGlobal; @@ -1033,6 +1064,8 @@ void LLAgentCamera::cameraPanUp(F32 meters) LLVector3d up_axis; up_axis.setVec(LLViewerCamera::getInstance()->getUpAxis()); + mPanFocusDiff += meters * up_axis; + mFocusTargetGlobal += meters * up_axis; mFocusGlobal = mFocusTargetGlobal; @@ -1045,6 +1078,26 @@ void LLAgentCamera::cameraPanUp(F32 meters) mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); } +void LLAgentCamera::resetCameraPan() +{ + mFocusTargetGlobal -= mPanFocusDiff; + + mFocusGlobal = mFocusTargetGlobal; + mCameraSmoothingStop = true; + + cameraZoomIn(1.f); + updateFocusOffset(); + + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); + + resetPanDiff(); +} + +void LLAgentCamera::resetPanDiff() +{ + mPanFocusDiff.clear(); +} + //----------------------------------------------------------------------------- // updateLookAt() //----------------------------------------------------------------------------- @@ -2330,6 +2383,9 @@ void LLAgentCamera::switchCameraPreset(ECameraPreset preset) mCameraPreset = preset; + resetPanDiff(); + resetOrbitDiff(); + gSavedSettings.setU32("CameraPreset", mCameraPreset); } diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 8a922bf678..0608507d1a 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -262,7 +262,8 @@ public: void cameraOrbitAround(const F32 radians); // Rotate camera CCW radians about build focus point void cameraOrbitOver(const F32 radians); // Rotate camera forward radians over build focus point void cameraOrbitIn(const F32 meters); // Move camera in toward build focus point - + void resetCameraOrbit(); + void resetOrbitDiff(); //-------------------------------------------------------------------- // Zoom //-------------------------------------------------------------------- @@ -279,8 +280,9 @@ public: public: void cameraPanIn(const F32 meters); void cameraPanLeft(const F32 meters); - void cameraPanUp(const F32 meters); - + void cameraPanUp(const F32 meters); + void resetCameraPan(); + void resetPanDiff(); //-------------------------------------------------------------------- // View //-------------------------------------------------------------------- @@ -367,6 +369,9 @@ private: F32 mOrbitInKey; F32 mOrbitOutKey; + F32 mOrbitAroundRadians; + F32 mOrbitOverAngle; + //-------------------------------------------------------------------- // Pan //-------------------------------------------------------------------- @@ -394,6 +399,8 @@ private: F32 mPanInKey; F32 mPanOutKey; + LLVector3d mPanFocusDiff; + /** Keys ** ** *******************************************************************************/ diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 59e14e6cc0..eb4e4f4100 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -37,6 +37,7 @@ #include "llui.h" #include "llagent.h" #include "llagentcamera.h" +#include "llviewercamera.h" #include "llviewertexture.h" #include "llviewertexturelist.h" #include "llviewerwindow.h" @@ -54,6 +55,8 @@ static LLDefaultChildRegistry::Register r5("joystick_trac const F32 NUDGE_TIME = 0.25f; // in seconds const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed +const S32 CENTER_DOT_RADIUS = 7; + // // Public Methods // @@ -138,9 +141,25 @@ bool LLJoystick::pointInCircle(S32 x, S32 y) const //center is x and y coordinates of center of joystick circle, and also its radius int center = this->getLocalRect().getHeight()/2; bool in_circle = (x - center) * (x - center) + (y - center) * (y - center) <= center * center; + return in_circle; } +bool LLJoystick::pointInCenterDot(S32 x, S32 y, S32 radius) const +{ + if (this->getLocalRect().getHeight() != this->getLocalRect().getWidth()) + { + LL_WARNS() << "Joystick shape is not square" << LL_ENDL; + return true; + } + + S32 center = this->getLocalRect().getHeight() / 2; + + bool in_center_circle = (x - center) * (x - center) + (y - center) * (y - center) <= radius * radius; + + return in_center_circle; +} + BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask) { //LL_INFOS() << "joystick mouse down " << x << ", " << y << LL_ENDL; @@ -403,8 +422,11 @@ LLJoystickCameraRotate::LLJoystickCameraRotate(const LLJoystickCameraRotate::Par mInLeft( FALSE ), mInTop( FALSE ), mInRight( FALSE ), - mInBottom( FALSE ) -{ } + mInBottom( FALSE ), + mInCenter( FALSE ) +{ + mCenterImageName = "Cam_Rotate_Center"; +} void LLJoystickCameraRotate::updateSlop() @@ -434,7 +456,16 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask) S32 dx = x - horiz_center; S32 dy = y - vert_center; - if (dy > dx && dy > -dx) + if (pointInCenterDot(x, y, CENTER_DOT_RADIUS)) + { + mInitialOffset.mX = 0; + mInitialOffset.mY = 0; + mInitialQuadrant = JQ_ORIGIN; + mInCenter = TRUE; + + resetJoystickCamera(); + } + else if (dy > dx && dy > -dx) { // top mInitialOffset.mX = 0; @@ -469,9 +500,20 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLJoystickCameraRotate::handleMouseUp(S32 x, S32 y, MASK mask) { gAgent.setMovementLocked(FALSE); + mInCenter = FALSE; return LLJoystick::handleMouseUp(x, y, mask); } +BOOL LLJoystickCameraRotate::handleHover(S32 x, S32 y, MASK mask) +{ + if (!pointInCenterDot(x, y, CENTER_DOT_RADIUS)) + { + mInCenter = FALSE; + } + + return LLJoystick::handleHover(x, y, mask); +} + void LLJoystickCameraRotate::onHeldDown() { updateSlop(); @@ -504,6 +546,11 @@ void LLJoystickCameraRotate::onHeldDown() } } +void LLJoystickCameraRotate::resetJoystickCamera() +{ + gAgentCamera.resetCameraOrbit(); +} + F32 LLJoystickCameraRotate::getOrbitRate() { F32 time = getElapsedHeldDownTime(); @@ -536,24 +583,31 @@ void LLJoystickCameraRotate::draw() getImageUnselected()->draw( 0, 0 ); LLPointer image = getImageSelected(); - if( mInTop ) + if (mInCenter) { - drawRotatedImage( getImageSelected(), 0 ); + drawRotatedImage(LLUI::getUIImage(mCenterImageName), 0); } - - if( mInRight ) + else { - drawRotatedImage( getImageSelected(), 1 ); - } + if (mInTop) + { + drawRotatedImage(getImageSelected(), 0); + } - if( mInBottom ) - { - drawRotatedImage( getImageSelected(), 2 ); - } + if (mInRight) + { + drawRotatedImage(getImageSelected(), 1); + } - if( mInLeft ) - { - drawRotatedImage( getImageSelected(), 3 ); + if (mInBottom) + { + drawRotatedImage(getImageSelected(), 2); + } + + if (mInLeft) + { + drawRotatedImage(getImageSelected(), 3); + } } } @@ -613,7 +667,9 @@ LLJoystickCameraTrack::Params::Params() LLJoystickCameraTrack::LLJoystickCameraTrack(const LLJoystickCameraTrack::Params& p) : LLJoystickCameraRotate(p) -{} +{ + mCenterImageName = "Cam_Tracking_Center"; +} void LLJoystickCameraTrack::onHeldDown() @@ -646,3 +702,8 @@ void LLJoystickCameraTrack::onHeldDown() gAgentCamera.setPanDownKey(getOrbitRate()); } } + +void LLJoystickCameraTrack::resetJoystickCamera() +{ + gAgentCamera.resetCameraPan(); +} diff --git a/indra/newview/lljoystickbutton.h b/indra/newview/lljoystickbutton.h index 4e6c774cad..3e29215f61 100644 --- a/indra/newview/lljoystickbutton.h +++ b/indra/newview/lljoystickbutton.h @@ -79,7 +79,8 @@ public: * Image containing circle is square and this square has adherent points with joystick * circle. Make sure to change method according to shape other than square. */ - bool pointInCircle(S32 x, S32 y) const; + bool pointInCircle(S32 x, S32 y) const; + bool pointInCenterDot(S32 x, S32 y, S32 radius) const; static std::string nameFromQuadrant(const EJoystickQuadrant quadrant); static EJoystickQuadrant quadrantFromName(const std::string& name); @@ -147,7 +148,9 @@ public: virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual void onHeldDown(); + virtual void resetJoystickCamera(); virtual void draw(); protected: @@ -160,6 +163,9 @@ protected: BOOL mInTop; BOOL mInRight; BOOL mInBottom; + BOOL mInCenter; + + std::string mCenterImageName; }; @@ -176,6 +182,7 @@ public: LLJoystickCameraTrack(const LLJoystickCameraTrack::Params&); virtual void onHeldDown(); + virtual void resetJoystickCamera(); }; #endif // LL_LLJOYSTICKBUTTON_H diff --git a/indra/newview/skins/default/textures/bottomtray/Cam_Rotate_Center.png b/indra/newview/skins/default/textures/bottomtray/Cam_Rotate_Center.png new file mode 100644 index 0000000000..ffc3c85ea2 Binary files /dev/null and b/indra/newview/skins/default/textures/bottomtray/Cam_Rotate_Center.png differ diff --git a/indra/newview/skins/default/textures/bottomtray/Cam_Tracking_Center.png b/indra/newview/skins/default/textures/bottomtray/Cam_Tracking_Center.png new file mode 100644 index 0000000000..2812d614e6 Binary files /dev/null and b/indra/newview/skins/default/textures/bottomtray/Cam_Tracking_Center.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index b086f7dfa8..2a4171f11b 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -113,8 +113,10 @@ with the same filename but different name + + -- cgit v1.2.3 From 4acfc99fa608269d06a5a3e45a4c3fdc5e3d06ee Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 22 Nov 2019 18:26:56 +0200 Subject: SL-12317 UI Changes to Group limits --- indra/llui/lltextbase.cpp | 8 +++++--- indra/llui/lltextbase.h | 6 ++++++ indra/newview/llpanelpeople.cpp | 15 ++++++++++++--- indra/newview/lltoastalertpanel.cpp | 5 +++++ indra/newview/skins/default/xui/en/notifications.xml | 18 ++++++++++++++---- indra/newview/skins/default/xui/en/panel_people.xml | 3 ++- 6 files changed, 44 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 22635f734e..8a4b224310 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -152,6 +152,7 @@ LLTextBase::Params::Params() plain_text("plain_text",false), track_end("track_end", false), read_only("read_only", false), + skip_link_underline("skip_link_underline", false), spellcheck("spellcheck", false), v_pad("v_pad", 0), h_pad("h_pad", 0), @@ -183,6 +184,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mFontShadow(p.font_shadow), mPopupMenuHandle(), mReadOnly(p.read_only), + mSkipLinkUnderline(p.skip_link_underline), mSpellCheck(p.spellcheck), mSpellCheckStart(-1), mSpellCheckEnd(-1), @@ -2289,7 +2291,7 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig S32 cur_length = getLength(); LLStyleConstSP sp(new LLStyle(highlight_params)); LLTextSegmentPtr segmentp; - if(underline_on_hover_only) + if (underline_on_hover_only || mSkipLinkUnderline) { highlight_params.font.style("NORMAL"); LLStyleConstSP normal_sp(new LLStyle(highlight_params)); @@ -2313,7 +2315,7 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig S32 segment_start = old_length; S32 segment_end = old_length + wide_text.size(); LLStyleConstSP sp(new LLStyle(style_params)); - if (underline_on_hover_only) + if (underline_on_hover_only || mSkipLinkUnderline) { LLStyle::Params normal_style_params(style_params); normal_style_params.font.style("NORMAL"); @@ -3488,7 +3490,7 @@ F32 LLOnHoverChangeableTextSegment::draw(S32 start, S32 end, S32 selection_start /*virtual*/ BOOL LLOnHoverChangeableTextSegment::handleHover(S32 x, S32 y, MASK mask) { - mStyle = mHoveredStyle; + mStyle = mEditor.getSkipLinkUnderline() ? mNormalStyle : mHoveredStyle; return LLNormalTextSegment::handleHover(x, y, mask); } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 9831c35858..86aecf9236 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -309,6 +309,7 @@ public: border_visible, track_end, read_only, + skip_link_underline, spellcheck, allow_scroll, plain_text, @@ -448,6 +449,9 @@ public: void setReadOnly(bool read_only) { mReadOnly = read_only; } bool getReadOnly() { return mReadOnly; } + void setSkipLinkUnderline(bool skip_link_underline) { mSkipLinkUnderline = skip_link_underline; } + bool getSkipLinkUnderline() { return mSkipLinkUnderline; } + void setPlainText(bool value) { mPlainText = value;} bool getPlainText() const { return mPlainText; } @@ -691,6 +695,8 @@ protected: bool mAutoIndent; S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes + bool mSkipLinkUnderline; + // support widgets LLHandle mPopupMenuHandle; LLView* mDocumentView; diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 2e991e425d..3126edc205 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1086,10 +1086,19 @@ void LLPanelPeople::onGroupLimitInfo() S32 max_basic = LLAgentBenefitsMgr::get("Base").getGroupMembershipLimit(); S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit(); - args["MAX_BASIC"] = max_basic; - args["MAX_PREMIUM"] = max_premium; + args["MAX_BASIC"] = max_basic; + args["MAX_PREMIUM"] = max_premium; - LLNotificationsUtil::add("GroupLimitInfo", args); + if (LLAgentBenefitsMgr::has("PremiumPlus")) + { + S32 max_premium_plus = LLAgentBenefitsMgr::get("PremiumPlus").getGroupMembershipLimit(); + args["MAX_PREMIUM"] = max_premium_plus; + LLNotificationsUtil::add("GroupLimitInfoPlus", args); + } + else + { + LLNotificationsUtil::add("GroupLimitInfo", args); + } } void LLPanelPeople::onTabSelected(const LLSD& param) diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp index 941cb410fc..bac3a6832e 100644 --- a/indra/newview/lltoastalertpanel.cpp +++ b/indra/newview/lltoastalertpanel.cpp @@ -194,6 +194,11 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal - 3*VPAD - BTN_HEIGHT; // reshape to calculate real text width and height msg_box->reshape( MAX_ALLOWED_MSG_WIDTH, max_allowed_msg_height ); + + if ("GroupLimitInfo" == mNotification->getName() || "GroupLimitInfoPlus" == mNotification->getName()) + { + msg_box->setSkipLinkUnderline(true); + } msg_box->setValue(msg); S32 pixel_width = msg_box->getTextPixelWidth(); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index c8db5d24dd..670784f3bf 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4276,11 +4276,21 @@ You have reached your maximum number of groups. Please leave some group before j icon="alert.tga" name="GroupLimitInfo" type="alert"> -The group limit for base accounts is [MAX_BASIC], and for [https://secondlife.com/premium/ premium] -accounts is [MAX_PREMIUM]. -If you downgraded your account, you will need to get below [MAX_BASIC] group limit before you can join more. +Residents with Basic memberships may join up to [MAX_BASIC] groups. +Premium memberships allow up to [MAX_PREMIUM]. [https://secondlife.com/my/account/membership.php? Learn more or upgrade] + group + + -[https://secondlife.com/my/account/membership.php Upgrade today!] + +Residents with Basic memberships may join up to [MAX_BASIC] groups. +Premium memberships allow up to [MAX_PREMIUM]. Premium Plus +memberships allow up to [MAX_PREMIUM_PLUS]. [https://secondlife.com/my/account/membership.php? Learn more or upgrade] group + value="You belong to [COUNT] groups, and can join [REMAINING] more. [secondlife:/// Raise your limit]"/> You belong to [COUNT] groups, and can join [REMAINING] more. -- cgit v1.2.3 From 9621dd8bbd1697b119574bcc879345f03b42969e Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 22 Nov 2019 20:18:30 +0200 Subject: SL-12100 Premium Enhancements - Changes to rates to create Groups, UI Work --- indra/llui/llscrolllistctrl.cpp | 8 +- indra/llui/llscrolllistctrl.h | 10 +- indra/newview/CMakeLists.txt | 2 + indra/newview/llagentbenefits.cpp | 7 + indra/newview/llagentbenefits.h | 2 + indra/newview/llgroupactions.cpp | 4 +- indra/newview/llgroupmgr.cpp | 4 +- indra/newview/llpanelgroup.cpp | 41 --- indra/newview/llpanelgroup.h | 3 - indra/newview/llpanelgroupcreate.cpp | 237 ++++++++++++++++ indra/newview/llpanelgroupcreate.h | 73 +++++ indra/newview/llpanelgroupgeneral.cpp | 59 +--- indra/newview/llpanelgroupgeneral.h | 1 - .../skins/default/xui/en/floater_people.xml | 6 + .../newview/skins/default/xui/en/notifications.xml | 12 + .../xui/en/panel_group_creation_sidetray.xml | 314 +++++++++++++++++++++ .../default/xui/en/panel_group_info_sidetray.xml | 11 - indra/newview/skins/default/xui/en/strings.xml | 6 + 18 files changed, 680 insertions(+), 120 deletions(-) create mode 100644 indra/newview/llpanelgroupcreate.cpp create mode 100644 indra/newview/llpanelgroupcreate.h create mode 100644 indra/newview/skins/default/xui/en/panel_group_creation_sidetray.xml (limited to 'indra') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index f4028057e8..7415e7d974 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -137,6 +137,7 @@ LLScrollListCtrl::Params::Params() background_visible("background_visible"), draw_stripes("draw_stripes"), column_padding("column_padding"), + row_padding("row_padding", 2), fg_unselected_color("fg_unselected_color"), fg_selected_color("fg_selected_color"), bg_selected_color("bg_selected_color"), @@ -199,6 +200,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mHoveredColor(p.hovered_color()), mSearchColumn(p.search_column), mColumnPadding(p.column_padding), + mRowPadding(p.row_padding), mContextMenuType(MENU_NONE), mIsFriendSignal(NULL) { @@ -685,8 +687,6 @@ bool LLScrollListCtrl::updateColumnWidths() return width_changed; } -const S32 SCROLL_LIST_ROW_PAD = 2; - // Line height is the max height of all the cells in all the items. void LLScrollListCtrl::updateLineHeight() { @@ -699,7 +699,7 @@ void LLScrollListCtrl::updateLineHeight() S32 i = 0; for (const LLScrollListCell* cell = itemp->getColumn(i); i < num_cols; cell = itemp->getColumn(++i)) { - mLineHeight = llmax( mLineHeight, cell->getHeight() + SCROLL_LIST_ROW_PAD ); + mLineHeight = llmax( mLineHeight, cell->getHeight() + mRowPadding ); } } } @@ -711,7 +711,7 @@ void LLScrollListCtrl::updateLineHeightInsert(LLScrollListItem* itemp) S32 i = 0; for (const LLScrollListCell* cell = itemp->getColumn(i); i < num_cols; cell = itemp->getColumn(++i)) { - mLineHeight = llmax( mLineHeight, cell->getHeight() + SCROLL_LIST_ROW_PAD ); + mLineHeight = llmax( mLineHeight, cell->getHeight() + mRowPadding ); } } diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index b35a8608e7..51e0819ecc 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -108,7 +108,8 @@ public: // layout Optional column_padding, - page_lines, + row_padding, + page_lines, heading_height; // sort and search behavior @@ -283,8 +284,10 @@ public: void setBackgroundVisible(BOOL b) { mBackgroundVisible = b; } void setDrawStripes(BOOL b) { mDrawStripes = b; } - void setColumnPadding(const S32 c) { mColumnPadding = c; } - S32 getColumnPadding() { return mColumnPadding; } + void setColumnPadding(const S32 c) { mColumnPadding = c; } + S32 getColumnPadding() const { return mColumnPadding; } + void setRowPadding(const S32 c) { mColumnPadding = c; } + S32 getRowPadding() const { return mColumnPadding; } void setCommitOnKeyboardMovement(BOOL b) { mCommitOnKeyboardMovement = b; } void setCommitOnSelectionChange(BOOL b) { mCommitOnSelectionChange = b; } void setAllowKeyboardMovement(BOOL b) { mAllowKeyboardMovement = b; } @@ -468,6 +471,7 @@ private: LLRect mItemListRect; S32 mColumnPadding; + S32 mRowPadding; BOOL mBackgroundVisible; BOOL mDrawStripes; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 5423ddb684..748cffd1c3 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -441,6 +441,7 @@ set(viewer_SOURCE_FILES llpanelface.cpp llpanelgenerictip.cpp llpanelgroup.cpp + llpanelgroupcreate.cpp llpanelgroupbulk.cpp llpanelgroupbulkban.cpp llpanelgroupexperiences.cpp @@ -1060,6 +1061,7 @@ set(viewer_HEADER_FILES llpanelface.h llpanelgenerictip.h llpanelgroup.h + llpanelgroupcreate.h llpanelgroupbulk.h llpanelgroupbulkimpl.h llpanelgroupbulkban.h diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp index fcb1600b1d..2d219735a0 100644 --- a/indra/newview/llagentbenefits.cpp +++ b/indra/newview/llagentbenefits.cpp @@ -217,6 +217,7 @@ bool LLAgentBenefitsMgr::initCurrent(const std::string& package, const LLSD& ben else { instance().mCurrent = benefits; + instance().mCurrentName = package; } return true; @@ -227,3 +228,9 @@ bool LLAgentBenefitsMgr::has(const std::string& package) { return instance().mPackageMap.find(package) != instance().mPackageMap.end(); } + +//static +bool LLAgentBenefitsMgr::isCurrent(const std::string& package) +{ + return instance().mCurrentName == package; +} diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h index 680b1e7b07..48aa6bd869 100644 --- a/indra/newview/llagentbenefits.h +++ b/indra/newview/llagentbenefits.h @@ -75,8 +75,10 @@ public: static bool init(const std::string& package, const LLSD& benefits_sd); static bool initCurrent(const std::string& package, const LLSD& benefits_sd); static bool has(const std::string& package); + static bool isCurrent(const std::string& package); private: + std::string mCurrentName; LLAgentBenefits mCurrent; LLAgentBenefits mDefault; std::map mPackageMap; diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index 599790d2bb..d2bd716f55 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -400,10 +400,10 @@ void LLGroupActions::createGroup() { LLSD params; params["group_id"] = LLUUID::null; - params["open_tab_name"] = "panel_group_info_sidetray"; + params["open_tab_name"] = "panel_group_creation_sidetray"; params["action"] = "create"; - LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + LLFloaterSidePanelContainer::showPanel("people", "panel_group_creation_sidetray", params); } //static diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index e384019a43..dbf7639539 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -45,7 +45,7 @@ #include "lltransactiontypes.h" #include "llstatusbar.h" #include "llviewerwindow.h" -#include "llpanelgroup.h" +#include "llpanelgroupcreate.h" #include "llgroupactions.h" #include "llnotificationsutil.h" #include "lluictrlfactory.h" @@ -1451,7 +1451,7 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data) gAgent.mGroups.push_back(gd); - LLPanelGroup::refreshCreatedGroup(group_id); + LLPanelGroupCreate::refreshCreatedGroup(group_id); //FIXME //LLFloaterGroupInfo::closeCreateGroup(); //LLFloaterGroupInfo::showFromUUID(group_id,"roles_tab"); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index e41211ddbd..ab255d5215 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -128,10 +128,6 @@ void LLPanelGroup::onOpen(const LLSD& key) { onBackBtnClick(); } - else if(str_action == "create") - { - setGroupID(LLUUID::null); - } else if(str_action == "refresh_notices") { LLPanelGroupNotices* panel_notices = findChild("group_notices_tab_panel"); @@ -162,12 +158,8 @@ BOOL LLPanelGroup::postBuild() button = getChild("btn_refresh"); button->setClickedCallback(onBtnRefresh, this); - getChild("btn_create")->setVisible(false); - childSetCommitCallback("back",boost::bind(&LLPanelGroup::onBackBtnClick,this),NULL); - childSetCommitCallback("btn_create",boost::bind(&LLPanelGroup::onBtnCreate,this),NULL); - LLPanelGroupTab* panel_general = findChild("group_general_tab_panel"); LLPanelGroupTab* panel_roles = findChild("group_roles_tab_panel"); LLPanelGroupTab* panel_notices = findChild("group_notices_tab_panel"); @@ -223,7 +215,6 @@ void LLPanelGroup::reposButtons() } reposButton("btn_apply"); - reposButton("btn_create"); reposButton("btn_refresh"); reposButton("btn_cancel"); reposButton("btn_chat"); @@ -246,23 +237,6 @@ void LLPanelGroup::onBackBtnClick() } } - -void LLPanelGroup::onBtnCreate() -{ - LLPanelGroupGeneral* panel_general = findChild("group_general_tab_panel"); - if(!panel_general) - return; - std::string apply_mesg; - if(panel_general->apply(apply_mesg))//yes yes you need to call apply to create... - return; - if ( !apply_mesg.empty() ) - { - LLSD args; - args["MESSAGE"] = apply_mesg; - LLNotificationsUtil::add("GenericAlert", args); - } -} - void LLPanelGroup::onBtnRefresh(void* user_data) { LLPanelGroup* self = static_cast(user_data); @@ -378,7 +352,6 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) LLButton* button_apply = findChild("btn_apply"); LLButton* button_refresh = findChild("btn_refresh"); - LLButton* button_create = findChild("btn_create"); LLButton* button_cancel = findChild("btn_cancel"); LLButton* button_call = findChild("btn_call"); @@ -391,8 +364,6 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) if(button_refresh) button_refresh->setVisible(!is_null_group_id); - if(button_create) - button_create->setVisible(is_null_group_id); if(button_cancel) button_cancel->setVisible(!is_null_group_id); @@ -611,18 +582,6 @@ void LLPanelGroup::showNotice(const std::string& subject, panel_notices->showNotice(subject,message,has_inventory,inventory_name,inventory_offer); } - - - -//static -void LLPanelGroup::refreshCreatedGroup(const LLUUID& group_id) -{ - LLPanelGroup* panel = LLFloaterSidePanelContainer::getPanel("people", "panel_group_info_sidetray"); - if(!panel) - return; - panel->setGroupID(group_id); -} - //static void LLPanelGroup::showNotice(const std::string& subject, diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index 0b40c8b5d3..be40b08a6d 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -79,8 +79,6 @@ public: virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - static void refreshCreatedGroup(const LLUUID& group_id); - static void showNotice(const std::string& subject, const std::string& message, const LLUUID& group_id, @@ -92,7 +90,6 @@ public: protected: virtual void update(LLGroupChange gc); - void onBtnCreate(); void onBackBtnClick(); void onBtnJoin(); diff --git a/indra/newview/llpanelgroupcreate.cpp b/indra/newview/llpanelgroupcreate.cpp new file mode 100644 index 0000000000..a782edae72 --- /dev/null +++ b/indra/newview/llpanelgroupcreate.cpp @@ -0,0 +1,237 @@ +/** + * @file llpanelgroupcreate.cpp + * + * $LicenseInfo:firstyear=2019&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2019, 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 "llpanelgroupcreate.h" + +// UI includes +#include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "llfloatersidepanelcontainer.h" +#include "llsidetraypanelcontainer.h" +#include "llscrolllistctrl.h" +#include "llspinctrl.h" +#include "lltextbox.h" +#include "lltexteditor.h" +#include "lltexturectrl.h" +#include "lluictrlfactory.h" + +// Viewer includes +#include "llagentbenefits.h" +#include "llfloaterreg.h" +#include "llfloater.h" +#include "llgroupmgr.h" +#include "lltrans.h" +#include "llnotificationsutil.h" +#include "lluicolortable.h" + + +const S32 MATURE_CONTENT = 1; +const S32 NON_MATURE_CONTENT = 2; +const S32 DECLINE_TO_STATE = 0; + +static LLPanelInjector t_panel_group_creation("panel_group_creation_sidetray"); + +LLPanelGroupCreate::LLPanelGroupCreate() +: LLPanel() +{ +} + +LLPanelGroupCreate::~LLPanelGroupCreate() +{ +} + +BOOL LLPanelGroupCreate::postBuild() +{ + childSetCommitCallback("back", boost::bind(&LLPanelGroupCreate::onBackBtnClick, this), NULL); + + mComboMature = getChild("group_mature_check", TRUE); + mCtrlOpenEnrollment = getChild("open_enrollement", TRUE); + mCtrlEnrollmentFee = getChild("check_enrollment_fee", TRUE); + mEditCharter = getChild("charter", TRUE); + mSpinEnrollmentFee = getChild("spin_enrollment_fee", TRUE); + mMembershipList = getChild("membership_list", TRUE); + + mCreateButton = getChild("btn_create", TRUE); + mCreateButton->setCommitCallback(boost::bind(&LLPanelGroupCreate::onBtnCreate, this)); + + mGroupNameEditor = getChild("group_name_editor", TRUE); + mGroupNameEditor->setPrevalidate(LLTextValidate::validateASCIINoLeadingSpace); + + mInsignia = getChild("insignia", TRUE); + mInsignia->setAllowLocalTexture(FALSE); + mInsignia->setCanApplyImmediately(FALSE); + + return TRUE; +} + +void LLPanelGroupCreate::onOpen(const LLSD& key) +{ + mInsignia->setImageAssetID(LLUUID::null); + mInsignia->setImageAssetName(mInsignia->getDefaultImageName()); + mGroupNameEditor->clear(); + mEditCharter->clear(); + mSpinEnrollmentFee->set(0.f); + mCtrlEnrollmentFee->set(FALSE); + mCtrlOpenEnrollment->set(FALSE); + mMembershipList->clearRows(); + + // populate list + addMembershipRow("Base"); + addMembershipRow("Premium"); + addMembershipRow("PremiumPlus"); + addMembershipRow("Internal");// Present only if you are already in one, needed for testing + + S32 cost = LLAgentBenefitsMgr::current().getCreateGroupCost(); + mCreateButton->setLabelArg("[COST]", llformat("%d", cost)); +} + +//static +void LLPanelGroupCreate::refreshCreatedGroup(const LLUUID& group_id) +{ + LLSD params; + params["group_id"] = group_id; + params["open_tab_name"] = "panel_group_info_sidetray"; + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); +} + +void LLPanelGroupCreate::addMembershipRow(const std::string &name) +{ + if (LLAgentBenefitsMgr::has(name)) + { + bool is_current = LLAgentBenefitsMgr::isCurrent(name); + + LLScrollListItem::Params item_params; + LLScrollListCell::Params cell_params; + cell_params.font = LLFontGL::getFontSansSerif(); + // Start out right justifying numeric displays + cell_params.font_halign = LLFontGL::LEFT; + if (is_current) + { + cell_params.color = LLUIColorTable::instance().getColor("DrYellow"); + } + + cell_params.column = "clmn_name"; + std::string mem_str = name + "Membership"; + if (is_current) + { + cell_params.value = LLTrans::getString(mem_str) + " " + getString("current_membership"); + } + else + { + cell_params.value = LLTrans::getString(mem_str); + } + item_params.columns.add(cell_params); + cell_params.column = "clmn_price"; + cell_params.value = llformat("L$ %d",LLAgentBenefitsMgr::get(name).getCreateGroupCost()); + item_params.columns.add(cell_params); + mMembershipList->addRow(item_params); + } +} + +void LLPanelGroupCreate::onBackBtnClick() +{ + LLSideTrayPanelContainer* parent = dynamic_cast(getParent()); + if(parent) + { + parent->openPreviousPanel(); + } +} + +bool LLPanelGroupCreate::confirmMatureApply(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + // 0 == Yes + // 1 == No + // 2 == Cancel + switch (option) + { + case 0: + mComboMature->setCurrentByIndex(MATURE_CONTENT); + createGroup(); + break; + case 1: + mComboMature->setCurrentByIndex(NON_MATURE_CONTENT); + createGroup(); + break; + default: + break; + } + + return true; +} + +void LLPanelGroupCreate::onBtnCreate() +{ + LL_INFOS() << "Validating group creation" << LL_ENDL; + + // Validate the group name length. + std::string gr_name = mGroupNameEditor->getText(); + LLStringUtil::trim(gr_name); + S32 group_name_len = gr_name.size(); + if (group_name_len < DB_GROUP_NAME_MIN_LEN + || group_name_len > DB_GROUP_NAME_STR_LEN) + { + LLSD args; + args["MIN_LEN"] = DB_GROUP_NAME_MIN_LEN; + args["MAX_LEN"] = DB_GROUP_NAME_STR_LEN; + LLNotificationsUtil::add("GroupNameLengthWarning", args); + } + else + // Check to make sure mature has been set + if (mComboMature && + mComboMature->getCurrentIndex() == DECLINE_TO_STATE) + { + LLNotificationsUtil::add("SetGroupMature", LLSD(), LLSD(), + boost::bind(&LLPanelGroupCreate::confirmMatureApply, this, _1, _2)); + } + else + { + createGroup(); + } +} + +void LLPanelGroupCreate::createGroup() +{ + LL_INFOS() << "Creating group" << LL_ENDL; + + U32 enrollment_fee = (mCtrlEnrollmentFee->get() ? + (U32)mSpinEnrollmentFee->get() : 0); + LLUUID insignia_id = mInsignia->getImageItemID().isNull() ? LLUUID::null : mInsignia->getImageAssetID(); + + std::string gr_name = mGroupNameEditor->getText(); + LLStringUtil::trim(gr_name); + LLGroupMgr::getInstance()->sendCreateGroupRequest(gr_name, + mEditCharter->getText(), + true, + insignia_id, + enrollment_fee, + mCtrlOpenEnrollment->get(), + false, + mComboMature->getCurrentIndex() == MATURE_CONTENT); +} + diff --git a/indra/newview/llpanelgroupcreate.h b/indra/newview/llpanelgroupcreate.h new file mode 100644 index 0000000000..3ae2e7f24a --- /dev/null +++ b/indra/newview/llpanelgroupcreate.h @@ -0,0 +1,73 @@ +/** + * @file llpanelgroupcreate.h + * + * $LicenseInfo:firstyear=2019&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2019, 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_LLPANELGROUPCREATE_H +#define LL_LLPANELGROUPCREATE_H + +#include "llpanel.h" + + +// Forward declares +class LLButton; +class LLCheckBoxCtrl; +class LLComboBox; +class LLLineEditor; +class LLTextEditor; +class LLTextureCtrl; +class LLScrollListCtrl; +class LLSpinCtrl; + + +class LLPanelGroupCreate : public LLPanel +{ +public: + LLPanelGroupCreate(); + virtual ~LLPanelGroupCreate(); + + virtual BOOL postBuild(); + + void onOpen(const LLSD& key); + + static void refreshCreatedGroup(const LLUUID& group_id); + +private: + void addMembershipRow(const std::string &name); + bool confirmMatureApply(const LLSD& notification, const LLSD& response); + void onBtnCreate(); + void onBackBtnClick(); + void createGroup(); + + LLComboBox *mComboMature; + LLButton *mCreateButton; + LLCheckBoxCtrl *mCtrlOpenEnrollment; + LLCheckBoxCtrl *mCtrlEnrollmentFee; + LLTextEditor *mEditCharter; + LLTextureCtrl *mInsignia; + LLLineEditor *mGroupNameEditor; + LLScrollListCtrl *mMembershipList; + LLSpinCtrl *mSpinEnrollmentFee; +}; + +#endif // LL_LLPANELGROUPCREATE_H diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 18f38b0d12..375daf60f8 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -304,6 +304,11 @@ void LLPanelGroupGeneral::draw() bool LLPanelGroupGeneral::apply(std::string& mesg) { + if (mGroupID.isNull()) + { + return false; + } + if (!mGroupID.isNull() && mAllowEdit && mComboActiveTitle && mComboActiveTitle->isDirty()) { LLGroupMgr::getInstance()->sendGroupTitleUpdate(mGroupID,mComboActiveTitle->getCurrentID()); @@ -313,7 +318,7 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) BOOL has_power_in_group = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY); - if (has_power_in_group || mGroupID.isNull()) + if (has_power_in_group) { LL_INFOS() << "LLPanelGroupGeneral::apply" << LL_ENDL; @@ -326,27 +331,6 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) return false; } - if (mGroupID.isNull()) - { - // Validate the group name length. - S32 group_name_len = mGroupNameEditor->getText().size(); - if ( group_name_len < DB_GROUP_NAME_MIN_LEN - || group_name_len > DB_GROUP_NAME_STR_LEN) - { - std::ostringstream temp_error; - temp_error << "A group name must be between " << DB_GROUP_NAME_MIN_LEN - << " and " << DB_GROUP_NAME_STR_LEN << " characters."; - mesg = temp_error.str(); - return false; - } - - LLSD args; - args["COST"] = LLAgentBenefitsMgr::current().getCreateGroupCost(); - LLNotificationsUtil::add("CreateGroupCost", args, LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2)); - - return false; - } - LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { @@ -453,37 +437,6 @@ bool LLPanelGroupGeneral::confirmMatureApply(const LLSD& notification, const LLS return ret; } -// static -bool LLPanelGroupGeneral::createGroupCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - switch(option) - { - case 0: - { - // Yay! We are making a new group! - U32 enrollment_fee = (mCtrlEnrollmentFee->get() ? - (U32) mSpinEnrollmentFee->get() : 0); - LLUUID insignia_id = mInsignia->getImageItemID().isNull() ? LLUUID::null : mInsignia->getImageAssetID(); - - LLGroupMgr::getInstance()->sendCreateGroupRequest(mGroupNameEditor->getText(), - mEditCharter->getText(), - mCtrlShowInGroupList->get(), - insignia_id, - enrollment_fee, - mCtrlOpenEnrollment->get(), - false, - mComboMature->getCurrentIndex() == MATURE_CONTENT); - - } - break; - case 1: - default: - break; - } - return false; -} - // virtual void LLPanelGroupGeneral::update(LLGroupChange gc) { diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h index 11972bafa9..1d0789521c 100644 --- a/indra/newview/llpanelgroupgeneral.h +++ b/indra/newview/llpanelgroupgeneral.h @@ -51,7 +51,6 @@ public: virtual bool needsApply(std::string& mesg); virtual bool apply(std::string& mesg); virtual void cancel(); - bool createGroupCallback(const LLSD& notification, const LLSD& response); virtual void update(LLGroupChange gc); diff --git a/indra/newview/skins/default/xui/en/floater_people.xml b/indra/newview/skins/default/xui/en/floater_people.xml index 701233ba4a..0cc0ca1ce4 100644 --- a/indra/newview/skins/default/xui/en/floater_people.xml +++ b/indra/newview/skins/default/xui/en/floater_people.xml @@ -31,5 +31,11 @@ filename="panel_group_info_sidetray.xml" label="Group Profile" font="SansSerifBold"/> + diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 670784f3bf..2417c52251 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -684,6 +684,18 @@ Do you want to revoke modify rights for the selected Residents? yestext="Yes"/> + +A group name must be between [MIN_LEN] and [MAX_LEN] characters. + group + fail + + + + + +(your membership) + + + + + + + + + + Group Charter + + + + + + + + + - Select maturity rating - + + + + + + + + + The fee to create a group is based on your membership level. [https://secondlife.com/my/account/membership.php More info] + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + -- cgit v1.2.3 From 518f8addd1a7e2da79ce7c6966fa5774cc8e6415 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 16 Jan 2020 20:10:55 +0000 Subject: SL-12587 - added ViewerBenefits to requested caps. --- indra/newview/llviewerregion.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 75e707aaa3..5d8660143e 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2969,6 +2969,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("UploadBakedTexture"); capabilityNames.append("UserInfo"); capabilityNames.append("ViewerAsset"); + capabilityNames.append("ViewerBenefits"); capabilityNames.append("ViewerMetrics"); capabilityNames.append("ViewerStartAuction"); capabilityNames.append("ViewerStats"); -- cgit v1.2.3 From fcbccd59d98ea0a4a11b26da6b19a9f90f65dae5 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 17 Jan 2020 17:54:40 +0200 Subject: SL-12424 Allow saving offsets based on current camera position --- indra/newview/llagentcamera.cpp | 16 ++++++++++++++++ indra/newview/llagentcamera.h | 4 ++++ indra/newview/llfloatersavecamerapreset.cpp | 6 ++++++ 3 files changed, 26 insertions(+) (limited to 'indra') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 04d726a131..18825d5b27 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1985,6 +1985,22 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) } +LLVector3 LLAgentCamera::getCurrentCameraOffset() +{ + LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - gAgentAvatarp->getRenderPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion(); + return camera_offset / mCameraZoomFraction / gSavedSettings.getF32("CameraOffsetScale"); +} + +LLVector3d LLAgentCamera::getCurrentFocusOffset() +{ + return (mFocusTargetGlobal - gAgent.getPositionGlobal()) * ~gAgent.getFrameAgent().getQuaternion(); +} + +bool LLAgentCamera::isJoystickCameraUsed() +{ + return ((mOrbitAroundRadians != 0) || (mOrbitOverAngle != 0) || !mPanFocusDiff.isNull()); +} + LLVector3 LLAgentCamera::getCameraOffsetInitial() { return convert_from_llsd(mCameraOffsetInitial->get(), TYPE_VEC3, ""); diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 6e73b7b0f0..af65ab431a 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -117,6 +117,10 @@ public: /** Determines default focus offset depending on the current camera preset */ LLVector3d getFocusOffsetInitial(); + LLVector3 getCurrentCameraOffset(); + LLVector3d getCurrentFocusOffset(); + bool isJoystickCameraUsed(); + private: /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */ F32 getCameraMaxZoomDistance(); diff --git a/indra/newview/llfloatersavecamerapreset.cpp b/indra/newview/llfloatersavecamerapreset.cpp index 5d62aff0e2..bbc4b5e354 100644 --- a/indra/newview/llfloatersavecamerapreset.cpp +++ b/indra/newview/llfloatersavecamerapreset.cpp @@ -28,6 +28,7 @@ #include "llfloatersavecamerapreset.h" +#include "llagentcamera.h" #include "llbutton.h" #include "llcombobox.h" #include "llfloaterpreference.h" @@ -101,6 +102,11 @@ void LLFloaterSaveCameraPreset::onBtnSave() } else { + if (gAgentCamera.isJoystickCameraUsed()) + { + gSavedSettings.setVector3("CameraOffsetRearView", gAgentCamera.getCurrentCameraOffset()); + gSavedSettings.setVector3d("FocusOffsetRearView", gAgentCamera.getCurrentFocusOffset()); + } if (is_saving_new) { std::list preset_names; -- cgit v1.2.3 From e865c94513ea22f06ceab4c3698cb180fb30707a Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 17 Jan 2020 18:58:07 +0200 Subject: SL-12424 Use correct avatar position --- indra/newview/llagentcamera.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 18825d5b27..d4d4f8e124 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1987,7 +1987,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) LLVector3 LLAgentCamera::getCurrentCameraOffset() { - LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - gAgentAvatarp->getRenderPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion(); + LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - gAgentAvatarp->mRoot->getWorldPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion(); return camera_offset / mCameraZoomFraction / gSavedSettings.getF32("CameraOffsetScale"); } -- cgit v1.2.3 From e63381a9365d69204b8e7593f47b963d3d037689 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 17 Jan 2020 17:32:29 +0000 Subject: SL-12587 - trigger build update --- indra/edit-me-to-trigger-new-build.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/edit-me-to-trigger-new-build.txt b/indra/edit-me-to-trigger-new-build.txt index b28b04f643..fd40910d9e 100644 --- a/indra/edit-me-to-trigger-new-build.txt +++ b/indra/edit-me-to-trigger-new-build.txt @@ -1,3 +1,4 @@ + -- cgit v1.2.3 From c5be566a6fbf121d1ca140586a02cda18f83b11b Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 20 Jan 2020 14:43:48 +0200 Subject: SL-12596 Fixed incorectly enabled checkbox and enabled login button --- indra/newview/llpanellogin.cpp | 15 +++++++++++---- indra/newview/skins/default/xui/en/panel_login.xml | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index cfa935cd01..7ef3685cdb 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -549,16 +549,19 @@ void LLPanelLogin::populateFields(LLPointer credential, bool remem LL_WARNS() << "Attempted fillFields with no login view shown" << LL_ENDL; return; } - LLUICtrl* remember_check = sInstance->getChild("remember_check"); - remember_check->setValue(remember_psswrd); if (sInstance->mFirstLoginThisInstall) { + LLUICtrl* remember_check = sInstance->getChild("remember_check"); + remember_check->setValue(remember_psswrd); // no list to populate setFields(credential); } else { sInstance->getChild("remember_name")->setValue(remember_user); + LLUICtrl* remember_password = sInstance->getChild("remember_password"); + remember_password->setValue(remember_psswrd); + remember_password->setEnabled(remember_user); sInstance->populateUserList(credential); } } @@ -746,13 +749,14 @@ void LLPanelLogin::getFields(LLPointer& credential, } } credential = gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), identifier, authenticator); - remember_psswrd = sInstance->getChild("remember_check")->getValue(); if (!sInstance->mFirstLoginThisInstall) { + remember_psswrd = sInstance->getChild("remember_password")->getValue(); remember_user = sInstance->getChild("remember_name")->getValue(); } else { + remember_psswrd = sInstance->getChild("remember_check")->getValue(); remember_user = remember_psswrd; // on panel_login_first "remember_check" is named as 'remember me' } } @@ -1080,6 +1084,7 @@ void LLPanelLogin::onUserNameTextEnty(void*) { sInstance->mPasswordModified = true; sInstance->getChild("password_edit")->setValue(std::string()); + sInstance->mPasswordLength = 0; sInstance->addFavoritesToStartLocation(); //will call updateLoginButtons() } @@ -1119,7 +1124,7 @@ void LLPanelLogin::onRememberUserCheck(void*) if (sInstance && !sInstance->mFirstLoginThisInstall) { LLCheckBoxCtrl* remember_name(sInstance->getChild("remember_name")); - LLCheckBoxCtrl* remember_psswrd(sInstance->getChild("remember_check")); + LLCheckBoxCtrl* remember_psswrd(sInstance->getChild("remember_password")); LLComboBox* user_combo(sInstance->getChild("username_combo")); bool remember = remember_name->getValue().asBoolean(); @@ -1179,6 +1184,8 @@ void LLPanelLogin::updateServer() // restore creds user_combo->setTextEntry(username); pswd_edit->setValue(password); + sInstance->mUsernameLength = username.length(); + sInstance->mPasswordLength = password.length(); } else { diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 9da0c815ed..eab53c9985 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -151,7 +151,7 @@ label_text.word_wrap="true" label_text.width="150" check_button.bottom="3" - name="remember_check" + name="remember_password" width="170" /> Date: Mon, 20 Jan 2020 16:59:27 +0200 Subject: SL-12595 The checkbox overlaps buttons in the 'Delete selected item?' notification --- indra/llui/llcheckboxctrl.cpp | 46 +++++++++++++++++----- indra/llui/llcheckboxctrl.h | 17 ++++++++ indra/newview/skins/default/xui/en/panel_login.xml | 5 +-- 3 files changed, 55 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index f5b64d58b0..6a51c4240b 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -47,10 +47,18 @@ static LLDefaultChildRegistry::Register r("check_box"); template class LLCheckBoxCtrl* LLView::getChild( const std::string& name, BOOL recurse) const; +void LLCheckBoxCtrl::WordWrap::declareValues() +{ + declare("none", EWordWrap::WRAP_NONE); + declare("down", EWordWrap::WRAP_DOWN); + declare("up", EWordWrap::WRAP_UP); +} + LLCheckBoxCtrl::Params::Params() : initial_value("initial_value", false), label_text("label_text"), check_button("check_button"), + word_wrap("word_wrap", EWordWrap::WRAP_NONE), radio_style("radio_style") {} @@ -59,14 +67,14 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p) : LLUICtrl(p), mTextEnabledColor(p.label_text.text_color()), mTextDisabledColor(p.label_text.text_readonly_color()), - mFont(p.font()) + mFont(p.font()), + mWordWrap(p.word_wrap) { mViewModel->setValue(LLSD(p.initial_value)); mViewModel->resetDirty(); static LLUICachedControl llcheckboxctrl_spacing ("UICheckboxctrlSpacing", 0); static LLUICachedControl llcheckboxctrl_hpad ("UICheckboxctrlHPad", 0); static LLUICachedControl llcheckboxctrl_vpad ("UICheckboxctrlVPad", 0); - static LLUICachedControl llcheckboxctrl_btn_size ("UICheckboxctrlBtnSize", 0); // must be big enough to hold all children setUseBoundingRect(TRUE); @@ -85,17 +93,35 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p) { tbparams.font(p.font); } - mLabel = LLUICtrlFactory::create (tbparams); + + mLabel = LLUICtrlFactory::create(tbparams); + if (mWordWrap != WRAP_NONE) + { + // Not setWordWrap(mWordWrap != WRAP_NONE) because there might be some old lurking code that sets it manually + mLabel->setWordWrap(true); + S32 new_width = getRect().getWidth() - p.check_button.rect().getWidth() - llcheckboxctrl_hpad; + LLRect label_rect = mLabel->getRect(); + label_rect.mRight = label_rect.mLeft + new_width; + mLabel->setRect(label_rect); + } mLabel->reshapeToFitText(); + LLRect label_rect = mLabel->getRect(); if (mLabel->getLineCount() > 1) { - // reshapeToFitText uses LLView::reshape() which always reshapes - // from bottom to top, but we want to extend the bottom - // Note: might be better idea to use getRect().mTop of LLCheckBoxCtrl (+pad) as top point of new rect - S32 delta = ll_round((F32)mLabel->getFont()->getLineHeight() * mLabel->getLineSpacingMult()) - label_rect.getHeight(); - label_rect.translate(0, delta); - mLabel->setRect(label_rect); + if (mWordWrap == WRAP_DOWN) + { + // reshapeToFitText uses LLView::reshape() which always reshapes + // from bottom to top, but we want to extend the bottom + // Note: might be better idea to use getRect().mTop of LLCheckBoxCtrl (+pad) as top point of new rect + S32 delta = ll_round((F32)mLabel->getFont()->getLineHeight() * mLabel->getLineSpacingMult()) - label_rect.getHeight(); + label_rect.translate(0, delta); + mLabel->setRect(label_rect); + } + // else + // WRAP_UP is essentially done by reshapeToFitText() (extends from bottom to top) + // howhever it doesn't respect rect of checkbox + // todo: this should be fixed, but there are at least couple checkboxes that use this feature as is. } addChild(mLabel); @@ -165,7 +191,7 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) mLabel->reshapeToFitText(); LLRect label_rect = mLabel->getRect(); - if (label_top != label_rect.mTop) + if (label_top != label_rect.mTop && mWordWrap == WRAP_DOWN) { // reshapeToFitText uses LLView::reshape() which always reshapes // from bottom to top, but we want to extend the bottom so diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index 07ae9c3b18..eb5bd5b6da 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -50,6 +50,19 @@ class LLCheckBoxCtrl , public ll::ui::SearchableControl { public: + + enum EWordWrap + { + WRAP_NONE, + WRAP_UP, + WRAP_DOWN + }; + + struct WordWrap : public LLInitParam::TypeValuesHelper + { + static void declareValues(); + }; + struct Params : public LLInitParam::Block { @@ -58,6 +71,8 @@ public: Optional label_text; Optional check_button; + Optional word_wrap; + Ignored radio_style; Params(); @@ -129,6 +144,8 @@ protected: LLUIColor mTextEnabledColor; LLUIColor mTextDisabledColor; + + EWordWrap mWordWrap; // off, shifts text up, shifts text down }; // Build time optimization, generate once in .cpp file diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index eab53c9985..58352509c4 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -148,11 +148,10 @@ left="408" bottom_delta="0" label="Remember password" - label_text.word_wrap="true" - label_text.width="150" + word_wrap="down" check_button.bottom="3" name="remember_password" - width="170" /> + width="165" /> Date: Mon, 20 Jan 2020 17:50:56 +0200 Subject: SL-9699 Enabled word-wrap for 'remember username' checkbox --- indra/newview/skins/default/xui/en/panel_login.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 58352509c4..ade004f9d0 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -135,10 +135,11 @@ bottom_delta="21" height="24" label="Remember me" + word_wrap="down" check_button.bottom="3" name="remember_name" tool_tip="Already remembered user can be forgotten from Me > Preferences > Advanced > Remembered Usernames." - width="145" /> + width="198" /> Date: Wed, 22 Jan 2020 13:06:57 -0700 Subject: DRTVWR-440, whitespace change to test TeamCity trigger --- indra/newview/llfeaturemanager.cpp | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index aa9cba0c18..d915a9fd26 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -617,36 +617,36 @@ void LLFeatureManager::applyFeatures(bool skipFeatures) void LLFeatureManager::setGraphicsLevel(U32 level, bool skipFeatures) { - LLViewerShaderMgr::sSkipReload = true; + LLViewerShaderMgr::sSkipReload = true; - applyBaseMasks(); + applyBaseMasks(); - // if we're passed an invalid level, default to "Low" - std::string features(isValidGraphicsLevel(level)? getNameForGraphicsLevel(level) : "Low"); - if (features == "Low") - { + // if we're passed an invalid level, default to "Low" + std::string features(isValidGraphicsLevel(level)? getNameForGraphicsLevel(level) : "Low"); + if (features == "Low") + { #if LL_DARWIN - // This Mac-specific change is to insure that we force 'Basic Shaders' for all Mac - // systems which support them instead of falling back to fixed-function unnecessarily - // MAINT-2157 - if (gGLManager.mGLVersion < 2.1f) + // This Mac-specific change is to insure that we force 'Basic Shaders' for all Mac + // systems which support them instead of falling back to fixed-function unnecessarily + // MAINT-2157 + if (gGLManager.mGLVersion < 2.1f) #else - // only use fixed function by default if GL version < 3.0 or this is an intel graphics chip - if (gGLManager.mGLVersion < 3.f || gGLManager.mIsIntel) + // only use fixed function by default if GL version < 3.0 or this is an intel graphics chip + if (gGLManager.mGLVersion < 3.f || gGLManager.mIsIntel) #endif - { + { // same as Low, but with "Basic Shaders" disabled - features = "LowFixedFunction"; - } - } + features = "LowFixedFunction"; + } + } - maskFeatures(features); + maskFeatures(features); - applyFeatures(skipFeatures); + applyFeatures(skipFeatures); - LLViewerShaderMgr::sSkipReload = false; - LLViewerShaderMgr::instance()->setShaders(); - gPipeline.refreshCachedSettings(); + LLViewerShaderMgr::sSkipReload = false; + LLViewerShaderMgr::instance()->setShaders(); + gPipeline.refreshCachedSettings(); } void LLFeatureManager::applyBaseMasks() -- cgit v1.2.3 From 16699fe8a563202c9b53b2f8e80a49c336b518d4 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 23 Jan 2020 16:29:43 +0200 Subject: SL-12591 Fixed float comparison --- indra/llinventory/llsettingsdaycycle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index b80e74791e..8498425f4e 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -724,7 +724,7 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::TrackPo return false; } - if (old_frame == new_frame) + if (llabs(old_frame - new_frame) < F_APPROXIMATELY_ZERO) { return false; } -- cgit v1.2.3 From 3e44cb06df22dd1b684dc8574c3b44d0851527bc Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 23 Jan 2020 13:30:14 -0700 Subject: DRTVWR-440, another whitespace only (detabify) to test TeamCity triggers --- indra/newview/llviewershadermgr.cpp | 292 ++++++++++++++++++------------------ 1 file changed, 146 insertions(+), 146 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index bdd0330cca..5628f257c5 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -392,84 +392,84 @@ S32 LLViewerShaderMgr::getShaderLevel(S32 type) void LLViewerShaderMgr::setShaders() { - //setShaders might be called redundantly by gSavedSettings, so return on reentrance - static bool reentrance = false; - - if (!gPipeline.mInitialized || !sInitialized || reentrance || sSkipReload) - { - return; - } + //setShaders might be called redundantly by gSavedSettings, so return on reentrance + static bool reentrance = false; + + if (!gPipeline.mInitialized || !sInitialized || reentrance || sSkipReload) + { + return; + } - static LLCachedControl max_texture_index(gSavedSettings, "RenderMaxTextureIndex", 16); - LLGLSLShader::sIndexedTextureChannels = llmax(llmin(gGLManager.mNumTextureImageUnits, (S32) max_texture_index), 1); + static LLCachedControl max_texture_index(gSavedSettings, "RenderMaxTextureIndex", 16); + LLGLSLShader::sIndexedTextureChannels = llmax(llmin(gGLManager.mNumTextureImageUnits, (S32) max_texture_index), 1); - //NEVER use more than 16 texture channels (work around for prevalent driver bug) - LLGLSLShader::sIndexedTextureChannels = llmin(LLGLSLShader::sIndexedTextureChannels, 16); + //NEVER use more than 16 texture channels (work around for prevalent driver bug) + LLGLSLShader::sIndexedTextureChannels = llmin(LLGLSLShader::sIndexedTextureChannels, 16); - if (gGLManager.mGLSLVersionMajor < 1 || - (gGLManager.mGLSLVersionMajor == 1 && gGLManager.mGLSLVersionMinor <= 20)) - { //NEVER use indexed texture rendering when GLSL version is 1.20 or earlier - LLGLSLShader::sIndexedTextureChannels = 1; - } + if (gGLManager.mGLSLVersionMajor < 1 || + (gGLManager.mGLSLVersionMajor == 1 && gGLManager.mGLSLVersionMinor <= 20)) + { //NEVER use indexed texture rendering when GLSL version is 1.20 or earlier + LLGLSLShader::sIndexedTextureChannels = 1; + } - reentrance = true; + reentrance = true; - if (LLRender::sGLCoreProfile) - { - if (!gSavedSettings.getBOOL("VertexShaderEnable")) - { //vertex shaders MUST be enabled to use core profile - gSavedSettings.setBOOL("VertexShaderEnable", TRUE); - } - } - - //setup preprocessor definitions - LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits); - - // Make sure the compiled shader map is cleared before we recompile shaders. + if (LLRender::sGLCoreProfile) + { + if (!gSavedSettings.getBOOL("VertexShaderEnable")) + { //vertex shaders MUST be enabled to use core profile + gSavedSettings.setBOOL("VertexShaderEnable", TRUE); + } + } + + //setup preprocessor definitions + LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits); + + // Make sure the compiled shader map is cleared before we recompile shaders. mVertexShaderObjects.clear(); mFragmentShaderObjects.clear(); - - initAttribsAndUniforms(); - gPipeline.releaseGLBuffers(); + + initAttribsAndUniforms(); + gPipeline.releaseGLBuffers(); - if (gSavedSettings.getBOOL("VertexShaderEnable")) - { - LLPipeline::sWaterReflections = gGLManager.mHasCubeMap; - LLPipeline::sRenderGlow = gSavedSettings.getBOOL("RenderGlow"); - LLPipeline::updateRenderDeferred(); - } - else - { - LLPipeline::sRenderGlow = FALSE; - LLPipeline::sWaterReflections = FALSE; - } - - //hack to reset buffers that change behavior with shaders - gPipeline.resetVertexBuffers(); + if (gSavedSettings.getBOOL("VertexShaderEnable")) + { + LLPipeline::sWaterReflections = gGLManager.mHasCubeMap; + LLPipeline::sRenderGlow = gSavedSettings.getBOOL("RenderGlow"); + LLPipeline::updateRenderDeferred(); + } + else + { + LLPipeline::sRenderGlow = FALSE; + LLPipeline::sWaterReflections = FALSE; + } + + //hack to reset buffers that change behavior with shaders + gPipeline.resetVertexBuffers(); - if (gViewerWindow) - { - gViewerWindow->setCursor(UI_CURSOR_WAIT); - } + if (gViewerWindow) + { + gViewerWindow->setCursor(UI_CURSOR_WAIT); + } - // Lighting - gPipeline.setLightingDetail(-1); + // Lighting + gPipeline.setLightingDetail(-1); - // Shaders - LL_INFOS("ShaderLoading") << "\n~~~~~~~~~~~~~~~~~~\n Loading Shaders:\n~~~~~~~~~~~~~~~~~~" << LL_ENDL; - LL_INFOS("ShaderLoading") << llformat("Using GLSL %d.%d", gGLManager.mGLSLVersionMajor, gGLManager.mGLSLVersionMinor) << LL_ENDL; + // Shaders + LL_INFOS("ShaderLoading") << "\n~~~~~~~~~~~~~~~~~~\n Loading Shaders:\n~~~~~~~~~~~~~~~~~~" << LL_ENDL; + LL_INFOS("ShaderLoading") << llformat("Using GLSL %d.%d", gGLManager.mGLSLVersionMajor, gGLManager.mGLSLVersionMinor) << LL_ENDL; - for (S32 i = 0; i < SHADER_COUNT; i++) - { - mShaderLevel[i] = 0; - } - mMaxAvatarShaderLevel = 0; + for (S32 i = 0; i < SHADER_COUNT; i++) + { + mShaderLevel[i] = 0; + } + mMaxAvatarShaderLevel = 0; - LLGLSLShader::sNoFixedFunction = false; - LLVertexBuffer::unbind(); - if (LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") - && (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 10) - && gSavedSettings.getBOOL("VertexShaderEnable")) + LLGLSLShader::sNoFixedFunction = false; + LLVertexBuffer::unbind(); + if (LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") + && (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 10) + && gSavedSettings.getBOOL("VertexShaderEnable")) { bool canRenderDeferred = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred"); bool hasWindLightShaders = LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders"); @@ -477,24 +477,24 @@ void LLViewerShaderMgr::setShaders() bool useRenderDeferred = canRenderDeferred && gSavedSettings.getBOOL("RenderDeferred") && gSavedSettings.getBOOL("RenderAvatarVP"); bool doingWindLight = hasWindLightShaders && gSavedSettings.getBOOL("WindLightUseAtmosShaders"); - //using shaders, disable fixed function - LLGLSLShader::sNoFixedFunction = true; + //using shaders, disable fixed function + LLGLSLShader::sNoFixedFunction = true; - S32 light_class = 3; + S32 light_class = 3; S32 interface_class = 2; - S32 env_class = 2; - S32 obj_class = 2; - S32 effect_class = 2; - S32 wl_class = 1; - S32 water_class = 2; - S32 deferred_class = 0; - S32 transform_class = gGLManager.mHasTransformFeedback ? 1 : 0; - - static LLCachedControl use_transform_feedback(gSavedSettings, "RenderUseTransformFeedback", false); - if (!use_transform_feedback) - { - transform_class = 0; - } + S32 env_class = 2; + S32 obj_class = 2; + S32 effect_class = 2; + S32 wl_class = 1; + S32 water_class = 2; + S32 deferred_class = 0; + S32 transform_class = gGLManager.mHasTransformFeedback ? 1 : 0; + + static LLCachedControl use_transform_feedback(gSavedSettings, "RenderUseTransformFeedback", false); + if (!use_transform_feedback) + { + transform_class = 0; + } if (useRenderDeferred) { @@ -527,55 +527,55 @@ void LLViewerShaderMgr::setShaders() light_class = 2; } - // Trigger a full rebuild of the fallback skybox / cubemap if we've toggled windlight shaders - if (!wl_class || (mShaderLevel[SHADER_WINDLIGHT] != wl_class && gSky.mVOSkyp.notNull())) - { - gSky.mVOSkyp->forceSkyUpdate(); - } + // Trigger a full rebuild of the fallback skybox / cubemap if we've toggled windlight shaders + if (!wl_class || (mShaderLevel[SHADER_WINDLIGHT] != wl_class && gSky.mVOSkyp.notNull())) + { + gSky.mVOSkyp->forceSkyUpdate(); + } - // Load lighting shaders - mShaderLevel[SHADER_LIGHTING] = light_class; - mShaderLevel[SHADER_INTERFACE] = interface_class; - mShaderLevel[SHADER_ENVIRONMENT] = env_class; - mShaderLevel[SHADER_WATER] = water_class; - mShaderLevel[SHADER_OBJECT] = obj_class; - mShaderLevel[SHADER_EFFECT] = effect_class; - mShaderLevel[SHADER_WINDLIGHT] = wl_class; - mShaderLevel[SHADER_DEFERRED] = deferred_class; - mShaderLevel[SHADER_TRANSFORM] = transform_class; + // Load lighting shaders + mShaderLevel[SHADER_LIGHTING] = light_class; + mShaderLevel[SHADER_INTERFACE] = interface_class; + mShaderLevel[SHADER_ENVIRONMENT] = env_class; + mShaderLevel[SHADER_WATER] = water_class; + mShaderLevel[SHADER_OBJECT] = obj_class; + mShaderLevel[SHADER_EFFECT] = effect_class; + mShaderLevel[SHADER_WINDLIGHT] = wl_class; + mShaderLevel[SHADER_DEFERRED] = deferred_class; + mShaderLevel[SHADER_TRANSFORM] = transform_class; BOOL loaded = loadBasicShaders(); - if (loaded) - { - LL_INFOS() << "Loaded basic shaders." << LL_ENDL; - } - else - { - LL_WARNS() << "Failed to load basic shaders." << LL_ENDL; - llassert(loaded); - } + if (loaded) + { + LL_INFOS() << "Loaded basic shaders." << LL_ENDL; + } + else + { + LL_WARNS() << "Failed to load basic shaders." << LL_ENDL; + llassert(loaded); + } - if (loaded) - { - gPipeline.mVertexShadersEnabled = TRUE; - gPipeline.mVertexShadersLoaded = 1; + if (loaded) + { + gPipeline.mVertexShadersEnabled = TRUE; + gPipeline.mVertexShadersLoaded = 1; - // Load all shaders to set max levels - loaded = loadShadersEnvironment(); + // Load all shaders to set max levels + loaded = loadShadersEnvironment(); - if (loaded) - { - LL_INFOS() << "Loaded environment shaders." << LL_ENDL; - } - else - { - LL_WARNS() << "Failed to load environment shaders." << LL_ENDL; - llassert(loaded); - } + if (loaded) + { + LL_INFOS() << "Loaded environment shaders." << LL_ENDL; + } + else + { + LL_WARNS() << "Failed to load environment shaders." << LL_ENDL; + llassert(loaded); + } - if (loaded) - { - loaded = loadShadersWater(); + if (loaded) + { + loaded = loadShadersWater(); if (loaded) { LL_INFOS() << "Loaded water shaders." << LL_ENDL; @@ -585,10 +585,10 @@ void LLViewerShaderMgr::setShaders() LL_WARNS() << "Failed to load water shaders." << LL_ENDL; llassert(loaded); } - } + } - if (loaded) - { + if (loaded) + { loaded = loadShadersWindLight(); if (loaded) { @@ -599,10 +599,10 @@ void LLViewerShaderMgr::setShaders() LL_WARNS() << "Failed to load windlight shaders." << LL_ENDL; llassert(loaded); } - } + } - if (loaded) - { + if (loaded) + { loaded = loadShadersEffects(); if (loaded) { @@ -613,25 +613,25 @@ void LLViewerShaderMgr::setShaders() LL_WARNS() << "Failed to load effects shaders." << LL_ENDL; llassert(loaded); } - } + } - if (loaded) - { - loaded = loadShadersInterface(); - if (loaded) - { - LL_INFOS() << "Loaded interface shaders." << LL_ENDL; - } - else - { - LL_WARNS() << "Failed to load interface shaders." << LL_ENDL; - llassert(loaded); - } - } + if (loaded) + { + loaded = loadShadersInterface(); + if (loaded) + { + LL_INFOS() << "Loaded interface shaders." << LL_ENDL; + } + else + { + LL_WARNS() << "Failed to load interface shaders." << LL_ENDL; + llassert(loaded); + } + } - if (loaded) + if (loaded) - { + { loaded = loadTransformShaders(); if (loaded) { @@ -767,7 +767,7 @@ void LLViewerShaderMgr::setShaders() } gPipeline.createGLBuffers(); - reentrance = false; + reentrance = false; } void LLViewerShaderMgr::unloadShaders() -- cgit v1.2.3 From 2998552f3d7447da316afdd1713595528596a0c5 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 28 Jan 2020 14:33:03 -0500 Subject: Increment viewer version to 6.3.7 following promotion of DRTVWR-496 --- indra/newview/VIEWER_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index c8320dd521..c44315e3f0 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -6.3.6 +6.3.7 -- cgit v1.2.3 From a4cabf80d3c7a125a23dbab0fadec5c8c5ab8d97 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 29 Jan 2020 16:39:49 +0200 Subject: SL-12590 SL-12608 Fixed wrong states --- indra/newview/llpanellogin.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 7ef3685cdb..224cec9650 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -1230,6 +1230,8 @@ void LLPanelLogin::updateLoginButtons() if (user_combo->getCurrentIndex() != -1) { remember_name->setValue(true); + LLCheckBoxCtrl* remember_pass = getChild("remember_password"); + remember_pass->setEnabled(TRUE); } // Note: might be good idea to do "else remember_name->setValue(mRememberedState)" but it might behave 'weird' to user } } @@ -1239,6 +1241,8 @@ void LLPanelLogin::populateUserList(LLPointer credential) LLComboBox* user_combo = getChild("username_combo"); user_combo->removeall(); user_combo->clear(); + user_combo->setValue(std::string()); + getChild("password_edit")->setValue(std::string()); mUsernameLength = 0; mPasswordLength = 0; @@ -1261,9 +1265,7 @@ void LLPanelLogin::populateUserList(LLPointer credential) if (credential.isNull() || !user_combo->setSelectedByValue(LLSD(credential->userID()), true)) { - // selection failed, just deselect whatever might be selected - user_combo->setValue(std::string()); - getChild("password_edit")->setValue(std::string()); + // selection failed, fields will be mepty updateLoginButtons(); } else @@ -1278,7 +1280,8 @@ void LLPanelLogin::populateUserList(LLPointer credential) const LLSD &ident = credential->getIdentifier(); if (ident.isMap() && ident.has("type")) { - user_combo->add(LLPanelLogin::getUserName(credential), credential->userID(), ADD_BOTTOM, TRUE); + // this llsd might hold invalid credencial (failed login), so + // do not add to the list, just set field. setFields(credential); } else -- cgit v1.2.3 From a8437a7636c065ae06e53281db1be94dd4ae9e88 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 29 Jan 2020 18:02:41 +0200 Subject: potential crashfix --- indra/newview/llimprocessing.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra') diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index d3537dc24e..c3375a3779 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -1569,6 +1569,12 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url) return; } + if (gAgent.getRegion() == NULL) + { + LL_WARNS("Messaging") << "Region null while attempting to load messages." << LL_ENDL; + return; + } + LL_INFOS("Messaging") << "Processing offline messages." << LL_ENDL; std::vector data; -- cgit v1.2.3 From 195f69f603613c3270050169c6a42f84307f8163 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 24 Jan 2020 16:45:36 -0700 Subject: SL-12594, remove the Basic Shaders checkbox from the gui --- indra/newview/skins/default/xui/da/panel_preferences_graphics1.xml | 1 - .../skins/default/xui/de/floater_preferences_graphics_advanced.xml | 1 - .../skins/default/xui/en/floater_preferences_graphics_advanced.xml | 4 +++- .../skins/default/xui/es/floater_preferences_graphics_advanced.xml | 1 - .../skins/default/xui/fr/floater_preferences_graphics_advanced.xml | 1 - .../skins/default/xui/it/floater_preferences_graphics_advanced.xml | 1 - .../skins/default/xui/ja/floater_preferences_graphics_advanced.xml | 1 - indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml | 1 - .../skins/default/xui/pt/floater_preferences_graphics_advanced.xml | 1 - .../skins/default/xui/ru/floater_preferences_graphics_advanced.xml | 1 - .../skins/default/xui/tr/floater_preferences_graphics_advanced.xml | 1 - .../skins/default/xui/zh/floater_preferences_graphics_advanced.xml | 1 - 12 files changed, 3 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/da/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/da/panel_preferences_graphics1.xml index e494b2b755..c7770eb81b 100644 --- a/indra/newview/skins/default/xui/da/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/da/panel_preferences_graphics1.xml @@ -29,7 +29,6 @@ - diff --git a/indra/newview/skins/default/xui/de/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/de/floater_preferences_graphics_advanced.xml index 41e8dc5ef4..cd514f5afd 100644 --- a/indra/newview/skins/default/xui/de/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/de/floater_preferences_graphics_advanced.xml @@ -82,7 +82,6 @@ - Niedrig diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index 70bf3f7c14..f06377f51a 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -623,6 +623,7 @@ top_delta="16" width="300" /> + + - Bajo diff --git a/indra/newview/skins/default/xui/fr/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/fr/floater_preferences_graphics_advanced.xml index fd47254934..42af9c526d 100644 --- a/indra/newview/skins/default/xui/fr/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/fr/floater_preferences_graphics_advanced.xml @@ -82,7 +82,6 @@ - Faible diff --git a/indra/newview/skins/default/xui/it/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/it/floater_preferences_graphics_advanced.xml index 3773ef3711..53f9ebc6fd 100644 --- a/indra/newview/skins/default/xui/it/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/it/floater_preferences_graphics_advanced.xml @@ -82,7 +82,6 @@ - Basso diff --git a/indra/newview/skins/default/xui/ja/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/ja/floater_preferences_graphics_advanced.xml index c28afa4c98..8ba537faa2 100644 --- a/indra/newview/skins/default/xui/ja/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/ja/floater_preferences_graphics_advanced.xml @@ -82,7 +82,6 @@ - 低 diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml index 738805d800..e8c400dbd1 100644 --- a/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml @@ -28,7 +28,6 @@ - diff --git a/indra/newview/skins/default/xui/pt/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/pt/floater_preferences_graphics_advanced.xml index c5039267ca..bbe36e3e03 100644 --- a/indra/newview/skins/default/xui/pt/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/pt/floater_preferences_graphics_advanced.xml @@ -82,7 +82,6 @@ - Baixo diff --git a/indra/newview/skins/default/xui/ru/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/ru/floater_preferences_graphics_advanced.xml index fc6b6a173e..84e1ff15a0 100644 --- a/indra/newview/skins/default/xui/ru/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/ru/floater_preferences_graphics_advanced.xml @@ -82,7 +82,6 @@ - Низкая diff --git a/indra/newview/skins/default/xui/tr/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/tr/floater_preferences_graphics_advanced.xml index 01ada1354c..c5ca997336 100644 --- a/indra/newview/skins/default/xui/tr/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/tr/floater_preferences_graphics_advanced.xml @@ -82,7 +82,6 @@ - Düşük diff --git a/indra/newview/skins/default/xui/zh/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/zh/floater_preferences_graphics_advanced.xml index 7b127acd71..58314efeed 100644 --- a/indra/newview/skins/default/xui/zh/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/zh/floater_preferences_graphics_advanced.xml @@ -82,7 +82,6 @@ - 低 -- cgit v1.2.3 From 18cdf4d2693c0b859a5378e251b1368975f62395 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 24 Jan 2020 17:26:20 -0700 Subject: SL-12594, remove Basic Shader checks Remove checks for Vertex Shader capability and UI selection of no Basic Shaders. --- indra/newview/llfloaterpreference.cpp | 113 +++++++++------------------------- indra/newview/llfloaterpreference.h | 8 +-- indra/newview/pipeline.cpp | 3 - 3 files changed, 33 insertions(+), 91 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 5cfdc466ef..8165207dd0 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -407,7 +407,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this)); mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this)); - mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); + mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onRenderOptionEnable, this)); mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this)); mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2)); @@ -866,12 +866,12 @@ void LLFloaterPreference::onOpen(const LLSD& key) } } -void LLFloaterPreference::onVertexShaderEnable() +void LLFloaterPreference::onRenderOptionEnable() { refreshEnabledGraphics(); } -void LLFloaterPreferenceGraphicsAdvanced::onVertexShaderEnable() +void LLFloaterPreferenceGraphicsAdvanced::onRenderOptionEnable() { LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); if (instance) @@ -1305,20 +1305,19 @@ void LLFloaterPreference::refreshEnabledState() LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); // if vertex shaders off, disable all shader related products - if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") || - !LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) + if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) { ctrl_wind_light->setEnabled(FALSE); ctrl_wind_light->setValue(FALSE); } else { - ctrl_wind_light->setEnabled(gSavedSettings.getBOOL("VertexShaderEnable")); + ctrl_wind_light->setEnabled(TRUE); } //Deferred/SSAO/Shadows BOOL bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump"); - BOOL shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders") && gSavedSettings.getBOOL("VertexShaderEnable"); + BOOL shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders"); BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && bumpshiny && shaders && @@ -1375,50 +1374,33 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() { ctrl_avatar_cloth->setEnabled(TRUE); } - - // Vertex Shaders - // Global Shader Enable - LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); - LLSliderCtrl* terrain_detail = getChild("TerrainDetail"); // can be linked with control var - LLTextBox* terrain_text = getChild("TerrainDetailText"); - ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); - - BOOL shaders = ctrl_shader_enable->get(); - if (shaders) - { - terrain_detail->setEnabled(FALSE); - terrain_text->setEnabled(FALSE); - } - else - { - terrain_detail->setEnabled(TRUE); - terrain_text->setEnabled(TRUE); - } - - // WindLight - LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); - LLSliderCtrl* sky = getChild("SkyMeshDetail"); - LLTextBox* sky_text = getChild("SkyMeshDetailText"); + // Vertex Shaders, Global Shader Enable + // SL-12594 Basic shaders are always enabled. DJH TODO clean up now-orphaned state handling code + LLSliderCtrl* terrain_detail = getChild("TerrainDetail"); // can be linked with control var + LLTextBox* terrain_text = getChild("TerrainDetailText"); - // *HACK just checks to see if we can use shaders... - // maybe some cards that use shaders, but don't support windlight - ctrl_wind_light->setEnabled(ctrl_shader_enable->getEnabled() && shaders); + terrain_detail->setEnabled(FALSE); + terrain_text->setEnabled(FALSE); - sky->setEnabled(ctrl_wind_light->get() && shaders); - sky_text->setEnabled(ctrl_wind_light->get() && shaders); + // WindLight + LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); + LLSliderCtrl* sky = getChild("SkyMeshDetail"); + LLTextBox* sky_text = getChild("SkyMeshDetailText"); + ctrl_wind_light->setEnabled(TRUE); + sky->setEnabled(TRUE); + sky_text->setEnabled(TRUE); - //Deferred/SSAO/Shadows - LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); - - BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && - ((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? TRUE : FALSE) && - shaders && - gGLManager.mHasFramebufferObject && - gSavedSettings.getBOOL("RenderAvatarVP") && - (ctrl_wind_light->get()) ? TRUE : FALSE; + //Deferred/SSAO/Shadows + LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); + + BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + ((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? TRUE : FALSE) && + gGLManager.mHasFramebufferObject && + gSavedSettings.getBOOL("RenderAvatarVP") && + (ctrl_wind_light->get()) ? TRUE : FALSE; - ctrl_deferred->setEnabled(enabled); + ctrl_deferred->setEnabled(enabled); LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); @@ -1516,7 +1498,6 @@ void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() LLTextBox* reflections_text = getChild("ReflectionsText"); LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); - LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); LLComboBox* ctrl_shadows = getChild("ShadowDetail"); @@ -1526,42 +1507,6 @@ void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() LLSliderCtrl* sky = getChild("SkyMeshDetail"); LLTextBox* sky_text = getChild("SkyMeshDetailText"); - // if vertex shaders off, disable all shader related products - if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")) - { - ctrl_shader_enable->setEnabled(FALSE); - ctrl_shader_enable->setValue(FALSE); - - ctrl_wind_light->setEnabled(FALSE); - ctrl_wind_light->setValue(FALSE); - - sky->setEnabled(FALSE); - sky_text->setEnabled(FALSE); - - ctrl_reflections->setEnabled(FALSE); - ctrl_reflections->setValue(0); - reflections_text->setEnabled(FALSE); - - ctrl_avatar_vp->setEnabled(FALSE); - ctrl_avatar_vp->setValue(FALSE); - - ctrl_avatar_cloth->setEnabled(FALSE); - ctrl_avatar_cloth->setValue(FALSE); - - ctrl_shadows->setEnabled(FALSE); - ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); - - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); - - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); - - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); - } - // disabled windlight if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) { @@ -2928,7 +2873,7 @@ void LLPanelPreferenceGraphics::setHardwareDefaults() LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const LLSD& key) : LLFloater(key) { - mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onVertexShaderEnable, this)); + mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onRenderOptionEnable, this)); mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this)); mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this)); } diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 42f1de4a5d..a0f43bd884 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -122,8 +122,8 @@ protected: // callback for defaults void setHardwareDefaults(); void setRecommended(); - // callback for when client turns on shaders - void onVertexShaderEnable(); + // callback for when client modifies a render option + void onRenderOptionEnable(); // callback for when client turns on impostors void onAvatarImpostorsEnable(); @@ -313,8 +313,8 @@ class LLFloaterPreferenceGraphicsAdvanced : public LLFloater static void setIndirectMaxNonImpostors(); static void setIndirectMaxArc(); void refresh(); - // callback for when client turns on shaders - void onVertexShaderEnable(); + // callback for when client modifies a render option + void onRenderOptionEnable(); void onAdvancedAtmosphericsEnable(); LOG_CLASS(LLFloaterPreferenceGraphicsAdvanced); }; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 0395bf1a71..349f2a761c 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1407,12 +1407,9 @@ void LLPipeline::restoreGL() bool LLPipeline::canUseVertexShaders() { - static const std::string vertex_shader_enable_feature_string = "VertexShaderEnable"; - if (sDisableShaders || !gGLManager.mHasVertexShader || !gGLManager.mHasFragmentShader || - !LLFeatureManager::getInstance()->isFeatureAvailable(vertex_shader_enable_feature_string) || (assertInitialized() && mVertexShadersLoaded != 1) ) { return false; -- cgit v1.2.3 From 66a831dcf94edb7e391c270ccb79a8f023219e09 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 29 Jan 2020 18:09:19 +0200 Subject: SL-4354 Mesh avatars look broken while loading. --- indra/newview/llvoavatar.cpp | 37 +++++++++++++++++++++++++++++-------- indra/newview/llvoavatar.h | 2 ++ 2 files changed, 31 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 887456dcfb..f4f91a4009 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -197,6 +197,8 @@ const F32 NAMETAG_VERT_OFFSET_WEIGHT = 0.17f; const U32 LLVOAvatar::VISUAL_COMPLEXITY_UNKNOWN = 0; const F64 HUD_OVERSIZED_TEXTURE_DATA_SIZE = 1024 * 1024; +const F32 MAX_TEXTURE_WAIT_TIME_SEC = 60; + enum ERenderName { RENDER_NAME_NEVER, @@ -663,6 +665,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mFullyLoadedInitialized(FALSE), mVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN), mLoadedCallbacksPaused(FALSE), + mLoadedCallbackTextures(0), mRenderUnloadedAvatar(LLCachedControl(gSavedSettings, "RenderUnloadedAvatar", false)), mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), @@ -5327,6 +5330,7 @@ void LLVOAvatar::checkTextureLoading() if(mCallbackTextureList.empty()) //when is self or no callbacks. Note: this list for self is always empty. { mLoadedCallbacksPaused = pause ; + mLoadedCallbackTextures = 0; return ; //nothing to check. } @@ -5334,7 +5338,9 @@ void LLVOAvatar::checkTextureLoading() { return ; //have not been invisible for enough time. } - + + mLoadedCallbackTextures = 0; + for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin(); iter != mCallbackTextureList.end(); ++iter) { @@ -5356,8 +5362,12 @@ void LLVOAvatar::checkTextureLoading() tex->unpauseLoadedCallbacks(&mCallbackTextureList) ; tex->addTextureStats(START_AREA); //jump start the fetching again } - } - } + } + if (tex->isFullyLoaded()) + { + mLoadedCallbackTextures++; + } + } if(!pause) { @@ -7799,9 +7809,19 @@ BOOL LLVOAvatar::updateIsFullyLoaded() { S32 rez_status = getRezzedStatus(); bool loading = getIsCloud(); - if (mFirstFullyVisible && !mIsControlAvatar && rez_status < 3) - { - loading = ((rez_status < 2) || !isFullyBaked()); + if (mFirstFullyVisible && !mIsControlAvatar) + { + loading = ((rez_status < 2) + || mMeshTexturesDirty + || mVisualComplexityStale //complexity just updated + // Wait at least 60s for unfinished textures to finish on first load, + // don't wait forever, it might fail. Even if it will eventually load by + // itself and update mLoadedCallbackTextures (or fail and clean the list), + // avatars are more time-sensitive than textures and can't wait that long. + || (mLoadedCallbackTextures != mCallbackTextureList.size() && mLastTexCallbackAddedTime.getElapsedTimeF32() <= MAX_TEXTURE_WAIT_TIME_SEC) + || !mPendingAttachment.empty() + || (rez_status < 3 && !isFullyBaked()) + ); } updateRezzedStatusTimers(rez_status); updateRuthTimer(loading); @@ -8185,6 +8205,7 @@ void LLVOAvatar::updateMeshTextures() } baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ), src_callback_list, paused ); + mLastTexCallbackAddedTime.reset(); // this could add paused texture callbacks mLoadedCallbacksPaused |= paused; @@ -8578,7 +8599,7 @@ void LLVOAvatar::onFirstTEMessageReceived() LL_DEBUGS("Avatar") << avString() << "layer_baked, setting onInitialBakedTextureLoaded as callback" << LL_ENDL; image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ), src_callback_list, paused ); - + mLastTexCallbackAddedTime.reset(); // this could add paused texture callbacks mLoadedCallbacksPaused |= paused; } @@ -10351,7 +10372,7 @@ void LLVOAvatar::calculateUpdateRenderComplexity() // Diagnostic list of all textures on our avatar static std::set all_textures; - if (mVisualComplexityStale) + if (mVisualComplexityStale) { U32 cost = VISUAL_COMPLEXITY_UNKNOWN; LLVOVolume::texture_cost_t textures; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index e352a6c1fa..3526142ff5 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -629,6 +629,8 @@ protected: LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; BOOL mLoadedCallbacksPaused; + S32 mLoadedCallbackTextures; // count of fully loaded textures filled from mCallbackTextureList + LLFrameTimer mLastTexCallbackAddedTime; std::set mTextureIDs; //-------------------------------------------------------------------- // Local Textures -- cgit v1.2.3 From a20a506bd1a281fe5d0d54c9a59c47abed23d44a Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Wed, 29 Jan 2020 13:18:41 -0700 Subject: SL-12594, rename some lingering VertexShaderEnable variables --- indra/newview/llfloaterpreference.cpp | 4 ++-- .../default/xui/en/floater_preferences_graphics_advanced.xml | 12 ++++++------ .../skins/default/xui/en/panel_preferences_graphics1.xml | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 8165207dd0..d11e5e44d2 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -407,7 +407,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this)); mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this)); - mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onRenderOptionEnable, this)); + mCommitCallbackRegistrar.add("Pref.RenderOptionUpdate", boost::bind(&LLFloaterPreference::onRenderOptionEnable, this)); mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this)); mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2)); @@ -2873,7 +2873,7 @@ void LLPanelPreferenceGraphics::setHardwareDefaults() LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const LLSD& key) : LLFloater(key) { - mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onRenderOptionEnable, this)); + mCommitCallbackRegistrar.add("Pref.RenderOptionUpdate", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onRenderOptionEnable, this)); mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this)); mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this)); } diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index f06377f51a..ce219069e7 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -609,7 +609,7 @@ top_delta="16" width="300"> + function="Pref.RenderOptionUpdate" /> + function="Pref.RenderOptionUpdate" /> + function="Pref.RenderOptionUpdate" /> + function="Pref.RenderOptionUpdate" /> + function="Pref.RenderOptionUpdate" /> + function="Pref.RenderOptionUpdate" /> - - diff --git a/indra/newview/app_settings/low_graphics.xml b/indra/newview/app_settings/low_graphics.xml index df3f67a5a1..0ee8e7a059 100644 --- a/indra/newview/app_settings/low_graphics.xml +++ b/indra/newview/app_settings/low_graphics.xml @@ -33,8 +33,6 @@ - - diff --git a/indra/newview/app_settings/mid_graphics.xml b/indra/newview/app_settings/mid_graphics.xml index a10c02b79f..c89e060307 100644 --- a/indra/newview/app_settings/mid_graphics.xml +++ b/indra/newview/app_settings/mid_graphics.xml @@ -33,8 +33,6 @@ - - diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 05722bd8c1..0cb9ee3ace 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14259,6 +14259,7 @@ Value 1 + VivoxAutoPostCrashDumps Comment diff --git a/indra/newview/app_settings/ultra_graphics.xml b/indra/newview/app_settings/ultra_graphics.xml index 3e7fccbd5f..eb2cd356d9 100644 --- a/indra/newview/app_settings/ultra_graphics.xml +++ b/indra/newview/app_settings/ultra_graphics.xml @@ -34,8 +34,6 @@ - - diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index ce219069e7..e93568a87e 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -623,7 +623,7 @@ top_delta="16" width="300" /> - - ([HH]:[MM]) + ([HH]:[MM]) Sky [ALT] Sky Water @@ -185,44 +185,44 @@ left="10" name="p0" top_pad="5" - value="0%[DSC]" - width="80" /> + value="0% [DSC]" + width="90" /> + value="25% [DSC]" + width="90" /> + value="50% [DSC]" + width="90" /> + value="75% [DSC]" + width="90" /> + value="100% [DSC]" + width="90" /> + width="56" + word_wrap="true"/> Date: Thu, 20 Feb 2020 19:37:33 -0500 Subject: Increment viewer version to 6.3.8 following promotion of DRTVWR-499 --- indra/newview/VIEWER_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index c44315e3f0..a7ee22c2e2 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -6.3.7 +6.3.8 -- cgit v1.2.3 From c5371bb2715325aa6d705a2fc9973510675e5e59 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 21 Feb 2020 18:51:14 +0200 Subject: SL-12732 Lights not working in some cases --- indra/newview/pipeline.cpp | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index bec33790bd..dcf435f78f 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8684,29 +8684,24 @@ void LLPipeline::renderDeferredLighting() } } - const LLViewerObject *vobj = drawablep->getVObj(); - if (vobj) - { - LLVOAvatar *av = vobj->getAvatar(); - if (av) - { - if (av->isTooComplex() || av->isInMuteList() || dist_vec(av->getPosition(), LLViewerCamera::getInstance()->getOrigin()) > RenderFarClip) - { - continue; - } - } - else - { - const LLViewerObject *root_obj = drawablep->getParent() ? drawablep->getParent()->getVObj() : vobj; - if (root_obj && dist_vec(root_obj->getPosition(), LLViewerCamera::getInstance()->getOrigin()) > RenderFarClip) - { - continue; - } - } - } + const LLViewerObject *vobj = drawablep->getVObj(); + if (vobj) + { + LLVOAvatar *av = vobj->getAvatar(); + if (av && (av->isTooComplex() || av->isInMuteList())) + { + continue; + } + } + + const LLVector3 position = drawablep->getPositionAgent(); + if (dist_vec(position, LLViewerCamera::getInstance()->getOrigin()) > RenderFarClip + volume->getLightRadius()) + { + continue; + } LLVector4a center; - center.load3(drawablep->getPositionAgent().mV); + center.load3(position.mV); const F32* c = center.getF32ptr(); F32 s = volume->getLightRadius()*1.5f; -- cgit v1.2.3 From 05e2efb283a8578abe073e4188bc64347814c679 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 21 Feb 2020 19:56:44 +0000 Subject: SL-10498 - made benefits debug output a bit less verbose --- indra/newview/llstartup.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index e6ad2373bf..be6e9e520a 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -3294,8 +3294,6 @@ void on_benefits_failed_callback(const LLSD& notification, const LLSD& response) bool init_benefits(LLSD& response) { - LL_DEBUGS("Benefits") << "login success response:" << response << LL_ENDL; - bool succ = true; std::string package_name = response["account_type"].asString(); -- cgit v1.2.3 From bfcb558f90d1b3108893cfcd3cc07325c47486b6 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 21 Feb 2020 23:38:39 +0200 Subject: SL-12678 Remove automatic retry of login --- indra/newview/lllogininstance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index b7c15b3a99..873531ef22 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -62,7 +62,7 @@ #include #include -const S32 LOGIN_MAX_RETRIES = 1; // Viewer should not autmatically retry login +const S32 LOGIN_MAX_RETRIES = 0; // Viewer should not autmatically retry login const F32 LOGIN_SRV_TIMEOUT_MIN = 10; const F32 LOGIN_SRV_TIMEOUT_MAX = 120; const F32 LOGIN_DNS_TIMEOUT_FACTOR = 0.9; // make DNS wait shorter then retry time -- cgit v1.2.3 From d16a79fc4c5d5af016db6c97efc3a7b2d08f62ce Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 24 Feb 2020 21:22:21 +0200 Subject: SL-12741 Moon was using fixed color --- indra/llinventory/llsettingssky.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 8d0b37d01f..306c732920 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1277,11 +1277,7 @@ LLColor4 LLSettingsSky::getTotalAmbient() const LLColor3 LLSettingsSky::getMoonlightColor() const { - F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; - LLColor3 moonlight_a(0.9, 0.9, 1.32); - LLColor3 moonlight_b(0.66, 0.66, 2.0); - LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); - return moonlight; + return getSunlightColor(); //moon and sun share light color } void LLSettingsSky::clampColor(LLColor3& color, F32 gamma, F32 scale) const -- cgit v1.2.3 From db2c32285b95d3517ebcd1dbf84faa2872ab6428 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 25 Feb 2020 18:59:43 +0200 Subject: SL-12591 Fixed slider value comparison --- indra/llui/llmultislider.cpp | 18 +++++++++++------- indra/llui/llmultislider.h | 4 ++++ indra/llui/llmultisliderctrl.h | 1 + indra/newview/llfloatereditextdaycycle.cpp | 9 ++++++++- 4 files changed, 24 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index fbe0d3f065..acfe4a0cba 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -149,6 +149,16 @@ LLMultiSlider::~LLMultiSlider() delete mMouseUpSignal; } +F32 LLMultiSlider::getNearestIncrement(F32 value) const +{ + value = llclamp(value, mMinValue, mMaxValue); + + // Round to nearest increment (bias towards rounding down) + value -= mMinValue; + value += mIncrement / 2.0001f; + value -= fmod(value, mIncrement); + return mMinValue + value; +} void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event) { @@ -157,13 +167,7 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from return; } - value = llclamp( value, mMinValue, mMaxValue ); - - // Round to nearest increment (bias towards rounding down) - value -= mMinValue; - value += mIncrement/2.0001f; - value -= fmod(value, mIncrement); - F32 newValue = mMinValue + value; + F32 newValue = getNearestIncrement(value); // now, make sure no overlap // if we want that diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 20c3437ec4..99a78d6e09 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -77,6 +77,10 @@ protected: friend class LLUICtrlFactory; public: virtual ~LLMultiSlider(); + + // Multi-slider rounds values to nearest increments (bias towards rounding down) + F32 getNearestIncrement(F32 value) const; + void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); F32 getSliderValue(const std::string& name) const; F32 getSliderValueFromPos(S32 xpos, S32 ypos) const; diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index e16737b3c7..adb28676ec 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -107,6 +107,7 @@ public: void setMaxValue(F32 max_value) {mMultiSlider->setMaxValue(max_value);} void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);} + F32 getNearestIncrement(F32 value) const { return mMultiSlider->getNearestIncrement(value); } F32 getSliderValueFromPos(S32 x, S32 y) const { return mMultiSlider->getSliderValueFromPos(x, y); } LLRect getSliderThumbRect(const std::string &name) const { return mMultiSlider->getSliderThumbRect(name); } diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 2c10835fb0..f57a54163d 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -991,13 +991,20 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data) } else { - if (mEditDay->moveTrackKeyframe(mCurrentTrack, (*it).second.mFrame, sliderpos) && mCanMod) + // slider rounds values to nearest increments, changes can be substanntial (half increment) + if (abs(mFramesSlider->getNearestIncrement((*it).second.mFrame) - sliderpos) < F_APPROXIMATELY_ZERO) + { + // same value + mFramesSlider->setCurSliderValue((*it).second.mFrame); + } + else if (mEditDay->moveTrackKeyframe(mCurrentTrack, (*it).second.mFrame, sliderpos) && mCanMod) { (*it).second.mFrame = sliderpos; setDirtyFlag(); } else { + // same value, wrong track, no such value, no mod mFramesSlider->setCurSliderValue((*it).second.mFrame); } -- cgit v1.2.3 From b1934b4d05f5d044584b5eb7115639bf1183aa93 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 25 Feb 2020 20:23:12 +0200 Subject: SL-12755 [EEP] The sky level dropdown was not disabled by default --- indra/newview/skins/default/xui/en/floater_settings_picker.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_settings_picker.xml b/indra/newview/skins/default/xui/en/floater_settings_picker.xml index 132d23492f..c6136904cf 100644 --- a/indra/newview/skins/default/xui/en/floater_settings_picker.xml +++ b/indra/newview/skins/default/xui/en/floater_settings_picker.xml @@ -107,6 +107,7 @@ max_chars="100" mouse_opaque="true" name="track_selection" + enabled="false" top="1" width="190"/> -- cgit v1.2.3 From dbf464e0fd0df27c18b78a77004b40a8477e0c31 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 25 Feb 2020 20:43:15 +0200 Subject: SL-12754 Fixed search field --- indra/newview/skins/default/xui/en/floater_settings_picker.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_settings_picker.xml b/indra/newview/skins/default/xui/en/floater_settings_picker.xml index c6136904cf..3a26c3b547 100644 --- a/indra/newview/skins/default/xui/en/floater_settings_picker.xml +++ b/indra/newview/skins/default/xui/en/floater_settings_picker.xml @@ -58,7 +58,7 @@ Date: Tue, 25 Feb 2020 08:05:24 -0700 Subject: SL-12638, fix overly dark appearance of normal-mapped objects Adds the 'additive' component of calcAtmosphericVars into the sunlit color to reduce darkening of sun lighting component, and adds a further magic number gainto boost final result to rough parity with windlight. Removes all light calculations on fullbright objects, just passing through the unlit diffuse color. --- .../shaders/class1/deferred/fullbrightF.glsl | 3 +- .../shaders/class1/deferred/materialF.glsl | 73 ++++++---------------- 2 files changed, 20 insertions(+), 56 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index c104dc884f..39ed9a6e82 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -86,7 +86,6 @@ void main() color.a = final_alpha; #endif - frag_color.rgb = color.rgb; - frag_color.a = color.a; + frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index d28fc128b6..2df683a5fd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -95,19 +95,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe dist /= la; - /* clip to projector bounds - vec4 proj_tc = proj_mat * lp; - - if (proj_tc.z < 0 - || proj_tc.z > 1 - || proj_tc.x < 0 - || proj_tc.x > 1 - || proj_tc.y < 0 - || proj_tc.y > 1) - { - return col; - }*/ - if (dist > 0.0 && la > 0.0) { //normalize light vector @@ -252,7 +239,11 @@ void main() vec3 norm = vec3(0); float bmap_specular = 1.0; + // Non-physical gain, sole purpose to make EEP viewer better match windlight when normal-mapped. + float eep_bump_gain = 1.0; + #ifdef HAS_NORMAL_MAP + eep_bump_gain = 1.75; vec4 bump_sample = texture2D(bumpMap, vary_texcoord1.xy); norm = (bump_sample.xyz * 2) - vec3(1); bmap_specular = bump_sample.w; @@ -295,7 +286,7 @@ void main() vec4 final_normal = vec4(abnormal, env_intensity, 0.0); vec3 color = vec3(0.0); - float al = 0.0; + float al = 1.0; if (emissive_brightness >= 1.0) { @@ -318,7 +309,12 @@ void main() #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - if (emissive_brightness <= 1.0) + if (emissive_brightness >= 1.0) + { + // fullbright = diffuse texture pass-through, no lighting + frag_color = diffuse_srgb; + } + else { //forward rendering, output just lit RGBA vec3 pos = vary_position; @@ -348,40 +344,28 @@ void main() float da = dot(norm, normalize(light_dir)); da = clamp(da, 0.0, 1.0); // No negative light contributions - float ambient = da; - ambient *= 0.5; - ambient *= ambient; - ambient = (1.0 - ambient); - - vec3 sun_contrib = min(da, shadow) * sunlit; + // ambient weight varies from 0.75 at max direct light to 1.0 with sun at grazing angle + float ambient = 1.0 - (0.25 * da * da); -// vec3 debug_sun_contrib = sun_contrib; + vec3 sun_contrib = additive + (min(da, shadow) * sunlit); #if !defined(AMBIENT_KILL) color.rgb = amblit; color.rgb *= ambient; #endif -//vec3 debug_post_ambient = color.rgb; - #if !defined(SUNLIGHT_KILL) - color.rgb += sun_contrib; + color.rgb += eep_bump_gain * sun_contrib; #endif -//vec3 debug_post_sunlight = color.rgb; - - //color.rgb *= diffuse_srgb.rgb; color.rgb *= diffuse_linear.rgb; // SL-12006 -//vec3 debug_post_diffuse = color.rgb; - float glare = 0.0; if (spec.a > 0.0) // specular reflection { vec3 npos = -normalize(pos.xyz); - //vec3 ref = dot(pos+lv, norm); vec3 h = normalize(light_dir.xyz+npos); float nh = dot(norm, h); float nv = dot(norm, npos); @@ -404,8 +388,6 @@ void main() } } -//vec3 debug_post_spec = color.rgb; - if (envIntensity > 0.0) { //add environmentmap @@ -422,15 +404,11 @@ void main() glare += cur_glare; } -//vec3 debug_post_env = color.rgb; - color = atmosFragLighting(color, additive, atten); //convert to linear space before adding local lights color = srgb_to_linear(color); -//vec3 debug_post_atmo = color.rgb; - vec3 npos = normalize(-pos.xyz); vec3 light = vec3(0,0,0); @@ -453,32 +431,19 @@ void main() #endif color = scaleSoftClipFrag(color); - + // (only) post-deferred needs inline gamma correction color.rgb = linear_to_srgb(color.rgb); -//color.rgb = amblit; -//color.rgb = vec3(ambient); -//color.rgb = sunlit; -//color.rgb = debug_post_ambient; -//color.rgb = vec3(da); -//color.rgb = debug_sun_contrib; -//color.rgb = debug_post_sunlight; -//color.rgb = diffuse_srgb.rgb; -//color.rgb = debug_post_diffuse; -//color.rgb = debug_post_spec; -//color.rgb = debug_post_env; -//color.rgb = debug_post_atmo; - #ifdef WATER_FOG vec4 temp = applyWaterFogView(pos, vec4(color.rgb, al)); color.rgb = temp.rgb; al = temp.a; #endif - } // !fullbright - frag_color.rgb = color.rgb; - frag_color.a = al; + frag_color.rgb = color.rgb; + frag_color.a = al; + } #else // if DIFFUSE_ALPHA_MODE_BLEND ... -- cgit v1.2.3 From e4a8942843316b6b4f9a88a280596c9311d88a53 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 25 Feb 2020 18:56:11 +0000 Subject: SL-12757 - typo in menu_viewer.xml --- indra/newview/skins/default/xui/en/menu_viewer.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index b1d44302f9..2c9bf99fe2 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1337,7 +1337,7 @@ function="File.VisibleUploadModel"/> Date: Tue, 25 Feb 2020 11:34:23 -0800 Subject: SL-12574: Simplify Direct Ambient --- .../app_settings/shaders/class1/deferred/softenLightF.glsl | 8 ++------ .../app_settings/shaders/class2/deferred/softenLightF.glsl | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index b1dce665a1..705cc2f04e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -81,11 +81,7 @@ void main() norm.xyz = getNorm(tc); vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - float da = dot(normalize(norm.xyz), light_dir.xyz); - da = clamp(da, -1.0, 1.0); - - float final_da = da; - final_da = clamp(final_da, 0.0, 1.0); + float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); vec4 diffuse_srgb = texture2DRect(diffuseRect, tc); vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); @@ -108,7 +104,7 @@ void main() ambient *= ambient; ambient = (1.0 - ambient); - vec3 sun_contrib = final_da * sunlit; + vec3 sun_contrib = da * sunlit; #if !defined(AMBIENT_KILL) color.rgb = amblit; diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index f49fad5517..593706867d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -85,11 +85,7 @@ void main() float scol = 1.0; vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; - float da = dot(normalize(norm.xyz), light_dir.xyz); - da = clamp(da, -1.0, 1.0); - - float final_da = da; - final_da = clamp(final_da, 0.0, 1.0); + float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); vec4 diffuse_srgb = texture2DRect(diffuseRect, tc); vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); @@ -116,7 +112,7 @@ void main() ambient *= ambient; ambient = (1.0 - ambient); - vec3 sun_contrib = min(scol, final_da) * sunlit; + vec3 sun_contrib = min(scol, da) * sunlit; #if !defined(AMBIENT_KILL) color.rgb = amblit; -- cgit v1.2.3 From d180e94a8633bb7d6c355b36aba9712151d90207 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 25 Feb 2020 11:37:24 -0800 Subject: SL-12574: Document shader class summary --- indra/newview/app_settings/shaders/shader_hierarchy.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/shader_hierarchy.txt b/indra/newview/app_settings/shaders/shader_hierarchy.txt index ebccaddd55..8ef04d8e1f 100644 --- a/indra/newview/app_settings/shaders/shader_hierarchy.txt +++ b/indra/newview/app_settings/shaders/shader_hierarchy.txt @@ -1,3 +1,9 @@ +Class 3 is highest quality / lowest performance +Class 2 is medium quality / medium performance +Class 1 is lowest quality / highest performance + +Shaders WILL fall back to "lower" classes for functionality. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ avatar/avatarV.glsl - gAvatarProgram, gAvatarWaterProgram main() - avatar/avatarV.glsl -- cgit v1.2.3 From b71e33b48cf321bb76081baeb210511cb9fbc1c8 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 25 Feb 2020 13:08:01 -0800 Subject: SL-12574 Cleanup unused argument --- indra/newview/llvosky.cpp | 27 +++++++++++++-------------- indra/newview/llvosky.h | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 64f34eb619..525251d42c 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -190,9 +190,8 @@ void LLSkyTex::initEmpty(const S32 tex) createGLImage(tex); } -void LLSkyTex::create(const F32 brightness) +void LLSkyTex::create() { - /// Brightness ignored for now. U8* data = mImageRaw[sCurrent]->getData(); for (S32 i = 0; i < sResolution; ++i) { @@ -502,8 +501,8 @@ void LLVOSky::init() initSkyTextureDirs(side, tile); createSkyTexture(m_atmosphericsVars, side, tile); } - mSkyTex[side].create(1.0f); - mShinyTex[side].create(1.0f); + mSkyTex[side].create(); + mShinyTex[side].create(); } initCubeMap(); @@ -764,35 +763,35 @@ bool LLVOSky::updateSky() { LLImageRaw* raw1 = nullptr; LLImageRaw* raw2 = nullptr; - + if (!is_alm_wl_sky) - { + { raw1 = mSkyTex[side].getImageRaw(TRUE); raw2 = mSkyTex[side].getImageRaw(FALSE); raw2->copy(raw1); mSkyTex[side].createGLImage(tex); - } + } raw1 = mShinyTex[side].getImageRaw(TRUE); raw2 = mShinyTex[side].getImageRaw(FALSE); raw2->copy(raw1); mShinyTex[side].createGLImage(tex); -} + } next_frame = 0; // update the sky texture if (!is_alm_wl_sky) { for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i) -{ - mSkyTex[i].create(1.0f); + { + mSkyTex[i].create(); } - } + } for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i) - { - mShinyTex[i].create(1.0f); - } + { + mShinyTex[i].create(); + } // update the environment map initCubeMap(); diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index fc577ab5f8..39e42bbb24 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -78,7 +78,7 @@ protected: void initEmpty(const S32 tex); - void create(F32 brightness); + void create(); void setDir(const LLVector3 &dir, const S32 i, const S32 j) { -- cgit v1.2.3 From d87cc68a72393cdc56dcbc2e36fd94ec7a814246 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 25 Feb 2020 13:08:37 -0800 Subject: SL-12574 Cleanup inconsistent indentation --- indra/newview/llvosky.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 525251d42c..943704c8de 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -698,20 +698,20 @@ bool LLVOSky::updateSky() LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))) -{ + { return TRUE; -} + } if (mDead) -{ + { // It's dead. Don't update it. return TRUE; -} + } if (gGLManager.mIsDisabled) -{ + { return TRUE; -} + } static S32 next_frame = 0; const S32 total_no_tiles = NUM_CUBEMAP_FACES * NUM_TILES; @@ -743,15 +743,15 @@ bool LLVOSky::updateSky() mNeedUpdate = mNeedUpdate || !same_atmospherics; if (mNeedUpdate && (mForceUpdateThrottle.hasExpired() || mForceUpdate)) -{ + { // start updating cube map sides updateFog(LLViewerCamera::getInstance()->getFar()); mCubeMapUpdateStage = 0; mForceUpdate = FALSE; - } - } + } + } else if (mCubeMapUpdateStage == NUM_CUBEMAP_FACES) - { + { LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED); LLSkyTex::stepCurrent(); @@ -805,9 +805,9 @@ bool LLVOSky::updateSky() gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); if (mDrawable.notNull() && mDrawable->getFace(0) && !mDrawable->getFace(0)->getVertexBuffer()) - { - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); - } + { + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); + } mCubeMapUpdateStage = -1; } // run 0 to 5 faces, each face in own frame @@ -821,11 +821,11 @@ bool LLVOSky::updateSky() // (i.e. potentially can be made per tile again, can be moved to thread // instead of executing per face, or may be can be moved to shaders) for (S32 tile = 0; tile < NUM_TILES; tile++) - { + { createSkyTexture(m_atmosphericsVars, side, tile); - } + } mCubeMapUpdateStage++; - } + } return TRUE; } -- cgit v1.2.3 From c4c8d2017494dc1e673b2cb09f031a1715efa0af Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 25 Feb 2020 13:23:51 -0800 Subject: SL-12574 Tweak sky to better match Windlight --- indra/newview/lllegacyatmospherics.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index 165ef8c797..e061b3ad17 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -208,23 +208,25 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(AtmosphericsVars& vars, const LLVecto return calcSkyColorInDir(psky, vars, dir, isShiny); } +// This cubemap is used as "environmentMap" in indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const LLVector3 &dir, bool isShiny) { - F32 saturation = 0.3f; + F32 sky_saturation = 0.25f; + F32 land_saturation = 0.1f; if (isShiny && dir.mV[VZ] < -0.02f) { LLColor4 col; LLColor3 desat_fog = LLColor3(mFogColor); - F32 brightness = desat_fog.brightness(); + F32 brightness = desat_fog.brightness();// NOTE: Linear brightness! // So that shiny somewhat shows up at night. if (brightness < 0.15f) { brightness = 0.15f; desat_fog = smear(0.15f); } - F32 greyscale_sat = brightness * (1.0f - saturation); - desat_fog = desat_fog * saturation + smear(greyscale_sat); + F32 greyscale_sat = brightness * (1.0f - land_saturation); + desat_fog = desat_fog * land_saturation + smear(greyscale_sat); if (!gPipeline.canUseWindLightShaders()) { col = LLColor4(desat_fog, 0.f); @@ -250,9 +252,9 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, Atm if (isShiny) { F32 brightness = vars.hazeColor.brightness(); - F32 greyscale_sat = brightness * (1.0f - saturation); - LLColor3 sky_color = vars.hazeColor * saturation + smear(greyscale_sat); - sky_color *= (0.5f + 0.5f * brightness); + F32 greyscale_sat = brightness * (1.0f - sky_saturation); + LLColor3 sky_color = vars.hazeColor * sky_saturation + smear(greyscale_sat); + //sky_color *= (0.5f + 0.5f * brightness); // SL-12574 EEP sky was too dark dark grey/blue, lighten it slightly return LLColor4(sky_color, 0.0f); } -- cgit v1.2.3 From 44f0cadad8f51e33d6af49d7ef3b3e175bd5b8b2 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 27 Feb 2020 15:30:09 +0200 Subject: SL-12739 FIXED [EEP] Viewer is crashed after clicking the "Forget" button on the Experience Profile after the llSetAgentEnvironment was used --- indra/newview/llenvironment.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 8f778711ce..b8c5648cca 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -397,8 +397,8 @@ namespace void removeInjection(const std::string keyname, LLUUID experience, LLSettingsBase::Seconds transition) { - auto it = mInjections.begin(); - while (it != mInjections.end()) + injections_t injections_buf; + for (auto it = mInjections.begin(); it != mInjections.end(); it++) { if ((keyname.empty() || ((*it)->mKeyName == keyname)) && (experience.isNull() || (experience == (*it)->mExperience))) @@ -406,13 +406,16 @@ namespace if (transition != LLEnvironment::TRANSITION_INSTANT) { typename Injection::ptr_t injection = std::make_shared(transition, keyname, (*it)->mLastValue, false, LLUUID::null); - mInjections.push_front(injection); // push them in at the front so we don't check them again. + injections_buf.push_front(injection); } - mInjections.erase(it++); } else - ++it; + { + injections_buf.push_front(*it); + } } + mInjections.clear(); + mInjections = injections_buf; for (auto itexp = mOverrideExps.begin(); itexp != mOverrideExps.end();) { -- cgit v1.2.3 From 823d8bce6034eaa748b65dfec3618d1283f1ec9d Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 27 Feb 2020 11:48:04 -0700 Subject: SL-12638, further tweaking of normal-map lighting, add some de-saturation --- .../app_settings/shaders/class1/deferred/materialF.glsl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 2df683a5fd..eebb0a5fe5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -164,6 +164,14 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe return max(col, vec3(0.0,0.0,0.0)); } +// Q&D approximate RGB-space de-saturation, strength from 0 (no effect) to 1.0 (complete grey-scale) +vec3 desat(vec3 color, float strength) +{ + float primary_value = max(color.r, max(color.g, color.b)); + vec3 delta = strength * (vec3(primary_value)-color); + return color + delta; +} + #else #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_data[3]; @@ -355,11 +363,15 @@ void main() #endif #if !defined(SUNLIGHT_KILL) - color.rgb += eep_bump_gain * sun_contrib; + color.rgb += sun_contrib; #endif color.rgb *= diffuse_linear.rgb; // SL-12006 + // ad-hoc brighten and de-saturate (normal-mapped only), to match windlight - SL-12638 + color.rgb = desat(color.rgb, 0.33 * (eep_bump_gain - 1.0)); + color.rgb *= eep_bump_gain; + float glare = 0.0; if (spec.a > 0.0) // specular reflection -- cgit v1.2.3 From 54ded3678781f9a5c3b18bb4512918613e35198f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 2 Mar 2020 15:34:38 +0200 Subject: SL-12755 [EEP] The sky level dropdown is not disabled for folders --- indra/newview/llsettingspicker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index b47821ddf2..d2d21063e7 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -271,7 +271,7 @@ void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::i } bool track_picker_enabled = mTrackMode != TRACK_NONE; - getChild(CMB_TRACK_SELECTION)->setEnabled(track_picker_enabled && mSettingAssetID == asset_id); + getChild(CMB_TRACK_SELECTION)->setEnabled(is_item && track_picker_enabled && mSettingAssetID == asset_id); getChild(BTN_SELECT)->setEnabled(is_item && (!track_picker_enabled || mSettingAssetID == asset_id)); if (track_picker_enabled && asset_id.notNull() && mSettingAssetID != asset_id) { -- cgit v1.2.3 From c40dd9917ffa9711f883d2a3ea57855bb98a7e23 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 2 Mar 2020 17:31:25 +0200 Subject: SL-11273 FIXED [EEP] The beacon checkboxes in the Day Cycle window can only be changed while a keyframe is selected. --- indra/newview/llpaneleditsky.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index a069d6655f..2e26b69144 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -512,19 +512,21 @@ void LLPanelSettingsSkySunMoonTab::setEnabled(BOOL enabled) void LLPanelSettingsSkySunMoonTab::refresh() { - if (!mSkySettings) + if (!mSkySettings || !getCanChangeSettings()) { getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(FALSE); getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(FALSE); getChildView(FIELD_SKY_SUN_BEACON)->setEnabled(TRUE); getChildView(FIELD_SKY_MOON_BEACON)->setEnabled(TRUE); - return; + + if (!mSkySettings) + return; + } + else + { + setEnabled(TRUE); + setAllChildrenEnabled(TRUE); } - - setEnabled(getCanChangeSettings()); - getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(getCanChangeSettings()); - getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(getCanChangeSettings()); - setAllChildrenEnabled(getCanChangeSettings()); getChild(FIELD_SKY_SUN_MOON_COLOR)->set(mSkySettings->getSunlightColor() / SLIDER_SCALE_SUN_AMBIENT); -- cgit v1.2.3 From 8c2b7e0e83566e9a27a65856d5ae7fbe3558422f Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 3 Mar 2020 16:39:17 -0700 Subject: Revert 2 merges (PR#13, PR#16) related to SL-12638 This reverts commits 9d9b890 and 5f846e4. --- .../shaders/class1/deferred/fullbrightF.glsl | 3 +- .../shaders/class1/deferred/materialF.glsl | 81 ++++++++++++++-------- 2 files changed, 54 insertions(+), 30 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 39ed9a6e82..c104dc884f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -86,6 +86,7 @@ void main() color.a = final_alpha; #endif - frag_color = color; + frag_color.rgb = color.rgb; + frag_color.a = color.a; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index eebb0a5fe5..d28fc128b6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -95,6 +95,19 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe dist /= la; + /* clip to projector bounds + vec4 proj_tc = proj_mat * lp; + + if (proj_tc.z < 0 + || proj_tc.z > 1 + || proj_tc.x < 0 + || proj_tc.x > 1 + || proj_tc.y < 0 + || proj_tc.y > 1) + { + return col; + }*/ + if (dist > 0.0 && la > 0.0) { //normalize light vector @@ -164,14 +177,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe return max(col, vec3(0.0,0.0,0.0)); } -// Q&D approximate RGB-space de-saturation, strength from 0 (no effect) to 1.0 (complete grey-scale) -vec3 desat(vec3 color, float strength) -{ - float primary_value = max(color.r, max(color.g, color.b)); - vec3 delta = strength * (vec3(primary_value)-color); - return color + delta; -} - #else #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_data[3]; @@ -247,11 +252,7 @@ void main() vec3 norm = vec3(0); float bmap_specular = 1.0; - // Non-physical gain, sole purpose to make EEP viewer better match windlight when normal-mapped. - float eep_bump_gain = 1.0; - #ifdef HAS_NORMAL_MAP - eep_bump_gain = 1.75; vec4 bump_sample = texture2D(bumpMap, vary_texcoord1.xy); norm = (bump_sample.xyz * 2) - vec3(1); bmap_specular = bump_sample.w; @@ -294,7 +295,7 @@ void main() vec4 final_normal = vec4(abnormal, env_intensity, 0.0); vec3 color = vec3(0.0); - float al = 1.0; + float al = 0.0; if (emissive_brightness >= 1.0) { @@ -317,12 +318,7 @@ void main() #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - if (emissive_brightness >= 1.0) - { - // fullbright = diffuse texture pass-through, no lighting - frag_color = diffuse_srgb; - } - else + if (emissive_brightness <= 1.0) { //forward rendering, output just lit RGBA vec3 pos = vary_position; @@ -352,25 +348,32 @@ void main() float da = dot(norm, normalize(light_dir)); da = clamp(da, 0.0, 1.0); // No negative light contributions - // ambient weight varies from 0.75 at max direct light to 1.0 with sun at grazing angle - float ambient = 1.0 - (0.25 * da * da); + float ambient = da; + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0 - ambient); + + vec3 sun_contrib = min(da, shadow) * sunlit; - vec3 sun_contrib = additive + (min(da, shadow) * sunlit); +// vec3 debug_sun_contrib = sun_contrib; #if !defined(AMBIENT_KILL) color.rgb = amblit; color.rgb *= ambient; #endif +//vec3 debug_post_ambient = color.rgb; + #if !defined(SUNLIGHT_KILL) color.rgb += sun_contrib; #endif +//vec3 debug_post_sunlight = color.rgb; + + //color.rgb *= diffuse_srgb.rgb; color.rgb *= diffuse_linear.rgb; // SL-12006 - // ad-hoc brighten and de-saturate (normal-mapped only), to match windlight - SL-12638 - color.rgb = desat(color.rgb, 0.33 * (eep_bump_gain - 1.0)); - color.rgb *= eep_bump_gain; +//vec3 debug_post_diffuse = color.rgb; float glare = 0.0; @@ -378,6 +381,7 @@ void main() { vec3 npos = -normalize(pos.xyz); + //vec3 ref = dot(pos+lv, norm); vec3 h = normalize(light_dir.xyz+npos); float nh = dot(norm, h); float nv = dot(norm, npos); @@ -400,6 +404,8 @@ void main() } } +//vec3 debug_post_spec = color.rgb; + if (envIntensity > 0.0) { //add environmentmap @@ -416,11 +422,15 @@ void main() glare += cur_glare; } +//vec3 debug_post_env = color.rgb; + color = atmosFragLighting(color, additive, atten); //convert to linear space before adding local lights color = srgb_to_linear(color); +//vec3 debug_post_atmo = color.rgb; + vec3 npos = normalize(-pos.xyz); vec3 light = vec3(0,0,0); @@ -443,19 +453,32 @@ void main() #endif color = scaleSoftClipFrag(color); - + // (only) post-deferred needs inline gamma correction color.rgb = linear_to_srgb(color.rgb); +//color.rgb = amblit; +//color.rgb = vec3(ambient); +//color.rgb = sunlit; +//color.rgb = debug_post_ambient; +//color.rgb = vec3(da); +//color.rgb = debug_sun_contrib; +//color.rgb = debug_post_sunlight; +//color.rgb = diffuse_srgb.rgb; +//color.rgb = debug_post_diffuse; +//color.rgb = debug_post_spec; +//color.rgb = debug_post_env; +//color.rgb = debug_post_atmo; + #ifdef WATER_FOG vec4 temp = applyWaterFogView(pos, vec4(color.rgb, al)); color.rgb = temp.rgb; al = temp.a; #endif + } // !fullbright - frag_color.rgb = color.rgb; - frag_color.a = al; - } + frag_color.rgb = color.rgb; + frag_color.a = al; #else // if DIFFUSE_ALPHA_MODE_BLEND ... -- cgit v1.2.3 From afd45506c12c93ff4b705d72de249005b9c27944 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Wed, 4 Mar 2020 05:31:22 +0200 Subject: SL-12792 Made "save as a new preset" a default option --- indra/newview/llfloatercamera.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 860005bfbe..cf25e35f63 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -609,11 +609,7 @@ void LLFloaterCamera::onSavePreset() LLFloaterReg::hideInstance("delete_pref_preset", PRESETS_CAMERA); LLFloaterReg::hideInstance("load_pref_preset", PRESETS_CAMERA); - LLSD key; - std::string current_preset = gSavedSettings.getString("PresetCameraActive"); - bool is_custom_preset = current_preset != "" && !LLPresetsManager::getInstance()->isDefaultCameraPreset(current_preset); - key["index"] = is_custom_preset ? 1 : 0; - LLFloaterReg::showInstance("save_camera_preset", key); + LLFloaterReg::showInstance("save_camera_preset"); } void LLFloaterCamera::onCustomPresetSelected() -- cgit v1.2.3 From 4b62779fd3379561e97fe283ffd1c80d27703e86 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 4 Mar 2020 14:58:55 +0200 Subject: SL-12562 Change events URL --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llfloaterevent.cpp | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 2 +- indra/newview/skins/default/xui/en/notifications.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index da1e87fda4..b8bc4fe0b9 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3775,7 +3775,7 @@ Type String Value - http://events.secondlife.com/viewer/embed/event/ + https://secondlife.com/my/community/events/event.php?id= FastCacheFetchEnabled diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp index 3e303e0932..a6640cc073 100644 --- a/indra/newview/llfloaterevent.cpp +++ b/indra/newview/llfloaterevent.cpp @@ -110,7 +110,7 @@ void LLFloaterEvent::setEventID(const U32 event_id) // get the search URL and expand all of the substitutions // (also adds things like [LANGUAGE], [VERSION], [OS], etc.) std::ostringstream url; - url << gSavedSettings.getString("EventURL") << event_id << "/" << std::endl; + url << gSavedSettings.getString("EventURL") << event_id << std::endl; // and load the URL in the web view mBrowser->navigateTo(url.str()); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 04b5d808ec..6284fe9a4d 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -461,7 +461,7 @@ name="Events"> + parameter="https://secondlife.com/my/community/events"/> confirm - http://secondlife.com/events/ + https://secondlife.com/my/community/events Date: Tue, 3 Mar 2020 17:13:46 -0700 Subject: Roll back SL-12006 commits to materialF.glsl (Dec23) --- .../shaders/class1/deferred/materialF.glsl | 69 ++++------------------ 1 file changed, 11 insertions(+), 58 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index d28fc128b6..0829968dd1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -95,19 +95,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe dist /= la; - /* clip to projector bounds - vec4 proj_tc = proj_mat * lp; - - if (proj_tc.z < 0 - || proj_tc.z > 1 - || proj_tc.x < 0 - || proj_tc.x > 1 - || proj_tc.y < 0 - || proj_tc.y > 1) - { - return col; - }*/ - if (dist > 0.0 && la > 0.0) { //normalize light vector @@ -273,7 +260,6 @@ void main() #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_EMISSIVE) final_color.a = diffuse_linear.a; - final_color.rgb = mix( diffuse_linear.rgb, final_color.rgb*0.5, diffuse_tap.a ); // SL-12171: Fix emissive texture portion being twice as bright. #endif final_color.a = max(final_color.a, emissive_brightness); @@ -295,17 +281,15 @@ void main() vec4 final_normal = vec4(abnormal, env_intensity, 0.0); vec3 color = vec3(0.0); - float al = 0.0; + float al = 0; +#ifdef HAS_SPECULAR_MAP if (emissive_brightness >= 1.0) { -#ifdef HAS_SPECULAR_MAP - // Note: We actually need to adjust all 4 channels not just .rgb - final_color *= 0.666666; -#endif - color.rgb = final_color.rgb; - al = vertex_color.a; + float ei = env_intensity*0.5 + 0.5; + final_normal = vec4(abnormal, ei, 0.0); } +#endif vec4 final_specular = spec; @@ -318,7 +302,6 @@ void main() #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - if (emissive_brightness <= 1.0) { //forward rendering, output just lit RGBA vec3 pos = vary_position; @@ -348,33 +331,22 @@ void main() float da = dot(norm, normalize(light_dir)); da = clamp(da, 0.0, 1.0); // No negative light contributions - float ambient = da; - ambient *= 0.5; - ambient *= ambient; - ambient = (1.0 - ambient); + // ambient weight varies from 0.75 at max direct light to 1.0 with sun at grazing angle + float ambient = 1.0 - (0.25 * da * da); vec3 sun_contrib = min(da, shadow) * sunlit; -// vec3 debug_sun_contrib = sun_contrib; - #if !defined(AMBIENT_KILL) color.rgb = amblit; color.rgb *= ambient; #endif -//vec3 debug_post_ambient = color.rgb; - #if !defined(SUNLIGHT_KILL) color.rgb += sun_contrib; #endif -//vec3 debug_post_sunlight = color.rgb; - - //color.rgb *= diffuse_srgb.rgb; - color.rgb *= diffuse_linear.rgb; // SL-12006 - -//vec3 debug_post_diffuse = color.rgb; - + color.rgb *= diffuse_srgb.rgb; + float glare = 0.0; if (spec.a > 0.0) // specular reflection @@ -404,8 +376,6 @@ void main() } } -//vec3 debug_post_spec = color.rgb; - if (envIntensity > 0.0) { //add environmentmap @@ -422,15 +392,11 @@ void main() glare += cur_glare; } -//vec3 debug_post_env = color.rgb; - color = atmosFragLighting(color, additive, atten); //convert to linear space before adding local lights color = srgb_to_linear(color); -//vec3 debug_post_atmo = color.rgb; - vec3 npos = normalize(-pos.xyz); vec3 light = vec3(0,0,0); @@ -457,30 +423,17 @@ void main() // (only) post-deferred needs inline gamma correction color.rgb = linear_to_srgb(color.rgb); -//color.rgb = amblit; -//color.rgb = vec3(ambient); -//color.rgb = sunlit; -//color.rgb = debug_post_ambient; -//color.rgb = vec3(da); -//color.rgb = debug_sun_contrib; -//color.rgb = debug_post_sunlight; -//color.rgb = diffuse_srgb.rgb; -//color.rgb = debug_post_diffuse; -//color.rgb = debug_post_spec; -//color.rgb = debug_post_env; -//color.rgb = debug_post_atmo; - #ifdef WATER_FOG vec4 temp = applyWaterFogView(pos, vec4(color.rgb, al)); color.rgb = temp.rgb; al = temp.a; #endif - } // !fullbright + } frag_color.rgb = color.rgb; frag_color.a = al; -#else // if DIFFUSE_ALPHA_MODE_BLEND ... +#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer // deferred path frag_data[0] = final_color; -- cgit v1.2.3 From cc5044bce06598aab9f405bba745f0e8209fc5ce Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Wed, 4 Mar 2020 15:56:02 -0600 Subject: WIP - fix various inconsistencies in sRGB vs linear color space. Fix inconsistencies between softenLightF.glsl, materialF.glsl, and alphaF.glsl --- .../shaders/class1/deferred/alphaF.glsl | 19 +++--- .../shaders/class1/deferred/materialF.glsl | 70 +++++++++++----------- .../class1/deferred/postDeferredGammaCorrect.glsl | 3 +- .../shaders/class1/deferred/softenLightF.glsl | 10 ++-- 4 files changed, 50 insertions(+), 52 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 546a502ee1..814d5036db 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -22,7 +22,9 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - + +//class1/deferred/alphaF.glsl + #extension GL_ARB_texture_rectangle : enable /*[EXTRA_CODE_HERE]*/ @@ -51,7 +53,7 @@ VARYING vec2 vary_texcoord0; VARYING vec3 vary_norm; #ifdef USE_VERTEX_COLOR -VARYING vec4 vertex_color; +VARYING vec4 vertex_color; //vertex color should be treated as sRGB #endif uniform mat4 proj_mat; @@ -190,7 +192,7 @@ void main() float final_alpha = diffuse_srgb.a * vertex_color.a; diffuse_srgb.rgb *= vertex_color.rgb; - diffuse_linear.rgb *= vertex_color.rgb; + diffuse_linear.rgb = srgb_to_linear(diffuse_srgb.rgb); // Insure we don't pollute depth with invis pixels in impostor rendering // @@ -207,7 +209,7 @@ void main() #ifdef USE_VERTEX_COLOR final_alpha *= vertex_color.a; diffuse_srgb.rgb *= vertex_color.rgb; - diffuse_linear.rgb *= vertex_color.rgb; + diffuse_linear.rgb = srgb_to_linear(diffuse_srgb.rgb); #endif vec3 sunlit; @@ -249,7 +251,7 @@ vec3 post_ambient = color.rgb; vec3 post_sunlight = color.rgb; - color.rgb *= diffuse_srgb.rgb; + color.rgb *= diffuse_linear.rgb; vec3 post_diffuse = color.rgb; @@ -258,10 +260,7 @@ vec3 post_diffuse = color.rgb; vec3 post_atmo = color.rgb; vec4 light = vec4(0,0,0,0); - - // to linear! - color.rgb = srgb_to_linear(color.rgb); - + #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diffuse_linear.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w); LIGHT_LOOP(1) @@ -298,7 +297,7 @@ vec3 post_atmo = color.rgb; #endif // WATER_FOG #endif - + frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index eebb0a5fe5..c6ba489d52 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -25,6 +25,10 @@ /*[EXTRA_CODE_HERE]*/ +//class1/deferred/materialF.glsl + +// This shader is used for both writing opaque/masked content to the gbuffer and writing blended content to the framebuffer during the alpha pass. + #define DIFFUSE_ALPHA_MODE_NONE 0 #define DIFFUSE_ALPHA_MODE_BLEND 1 #define DIFFUSE_ALPHA_MODE_MASK 2 @@ -180,7 +184,7 @@ out vec4 frag_data[3]; #endif #endif -uniform sampler2D diffuseMap; +uniform sampler2D diffuseMap; //always in sRGB space #ifdef HAS_NORMAL_MAP uniform sampler2D bumpMap; @@ -218,14 +222,16 @@ void main() vec2 pos_screen = vary_texcoord0.xy; vec4 diffuse_tap = texture2D(diffuseMap, vary_texcoord0.xy); + diffuse_tap.rgb *= vertex_color.rgb; + //diffuse_tap = vec4(1,1,1,1); -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) +//#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) vec4 diffuse_srgb = diffuse_tap; vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); -#else +/*#else vec4 diffuse_linear = diffuse_tap; vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a); -#endif +#endif*/ #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) if (diffuse_linear.a < minimum_alpha) @@ -234,9 +240,6 @@ void main() } #endif - diffuse_linear.rgb *= vertex_color.rgb; - diffuse_srgb.rgb *= linear_to_srgb(vertex_color.rgb); - #ifdef HAS_SPECULAR_MAP vec4 spec = texture2D(specularMap, vary_texcoord2.xy); spec.rgb *= specular_color.rgb; @@ -298,10 +301,10 @@ void main() if (emissive_brightness >= 1.0) { -#ifdef HAS_SPECULAR_MAP +/*#ifdef HAS_SPECULAR_MAP // Note: We actually need to adjust all 4 channels not just .rgb final_color *= 0.666666; -#endif +#endif*/ color.rgb = final_color.rgb; al = vertex_color.a; } @@ -320,11 +323,12 @@ void main() if (emissive_brightness >= 1.0) { // fullbright = diffuse texture pass-through, no lighting - frag_color = diffuse_srgb; + color = diffuse_linear.rgb; + al = diffuse_linear.a; } else { - //forward rendering, output just lit RGBA + //forward rendering, output just lit sRGBA vec3 pos = vary_position; float shadow = 1.0f; @@ -349,13 +353,14 @@ void main() vec3 refnormpersp = normalize(reflect(pos.xyz, norm)); - float da = dot(norm, normalize(light_dir)); - da = clamp(da, 0.0, 1.0); // No negative light contributions + float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); - // ambient weight varies from 0.75 at max direct light to 1.0 with sun at grazing angle - float ambient = 1.0 - (0.25 * da * da); + float ambient = da; + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0 - ambient); - vec3 sun_contrib = additive + (min(da, shadow) * sunlit); + vec3 sun_contrib = da * sunlit; #if !defined(AMBIENT_KILL) color.rgb = amblit; @@ -367,11 +372,7 @@ void main() #endif color.rgb *= diffuse_linear.rgb; // SL-12006 - - // ad-hoc brighten and de-saturate (normal-mapped only), to match windlight - SL-12638 - color.rgb = desat(color.rgb, 0.33 * (eep_bump_gain - 1.0)); - color.rgb *= eep_bump_gain; - + float glare = 0.0; if (spec.a > 0.0) // specular reflection @@ -391,9 +392,9 @@ void main() if (nh > 0.0) { float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - vec3 sp = sun_contrib*scol / 16.0f; + vec3 sp = sun_contrib*scol / 6.0f; sp = clamp(sp, vec3(0), vec3(1)); - bloom = dot(sp, sp) / 6.0; + bloom = dot(sp, sp) / 4.0; #if !defined(SUNLIGHT_KILL) color += sp * spec.rgb; #endif @@ -418,9 +419,6 @@ void main() color = atmosFragLighting(color, additive, atten); - //convert to linear space before adding local lights - color = srgb_to_linear(color); - vec3 npos = normalize(-pos.xyz); vec3 light = vec3(0,0,0); @@ -444,23 +442,23 @@ void main() color = scaleSoftClipFrag(color); - // (only) post-deferred needs inline gamma correction - color.rgb = linear_to_srgb(color.rgb); - -#ifdef WATER_FOG +/*#ifdef WATER_FOG vec4 temp = applyWaterFogView(pos, vec4(color.rgb, al)); color.rgb = temp.rgb; al = temp.a; -#endif - - frag_color.rgb = color.rgb; - frag_color.a = al; +#endif*/ } -#else // if DIFFUSE_ALPHA_MODE_BLEND ... + // (only) post-deferred needs inline gamma correction + color.rgb = linear_to_srgb(color.rgb); + + frag_color = vec4(color, al); + +#else // if DIFFUSE_ALPHA_MODE_BLEND ... + // deferred path - frag_data[0] = final_color; + frag_data[0] = vec4(linear_to_srgb(final_color.rgb), final_color.a); //gbuffer is sRGB frag_data[1] = final_specular; // XYZ = Specular color. W = Specular exponent. frag_data[2] = final_normal; // XY = Normal. Z = Env. intensity. #endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl index 9f519708a2..966c73ef24 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -44,7 +44,8 @@ vec3 linear_to_srgb(vec3 cl); void main() { vec4 diff = texture2DRect(diffuseRect, vary_fragcoord); - diff.rgb = pow(diff.rgb, vec3(display_gamma)); + //diff.rgb = pow(diff.rgb, vec3(display_gamma)); + diff.rgb = linear_to_srgb(diff.rgb); frag_color = diff; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 705cc2f04e..da2eb47e3b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -119,7 +119,7 @@ vec3 post_ambient = color.rgb; vec3 post_sunlight = color.rgb; - color.rgb *= diffuse_srgb.rgb; + color.rgb *= diffuse_linear.rgb; vec3 post_diffuse = color.rgb; @@ -157,7 +157,7 @@ vec3 post_diffuse = color.rgb; #ifdef WATER_FOG color.rgb += diffuse_srgb.rgb * diffuse_srgb.a * 0.25; #else - color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); + color.rgb = mix(color.rgb, diffuse_linear.rgb, diffuse_linear.a); #endif if (envIntensity > 0.0) @@ -201,7 +201,7 @@ vec3 post_atmo = color.rgb; // convert to linear as fullscreen lights need to sum in linear colorspace // and will be gamma (re)corrected downstream... - color.rgb = srgb_to_linear(color.rgb); + //color.rgb = srgb_to_linear(color.rgb); } // linear debuggables @@ -209,7 +209,7 @@ vec3 post_atmo = color.rgb; //color.rgb = vec3(ambient); //color.rgb = vec3(scol); //color.rgb = diffuse_linear.rgb; - + frag_color.rgb = color.rgb; - frag_color.a = bloom; + frag_color.a = 0.0; //bloom; } -- cgit v1.2.3 From 1481d78bb25a06ca99e0d75e8d6333abd6ce5590 Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Wed, 4 Mar 2020 16:23:31 -0600 Subject: Changes somehow missing from last commit --- .../shaders/class1/deferred/multiPointLightF.glsl | 3 ++- .../app_settings/shaders/class2/deferred/softenLightF.glsl | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index dcc3750a8f..0d1cc81786 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -102,7 +102,8 @@ void main() dist_atten *= dist_atten; // Tweak falloff slightly to match pre-EEP attenuation - dist_atten *= 2.2; + // NOTE: this magic number also shows up in a great many other places, search for dist_atten *= to audit + dist_atten *= 2.0; dist_atten *= noise; diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 593706867d..bacdb6f70f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -127,7 +127,7 @@ vec3 post_ambient = color.rgb; vec3 post_sunlight = color.rgb; - color.rgb *= diffuse_srgb.rgb; + color.rgb *= diffuse_linear.rgb; vec3 post_diffuse = color.rgb; @@ -162,8 +162,10 @@ vec3 post_diffuse = color.rgb; vec3 post_spec = color.rgb; -#ifndef WATER_FOG - color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); +#ifdef WATER_FOG + color.rgb += diffuse_srgb.rgb * diffuse_srgb.a * 0.25; +#else + color.rgb = mix(color.rgb, diffuse_linear.rgb, diffuse_linear.a); #endif if (envIntensity > 0.0) @@ -206,9 +208,6 @@ vec3 post_atmo = color.rgb; //color.rgb = post_env; //color.rgb = post_atmo; -// convert to linear as fullscreen lights need to sum in linear colorspace -// and will be gamma (re)corrected downstream... - color.rgb = srgb_to_linear(color.rgb); } // linear debuggables @@ -217,6 +216,8 @@ vec3 post_atmo = color.rgb; //color.rgb = vec3(scol); //color.rgb = diffuse_linear.rgb; + //output linear RGB as lights are summed up in linear space and then gamma corrected prior to the + //post deferred passes frag_color.rgb = color.rgb; frag_color.a = bloom; } -- cgit v1.2.3 From 265cefd2621a7d29e322ac903835bceb365f4f0a Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Wed, 4 Mar 2020 16:38:37 -0600 Subject: Merge fix --- indra/newview/app_settings/shaders/class1/deferred/materialF.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 57e30c0ef3..ffd9dfed8c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -349,7 +349,7 @@ void main() color.rgb += sun_contrib; #endif - color.rgb *= diffuse_srgb.rgb; + color.rgb *= diffuse_linear.rgb; float glare = 0.0; -- cgit v1.2.3 From ca5cc79dfbc55a2160212f213a1a622691b7f02e Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Wed, 4 Mar 2020 16:43:18 -0600 Subject: Fix line endings? --- .../shaders/class1/deferred/materialF.glsl | 888 ++++++++++----------- 1 file changed, 444 insertions(+), 444 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index ffd9dfed8c..586ce4a9b7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -1,444 +1,444 @@ -/** - * @file materialF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -/*[EXTRA_CODE_HERE]*/ - -//class1/deferred/materialF.glsl - -// This shader is used for both writing opaque/masked content to the gbuffer and writing blended content to the framebuffer during the alpha pass. - -#define DIFFUSE_ALPHA_MODE_NONE 0 -#define DIFFUSE_ALPHA_MODE_BLEND 1 -#define DIFFUSE_ALPHA_MODE_MASK 2 -#define DIFFUSE_ALPHA_MODE_EMISSIVE 3 - -uniform float emissive_brightness; -uniform int sun_up_factor; - -#ifdef WATER_FOG -vec4 applyWaterFogView(vec3 pos, vec4 color); -#endif - -vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); -vec3 scaleSoftClipFrag(vec3 l); - -void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); - -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cs); - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - -#ifdef DEFINE_GL_FRAGCOLOR - out vec4 frag_color; -#else - #define frag_color gl_FragColor -#endif - -#ifdef HAS_SUN_SHADOW - float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); -#endif - -uniform samplerCube environmentMap; -uniform sampler2D lightFunc; - -// Inputs -uniform vec4 morphFactor; -uniform vec3 camPosLocal; -uniform mat3 env_mat; - -uniform vec3 sun_dir; -uniform vec3 moon_dir; -VARYING vec2 vary_fragcoord; - -VARYING vec3 vary_position; - -uniform mat4 proj_mat; -uniform mat4 inv_proj; -uniform vec2 screen_res; - -uniform vec4 light_position[8]; -uniform vec3 light_direction[8]; -uniform vec4 light_attenuation[8]; -uniform vec3 light_diffuse[8]; - -float getAmbientClamp(); - -vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, inout float glare, float ambiance) -{ - vec3 col = vec3(0); - - //get light vector - vec3 lv = lp.xyz-v; - - //get distance - float dist = length(lv); - float da = 1.0; - - dist /= la; - - if (dist > 0.0 && la > 0.0) - { - //normalize light vector - lv = normalize(lv); - - //distance attenuation - float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); - dist_atten *= dist_atten; - dist_atten *= 2.0f; - - if (dist_atten <= 0.0) - { - return col; - } - - // spotlight coefficient. - float spot = max(dot(-ln, lv), is_pointlight); - da *= spot*spot; // GL_SPOT_EXPONENT=2 - - //angular attenuation - da *= dot(n, lv); - - float lit = 0.0f; - - float amb_da = ambiance; - if (da >= 0) - { - lit = max(da * dist_atten,0.0); - col = lit * light_col * diffuse; - amb_da += (da*0.5+0.5) * ambiance; - } - amb_da += (da*da*0.5 + 0.5) * ambiance; - amb_da *= dist_atten; - amb_da = min(amb_da, 1.0f - lit); - - // SL-10969 need to see why these are blown out - //col.rgb += amb_da * light_col * diffuse; - - if (spec.a > 0.0) - { - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(lv+npos); - float nh = dot(n, h); - float nv = dot(n, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - vec3 speccol = lit*scol*light_col.rgb*spec.rgb; - speccol = clamp(speccol, vec3(0), vec3(1)); - col += speccol; - - float cur_glare = max(speccol.r, speccol.g); - cur_glare = max(cur_glare, speccol.b); - glare = max(glare, speccol.r); - glare += max(cur_glare, 0.0); - } - } - } - - return max(col, vec3(0.0,0.0,0.0)); -} - -#else -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; -#else -#define frag_data gl_FragData -#endif -#endif - -uniform sampler2D diffuseMap; //always in sRGB space - -#ifdef HAS_NORMAL_MAP -uniform sampler2D bumpMap; -#endif - -#ifdef HAS_SPECULAR_MAP -uniform sampler2D specularMap; - -VARYING vec2 vary_texcoord2; -#endif - -uniform float env_intensity; -uniform vec4 specular_color; // specular color RGB and specular exponent (glossiness) in alpha - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) -uniform float minimum_alpha; -#endif - -#ifdef HAS_NORMAL_MAP -VARYING vec3 vary_mat0; -VARYING vec3 vary_mat1; -VARYING vec3 vary_mat2; -VARYING vec2 vary_texcoord1; -#else -VARYING vec3 vary_normal; -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -vec2 encode_normal(vec3 n); - -void main() -{ - vec2 pos_screen = vary_texcoord0.xy; - - vec4 diffuse_tap = texture2D(diffuseMap, vary_texcoord0.xy); - diffuse_tap.rgb *= vertex_color.rgb; - //diffuse_tap = vec4(1,1,1,1); - -//#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - vec4 diffuse_srgb = diffuse_tap; - vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); -/*#else - vec4 diffuse_linear = diffuse_tap; - vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a); -#endif*/ - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) - if (diffuse_linear.a < minimum_alpha) - { - discard; - } -#endif - -#ifdef HAS_SPECULAR_MAP - vec4 spec = texture2D(specularMap, vary_texcoord2.xy); - spec.rgb *= specular_color.rgb; -#else - vec4 spec = vec4(specular_color.rgb, 1.0); -#endif - - vec3 norm = vec3(0); - float bmap_specular = 1.0; - -#ifdef HAS_NORMAL_MAP - vec4 bump_sample = texture2D(bumpMap, vary_texcoord1.xy); - norm = (bump_sample.xyz * 2) - vec3(1); - bmap_specular = bump_sample.w; - - // convert sampled normal to tangent space normal - norm = vec3(dot(norm, vary_mat0), - dot(norm, vary_mat1), - dot(norm, vary_mat2)); -#else - norm = vary_normal; -#endif - - norm = normalize(norm); - - vec2 abnormal = encode_normal(norm); - - vec4 final_color = vec4(diffuse_linear.rgb, 0.0); - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_EMISSIVE) - final_color.a = diffuse_linear.a; -#endif - - final_color.a = max(final_color.a, emissive_brightness); - - // Texture - // [x] Full Bright (emissive_brightness >= 1.0) - // Shininess (specular) - // [X] Texture - // Environment Intensity = 1 - // NOTE: There are two shaders that are used depending on the EI byte value: - // EI = 0 fullbright - // EI > 0 .. 255 material - // When it is passed to us it is normalized. - // We can either modify the output environment intensity - // OR - // adjust the final color via: - // final_color *= 0.666666; - // We don't remap the environment intensity but adjust the final color to closely simulate what non-EEP is doing. - vec4 final_normal = vec4(abnormal, env_intensity, 0.0); - - vec3 color = vec3(0.0); - float al = 0; - -#ifdef HAS_SPECULAR_MAP - if (emissive_brightness >= 1.0) - { - float ei = env_intensity*0.5 + 0.5; - final_normal = vec4(abnormal, ei, 0.0); - } -#endif - - vec4 final_specular = spec; - - final_specular.a = specular_color.a; - -#ifdef HAS_SPECULAR_MAP - final_specular.a *= bmap_specular; - final_normal.z *= spec.a; -#endif - - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - { - //forward rendering, output just lit sRGBA - vec3 pos = vary_position; - - float shadow = 1.0f; - -#ifdef HAS_SUN_SHADOW - shadow = sampleDirectionalShadow(pos.xyz, norm, pos_screen); -#endif - - spec = final_specular; - - float envIntensity = final_normal.z; - - vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - - float bloom = 0.0; - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - - calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false); - - vec3 refnormpersp = normalize(reflect(pos.xyz, norm)); - - float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); - - float ambient = da; - ambient *= 0.5; - ambient *= ambient; - ambient = (1.0 - ambient); - - vec3 sun_contrib = min(da, shadow) * sunlit; - -#if !defined(AMBIENT_KILL) - color.rgb = amblit; - color.rgb *= ambient; -#endif - -#if !defined(SUNLIGHT_KILL) - color.rgb += sun_contrib; -#endif - - color.rgb *= diffuse_linear.rgb; - - float glare = 0.0; - - if (spec.a > 0.0) // specular reflection - { - vec3 npos = -normalize(pos.xyz); - - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(light_dir.xyz+npos); - float nh = dot(norm, h); - float nv = dot(norm, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - vec3 sp = sun_contrib*scol / 6.0f; - sp = clamp(sp, vec3(0), vec3(1)); - bloom = dot(sp, sp) / 4.0; -#if !defined(SUNLIGHT_KILL) - color += sp * spec.rgb; -#endif - } - } - - if (envIntensity > 0.0) - { - //add environmentmap - vec3 env_vec = env_mat * refnormpersp; - - vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; - -#if !defined(SUNLIGHT_KILL) - color = mix(color.rgb, reflected_color, envIntensity); -#endif - float cur_glare = max(reflected_color.r, reflected_color.g); - cur_glare = max(cur_glare, reflected_color.b); - cur_glare *= envIntensity*4.0; - glare += cur_glare; - } - - color = atmosFragLighting(color, additive, atten); - - vec3 npos = normalize(-pos.xyz); - - vec3 light = vec3(0,0,0); - -#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse_linear.rgb, final_specular, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w ); - - LIGHT_LOOP(1) - LIGHT_LOOP(2) - LIGHT_LOOP(3) - LIGHT_LOOP(4) - LIGHT_LOOP(5) - LIGHT_LOOP(6) - LIGHT_LOOP(7) - - glare = min(glare, 1.0); - al = max(diffuse_linear.a,glare)*vertex_color.a; - -#if !defined(LOCAL_LIGHT_KILL) - color.rgb += light.rgb; -#endif - - color = scaleSoftClipFrag(color); - -/*#ifdef WATER_FOG - vec4 temp = applyWaterFogView(pos, vec4(color.rgb, al)); - color.rgb = temp.rgb; - al = temp.a; -#endif*/ - } - - - color.rgb = linear_to_srgb(color.rgb); - - frag_color = vec4(color, al); - -#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer - - // deferred path - frag_data[0] = vec4(linear_to_srgb(final_color.rgb), final_color.a); //gbuffer is sRGB - frag_data[1] = final_specular; // XYZ = Specular color. W = Specular exponent. - frag_data[2] = final_normal; // XY = Normal. Z = Env. intensity. -#endif -} - +/** + * @file materialF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, 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$ + */ + +/*[EXTRA_CODE_HERE]*/ + +//class1/deferred/materialF.glsl + +// This shader is used for both writing opaque/masked content to the gbuffer and writing blended content to the framebuffer during the alpha pass. + +#define DIFFUSE_ALPHA_MODE_NONE 0 +#define DIFFUSE_ALPHA_MODE_BLEND 1 +#define DIFFUSE_ALPHA_MODE_MASK 2 +#define DIFFUSE_ALPHA_MODE_EMISSIVE 3 + +uniform float emissive_brightness; +uniform int sun_up_factor; + +#ifdef WATER_FOG +vec4 applyWaterFogView(vec3 pos, vec4 color); +#endif + +vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); +vec3 scaleSoftClipFrag(vec3 l); + +void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); + +vec3 srgb_to_linear(vec3 cs); +vec3 linear_to_srgb(vec3 cs); + +#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) + +#ifdef DEFINE_GL_FRAGCOLOR + out vec4 frag_color; +#else + #define frag_color gl_FragColor +#endif + +#ifdef HAS_SUN_SHADOW + float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); +#endif + +uniform samplerCube environmentMap; +uniform sampler2D lightFunc; + +// Inputs +uniform vec4 morphFactor; +uniform vec3 camPosLocal; +uniform mat3 env_mat; + +uniform vec3 sun_dir; +uniform vec3 moon_dir; +VARYING vec2 vary_fragcoord; + +VARYING vec3 vary_position; + +uniform mat4 proj_mat; +uniform mat4 inv_proj; +uniform vec2 screen_res; + +uniform vec4 light_position[8]; +uniform vec3 light_direction[8]; +uniform vec4 light_attenuation[8]; +uniform vec3 light_diffuse[8]; + +float getAmbientClamp(); + +vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, inout float glare, float ambiance) +{ + vec3 col = vec3(0); + + //get light vector + vec3 lv = lp.xyz-v; + + //get distance + float dist = length(lv); + float da = 1.0; + + dist /= la; + + if (dist > 0.0 && la > 0.0) + { + //normalize light vector + lv = normalize(lv); + + //distance attenuation + float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); + dist_atten *= dist_atten; + dist_atten *= 2.0f; + + if (dist_atten <= 0.0) + { + return col; + } + + // spotlight coefficient. + float spot = max(dot(-ln, lv), is_pointlight); + da *= spot*spot; // GL_SPOT_EXPONENT=2 + + //angular attenuation + da *= dot(n, lv); + + float lit = 0.0f; + + float amb_da = ambiance; + if (da >= 0) + { + lit = max(da * dist_atten,0.0); + col = lit * light_col * diffuse; + amb_da += (da*0.5+0.5) * ambiance; + } + amb_da += (da*da*0.5 + 0.5) * ambiance; + amb_da *= dist_atten; + amb_da = min(amb_da, 1.0f - lit); + + // SL-10969 need to see why these are blown out + //col.rgb += amb_da * light_col * diffuse; + + if (spec.a > 0.0) + { + //vec3 ref = dot(pos+lv, norm); + vec3 h = normalize(lv+npos); + float nh = dot(n, h); + float nv = dot(n, npos); + float vh = dot(npos, h); + float sa = nh; + float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; + + float gtdenom = 2 * nh; + float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); + + if (nh > 0.0) + { + float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); + vec3 speccol = lit*scol*light_col.rgb*spec.rgb; + speccol = clamp(speccol, vec3(0), vec3(1)); + col += speccol; + + float cur_glare = max(speccol.r, speccol.g); + cur_glare = max(cur_glare, speccol.b); + glare = max(glare, speccol.r); + glare += max(cur_glare, 0.0); + } + } + } + + return max(col, vec3(0.0,0.0,0.0)); +} + +#else +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData +#endif +#endif + +uniform sampler2D diffuseMap; //always in sRGB space + +#ifdef HAS_NORMAL_MAP +uniform sampler2D bumpMap; +#endif + +#ifdef HAS_SPECULAR_MAP +uniform sampler2D specularMap; + +VARYING vec2 vary_texcoord2; +#endif + +uniform float env_intensity; +uniform vec4 specular_color; // specular color RGB and specular exponent (glossiness) in alpha + +#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) +uniform float minimum_alpha; +#endif + +#ifdef HAS_NORMAL_MAP +VARYING vec3 vary_mat0; +VARYING vec3 vary_mat1; +VARYING vec3 vary_mat2; +VARYING vec2 vary_texcoord1; +#else +VARYING vec3 vary_normal; +#endif + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + +vec2 encode_normal(vec3 n); + +void main() +{ + vec2 pos_screen = vary_texcoord0.xy; + + vec4 diffuse_tap = texture2D(diffuseMap, vary_texcoord0.xy); + diffuse_tap.rgb *= vertex_color.rgb; + //diffuse_tap = vec4(1,1,1,1); + +//#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) + vec4 diffuse_srgb = diffuse_tap; + vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); +/*#else + vec4 diffuse_linear = diffuse_tap; + vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a); +#endif*/ + +#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) + if (diffuse_linear.a < minimum_alpha) + { + discard; + } +#endif + +#ifdef HAS_SPECULAR_MAP + vec4 spec = texture2D(specularMap, vary_texcoord2.xy); + spec.rgb *= specular_color.rgb; +#else + vec4 spec = vec4(specular_color.rgb, 1.0); +#endif + + vec3 norm = vec3(0); + float bmap_specular = 1.0; + +#ifdef HAS_NORMAL_MAP + vec4 bump_sample = texture2D(bumpMap, vary_texcoord1.xy); + norm = (bump_sample.xyz * 2) - vec3(1); + bmap_specular = bump_sample.w; + + // convert sampled normal to tangent space normal + norm = vec3(dot(norm, vary_mat0), + dot(norm, vary_mat1), + dot(norm, vary_mat2)); +#else + norm = vary_normal; +#endif + + norm = normalize(norm); + + vec2 abnormal = encode_normal(norm); + + vec4 final_color = vec4(diffuse_linear.rgb, 0.0); + +#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_EMISSIVE) + final_color.a = diffuse_linear.a; +#endif + + final_color.a = max(final_color.a, emissive_brightness); + + // Texture + // [x] Full Bright (emissive_brightness >= 1.0) + // Shininess (specular) + // [X] Texture + // Environment Intensity = 1 + // NOTE: There are two shaders that are used depending on the EI byte value: + // EI = 0 fullbright + // EI > 0 .. 255 material + // When it is passed to us it is normalized. + // We can either modify the output environment intensity + // OR + // adjust the final color via: + // final_color *= 0.666666; + // We don't remap the environment intensity but adjust the final color to closely simulate what non-EEP is doing. + vec4 final_normal = vec4(abnormal, env_intensity, 0.0); + + vec3 color = vec3(0.0); + float al = 0; + +#ifdef HAS_SPECULAR_MAP + if (emissive_brightness >= 1.0) + { + float ei = env_intensity*0.5 + 0.5; + final_normal = vec4(abnormal, ei, 0.0); + } +#endif + + vec4 final_specular = spec; + + final_specular.a = specular_color.a; + +#ifdef HAS_SPECULAR_MAP + final_specular.a *= bmap_specular; + final_normal.z *= spec.a; +#endif + + +#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) + { + //forward rendering, output just lit sRGBA + vec3 pos = vary_position; + + float shadow = 1.0f; + +#ifdef HAS_SUN_SHADOW + shadow = sampleDirectionalShadow(pos.xyz, norm, pos_screen); +#endif + + spec = final_specular; + + float envIntensity = final_normal.z; + + vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; + + float bloom = 0.0; + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; + + calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false); + + vec3 refnormpersp = normalize(reflect(pos.xyz, norm)); + + float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); + + float ambient = da; + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0 - ambient); + + vec3 sun_contrib = min(da, shadow) * sunlit; + +#if !defined(AMBIENT_KILL) + color.rgb = amblit; + color.rgb *= ambient; +#endif + +#if !defined(SUNLIGHT_KILL) + color.rgb += sun_contrib; +#endif + + color.rgb *= diffuse_linear.rgb; + + float glare = 0.0; + + if (spec.a > 0.0) // specular reflection + { + vec3 npos = -normalize(pos.xyz); + + //vec3 ref = dot(pos+lv, norm); + vec3 h = normalize(light_dir.xyz+npos); + float nh = dot(norm, h); + float nv = dot(norm, npos); + float vh = dot(npos, h); + float sa = nh; + float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; + + float gtdenom = 2 * nh; + float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); + + if (nh > 0.0) + { + float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); + vec3 sp = sun_contrib*scol / 6.0f; + sp = clamp(sp, vec3(0), vec3(1)); + bloom = dot(sp, sp) / 4.0; +#if !defined(SUNLIGHT_KILL) + color += sp * spec.rgb; +#endif + } + } + + if (envIntensity > 0.0) + { + //add environmentmap + vec3 env_vec = env_mat * refnormpersp; + + vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; + +#if !defined(SUNLIGHT_KILL) + color = mix(color.rgb, reflected_color, envIntensity); +#endif + float cur_glare = max(reflected_color.r, reflected_color.g); + cur_glare = max(cur_glare, reflected_color.b); + cur_glare *= envIntensity*4.0; + glare += cur_glare; + } + + color = atmosFragLighting(color, additive, atten); + + vec3 npos = normalize(-pos.xyz); + + vec3 light = vec3(0,0,0); + +#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse_linear.rgb, final_specular, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w ); + + LIGHT_LOOP(1) + LIGHT_LOOP(2) + LIGHT_LOOP(3) + LIGHT_LOOP(4) + LIGHT_LOOP(5) + LIGHT_LOOP(6) + LIGHT_LOOP(7) + + glare = min(glare, 1.0); + al = max(diffuse_linear.a,glare)*vertex_color.a; + +#if !defined(LOCAL_LIGHT_KILL) + color.rgb += light.rgb; +#endif + + color = scaleSoftClipFrag(color); + +/*#ifdef WATER_FOG + vec4 temp = applyWaterFogView(pos, vec4(color.rgb, al)); + color.rgb = temp.rgb; + al = temp.a; +#endif*/ + } + + + color.rgb = linear_to_srgb(color.rgb); + + frag_color = vec4(color, al); + +#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer + + // deferred path + frag_data[0] = vec4(linear_to_srgb(final_color.rgb), final_color.a); //gbuffer is sRGB + frag_data[1] = final_specular; // XYZ = Specular color. W = Specular exponent. + frag_data[2] = final_normal; // XY = Normal. Z = Env. intensity. +#endif +} + -- cgit v1.2.3 From edb4373f7d2a32beb93a7f69ddcdf5e1bc0eb6a1 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 5 Mar 2020 14:13:39 +0200 Subject: SL-9775 FIXED EEP viewer crash when looking at the sun (which is playing parcel media) --- indra/newview/llface.cpp | 3 ++- indra/newview/llface.h | 4 ++++ indra/newview/llviewertexture.cpp | 5 ++++- indra/newview/llvosky.cpp | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 174d8e34d1..59269c2115 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -168,7 +168,8 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp) mImportanceToCamera = 0.f ; mBoundingSphereRadius = 0.0f ; - mHasMedia = FALSE ; + mHasMedia = false ; + mIsMediaAllowed = true; } void LLFace::destroy() diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 0c5af5b579..c74d4e3fa8 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -218,6 +218,9 @@ public: void setHasMedia(bool has_media) { mHasMedia = has_media ;} BOOL hasMedia() const ; + void setMediaAllowed(bool is_media_allowed) { mIsMediaAllowed = is_media_allowed; } + BOOL isMediaAllowed() const { return mIsMediaAllowed; } + BOOL switchTexture() ; //vertex buffer tracking @@ -293,6 +296,7 @@ private: F32 mImportanceToCamera ; F32 mBoundingSphereRadius ; bool mHasMedia ; + bool mIsMediaAllowed; protected: diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index f5f9d0d3cc..a2cec9a613 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3481,7 +3481,10 @@ BOOL LLViewerMediaTexture::findFaces() U32 end = tex->getNumFaces(ch); for(U32 i = 0; i < end; i++) { - mMediaFaceList.push_back((*face_list)[i]); + if ((*face_list)[i]->isMediaAllowed()) + { + mMediaFaceList.push_back((*face_list)[i]); + } } } } diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 943704c8de..2037aca7e9 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -881,6 +881,10 @@ LLDrawable *LLVOSky::createDrawable(LLPipeline *pipeline) mFace[FACE_MOON] = mDrawable->addFace(poolp, nullptr); mFace[FACE_BLOOM] = mDrawable->addFace(poolp, nullptr); + mFace[FACE_SUN]->setMediaAllowed(false); + mFace[FACE_MOON]->setMediaAllowed(false); + mFace[FACE_BLOOM]->setMediaAllowed(false); + return mDrawable; } -- cgit v1.2.3 From d33655828c104d1afe484b63093ad5aab1571a3c Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Thu, 5 Mar 2020 11:58:58 -0600 Subject: Reenable water fog in materialF.glsl (oops) --- indra/newview/app_settings/shaders/class1/deferred/materialF.glsl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 586ce4a9b7..18293f4c11 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -421,16 +421,16 @@ void main() color = scaleSoftClipFrag(color); -/*#ifdef WATER_FOG +#ifdef WATER_FOG vec4 temp = applyWaterFogView(pos, vec4(color.rgb, al)); color.rgb = temp.rgb; al = temp.a; -#endif*/ +#endif } - - color.rgb = linear_to_srgb(color.rgb); + color.rgb = linear_to_srgb(color.rgb); + frag_color = vec4(color, al); #else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer -- cgit v1.2.3 From 7c7d71269f5b47397d14bbe44e341e4ac1d96889 Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Thu, 5 Mar 2020 16:28:06 -0600 Subject: WIP - Windlight sun lighting should happen in sRGB space, not linear space. This keeps ambient from getting overblown and better matches environment lighting with ALM on/off. --- .../app_settings/shaders/class1/deferred/alphaF.glsl | 10 ++++++---- .../shaders/class1/deferred/materialF.glsl | 18 ++++++++++-------- .../shaders/class1/deferred/multiSpotLightF.glsl | 18 ++++++++++++------ .../class1/deferred/postDeferredGammaCorrect.glsl | 1 + .../shaders/class1/deferred/softenLightF.glsl | 11 +++++------ .../shaders/class1/windlight/atmosphericsFuncs.glsl | 3 ++- .../shaders/class2/deferred/multiSpotLightF.glsl | 8 +++++--- .../shaders/class2/deferred/softenLightF.glsl | 6 +++--- .../shaders/class2/deferred/spotLightF.glsl | 3 ++- .../shaders/class3/deferred/multiSpotLightF.glsl | 3 ++- .../shaders/class3/deferred/softenLightF.glsl | 6 ++++-- .../shaders/class3/deferred/spotLightF.glsl | 2 +- 12 files changed, 53 insertions(+), 36 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 814d5036db..e38eeab370 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -251,7 +251,7 @@ vec3 post_ambient = color.rgb; vec3 post_sunlight = color.rgb; - color.rgb *= diffuse_linear.rgb; + color.rgb *= diffuse_srgb.rgb; vec3 post_diffuse = color.rgb; @@ -261,6 +261,11 @@ vec3 post_atmo = color.rgb; vec4 light = vec4(0,0,0,0); + color.rgb = scaleSoftClipFrag(color.rgb); + + //convert to linear before applying local lights + color.rgb = srgb_to_linear(color.rgb); + #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diffuse_linear.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w); LIGHT_LOOP(1) @@ -275,9 +280,6 @@ vec3 post_atmo = color.rgb; #if !defined(LOCAL_LIGHT_KILL) color.rgb += light.rgb; #endif - - color.rgb = scaleSoftClipFrag(color.rgb); - // back to sRGB as we're going directly to the final RT post-deferred gamma correction color.rgb = linear_to_srgb(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 18293f4c11..e4ebf0edee 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -117,7 +117,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe // spotlight coefficient. float spot = max(dot(-ln, lv), is_pointlight); da *= spot*spot; // GL_SPOT_EXPONENT=2 - + //angular attenuation da *= dot(n, lv); @@ -215,8 +215,7 @@ void main() vec4 diffuse_tap = texture2D(diffuseMap, vary_texcoord0.xy); diffuse_tap.rgb *= vertex_color.rgb; - //diffuse_tap = vec4(1,1,1,1); - + //#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) vec4 diffuse_srgb = diffuse_tap; vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); @@ -349,7 +348,7 @@ void main() color.rgb += sun_contrib; #endif - color.rgb *= diffuse_linear.rgb; + color.rgb *= diffuse_srgb.rgb; float glare = 0.0; @@ -397,11 +396,15 @@ void main() } color = atmosFragLighting(color, additive, atten); + color = scaleSoftClipFrag(color); vec3 npos = normalize(-pos.xyz); vec3 light = vec3(0,0,0); + //convert to linear before adding local lights + color.rgb = srgb_to_linear(color.rgb); + #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse_linear.rgb, final_specular, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w ); LIGHT_LOOP(1) @@ -419,8 +422,9 @@ void main() color.rgb += light.rgb; #endif - color = scaleSoftClipFrag(color); - +//convert to srgb as this color is being written post gamma correction + color.rgb = linear_to_srgb(color.rgb); + #ifdef WATER_FOG vec4 temp = applyWaterFogView(pos, vec4(color.rgb, al)); color.rgb = temp.rgb; @@ -429,8 +433,6 @@ void main() } - color.rgb = linear_to_srgb(color.rgb); - frag_color = vec4(color, al); #else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index a690cc45a8..9bba45bc4e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -163,15 +163,19 @@ void main() proj_tc.xyz /= proj_tc.w; float fa = falloff+1.0; - float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0); + float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); dist_atten *= dist_atten; dist_atten *= 2.0; + if (dist_atten <= 0.0) { discard; } + float noise = texture2D(noiseMap, frag.xy/128.0).b; + dist_atten *= noise; + lv = proj_origin-pos.xyz; lv = normalize(lv); float da = dot(norm, lv); @@ -179,12 +183,13 @@ void main() vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space. - // We can't switch to linear here unless we do it everywhere - //diff_tex.rgb = srgb_to_linear(diff_tex.rgb); + // We can't switch to linear here unless we do it everywhere* + // *gbuffer is sRGB, convert to linear whenever sampling from it + diff_tex.rgb = srgb_to_linear(diff_tex.rgb); vec3 dlit = vec3(0, 0, 0); - float noise = texture2D(noiseMap, frag.xy/128.0).b; + if (proj_tc.z > 0.0 && proj_tc.x < 1.0 && proj_tc.y < 1.0 && @@ -203,7 +208,7 @@ void main() dlit = color.rgb * plcol.rgb * plcol.a; - lit = da * dist_atten * noise; + lit = da * dist_atten; col = dlit*lit*diff_tex; amb_da += (da*0.5)*proj_ambiance; @@ -245,7 +250,7 @@ void main() col += dlit*scol*spec.rgb; //col += spec.rgb; } - } + } if (envIntensity > 0.0) { @@ -277,6 +282,7 @@ void main() } #endif + //output linear, sum of lights will be gamma corrected later frag_color.rgb = col; frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl index 966c73ef24..cd37a34e0d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -43,6 +43,7 @@ vec3 linear_to_srgb(vec3 cl); void main() { + //this is the one of the rare spots where diffuseRect contains linear color values (not sRGB) vec4 diff = texture2DRect(diffuseRect, vary_fragcoord); //diff.rgb = pow(diff.rgb, vec3(display_gamma)); diff.rgb = linear_to_srgb(diff.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index da2eb47e3b..19e737326d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -119,7 +119,7 @@ vec3 post_ambient = color.rgb; vec3 post_sunlight = color.rgb; - color.rgb *= diffuse_linear.rgb; + color.rgb *= diffuse_srgb.rgb; vec3 post_diffuse = color.rgb; @@ -199,9 +199,6 @@ vec3 post_atmo = color.rgb; //color.rgb = post_env; //color.rgb = post_atmo; -// convert to linear as fullscreen lights need to sum in linear colorspace -// and will be gamma (re)corrected downstream... - //color.rgb = srgb_to_linear(color.rgb); } // linear debuggables @@ -209,7 +206,9 @@ vec3 post_atmo = color.rgb; //color.rgb = vec3(ambient); //color.rgb = vec3(scol); //color.rgb = diffuse_linear.rgb; - - frag_color.rgb = color.rgb; + + // convert to linear as fullscreen lights need to sum in linear colorspace + // and will be gamma (re)corrected downstream... + frag_color.rgb = srgb_to_linear(color.rgb); frag_color.a = 0.0; //bloom; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl index e5f1e11180..dcb02bd1c1 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -46,6 +46,7 @@ float getAmbientClamp() return 1.0f; } + void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao) { vec3 P = inPositionEye; @@ -123,7 +124,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou temp2.x *= sun_moon_glow_factor; vec4 amb_color = ambient_color; - + //increase ambient when there are more clouds vec4 tmpAmbient = amb_color + (vec4(1.) - amb_color) * cloud_shadow * 0.5; diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 7cde67d11b..5d7a28c359 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -192,8 +192,9 @@ void main() vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space. - // We can't switch to linear here unless we do it everywhere - //diff_tex.rgb = srgb_to_linear(diff_tex.rgb); + // We can't switch to linear here unless we do it everywhere* + // *gbuffer IS sRGB, convert to linear since this shader outputs linear + diff_tex.rgb = srgb_to_linear(diff_tex.rgb); vec4 spec = texture2DRect(specularRect, frag.xy); @@ -296,6 +297,7 @@ void main() //not sure why, but this line prevents MATBUG-194 col = max(col, vec3(0.0)); - frag_color.rgb = col; + //output linear + frag_color.rgb = col; frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index bacdb6f70f..58d573c724 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -106,7 +106,7 @@ void main() vec3 atten; calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, true); - + float ambient = da; ambient *= 0.5; ambient *= ambient; @@ -127,7 +127,7 @@ vec3 post_ambient = color.rgb; vec3 post_sunlight = color.rgb; - color.rgb *= diffuse_linear.rgb; + color.rgb *= diffuse_srgb.rgb; vec3 post_diffuse = color.rgb; @@ -218,6 +218,6 @@ vec3 post_atmo = color.rgb; //output linear RGB as lights are summed up in linear space and then gamma corrected prior to the //post deferred passes - frag_color.rgb = color.rgb; + frag_color.rgb = srgb_to_linear(color.rgb); frag_color.a = bloom; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 77f6e6f7ac..5ab0b5c5b4 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -189,7 +189,7 @@ void main() lv = normalize(lv); float da = dot(norm, lv); - vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; + vec3 diff_tex = srgb_to_linear(texture2DRect(diffuseRect, frag.xy).rgb); vec4 spec = texture2DRect(specularRect, frag.xy); vec3 dlit = vec3(0, 0, 0); @@ -287,6 +287,7 @@ void main() //not sure why, but this line prevents MATBUG-194 col = max(col, vec3(0.0)); + //output linear colors as gamma correction happens down stream frag_color.rgb = col; frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl index 52de7ceaad..9d62b9d180 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl @@ -183,7 +183,7 @@ void main() vec3 col = vec3(0,0,0); - vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; + vec3 diff_tex = srgb_to_linear(texture2DRect(diffuseRect, frag.xy).rgb); vec4 spec = texture2DRect(specularRect, frag.xy); @@ -285,6 +285,7 @@ void main() col = scaleDownLight(col); + //output linear space color as gamma correction happens down stream frag_color.rgb = col; frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 978c25b86a..7ed9e7b4fc 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -94,7 +94,8 @@ void main() float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); - vec4 diffuse = texture2DRect(diffuseRect, tc); // linear + vec4 diffuse = texture2DRect(diffuseRect, tc); // sRGB + diffuse.rgb = srgb_to_linear(diffuse.rgb); vec3 col; float bloom = 0.0; @@ -169,7 +170,8 @@ void main() bloom = fogged.a; #endif } - + + //output linear since gamma correction happens down stream frag_color.rgb = col; frag_color.a = bloom; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index bccd819a43..56b0f4e5ce 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -182,7 +182,7 @@ void main() vec3 col = vec3(0,0,0); - vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; + vec3 diff_tex = srgb_to_linear(texture2DRect(diffuseRect, frag.xy).rgb); vec4 spec = texture2DRect(specularRect, frag.xy); -- cgit v1.2.3 From 7d0cf70e4f335056e0d81b0b48264e5dda5be668 Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Fri, 6 Mar 2020 11:05:55 -0600 Subject: Fix for under water being much brighter and mismatching between alpha and deferred. Don't make terrain fullbright under water. --- .../app_settings/shaders/class1/deferred/softenLightF.glsl | 7 ++----- indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl | 8 -------- .../app_settings/shaders/class2/deferred/softenLightF.glsl | 4 ---- 3 files changed, 2 insertions(+), 17 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 19e737326d..54abd56625 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -154,11 +154,7 @@ vec3 post_diffuse = color.rgb; vec3 post_spec = color.rgb; -#ifdef WATER_FOG - color.rgb += diffuse_srgb.rgb * diffuse_srgb.a * 0.25; -#else color.rgb = mix(color.rgb, diffuse_linear.rgb, diffuse_linear.a); -#endif if (envIntensity > 0.0) { //add environmentmap @@ -209,6 +205,7 @@ vec3 post_atmo = color.rgb; // convert to linear as fullscreen lights need to sum in linear colorspace // and will be gamma (re)corrected downstream... + frag_color.rgb = srgb_to_linear(color.rgb); - frag_color.a = 0.0; //bloom; + frag_color.a = bloom; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl index b7bc92c460..6b6eed9db8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl @@ -44,10 +44,6 @@ VARYING vec4 vary_texcoord1; vec2 encode_normal(vec3 n); -#ifdef WATER_FOG -vec4 applyWaterFogView(vec3 pos, vec4 c); -#endif - void main() { /// Note: This should duplicate the blending functionality currently used for the terrain rendering. @@ -63,10 +59,6 @@ void main() vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); outColor.a = 0.0; // yes, downstream atmospherics -#ifdef WATER_FOG - outColor = applyWaterFogView(pos.xyz, outColor); - outColor.a = 1.0; // no downstream atmo -#endif frag_data[0] = outColor; frag_data[1] = vec4(0.0,0.0,0.0,-1.0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 58d573c724..9ebacd59c7 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -162,11 +162,7 @@ vec3 post_diffuse = color.rgb; vec3 post_spec = color.rgb; -#ifdef WATER_FOG - color.rgb += diffuse_srgb.rgb * diffuse_srgb.a * 0.25; -#else color.rgb = mix(color.rgb, diffuse_linear.rgb, diffuse_linear.a); -#endif if (envIntensity > 0.0) { //add environmentmap -- cgit v1.2.3 From a3759b4910b94b3a375e16e605dc1a4f096f2256 Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Fri, 6 Mar 2020 13:54:27 -0600 Subject: Fix for sky in wrong color space. --- indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl | 2 +- indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 54abd56625..1acb8d08eb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -154,7 +154,7 @@ vec3 post_diffuse = color.rgb; vec3 post_spec = color.rgb; - color.rgb = mix(color.rgb, diffuse_linear.rgb, diffuse_linear.a); + color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); if (envIntensity > 0.0) { //add environmentmap diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 9ebacd59c7..6f5b0981f9 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -162,7 +162,7 @@ vec3 post_diffuse = color.rgb; vec3 post_spec = color.rgb; - color.rgb = mix(color.rgb, diffuse_linear.rgb, diffuse_linear.a); + color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); if (envIntensity > 0.0) { //add environmentmap -- cgit v1.2.3 From f0a9b6c01bc1e348969e3c4ac1e929aefa538ea8 Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Fri, 6 Mar 2020 14:27:46 -0600 Subject: Fix for sunlight having improper gamma curve for angular attenuation. Fix for lack of angular attenuation on ambient lighting on triangles facing away from sun. --- indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl | 3 ++- indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 1acb8d08eb..b38f488a1f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -82,6 +82,7 @@ void main() vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); + da = pow(da, 1.0/1.3); vec4 diffuse_srgb = texture2DRect(diffuseRect, tc); vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); @@ -99,7 +100,7 @@ void main() calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, false); - float ambient = da; + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; ambient *= ambient; ambient = (1.0 - ambient); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 6f5b0981f9..da78691861 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -86,7 +86,7 @@ void main() vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); - + da = pow(da, 1.0/1.3); vec4 diffuse_srgb = texture2DRect(diffuseRect, tc); vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); @@ -107,7 +107,7 @@ void main() calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, true); - float ambient = da; + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; ambient *= ambient; ambient = (1.0 - ambient); -- cgit v1.2.3 From 0390dc2fec2afdc053f373813d419178a70b299c Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Fri, 6 Mar 2020 14:33:58 -0600 Subject: Fix for mismatch on angular attenuation between sunlight on opaque and transparent objects from last commit. --- indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl | 5 +++-- indra/newview/app_settings/shaders/class1/deferred/materialF.glsl | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index e38eeab370..dc484317e9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -223,6 +223,7 @@ void main() float da = dot(norm.xyz, light_dir.xyz); da = clamp(da, -1.0, 1.0); + da = pow(da, 1.0/1.3); float final_da = da; final_da = clamp(final_da, 0.0f, 1.0f); @@ -231,7 +232,7 @@ void main() color.a = final_alpha; - float ambient = da; + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; ambient *= ambient; ambient = (1.0 - ambient); @@ -262,7 +263,7 @@ vec3 post_atmo = color.rgb; vec4 light = vec4(0,0,0,0); color.rgb = scaleSoftClipFrag(color.rgb); - + //convert to linear before applying local lights color.rgb = srgb_to_linear(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index e4ebf0edee..d07de529ca 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -331,8 +331,9 @@ void main() vec3 refnormpersp = normalize(reflect(pos.xyz, norm)); float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); + da = pow(da, 1.0/1.3); - float ambient = da; + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; ambient *= ambient; ambient = (1.0 - ambient); -- cgit v1.2.3 From d32821ea5bf17c4de47b9ee03b43a20ae278dfe4 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 6 Mar 2020 17:20:46 -0800 Subject: SL-12574 Fix EEP cubemap not matching non-EEP for both ALM on and off --- .../newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl | 2 +- indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl | 2 +- .../app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl | 2 +- indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl | 2 +- indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl index 4005d5064d..523e7f9e04 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl @@ -56,7 +56,7 @@ void main() color.rgb *= vertex_color.rgb; vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low color.rgb = pow(color.rgb,vec3(2.2f,2.2f,2.2f)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index b38f488a1f..547a159f3a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -162,7 +162,7 @@ vec3 post_diffuse = color.rgb; vec3 env_vec = env_mat * refnormpersp; vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; #if !defined(SUNLIGHT_KILL) - color = mix(color.rgb, reflected_color, envIntensity); + color = mix(color.rgb, reflected_color, envIntensity*0.75); // MAGIC NUMBER SL-12574; ALM: On, Quality <= Mid+ #endif } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl index 64ecf1f392..567811cd75 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl @@ -44,7 +44,7 @@ void fullbright_shiny_lighting() color.rgb *= vertex_color.rgb; vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low color.rgb = fullbrightShinyAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl index 5bbd71002d..f621a00785 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl @@ -45,7 +45,7 @@ void shiny_lighting() color.rgb *= vertex_color.rgb; vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low color.rgb = atmosLighting(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index da78691861..15a3bc349a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -169,7 +169,7 @@ vec3 post_diffuse = color.rgb; vec3 env_vec = env_mat * refnormpersp; vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; #if !defined(SUNLIGHT_KILL) - color = mix(color.rgb, reflected_color, envIntensity); + color = mix(color.rgb, reflected_color, envIntensity*0.75); // MAGIC NUMBER SL-12574; ALM: On, Quality >= High #endif } -- cgit v1.2.3 From 3f96aeff8c84e55164ce5d652e38041b4e1db82b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 10 Mar 2020 16:33:55 +0200 Subject: SL-12817 New text for snapshot upload --- indra/newview/llpanelsnapshotinventory.cpp | 1 - .../default/xui/en/panel_outfit_snapshot_inventory.xml | 6 ++++-- .../skins/default/xui/en/panel_snapshot_inventory.xml | 2 +- .../skins/default/xui/en/panel_snapshot_options.xml | 14 ++++++++++++++ 4 files changed, 19 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 594cbed7ad..9e56a04b3b 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -136,7 +136,6 @@ BOOL LLPanelSnapshotInventory::postBuild() // virtual void LLPanelSnapshotInventory::onOpen(const LLSD& key) { - getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost())); LLPanelSnapshot::onOpen(key); } diff --git a/indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml index ace0ee01e2..441cf97e87 100644 --- a/indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml @@ -41,7 +41,7 @@ - Uploading an image to your inventory costs L$[UPLOAD_COST]. +Uploading an image to your inventory costs L$[UPLOAD_COST]. + +Fee is based on your subscription level. Higher levels are charged lower fees. + + Fee is based on your subscription level. Higher levels are charged lower fees. + \ No newline at end of file -- cgit v1.2.3 From f9eada575bfa46a1da5aeaf27c73537a9b86aa76 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 10 Mar 2020 00:21:52 -0600 Subject: SL-12592, avoid light modulation of fullbright and preserve diffuse alpha component --- .../shaders/class1/deferred/materialF.glsl | 191 +++++++++++---------- 1 file changed, 96 insertions(+), 95 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index d07de529ca..21a462e2db 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -1,28 +1,28 @@ -/** - * @file materialF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - +/** +* @file materialF.glsl +* +* $LicenseInfo:firstyear=2007&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2007, 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$ +*/ + /*[EXTRA_CODE_HERE]*/ //class1/deferred/materialF.glsl @@ -34,7 +34,7 @@ #define DIFFUSE_ALPHA_MODE_MASK 2 #define DIFFUSE_ALPHA_MODE_EMISSIVE 3 -uniform float emissive_brightness; +uniform float emissive_brightness; // fullbright flag, 1.0 == fullbright, 0.0 otherwise uniform int sun_up_factor; #ifdef WATER_FOG @@ -52,13 +52,13 @@ vec3 linear_to_srgb(vec3 cs); #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) #ifdef DEFINE_GL_FRAGCOLOR - out vec4 frag_color; +out vec4 frag_color; #else - #define frag_color gl_FragColor +#define frag_color gl_FragColor #endif #ifdef HAS_SUN_SHADOW - float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); +float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); #endif uniform samplerCube environmentMap; @@ -81,7 +81,7 @@ uniform vec2 screen_res; uniform vec4 light_position[8]; uniform vec3 light_direction[8]; -uniform vec4 light_attenuation[8]; +uniform vec4 light_attenuation[8]; uniform vec3 light_diffuse[8]; float getAmbientClamp(); @@ -91,7 +91,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe vec3 col = vec3(0); //get light vector - vec3 lv = lp.xyz-v; + vec3 lv = lp.xyz - v; //get distance float dist = length(lv); @@ -103,21 +103,21 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe { //normalize light vector lv = normalize(lv); - + //distance attenuation - float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); + float dist_atten = clamp(1.0 - (dist - 1.0*(1.0 - fa)) / fa, 0.0, 1.0); dist_atten *= dist_atten; dist_atten *= 2.0f; if (dist_atten <= 0.0) { - return col; + return col; } // spotlight coefficient. float spot = max(dot(-ln, lv), is_pointlight); da *= spot*spot; // GL_SPOT_EXPONENT=2 - + //angular attenuation da *= dot(n, lv); @@ -126,9 +126,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe float amb_da = ambiance; if (da >= 0) { - lit = max(da * dist_atten,0.0); + lit = max(da * dist_atten, 0.0); col = lit * light_col * diffuse; - amb_da += (da*0.5+0.5) * ambiance; + amb_da += (da*0.5 + 0.5) * ambiance; } amb_da += (da*da*0.5 + 0.5) * ambiance; amb_da *= dist_atten; @@ -140,19 +140,19 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe if (spec.a > 0.0) { //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(lv+npos); + vec3 h = normalize(lv + npos); float nh = dot(n, h); float nv = dot(n, npos); float vh = dot(npos, h); float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; + float fres = pow(1 - dot(h, npos), 5)*0.4 + 0.5; float gtdenom = 2 * nh; float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - + if (nh > 0.0) { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); + float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da); vec3 speccol = lit*scol*light_col.rgb*spec.rgb; speccol = clamp(speccol, vec3(0), vec3(1)); col += speccol; @@ -165,7 +165,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe } } - return max(col, vec3(0.0,0.0,0.0)); + return max(col, vec3(0.0, 0.0, 0.0)); } #else @@ -213,16 +213,9 @@ void main() { vec2 pos_screen = vary_texcoord0.xy; - vec4 diffuse_tap = texture2D(diffuseMap, vary_texcoord0.xy); - diffuse_tap.rgb *= vertex_color.rgb; - -//#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - vec4 diffuse_srgb = diffuse_tap; + vec4 diffuse_srgb = texture2D(diffuseMap, vary_texcoord0.xy); + diffuse_srgb.rgb *= vertex_color.rgb; vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); -/*#else - vec4 diffuse_linear = diffuse_tap; - vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a); -#endif*/ #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) if (diffuse_linear.a < minimum_alpha) @@ -248,15 +241,15 @@ void main() // convert sampled normal to tangent space normal norm = vec3(dot(norm, vary_mat0), - dot(norm, vary_mat1), - dot(norm, vary_mat2)); + dot(norm, vary_mat1), + dot(norm, vary_mat2)); #else norm = vary_normal; #endif norm = normalize(norm); - vec2 abnormal = encode_normal(norm); + vec2 abnormal = encode_normal(norm); vec4 final_color = vec4(diffuse_linear.rgb, 0.0); @@ -286,7 +279,7 @@ void main() float al = 0; #ifdef HAS_SPECULAR_MAP - if (emissive_brightness >= 1.0) + if (emissive_brightness >= 1.0) // ie, if fullbright { float ei = env_intensity*0.5 + 0.5; final_normal = vec4(abnormal, ei, 0.0); @@ -304,34 +297,43 @@ void main() #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - { - //forward rendering, output just lit sRGBA - vec3 pos = vary_position; - float shadow = 1.0f; + //forward rendering, output just lit sRGBA + vec3 pos = vary_position; + + float shadow = 1.0f; #ifdef HAS_SUN_SHADOW - shadow = sampleDirectionalShadow(pos.xyz, norm, pos_screen); + shadow = sampleDirectionalShadow(pos.xyz, norm, pos_screen); #endif - spec = final_specular; + spec = final_specular; - float envIntensity = final_normal.z; + float envIntensity = final_normal.z; - vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; + vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - float bloom = 0.0; - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; + float bloom = 0.0; + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; - calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false); + calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false); + if (emissive_brightness >= 1.0) // fullbright, skip lighting calculations + { + // just do atmos attenuation (ad hoc 60% factor to match release viewer) + color = atmosFragLighting(diffuse_srgb.rgb, additive, atten*0.6); + color = scaleSoftClipFrag(color); + al = diffuse_srgb.a; + } + else // not fullbright, calculate lighting + { vec3 refnormpersp = normalize(reflect(pos.xyz, norm)); float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); - da = pow(da, 1.0/1.3); + da = pow(da, 1.0 / 1.3); float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; @@ -341,16 +343,15 @@ void main() vec3 sun_contrib = min(da, shadow) * sunlit; #if !defined(AMBIENT_KILL) - color.rgb = amblit; - color.rgb *= ambient; + color = amblit; + color *= ambient; #endif #if !defined(SUNLIGHT_KILL) - color.rgb += sun_contrib; + color += sun_contrib; #endif + color *= diffuse_srgb.rgb; - color.rgb *= diffuse_srgb.rgb; - float glare = 0.0; if (spec.a > 0.0) // specular reflection @@ -358,19 +359,19 @@ void main() vec3 npos = -normalize(pos.xyz); //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(light_dir.xyz+npos); + vec3 h = normalize(light_dir.xyz + npos); float nh = dot(norm, h); float nv = dot(norm, npos); float vh = dot(npos, h); float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; + float fres = pow(1 - dot(h, npos), 5)*0.4 + 0.5; float gtdenom = 2 * nh; float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); if (nh > 0.0) { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); + float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da); vec3 sp = sun_contrib*scol / 6.0f; sp = clamp(sp, vec3(0), vec3(1)); bloom = dot(sp, sp) / 4.0; @@ -384,11 +385,11 @@ void main() { //add environmentmap vec3 env_vec = env_mat * refnormpersp; - + vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; #if !defined(SUNLIGHT_KILL) - color = mix(color.rgb, reflected_color, envIntensity); + color = mix(color, reflected_color, envIntensity); #endif float cur_glare = max(reflected_color.r, reflected_color.g); cur_glare = max(cur_glare, reflected_color.b); @@ -401,14 +402,14 @@ void main() vec3 npos = normalize(-pos.xyz); - vec3 light = vec3(0,0,0); + vec3 light = vec3(0, 0, 0); //convert to linear before adding local lights - color.rgb = srgb_to_linear(color.rgb); + color = srgb_to_linear(color); #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse_linear.rgb, final_specular, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w ); - LIGHT_LOOP(1) + LIGHT_LOOP(1) LIGHT_LOOP(2) LIGHT_LOOP(3) LIGHT_LOOP(4) @@ -416,25 +417,25 @@ void main() LIGHT_LOOP(6) LIGHT_LOOP(7) - glare = min(glare, 1.0); - al = max(diffuse_linear.a,glare)*vertex_color.a; + glare = min(glare, 1.0); + al = max(diffuse_linear.a, glare)*vertex_color.a; #if !defined(LOCAL_LIGHT_KILL) - color.rgb += light.rgb; + color += light; #endif -//convert to srgb as this color is being written post gamma correction - color.rgb = linear_to_srgb(color.rgb); - + //convert to srgb as this color is being written post gamma correction + color = linear_to_srgb(color); + } + #ifdef WATER_FOG - vec4 temp = applyWaterFogView(pos, vec4(color.rgb, al)); - color.rgb = temp.rgb; - al = temp.a; + vec4 temp = applyWaterFogView(pos, vec4(color, al)); + color = temp.rgb; + al = temp.a; #endif - } - - frag_color = vec4(color, al); + // Don't allow alpha to exceed input value - SL-12592 + frag_color = vec4(color, min(al, diffuse_srgb.a)); #else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer -- cgit v1.2.3 From 7d94bcf72918779c311d92db67a7f67e2c737c9d Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 10 Mar 2020 11:41:39 -0600 Subject: DRTVWR-440 Add compile switch SHADER_CRASH_NONFATAL to prevent app exit on shader failure --- indra/newview/llappviewer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 73a58fee16..118edb8beb 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2212,7 +2212,9 @@ void errorCallback(const std::string &error_string) // static info file. LLAppViewer::instance()->writeDebugInfo(); +#ifndef SHADER_CRASH_NONFATAL LLError::crashAndLoop(error_string); +#endif } void LLAppViewer::initLoggingAndGetLastDuration() -- cgit v1.2.3 From b1e2615cd80f27dac6712995edcc890df021041a Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 10 Mar 2020 12:35:12 -0700 Subject: SL-12171 Fix emissive mask being too bright post sRGB/Linear cleanup --- indra/newview/app_settings/shaders/class1/deferred/materialF.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 21a462e2db..5999063ae5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -254,7 +254,7 @@ void main() vec4 final_color = vec4(diffuse_linear.rgb, 0.0); #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_EMISSIVE) - final_color.a = diffuse_linear.a; + final_color.a = diffuse_linear.a * 0.5; // SL-12171 #endif final_color.a = max(final_color.a, emissive_brightness); -- cgit v1.2.3 From 13c8496799581ad88d4ef1f1dd84bcbf331edb5b Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Tue, 10 Mar 2020 23:29:32 +0200 Subject: SL-12779 [EEP] Fix for cropped buttons in 'Edit Day Cycle' floater --- indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml index 6869eefda2..30e9002230 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml @@ -260,7 +260,7 @@ Date: Wed, 11 Mar 2020 16:48:22 +0200 Subject: SL-12562 Reverted change to 'embed' link --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b8bc4fe0b9..da1e87fda4 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3775,7 +3775,7 @@ Type String Value - https://secondlife.com/my/community/events/event.php?id= + http://events.secondlife.com/viewer/embed/event/ FastCacheFetchEnabled -- cgit v1.2.3 From 23953e416e007f082acd59157e6dfb9455917bc5 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 12 Mar 2020 13:22:32 -0600 Subject: DRTVWR-440 fix 'unreachable code' warning-as-error when buildin /Od --- indra/newview/llweb.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 840eb06acf..a34c5826ed 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -247,6 +247,5 @@ bool LLWeb::useExternalBrowser(const std::string &url) boost::match_results matches; return boost::regex_search(url, matches, pattern); } - return false; #endif } -- cgit v1.2.3 From c7f2712d9576c0122726104f74690c1ee5f94ae2 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 12 Mar 2020 16:52:48 -0600 Subject: SL-12784 restore vertex color alpha contribution --- indra/newview/app_settings/shaders/class1/deferred/materialF.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 5999063ae5..553c2f3045 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -214,7 +214,7 @@ void main() vec2 pos_screen = vary_texcoord0.xy; vec4 diffuse_srgb = texture2D(diffuseMap, vary_texcoord0.xy); - diffuse_srgb.rgb *= vertex_color.rgb; + diffuse_srgb *= vertex_color; vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) -- cgit v1.2.3 From 6708b382ac2cbb42f01ec08ee300840a43bb59b5 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 12 Mar 2020 18:37:10 -0700 Subject: SL-12781 Fix Upload 3D Preview not using z-buffer --- indra/newview/pipeline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d6ff9bd548..fda79984ab 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1250,7 +1250,7 @@ void LLPipeline::createGLBuffers() } // Use FBO for bake tex - mBake.allocate(512, 512, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, true); + mBake.allocate(512, 512, GL_RGBA, TRUE, FALSE, LLTexUnit::TT_TEXTURE, true); // SL-12781 Build > Upload > Model; 3D Preview mHighlight.allocate(256,256,GL_RGBA, FALSE, FALSE); -- cgit v1.2.3 From 36499c7526682e999648250d39a6d0960d9b72a5 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 12 Mar 2020 18:38:05 -0700 Subject: SL-12781 Cleanup: Update out-of-date color comment --- indra/newview/llfloatermodelpreview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index f32f34c354..267e88612c 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3652,7 +3652,7 @@ BOOL LLModelPreview::render() { gUIProgram.bind(); } - //clear background to blue + //clear background to grey gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); gGL.loadIdentity(); -- cgit v1.2.3 From fe4549c950e5cfcb143650e4d6693bc87db6e011 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 12 Mar 2020 18:40:11 -0700 Subject: SL-12781 Cleanup: Rename non-descript generic var name --- indra/newview/llfloatermodelpreview.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 267e88612c..13ac583c1c 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3920,9 +3920,9 @@ BOOL LLModelPreview::render() { glClear(GL_DEPTH_BUFFER_BIT); - for (U32 i = 0; i < 2; i++) + for (U32 pass = 0; pass < 2; pass++) { - if (i == 0) + if (pass == 0) { //depth only pass gGL.setColorMask(false, false); } @@ -3932,7 +3932,7 @@ BOOL LLModelPreview::render() } //enable alpha blending on second pass but not first pass - LLGLState blend(GL_BLEND, i); + LLGLState blend(GL_BLEND, pass); gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); -- cgit v1.2.3 From b67df8184f273294b1703df25b012dfa0ad36d28 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 12 Mar 2020 18:42:14 -0700 Subject: SL-12781 Cleanup: Remove HACK / MAGIC NUMBER effective constant of mCameraDistance as it is set in setPreviewTarget() via initModelPreview() --- indra/newview/llfloatermodelpreview.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 13ac583c1c..d808d4588a 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -108,6 +108,10 @@ const double RETAIN_COEFFICIENT = 100; // So this const is used as a size of Smooth combobox list. const S32 SMOOTH_VALUES_NUMBER = 10; +// mCameraDistance +// Also see: mCameraZoom +const F32 MODEL_PREVIEW_CAMERA_DISTANCE = 16.f; + void drawBoxOutline(const LLVector3& pos, const LLVector3& size); @@ -431,7 +435,7 @@ void LLFloaterModelPreview::initModelPreview() } mModelPreview = new LLModelPreview(512, 512, this ); - mModelPreview->setPreviewTarget(16.f); + mModelPreview->setPreviewTarget(MODEL_PREVIEW_CAMERA_DISTANCE); mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5)); mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::modelUpdated, this, _1)); } @@ -3780,7 +3784,6 @@ BOOL LLModelPreview::render() target_pos = getPreviewAvatar()->getPositionAgent(); z_near = 0.01f; z_far = 1024.f; - mCameraDistance = 16.f; //render avatar previews every frame refresh(); -- cgit v1.2.3 From 2b0b3e86258bef6d4b8a51c519626b9492200025 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 12 Mar 2020 18:45:02 -0700 Subject: SL-12781 Remove expensive and redundant z clear; instead enable/disable z test for background and model preview --- indra/newview/llfloatermodelpreview.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index d808d4588a..8a894c4ec8 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3645,10 +3645,9 @@ BOOL LLModelPreview::render() S32 width = getWidth(); S32 height = getHeight(); - LLGLSUIDefault def; + LLGLSUIDefault def; // GL_BLEND, GL_ALPHA_TEST, GL_CULL_FACE, depth test LLGLDisable no_blend(GL_BLEND); - LLGLEnable cull(GL_CULL_FACE); - LLGLDepthTest depth(GL_TRUE); + LLGLDepthTest depth(GL_FALSE); // SL-12781 disable z-buffer to render background color LLGLDisable fog(GL_FOG); { @@ -3761,7 +3760,7 @@ BOOL LLModelPreview::render() F32 explode = mFMP->childGetValue("physics_explode").asReal(); - glClear(GL_DEPTH_BUFFER_BIT); + LLGLDepthTest gls_depth(GL_TRUE); // SL-12781 re-enable z-buffer for 3D model preview LLRect preview_rect; -- cgit v1.2.3 From 0a0cfcf2ef92375f099ed91f009db1ebf2d410c0 Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Fri, 13 Mar 2020 12:58:47 -0500 Subject: SL-12233 Fix for disagreement between fullbright implementations with ALM on and off. --- .../app_settings/shaders/class1/deferred/emissiveF.glsl | 1 - .../shaders/class1/deferred/fullbrightF.glsl | 6 ++---- .../app_settings/shaders/class1/deferred/materialF.glsl | 16 ++++++++++++---- .../shaders/class2/windlight/transportF.glsl | 9 +++++++-- .../shaders/class3/windlight/transportF.glsl | 9 +++++++-- 5 files changed, 28 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl index 0ffca8515c..f0522850de 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl @@ -44,7 +44,6 @@ void main() float shadow = 1.0; vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color; - color.rgb = pow(color.rgb, vec3(2.2)); color.rgb = fullbrightAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index c104dc884f..46ec20c8b0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -79,11 +79,9 @@ void main() color.rgb = fogged.rgb; color.a = fogged.a; #else - color.rgb = srgb_to_linear(color.rgb); - color.rgb = fullbrightAtmosTransport(color.rgb); + color.rgb = fullbrightAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); - color.rgb = linear_to_srgb(color.rgb); - color.a = final_alpha; + color.a = final_alpha; #endif frag_color.rgb = color.rgb; diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 5999063ae5..a69653fe4e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -44,6 +44,9 @@ vec4 applyWaterFogView(vec3 pos, vec4 color); vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); vec3 scaleSoftClipFrag(vec3 l); +vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); +vec3 fullbrightScaleSoftClip(vec3 light); + void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); vec3 srgb_to_linear(vec3 cs); @@ -320,21 +323,26 @@ void main() vec3 atten; calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false); - + if (emissive_brightness >= 1.0) // fullbright, skip lighting calculations { - // just do atmos attenuation (ad hoc 60% factor to match release viewer) - color = atmosFragLighting(diffuse_srgb.rgb, additive, atten*0.6); - color = scaleSoftClipFrag(color); + color = fullbrightAtmosTransportFrag(diffuse_srgb.rgb, additive, atten); + color = fullbrightScaleSoftClip(color); + al = diffuse_srgb.a; } else // not fullbright, calculate lighting { vec3 refnormpersp = normalize(reflect(pos.xyz, norm)); + //we're in sRGB space, so gamma correct this dot product so + // lighting from the sun stays sharp float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); da = pow(da, 1.0 / 1.3); + //darken ambient for normals perpendicular to light vector so surfaces in shadow + // and facing away from light still have some definition to them. + // do NOT gamma correct this dot product so ambient lighting stays soft float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; ambient *= ambient; diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index 8fc5d750e3..f69d36f715 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -49,10 +49,15 @@ vec3 atmosTransport(vec3 light) return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } -vec3 fullbrightAtmosTransport(vec3 light) +vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { float brightness = dot(light.rgb * 0.5, vec3(0.3333)) + 0.1; - return atmosTransportFrag(light * 0.5, getAdditiveColor() * brightness, getAtmosAttenuation()); + return atmosTransportFrag(light * 0.5, additive * brightness, atten); +} + +vec3 fullbrightAtmosTransport(vec3 light) +{ + return fullbrightAtmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } vec3 fullbrightShinyAtmosTransport(vec3 light) diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl index 18705f785f..aa7dbc39ce 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl @@ -49,10 +49,15 @@ vec3 atmosTransport(vec3 light) return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } -vec3 fullbrightAtmosTransport(vec3 light) +vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { float brightness = dot(light.rgb, vec3(0.33333)); - return atmosTransportFrag(light * 0.5, getAdditiveColor() * (brightness * 0.5 + 0.5), getAtmosAttenuation()); + return atmosTransportFrag(light * 0.5, additive * (brightness * 0.5 + 0.5), atten); +} + +vec3 fullbrightAtmosTransport(vec3 light) +{ + return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } vec3 fullbrightShinyAtmosTransport(vec3 light) -- cgit v1.2.3 From 744872b43d4b538a828dad116c46eed3d6d35436 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 13 Mar 2020 11:46:13 -0700 Subject: SL-12850 --- .../newview/app_settings/shaders/class1/deferred/softenLightF.glsl | 6 +++--- .../newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 547a159f3a..69a694a6cd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -154,8 +154,6 @@ vec3 post_diffuse = color.rgb; } vec3 post_spec = color.rgb; - - color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); if (envIntensity > 0.0) { //add environmentmap @@ -165,7 +163,9 @@ vec3 post_diffuse = color.rgb; color = mix(color.rgb, reflected_color, envIntensity*0.75); // MAGIC NUMBER SL-12574; ALM: On, Quality <= Mid+ #endif } - + else + color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); + vec3 post_env = color.rgb; if (norm.w < 1) diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 15a3bc349a..63b0f0b5c8 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -161,8 +161,6 @@ vec3 post_diffuse = color.rgb; } vec3 post_spec = color.rgb; - - color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); if (envIntensity > 0.0) { //add environmentmap @@ -170,9 +168,12 @@ vec3 post_diffuse = color.rgb; vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; #if !defined(SUNLIGHT_KILL) color = mix(color.rgb, reflected_color, envIntensity*0.75); // MAGIC NUMBER SL-12574; ALM: On, Quality >= High +//color.rgb = reflected_color.rgb; #endif } - + else + color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); + vec3 post_env = color.rgb; if (norm.w < 1) -- cgit v1.2.3 From bedbbdc5c39a4ae684c0b8e569dae4bb0d7b314c Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 13 Mar 2020 12:35:12 -0700 Subject: SL-12850 remove debug --- indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 63b0f0b5c8..a1366eec01 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -168,7 +168,6 @@ vec3 post_diffuse = color.rgb; vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; #if !defined(SUNLIGHT_KILL) color = mix(color.rgb, reflected_color, envIntensity*0.75); // MAGIC NUMBER SL-12574; ALM: On, Quality >= High -//color.rgb = reflected_color.rgb; #endif } else -- cgit v1.2.3 From 3792c3c7debb428d9727136afaa8b16d312abd42 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 13 Mar 2020 12:37:14 -0700 Subject: SL-12850 Adhere to coding standard --- indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl | 2 ++ indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 2 ++ 2 files changed, 4 insertions(+) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 69a694a6cd..20ac78947b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -164,7 +164,9 @@ vec3 post_diffuse = color.rgb; #endif } else + { color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); + } vec3 post_env = color.rgb; diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index a1366eec01..9c7a4df767 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -171,7 +171,9 @@ vec3 post_diffuse = color.rgb; #endif } else + { color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); + } vec3 post_env = color.rgb; -- cgit v1.2.3 From 09b13b3981f121f20674b874f47f96bef2ac73ce Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 13 Mar 2020 14:59:11 -0600 Subject: SL-12784 disambiguate vertex_color.a of 0 --- .../app_settings/shaders/class1/deferred/materialF.glsl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index ca11f58888..a8a5cc22db 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -217,7 +217,16 @@ void main() vec2 pos_screen = vary_texcoord0.xy; vec4 diffuse_srgb = texture2D(diffuseMap, vary_texcoord0.xy); - diffuse_srgb *= vertex_color; + diffuse_srgb.rgb *= vertex_color.rgb; + + // For some reason the Transparency slider sets vertex_color.a to 0.0 both for + // fully opaque and for fully transparent objects. This code assumes the 0 alpha + // is always from the opaque end of the scale. TODO: Remove the conditional once + // the root cause of the slider ambiguity is fixed. + if (vertex_color.a > 0.0) + { + diffuse_srgb.a *= vertex_color.a; + } vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) -- cgit v1.2.3 From 5f0303eea5a30c914b61d5de6ade3697e551f9c6 Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Fri, 13 Mar 2020 16:39:58 -0500 Subject: SL-12005 Fix for projectors getting brighter when switching to single light shader. --- indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 2216afe609..694b19cdfb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -177,9 +177,8 @@ void main() float da = dot(norm, lv); vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; - // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space. - // We can't switch to linear here unless we do it everywhere - //diff_tex.rgb = srgb_to_linear(diff_tex.rgb); + //light shaders output linear and are gamma corrected later in postDeferredGammaCorrectF.glsl + diff_tex.rgb = srgb_to_linear(diff_tex.rgb); vec4 spec = texture2DRect(specularRect, frag.xy); @@ -274,6 +273,7 @@ void main() } #endif + //col.r = 1.0; frag_color.rgb = col; frag_color.a = 0.0; } -- cgit v1.2.3 From 3e403ffb4f6d295b11c9842bed53df5d15848f0b Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 16 Mar 2020 17:48:23 +0200 Subject: SL-4495 Add setting to ignore Hover height when setting Camera position --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llagentcamera.cpp | 10 ++++++++-- indra/newview/llagentcamera.h | 2 ++ .../default/xui/en/floater_edit_hover_height.xml | 19 +++++++++++++------ 4 files changed, 34 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f35408f48e..cc86ba85c1 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16406,6 +16406,17 @@ Value 0 + HoverHeightAffectsCamera + + Comment + Camera view is affected by Hover Height setting + Persist + 1 + Type + Boolean + Value + 1 + CefVerboseLog Comment diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 6b1dd4c3c3..a1920f0332 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1730,7 +1730,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) F32 camera_land_height; LLVector3d frame_center_global = !isAgentAvatarValid() ? gAgent.getPositionGlobal() : - gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition()); + gAgent.getPosGlobalFromAgent(getAvatarRootPosition()); BOOL isConstrained = FALSE; LLVector3d head_offset; @@ -1987,7 +1987,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) LLVector3 LLAgentCamera::getCurrentCameraOffset() { - LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - gAgentAvatarp->mRoot->getWorldPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion(); + LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - getAvatarRootPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion(); return camera_offset / mCameraZoomFraction / gSavedSettings.getF32("CameraOffsetScale"); } @@ -2019,6 +2019,12 @@ F32 LLAgentCamera::getCameraMaxZoomDistance() LLWorld::getInstance()->getRegionWidthInMeters() - CAMERA_FUDGE_FROM_OBJECT); } +LLVector3 LLAgentCamera::getAvatarRootPosition() +{ + static LLCachedControl use_hover_height(gSavedSettings, "HoverHeightAffectsCamera"); + return use_hover_height ? gAgentAvatarp->mRoot->getWorldPosition() : gAgentAvatarp->mRoot->getWorldPosition() - gAgentAvatarp->getHoverOffset(); + +} //----------------------------------------------------------------------------- // handleScrollWheel() //----------------------------------------------------------------------------- diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 128974666e..a9f57cf956 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -147,6 +147,8 @@ public: F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); } void clearCameraLag() { mCameraLag.clearVec(); } private: + LLVector3 getAvatarRootPosition(); + F32 mCurrentCameraDistance; // Current camera offset from avatar F32 mTargetCameraDistance; // Target camera offset from avatar F32 mCameraFOVZoomFactor; // Amount of fov zoom applied to camera when zeroing in on an object diff --git a/indra/newview/skins/default/xui/en/floater_edit_hover_height.xml b/indra/newview/skins/default/xui/en/floater_edit_hover_height.xml index 52084e5f8e..3570456b44 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_hover_height.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_hover_height.xml @@ -4,18 +4,16 @@ legacy_header_height="225" can_minimize="true" can_close="true" - can_resize="true" - min_height="65" - min_width="515" - height="65" + can_resize="false" + height="80" + width="515" layout="topleft" name="HoverHeight" single_instance="true" help_topic="hover_height" save_rect="true" save_visibility="true" - title="SET HOVER HEIGHT" - width="515"> + title="SET HOVER HEIGHT"> + -- cgit v1.2.3 From 8c1b9d3e7a194c106ee79067e3136c37ea7e84e1 Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Mon, 16 Mar 2020 12:10:34 -0500 Subject: Add missing fullbrightAtmosTransportFrag stub. --- indra/newview/app_settings/shaders/class1/windlight/transportF.glsl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl index 79d8d11b32..a937d9fa99 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl @@ -37,6 +37,12 @@ vec3 atmosTransport(vec3 light) return light; } +vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) +{ + /* stub function for fallback compatibility on class1 hardware */ + return light; +} + vec3 fullbrightAtmosTransport(vec3 light) { /* stub function for fallback compatibility on class1 hardware */ -- cgit v1.2.3 From 49239e8fe178c313771a1d8b389844761cd740ad Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Mon, 16 Mar 2020 19:43:14 -0700 Subject: SL-12574: Tweak sky cubemap to not be as dark to better match Windlight --- indra/newview/lllegacyatmospherics.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index e061b3ad17..3c675f7c4f 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -254,7 +254,8 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, Atm F32 brightness = vars.hazeColor.brightness(); F32 greyscale_sat = brightness * (1.0f - sky_saturation); LLColor3 sky_color = vars.hazeColor * sky_saturation + smear(greyscale_sat); - //sky_color *= (0.5f + 0.5f * brightness); // SL-12574 EEP sky was too dark dark grey/blue, lighten it slightly + //sky_color *= (0.5f + 0.5f * brightness); + sky_color *= (0.85f + 0.15f*brightness); // SL-12574 EEP sky is being attenuated too much; brighten it slightly until calcSkyColorWLVert() is fixed to match Windlight return LLColor4(sky_color, 0.0f); } -- cgit v1.2.3 From e85fe64a5649c5250299e6b9caeffc83fcfc409c Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 17 Mar 2020 16:38:55 +0200 Subject: SL-12858 Fixed bad merge --- indra/newview/skins/default/xui/de/floater_about_land.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/de/floater_about_land.xml b/indra/newview/skins/default/xui/de/floater_about_land.xml index 8fb953d3ab..8f55b3297f 100644 --- a/indra/newview/skins/default/xui/de/floater_about_land.xml +++ b/indra/newview/skins/default/xui/de/floater_about_land.xml @@ -370,8 +370,8 @@ Nur große Parzellen können in der Suche aufgeführt werden. Landepunkt: [LANDING] -