From 92dc9ceb834dd31aa6fe1c67b9ea896a62cd7c7c Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 24 Sep 2018 16:36:01 +0300 Subject: [PATCH 01/15] SL-9676 EEP Pick:SELECT SETTINGS limit folder operations options --- indra/llui/llfolderview.cpp | 25 ++++++++++++++++--- indra/llui/llfolderview.h | 8 ++++-- indra/newview/llinventorypanel.cpp | 2 ++ indra/newview/llinventorypanel.h | 3 +++ .../xui/en/floater_settings_picker.xml | 1 + 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 895753aeae..9d0f4b6db1 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -149,6 +149,7 @@ LLFolderView::Params::Params() use_label_suffix("use_label_suffix"), allow_multiselect("allow_multiselect", true), show_empty_message("show_empty_message", true), + suppress_folder_menu("suppress_folder_menu", false), use_ellipses("use_ellipses", false), options_menu("options_menu", "") { @@ -167,6 +168,7 @@ LLFolderView::LLFolderView(const Params& p) mRenameItem( NULL ), mNeedsScroll( FALSE ), mUseLabelSuffix(p.use_label_suffix), + mSuppressFolderMenu(p.suppress_folder_menu), mPinningSelectedItem(FALSE), mNeedsAutoSelect( FALSE ), mAutoSelectOverride(FALSE), @@ -1432,10 +1434,13 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; S32 count = mSelectedItems.size(); + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); - if ( handled + bool hide_folder_menu = mSuppressFolderMenu && isFolderSelected(); + if ((handled && ( count > 0 && (hasVisibleChildren()) ) // show menu only if selected items are visible - && menu ) + && menu ) && + !hide_folder_menu) { if (mCallbackRegistrar) { @@ -1449,7 +1454,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) if (mCallbackRegistrar) { mCallbackRegistrar->popScope(); - } + } } else { @@ -1862,6 +1867,20 @@ void LLFolderView::updateMenu() } } +bool LLFolderView::isFolderSelected() +{ + selected_items_t::iterator item_iter; + for (item_iter = mSelectedItems.begin(); item_iter != mSelectedItems.end(); ++item_iter) + { + LLFolderViewFolder* folder = dynamic_cast(*item_iter); + if (folder != NULL) + { + return true; + } + } + return false; +} + bool LLFolderView::selectFirstItem() { for (folders_t::iterator iter = mFolders.begin(); diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 2926e160d0..69824992c1 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -92,7 +92,8 @@ public: allow_multiselect, show_empty_message, use_ellipses, - show_item_link_overlays; + show_item_link_overlays, + suppress_folder_menu; Mandatory view_model; Optional grouped_item_model; Mandatory options_menu; @@ -259,6 +260,8 @@ protected: void closeRenamer( void ); + bool isFolderSelected(); + bool selectFirstItem(); bool selectLastItem(); @@ -282,7 +285,8 @@ protected: mDragAndDropThisFrame, mShowItemLinkOverlays, mShowSelectionContext, - mShowSingleSelection; + mShowSingleSelection, + mSuppressFolderMenu; // Renaming variables and methods LLFolderViewItem* mRenameItem; // The item currently being renamed diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index d84ce16792..36fb98efe1 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -144,6 +144,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mAllowMultiSelect(p.allow_multi_select), mShowItemLinkOverlays(p.show_item_link_overlays), mShowEmptyMessage(p.show_empty_message), + mSuppressFolderMenu(p.suppress_folder_menu), mViewsInitialized(false), mInvFVBridgeBuilder(NULL), mInventoryViewModel(p.name), @@ -191,6 +192,7 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id ) p.use_label_suffix = mParams.use_label_suffix; p.allow_multiselect = mAllowMultiSelect; p.show_empty_message = mShowEmptyMessage; + p.suppress_folder_menu = mSuppressFolderMenu; p.show_item_link_overlays = mShowItemLinkOverlays; p.root = NULL; p.allow_drop = mParams.allow_drop_on_root; diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index e2da06b8d8..90fd659522 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -97,6 +97,7 @@ public: Optional start_folder; Optional use_label_suffix; Optional show_empty_message; + Optional suppress_folder_menu; Optional show_root_folder; Optional allow_drop_on_root; Optional use_marketplace_folders; @@ -111,6 +112,7 @@ public: inventory("", &gInventory), allow_multi_select("allow_multi_select", true), show_item_link_overlays("show_item_link_overlays", false), + suppress_folder_menu("suppress_folder_menu", false), filter("filter"), start_folder("start_folder"), use_label_suffix("use_label_suffix", true), @@ -261,6 +263,7 @@ protected: bool mAllowMultiSelect; bool mShowItemLinkOverlays; // Shows link graphic over inventory item icons bool mShowEmptyMessage; + bool mSuppressFolderMenu; LLHandle mFolderRoot; LLScrollContainer* mScroller; 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 2df52ec6d5..2258a1dc24 100644 --- a/indra/newview/skins/default/xui/en/floater_settings_picker.xml +++ b/indra/newview/skins/default/xui/en/floater_settings_picker.xml @@ -51,6 +51,7 @@ right="-2" /> Date: Mon, 24 Sep 2018 17:44:32 +0300 Subject: [PATCH 02/15] line endings fix --- indra/newview/lldrawpoolwater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 56f3b75792..7a25e62651 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -721,7 +721,7 @@ void LLDrawPoolWater::shade() // using squash clip for deferred rendering makes the horizon lines match // between ALM and non-ALM rendering (SL-1655), but introduces an ugly seem between // near and far water(SL-9696)...we're going to live with the former and not cause the latter - else if (gGLManager.mHasDepthClamp || deferred_render) + else if (gGLManager.mHasDepthClamp || deferred_render) { face->renderIndexed(); } From ee532d946dc394bd3ebdaefedb6034520b83ef9a Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 24 Sep 2018 18:00:01 +0300 Subject: [PATCH 03/15] SL-1817 EEP Day Cycle timeline scrubber can't be repositioned while it's playing --- indra/newview/llfloatereditextdaycycle.cpp | 5 +++-- indra/newview/llfloatereditextdaycycle.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 5b083e8503..96af840bba 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -184,7 +184,7 @@ BOOL LLFloaterEditExtDayCycle::postBuild() mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); getChild(BTN_CANCEL, true)->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onClickCloseBtn(); }); - mTimeSlider->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onTimeSliderMoved(); }); + mTimeSlider->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onTimeSliderCallback(); }); 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(); }); @@ -786,8 +786,9 @@ void LLFloaterEditExtDayCycle::checkAndConfirmSettingsLoss(on_confirm_fn cb) } } -void LLFloaterEditExtDayCycle::onTimeSliderMoved() +void LLFloaterEditExtDayCycle::onTimeSliderCallback() { + stopPlay(); selectFrame(mTimeSlider->getCurSliderValue(), LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR); } diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 185b27bff3..0ab47fc1e5 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -108,8 +108,8 @@ private: void onCommitName(class LLLineEditor* caller, void* user_data); void onTrackSelectionCallback(const LLSD& user_data); void onPlayActionCallback(const LLSD& user_data); - // time slider moved - void onTimeSliderMoved(); + // time slider clicked + void onTimeSliderCallback(); // a frame moved or frame selection changed void onFrameSliderCallback(const LLSD &); void onFrameSliderDoubleClick(S32 x, S32 y, MASK mask); From f0eb06ed13313e3c5a78224506cde7a894591880 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Mon, 24 Sep 2018 18:24:32 +0300 Subject: [PATCH 04/15] SL-1546 VitrualTrackBall - Reduced the angle change per button click to 1deg --- .../newview/skins/default/xui/en/widgets/sun_moon_trackball.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/widgets/sun_moon_trackball.xml b/indra/newview/skins/default/xui/en/widgets/sun_moon_trackball.xml index 0e729c821a..9fa77855c0 100644 --- a/indra/newview/skins/default/xui/en/widgets/sun_moon_trackball.xml +++ b/indra/newview/skins/default/xui/en/widgets/sun_moon_trackball.xml @@ -5,7 +5,7 @@ height="150" user_resize="false" increment_angle_mouse="1.5f" - increment_angle_btn="3.0f" + increment_angle_btn="1.0f" image_sphere="VirtualTrackball_Sphere" image_moon_back="VirtualTrackball_Moon_Back" image_moon_front="VirtualTrackball_Moon_Front" From 6e0481b6040a0f9cad9d91f130e5ddd9ab1a0b52 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 24 Sep 2018 18:54:54 +0300 Subject: [PATCH 05/15] SL-9677 EEP Small adjustment to error message for not applying enviroment setting --- indra/newview/skins/default/xui/en/notifications.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index cd642f9531..4813ae3468 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6068,7 +6068,7 @@ This day cycle file references a missing sky file: [SKY]. icon="alertmodal.tga" name="WLRegionApplyFail" type="alertmodal"> -Sorry, the settings couldn't be applied to the region. Leaving the region and then returning may help rectify the problem. The reason given was: [FAIL_REASON] +Sorry, the settings couldn't be applied to the region. Reason: [FAIL_REASON] Date: Mon, 24 Sep 2018 19:14:41 +0100 Subject: [PATCH 06/15] SL-9708 Fix knock-on from fix for SL1505 reflection matrix bug by putting back old code for setting up underwater culling planes. Fix some diffs from viewer-release. --- indra/newview/lldrawpoolwater.cpp | 1522 ++++++++++++++--------------- indra/newview/llviewerregion.h | 434 ++++---- indra/newview/llvovolume.cpp | 5 +- indra/newview/pipeline.cpp | 11 +- 4 files changed, 990 insertions(+), 982 deletions(-) diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 56f3b75792..a91246b5a1 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -1,762 +1,762 @@ -/** - * @file lldrawpoolwater.cpp - * @brief LLDrawPoolWater class implementation - * - * $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 "llviewerprecompiledheaders.h" -#include "llfeaturemanager.h" -#include "lldrawpoolwater.h" - -#include "llviewercontrol.h" -#include "lldir.h" -#include "llerror.h" -#include "m3math.h" -#include "llrender.h" - -#include "llagent.h" // for gAgent for getRegion for getWaterHeight -#include "llcubemap.h" -#include "lldrawable.h" -#include "llface.h" -#include "llsky.h" -#include "llviewertexturelist.h" -#include "llviewerregion.h" -#include "llvosky.h" -#include "llvowater.h" -#include "llworld.h" -#include "pipeline.h" -#include "llviewershadermgr.h" -#include "llenvironment.h" -#include "llsettingssky.h" -#include "llsettingswater.h" - -static float sTime; - -BOOL deferred_render = FALSE; - -BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE; -BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE; -BOOL LLDrawPoolWater::sNeedsDistortionUpdate = TRUE; -F32 LLDrawPoolWater::sWaterFogEnd = 0.f; - -LLDrawPoolWater::LLDrawPoolWater() : LLFacePool(POOL_WATER) -{ -} - -LLDrawPoolWater::~LLDrawPoolWater() -{ -} - -void LLDrawPoolWater::setTransparentTextures(const LLUUID& transparentTextureId, const LLUUID& nextTransparentTextureId) -{ - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); - mWaterImagep[0] = LLViewerTextureManager::getFetchedTexture(!transparentTextureId.isNull() ? transparentTextureId : pwater->GetDefaultTransparentTextureAssetId()); - mWaterImagep[1] = LLViewerTextureManager::getFetchedTexture(!nextTransparentTextureId.isNull() ? nextTransparentTextureId : (!transparentTextureId.isNull() ? transparentTextureId : pwater->GetDefaultTransparentTextureAssetId())); - mWaterImagep[0]->addTextureStats(1024.f*1024.f); - mWaterImagep[1]->addTextureStats(1024.f*1024.f); -} - -void LLDrawPoolWater::setOpaqueTexture(const LLUUID& opaqueTextureId) -{ - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); - mOpaqueWaterImagep = LLViewerTextureManager::getFetchedTexture(opaqueTextureId); - mOpaqueWaterImagep->addTextureStats(1024.f*1024.f); -} - -void LLDrawPoolWater::setNormalMaps(const LLUUID& normalMapId, const LLUUID& nextNormalMapId) -{ - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); - mWaterNormp[0] = LLViewerTextureManager::getFetchedTexture(!normalMapId.isNull() ? normalMapId : pwater->GetDefaultWaterNormalAssetId()); - mWaterNormp[1] = LLViewerTextureManager::getFetchedTexture(!nextNormalMapId.isNull() ? nextNormalMapId : (!normalMapId.isNull() ? normalMapId : pwater->GetDefaultWaterNormalAssetId())); - mWaterNormp[0]->addTextureStats(1024.f*1024.f); - mWaterNormp[1]->addTextureStats(1024.f*1024.f); -} - -//static -void LLDrawPoolWater::restoreGL() -{ - /*LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); - if (pwater) - { - setTransparentTextures(pwater->getTransparentTextureID(), pwater->getNextTransparentTextureID()); - setOpaqueTexture(pwater->GetDefaultOpaqueTextureAssetId()); - setNormalMaps(pwater->getNormalMapID(), pwater->getNextNormalMapID()); - }*/ -} - -LLDrawPool *LLDrawPoolWater::instancePool() -{ - LL_ERRS() << "Should never be calling instancePool on a water pool!" << LL_ENDL; - return NULL; -} - - -void LLDrawPoolWater::prerender() -{ - mVertexShaderLevel = (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) ? LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0; -} - -S32 LLDrawPoolWater::getNumPasses() -{ - if (LLViewerCamera::getInstance()->getOrigin().mV[2] < 1024.f) - { - return 1; - } - - return 0; -} - -void LLDrawPoolWater::beginPostDeferredPass(S32 pass) -{ - beginRenderPass(pass); - deferred_render = TRUE; -} - -void LLDrawPoolWater::endPostDeferredPass(S32 pass) -{ - endRenderPass(pass); - deferred_render = FALSE; -} - -//=============================== -//DEFERRED IMPLEMENTATION -//=============================== -void LLDrawPoolWater::renderDeferred(S32 pass) -{ - LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); - deferred_render = TRUE; - shade(); - deferred_render = FALSE; -} - -//========================================= - -void LLDrawPoolWater::render(S32 pass) -{ - LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); - if (mDrawFace.empty() || LLDrawable::getCurrentFrame() <= 1) - { - return; - } - - //do a quick 'n dirty depth sort - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace* facep = *iter; - facep->mDistance = -facep->mCenterLocal.mV[2]; - } - - std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater()); - - // See if we are rendering water as opaque or not - if (!gSavedSettings.getBOOL("RenderTransparentWater")) - { - // render water for low end hardware - renderOpaqueLegacyWater(); - return; - } - - LLGLEnable blend(GL_BLEND); - - if ((mVertexShaderLevel > 0) && !sSkipScreenCopy) - { - shade(); - return; - } - - LLVOSky *voskyp = gSky.mVOSkyp; - - stop_glerror(); - - if (!gGLManager.mHasMultitexture) - { - // Ack! No multitexture! Bail! - return; - } - - LLFace* refl_face = voskyp->getReflFace(); - - gPipeline.disableLights(); - - LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - - LLGLDisable cullFace(GL_CULL_FACE); - - // Set up second pass first - gGL.getTexUnit(1)->activate(); - gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->bind(mWaterImagep[0]) ; - - gGL.getTexUnit(2)->activate(); - gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(2)->bind(mWaterImagep[1]) ; - - LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); - F32 up_dot = camera_up * LLVector3::z_axis; - - LLColor4 water_color; - if (LLViewerCamera::getInstance()->cameraUnderWater()) - { - water_color.setVec(1.f, 1.f, 1.f, 0.4f); - } - else - { - water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); - } - - gGL.diffuseColor4fv(water_color.mV); - - // Automatically generate texture coords for detail map - glEnable(GL_TEXTURE_GEN_S); //texture unit 1 - glEnable(GL_TEXTURE_GEN_T); //texture unit 1 - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - - // Slowly move over time. - F32 offset = fmod(gFrameTimeSeconds*2.f, 100.f); - F32 tp0[4] = {16.f/256.f, 0.0f, 0.0f, offset*0.01f}; - F32 tp1[4] = {0.0f, 16.f/256.f, 0.0f, offset*0.01f}; - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); - - gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); - gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); - - gGL.getTexUnit(0)->activate(); - - glClearStencil(1); - glClear(GL_STENCIL_BUFFER_BIT); - LLGLEnable gls_stencil(GL_STENCIL_TEST); - glStencilOp(GL_KEEP, GL_REPLACE, GL_KEEP); - glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF); - - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - if (voskyp->isReflFace(face)) - { - continue; - } - gGL.getTexUnit(0)->bind(face->getTexture()); - face->renderIndexed(); - } - - // Now, disable texture coord generation on texture state 1 - gGL.getTexUnit(1)->activate(); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->disable(); - - glDisable(GL_TEXTURE_GEN_S); //texture unit 1 - glDisable(GL_TEXTURE_GEN_T); //texture unit 1 - - gGL.getTexUnit(1)->activate(); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->disable(); - - glDisable(GL_TEXTURE_GEN_S); //texture unit 1 - glDisable(GL_TEXTURE_GEN_T); //texture unit 1 - - // Disable texture coordinate and color arrays - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - stop_glerror(); - - if (gSky.mVOSkyp->getCubeMap()) - { - gSky.mVOSkyp->getCubeMap()->enable(0); - gSky.mVOSkyp->getCubeMap()->bind(); - - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview(); - LLMatrix4 camera_rot(camera_mat.getMat3()); - camera_rot.invert(); - - gGL.loadMatrix((F32 *)camera_rot.mMatrix); - - gGL.matrixMode(LLRender::MM_MODELVIEW); - LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot); - - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - if (voskyp->isReflFace(face)) - { - //refl_face = face; - continue; - } - - if (face->getGeomCount() > 0) - { - face->renderIndexed(); - } - } - - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - - gSky.mVOSkyp->getCubeMap()->disable(); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - - } - - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - - if (refl_face) - { - glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF); - renderReflection(refl_face); - } - - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); -} - -// for low end hardware -void LLDrawPoolWater::renderOpaqueLegacyWater() -{ - LLVOSky *voskyp = gSky.mVOSkyp; - - LLGLSLShader* shader = NULL; - if (LLGLSLShader::sNoFixedFunction) - { - if (LLPipeline::sUnderWaterRender) - { - shader = &gObjectSimpleNonIndexedTexGenWaterProgram; - } - else - { - shader = &gObjectSimpleNonIndexedTexGenProgram; - } - - shader->bind(); - } - - stop_glerror(); - - // Depth sorting and write to depth buffer - // since this is opaque, we should see nothing - // behind the water. No blending because - // of no transparency. And no face culling so - // that the underside of the water is also opaque. - LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); - LLGLDisable no_cull(GL_CULL_FACE); - LLGLDisable no_blend(GL_BLEND); - - gPipeline.disableLights(); - - // Activate the texture binding and bind one - // texture since all images will have the same texture - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->bind(mOpaqueWaterImagep); - - // Automatically generate texture coords for water texture - if (!shader) - { - glEnable(GL_TEXTURE_GEN_S); //texture unit 0 - glEnable(GL_TEXTURE_GEN_T); //texture unit 0 - glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - } - - // Use the fact that we know all water faces are the same size - // to save some computation - - // Slowly move texture coordinates over time so the watter appears - // to be moving. - F32 movement_period_secs = 50.f; - - F32 offset = fmod(gFrameTimeSeconds, movement_period_secs); - - if (movement_period_secs != 0) - { - offset /= movement_period_secs; - } - else - { - offset = 0; - } - - F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset }; - F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset }; - - if (!shader) - { - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); - } - else - { - shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0); - shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1); - } - - gGL.diffuseColor3f(1.f, 1.f, 1.f); - - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - if (voskyp->isReflFace(face)) - { - continue; - } - - face->renderIndexed(); - } - - stop_glerror(); - - if (!shader) - { - // Reset the settings back to expected values - glDisable(GL_TEXTURE_GEN_S); //texture unit 0 - glDisable(GL_TEXTURE_GEN_T); //texture unit 0 - } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); -} - - -void LLDrawPoolWater::renderReflection(LLFace* face) -{ - LLVOSky *voskyp = gSky.mVOSkyp; - - if (!voskyp) - { - return; - } - - if (!face->getGeomCount()) - { - return; - } - - S8 dr = voskyp->getDrawRefl(); - if (dr < 0) - { - return; - } - - LLGLSNoFog noFog; - - gGL.getTexUnit(0)->bind((dr == 0) ? voskyp->getSunTex() : voskyp->getMoonTex()); - - LLOverrideFaceColor override(this, LLColor4(face->getFaceColor().mV)); - face->renderIndexed(); -} - -void LLDrawPoolWater::shade() -{ - if (!deferred_render) - { - gGL.setColorMask(true, true); - } - - LLVOSky *voskyp = gSky.mVOSkyp; - - if(voskyp == NULL) - { - return; - } - - LLGLDisable blend(GL_BLEND); - - LLColor3 light_diffuse(0,0,0); - F32 light_exp = 0.0f; - LLVector3 light_dir; - LLColor3 light_color; - - LLEnvironment& environment = LLEnvironment::instance(); - LLSettingsWater::ptr_t pwater = environment.getCurrentWater(); - LLSettingsSky::ptr_t psky = environment.getCurrentSky(); - - light_dir = environment.getLightDirection(); - light_dir.normalize(); - - bool sun_up = environment.getIsSunUp(); - bool moon_up = environment.getIsMoonUp(); - - if (sun_up) - { - light_color = light_color + psky->getSunAmbient(); - light_diffuse += psky->getSunDiffuse(); - } - - light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0.f); - - if (moon_up) - { - LLColor3 moon_diffuse_color = psky->getMoonDiffuse(); - light_color += moon_diffuse_color; - light_diffuse += moon_diffuse_color * 0.5f; - - if (!sun_up) - { - light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0.f); - } - } - - light_diffuse.normalize(); - light_diffuse *= (light_exp + 0.25f); - - light_exp *= light_exp; - light_exp *= light_exp; - light_exp *= light_exp; - light_exp *= light_exp; - light_exp *= 256.f; - light_exp = light_exp > 32.f ? light_exp : 32.f; - - light_diffuse *= 6.f; - - LLGLSLShader* shader; - - F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - LLEnvironment::instance().getWaterHeight(); - - if (eyedepth < 0.f && LLPipeline::sWaterReflections) - { - if (deferred_render) - { - shader = &gDeferredUnderWaterProgram; - } - else - { - shader = &gUnderWaterProgram; - } - } - else if (deferred_render) - { - shader = &gDeferredWaterProgram; - } - else - { - shader = &gWaterProgram; - } - - shader->bind(); - - if (deferred_render) - { - 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); - } - } - - sTime = (F32)LLFrameTimer::getElapsedSeconds() * 0.5f; - - S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX); - - if (reftex > -1) - { - gGL.getTexUnit(reftex)->activate(); - gGL.getTexUnit(reftex)->bind(&gPipeline.mWaterRef); - gGL.getTexUnit(0)->activate(); - } - - //bind normal map - S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); - - if (mWaterNormp[0]) - { - gGL.getTexUnit(bumpTex)->bind(mWaterNormp[0]) ; - - if (gSavedSettings.getBOOL("RenderWaterMipNormal")) - { - mWaterNormp[0]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); - } - else - { - mWaterNormp[0]->setFilteringOption(LLTexUnit::TFO_POINT); - } - } - - if (mWaterNormp[1]) - { - bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP2); - - gGL.getTexUnit(bumpTex)->bind(mWaterNormp[1]) ; - - if (gSavedSettings.getBOOL("RenderWaterMipNormal")) - { - mWaterNormp[1]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); - } - else - { - mWaterNormp[1]->setFilteringOption(LLTexUnit::TFO_POINT); - } - } - - shader->uniform3fv(LLShaderMgr::WATER_FOGCOLOR, 1, pwater->getWaterFogColor().mV); - shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, pwater->getWaterFogDensity()); - - // bind reflection texture from RenderTarget - S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); - gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); - - if (mVertexShaderLevel == 1) - { - LLColor4 fog_color(pwater->getWaterFogColor(), 0.f); - fog_color[3] = pwater->getWaterFogDensity(); - shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, fog_color.mV); - } - - F32 screenRes[] = - { - 1.f/gGLViewport[2], - 1.f/gGLViewport[3] - }; - shader->uniform2fv(LLShaderMgr::DEFERRED_SCREEN_RES, 1, screenRes); - stop_glerror(); - - S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); - stop_glerror(); - - //shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix); - shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth); - shader->uniform1f(LLShaderMgr::WATER_TIME, sTime); - shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV); - shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); - shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); - if (LLEnvironment::instance().isCloudScrollPaused()) - { - static const std::array zerowave{ {0.0f, 0.0f} }; - - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, zerowave.data()); - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, zerowave.data()); - } - else - { - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, pwater->getWave1Dir().mV); - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, pwater->getWave2Dir().mV); - } - shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV); - - shader->uniform3fv(LLShaderMgr::WATER_NORM_SCALE, 1, pwater->getNormalScale().mV); - shader->uniform1f(LLShaderMgr::WATER_FRESNEL_SCALE, pwater->getFresnelScale()); - 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 scaledAngle = 1.f - sunAngle; - - shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE, sunAngle); - shader->uniform1f(LLShaderMgr::WATER_SCALED_ANGLE, scaledAngle); - shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f*sunAngle); - - LLColor4 water_color; - LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); - F32 up_dot = camera_up * LLVector3::z_axis; - if (LLViewerCamera::getInstance()->cameraUnderWater()) - { - water_color.setVec(1.f, 1.f, 1.f, 0.4f); - shader->uniform1f(LLShaderMgr::WATER_REFSCALE, pwater->getScaleBelow()); - } - else - { - water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); - shader->uniform1f(LLShaderMgr::WATER_REFSCALE, pwater->getScaleAbove()); - } - - if (water_color.mV[3] > 0.9f) - { - water_color.mV[3] = 0.9f; - } - - { - LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0); - LLGLDisable cullface(GL_CULL_FACE); - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - - if (voskyp->isReflFace(face)) - { - continue; - } - - LLVOWater* water = (LLVOWater*) face->getViewerObject(); - gGL.getTexUnit(diffTex)->bind(face->getTexture()); - - sNeedsReflectionUpdate = TRUE; - - if (water->getUseTexture() || !water->getIsEdgePatch()) - { - sNeedsDistortionUpdate = TRUE; - face->renderIndexed(); - } - // using squash clip for deferred rendering makes the horizon lines match - // between ALM and non-ALM rendering (SL-1655), but introduces an ugly seem between - // near and far water(SL-9696)...we're going to live with the former and not cause the latter +/** + * @file lldrawpoolwater.cpp + * @brief LLDrawPoolWater class implementation + * + * $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 "llviewerprecompiledheaders.h" +#include "llfeaturemanager.h" +#include "lldrawpoolwater.h" + +#include "llviewercontrol.h" +#include "lldir.h" +#include "llerror.h" +#include "m3math.h" +#include "llrender.h" + +#include "llagent.h" // for gAgent for getRegion for getWaterHeight +#include "llcubemap.h" +#include "lldrawable.h" +#include "llface.h" +#include "llsky.h" +#include "llviewertexturelist.h" +#include "llviewerregion.h" +#include "llvosky.h" +#include "llvowater.h" +#include "llworld.h" +#include "pipeline.h" +#include "llviewershadermgr.h" +#include "llenvironment.h" +#include "llsettingssky.h" +#include "llsettingswater.h" + +static float sTime; + +BOOL deferred_render = FALSE; + +BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE; +BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE; +BOOL LLDrawPoolWater::sNeedsDistortionUpdate = TRUE; +F32 LLDrawPoolWater::sWaterFogEnd = 0.f; + +LLDrawPoolWater::LLDrawPoolWater() : LLFacePool(POOL_WATER) +{ +} + +LLDrawPoolWater::~LLDrawPoolWater() +{ +} + +void LLDrawPoolWater::setTransparentTextures(const LLUUID& transparentTextureId, const LLUUID& nextTransparentTextureId) +{ + LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); + mWaterImagep[0] = LLViewerTextureManager::getFetchedTexture(!transparentTextureId.isNull() ? transparentTextureId : pwater->GetDefaultTransparentTextureAssetId()); + mWaterImagep[1] = LLViewerTextureManager::getFetchedTexture(!nextTransparentTextureId.isNull() ? nextTransparentTextureId : (!transparentTextureId.isNull() ? transparentTextureId : pwater->GetDefaultTransparentTextureAssetId())); + mWaterImagep[0]->addTextureStats(1024.f*1024.f); + mWaterImagep[1]->addTextureStats(1024.f*1024.f); +} + +void LLDrawPoolWater::setOpaqueTexture(const LLUUID& opaqueTextureId) +{ + LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); + mOpaqueWaterImagep = LLViewerTextureManager::getFetchedTexture(opaqueTextureId); + mOpaqueWaterImagep->addTextureStats(1024.f*1024.f); +} + +void LLDrawPoolWater::setNormalMaps(const LLUUID& normalMapId, const LLUUID& nextNormalMapId) +{ + LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); + mWaterNormp[0] = LLViewerTextureManager::getFetchedTexture(!normalMapId.isNull() ? normalMapId : pwater->GetDefaultWaterNormalAssetId()); + mWaterNormp[1] = LLViewerTextureManager::getFetchedTexture(!nextNormalMapId.isNull() ? nextNormalMapId : (!normalMapId.isNull() ? normalMapId : pwater->GetDefaultWaterNormalAssetId())); + mWaterNormp[0]->addTextureStats(1024.f*1024.f); + mWaterNormp[1]->addTextureStats(1024.f*1024.f); +} + +//static +void LLDrawPoolWater::restoreGL() +{ + /*LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); + if (pwater) + { + setTransparentTextures(pwater->getTransparentTextureID(), pwater->getNextTransparentTextureID()); + setOpaqueTexture(pwater->GetDefaultOpaqueTextureAssetId()); + setNormalMaps(pwater->getNormalMapID(), pwater->getNextNormalMapID()); + }*/ +} + +LLDrawPool *LLDrawPoolWater::instancePool() +{ + LL_ERRS() << "Should never be calling instancePool on a water pool!" << LL_ENDL; + return NULL; +} + + +void LLDrawPoolWater::prerender() +{ + mVertexShaderLevel = (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) ? LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0; +} + +S32 LLDrawPoolWater::getNumPasses() +{ + if (LLViewerCamera::getInstance()->getOrigin().mV[2] < 1024.f) + { + return 1; + } + + return 0; +} + +void LLDrawPoolWater::beginPostDeferredPass(S32 pass) +{ + beginRenderPass(pass); + deferred_render = TRUE; +} + +void LLDrawPoolWater::endPostDeferredPass(S32 pass) +{ + endRenderPass(pass); + deferred_render = FALSE; +} + +//=============================== +//DEFERRED IMPLEMENTATION +//=============================== +void LLDrawPoolWater::renderDeferred(S32 pass) +{ + LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); + deferred_render = TRUE; + shade(); + deferred_render = FALSE; +} + +//========================================= + +void LLDrawPoolWater::render(S32 pass) +{ + LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); + if (mDrawFace.empty() || LLDrawable::getCurrentFrame() <= 1) + { + return; + } + + //do a quick 'n dirty depth sort + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace* facep = *iter; + facep->mDistance = -facep->mCenterLocal.mV[2]; + } + + std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater()); + + // See if we are rendering water as opaque or not + if (!gSavedSettings.getBOOL("RenderTransparentWater")) + { + // render water for low end hardware + renderOpaqueLegacyWater(); + return; + } + + LLGLEnable blend(GL_BLEND); + + if ((mVertexShaderLevel > 0) && !sSkipScreenCopy) + { + shade(); + return; + } + + LLVOSky *voskyp = gSky.mVOSkyp; + + stop_glerror(); + + if (!gGLManager.mHasMultitexture) + { + // Ack! No multitexture! Bail! + return; + } + + LLFace* refl_face = voskyp->getReflFace(); + + gPipeline.disableLights(); + + LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); + + LLGLDisable cullFace(GL_CULL_FACE); + + // Set up second pass first + gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->bind(mWaterImagep[0]) ; + + gGL.getTexUnit(2)->activate(); + gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(2)->bind(mWaterImagep[1]) ; + + LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); + F32 up_dot = camera_up * LLVector3::z_axis; + + LLColor4 water_color; + if (LLViewerCamera::getInstance()->cameraUnderWater()) + { + water_color.setVec(1.f, 1.f, 1.f, 0.4f); + } + else + { + water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); + } + + gGL.diffuseColor4fv(water_color.mV); + + // Automatically generate texture coords for detail map + glEnable(GL_TEXTURE_GEN_S); //texture unit 1 + glEnable(GL_TEXTURE_GEN_T); //texture unit 1 + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + + // Slowly move over time. + F32 offset = fmod(gFrameTimeSeconds*2.f, 100.f); + F32 tp0[4] = {16.f/256.f, 0.0f, 0.0f, offset*0.01f}; + F32 tp1[4] = {0.0f, 16.f/256.f, 0.0f, offset*0.01f}; + glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); + glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); + + gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); + gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); + + gGL.getTexUnit(0)->activate(); + + glClearStencil(1); + glClear(GL_STENCIL_BUFFER_BIT); + LLGLEnable gls_stencil(GL_STENCIL_TEST); + glStencilOp(GL_KEEP, GL_REPLACE, GL_KEEP); + glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF); + + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + if (voskyp->isReflFace(face)) + { + continue; + } + gGL.getTexUnit(0)->bind(face->getTexture()); + face->renderIndexed(); + } + + // Now, disable texture coord generation on texture state 1 + gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->disable(); + + glDisable(GL_TEXTURE_GEN_S); //texture unit 1 + glDisable(GL_TEXTURE_GEN_T); //texture unit 1 + + gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->disable(); + + glDisable(GL_TEXTURE_GEN_S); //texture unit 1 + glDisable(GL_TEXTURE_GEN_T); //texture unit 1 + + // Disable texture coordinate and color arrays + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + stop_glerror(); + + if (gSky.mVOSkyp->getCubeMap()) + { + gSky.mVOSkyp->getCubeMap()->enable(0); + gSky.mVOSkyp->getCubeMap()->bind(); + + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview(); + LLMatrix4 camera_rot(camera_mat.getMat3()); + camera_rot.invert(); + + gGL.loadMatrix((F32 *)camera_rot.mMatrix); + + gGL.matrixMode(LLRender::MM_MODELVIEW); + LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot); + + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + if (voskyp->isReflFace(face)) + { + //refl_face = face; + continue; + } + + if (face->getGeomCount() > 0) + { + face->renderIndexed(); + } + } + + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + + gSky.mVOSkyp->getCubeMap()->disable(); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + + } + + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + + if (refl_face) + { + glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF); + renderReflection(refl_face); + } + + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); +} + +// for low end hardware +void LLDrawPoolWater::renderOpaqueLegacyWater() +{ + LLVOSky *voskyp = gSky.mVOSkyp; + + LLGLSLShader* shader = NULL; + if (LLGLSLShader::sNoFixedFunction) + { + if (LLPipeline::sUnderWaterRender) + { + shader = &gObjectSimpleNonIndexedTexGenWaterProgram; + } + else + { + shader = &gObjectSimpleNonIndexedTexGenProgram; + } + + shader->bind(); + } + + stop_glerror(); + + // Depth sorting and write to depth buffer + // since this is opaque, we should see nothing + // behind the water. No blending because + // of no transparency. And no face culling so + // that the underside of the water is also opaque. + LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); + LLGLDisable no_cull(GL_CULL_FACE); + LLGLDisable no_blend(GL_BLEND); + + gPipeline.disableLights(); + + // Activate the texture binding and bind one + // texture since all images will have the same texture + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->bind(mOpaqueWaterImagep); + + // Automatically generate texture coords for water texture + if (!shader) + { + glEnable(GL_TEXTURE_GEN_S); //texture unit 0 + glEnable(GL_TEXTURE_GEN_T); //texture unit 0 + glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + } + + // Use the fact that we know all water faces are the same size + // to save some computation + + // Slowly move texture coordinates over time so the watter appears + // to be moving. + F32 movement_period_secs = 50.f; + + F32 offset = fmod(gFrameTimeSeconds, movement_period_secs); + + if (movement_period_secs != 0) + { + offset /= movement_period_secs; + } + else + { + offset = 0; + } + + F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset }; + F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset }; + + if (!shader) + { + glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); + glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); + } + else + { + shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0); + shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1); + } + + gGL.diffuseColor3f(1.f, 1.f, 1.f); + + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + if (voskyp->isReflFace(face)) + { + continue; + } + + face->renderIndexed(); + } + + stop_glerror(); + + if (!shader) + { + // Reset the settings back to expected values + glDisable(GL_TEXTURE_GEN_S); //texture unit 0 + glDisable(GL_TEXTURE_GEN_T); //texture unit 0 + } + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); +} + + +void LLDrawPoolWater::renderReflection(LLFace* face) +{ + LLVOSky *voskyp = gSky.mVOSkyp; + + if (!voskyp) + { + return; + } + + if (!face->getGeomCount()) + { + return; + } + + S8 dr = voskyp->getDrawRefl(); + if (dr < 0) + { + return; + } + + LLGLSNoFog noFog; + + gGL.getTexUnit(0)->bind((dr == 0) ? voskyp->getSunTex() : voskyp->getMoonTex()); + + LLOverrideFaceColor override(this, LLColor4(face->getFaceColor().mV)); + face->renderIndexed(); +} + +void LLDrawPoolWater::shade() +{ + if (!deferred_render) + { + gGL.setColorMask(true, true); + } + + LLVOSky *voskyp = gSky.mVOSkyp; + + if(voskyp == NULL) + { + return; + } + + LLGLDisable blend(GL_BLEND); + + LLColor3 light_diffuse(0,0,0); + F32 light_exp = 0.0f; + LLVector3 light_dir; + LLColor3 light_color; + + LLEnvironment& environment = LLEnvironment::instance(); + LLSettingsWater::ptr_t pwater = environment.getCurrentWater(); + LLSettingsSky::ptr_t psky = environment.getCurrentSky(); + + light_dir = environment.getLightDirection(); + light_dir.normalize(); + + bool sun_up = environment.getIsSunUp(); + bool moon_up = environment.getIsMoonUp(); + + if (sun_up) + { + light_color = light_color + psky->getSunAmbient(); + light_diffuse += psky->getSunDiffuse(); + } + + light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0.f); + + if (moon_up) + { + LLColor3 moon_diffuse_color = psky->getMoonDiffuse(); + light_color += moon_diffuse_color; + light_diffuse += moon_diffuse_color * 0.5f; + + if (!sun_up) + { + light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0.f); + } + } + + light_diffuse.normalize(); + light_diffuse *= (light_exp + 0.25f); + + light_exp *= light_exp; + light_exp *= light_exp; + light_exp *= light_exp; + light_exp *= light_exp; + light_exp *= 256.f; + light_exp = light_exp > 32.f ? light_exp : 32.f; + + light_diffuse *= 6.f; + + LLGLSLShader* shader; + + F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - LLEnvironment::instance().getWaterHeight(); + + if (eyedepth < 0.f && LLPipeline::sWaterReflections) + { + if (deferred_render) + { + shader = &gDeferredUnderWaterProgram; + } + else + { + shader = &gUnderWaterProgram; + } + } + else if (deferred_render) + { + shader = &gDeferredWaterProgram; + } + else + { + shader = &gWaterProgram; + } + + shader->bind(); + + if (deferred_render) + { + 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); + } + } + + sTime = (F32)LLFrameTimer::getElapsedSeconds() * 0.5f; + + S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX); + + if (reftex > -1) + { + gGL.getTexUnit(reftex)->activate(); + gGL.getTexUnit(reftex)->bind(&gPipeline.mWaterRef); + gGL.getTexUnit(0)->activate(); + } + + //bind normal map + S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); + + if (mWaterNormp[0]) + { + gGL.getTexUnit(bumpTex)->bind(mWaterNormp[0]) ; + + if (gSavedSettings.getBOOL("RenderWaterMipNormal")) + { + mWaterNormp[0]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); + } + else + { + mWaterNormp[0]->setFilteringOption(LLTexUnit::TFO_POINT); + } + } + + if (mWaterNormp[1]) + { + bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP2); + + gGL.getTexUnit(bumpTex)->bind(mWaterNormp[1]) ; + + if (gSavedSettings.getBOOL("RenderWaterMipNormal")) + { + mWaterNormp[1]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); + } + else + { + mWaterNormp[1]->setFilteringOption(LLTexUnit::TFO_POINT); + } + } + + shader->uniform3fv(LLShaderMgr::WATER_FOGCOLOR, 1, pwater->getWaterFogColor().mV); + shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, pwater->getWaterFogDensity()); + + // bind reflection texture from RenderTarget + S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); + gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); + + if (mVertexShaderLevel == 1) + { + LLColor4 fog_color(pwater->getWaterFogColor(), 0.f); + fog_color[3] = pwater->getWaterFogDensity(); + shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, fog_color.mV); + } + + F32 screenRes[] = + { + 1.f/gGLViewport[2], + 1.f/gGLViewport[3] + }; + shader->uniform2fv(LLShaderMgr::DEFERRED_SCREEN_RES, 1, screenRes); + stop_glerror(); + + S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); + stop_glerror(); + + //shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix); + shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth); + shader->uniform1f(LLShaderMgr::WATER_TIME, sTime); + shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV); + shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); + shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); + if (LLEnvironment::instance().isCloudScrollPaused()) + { + static const std::array zerowave{ {0.0f, 0.0f} }; + + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, zerowave.data()); + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, zerowave.data()); + } + else + { + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, pwater->getWave1Dir().mV); + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, pwater->getWave2Dir().mV); + } + shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV); + + shader->uniform3fv(LLShaderMgr::WATER_NORM_SCALE, 1, pwater->getNormalScale().mV); + shader->uniform1f(LLShaderMgr::WATER_FRESNEL_SCALE, pwater->getFresnelScale()); + 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 scaledAngle = 1.f - sunAngle; + + shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE, sunAngle); + shader->uniform1f(LLShaderMgr::WATER_SCALED_ANGLE, scaledAngle); + shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f*sunAngle); + + LLColor4 water_color; + LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); + F32 up_dot = camera_up * LLVector3::z_axis; + if (LLViewerCamera::getInstance()->cameraUnderWater()) + { + water_color.setVec(1.f, 1.f, 1.f, 0.4f); + shader->uniform1f(LLShaderMgr::WATER_REFSCALE, pwater->getScaleBelow()); + } + else + { + water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); + shader->uniform1f(LLShaderMgr::WATER_REFSCALE, pwater->getScaleAbove()); + } + + if (water_color.mV[3] > 0.9f) + { + water_color.mV[3] = 0.9f; + } + + { + LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0); + LLGLDisable cullface(GL_CULL_FACE); + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + + if (voskyp->isReflFace(face)) + { + continue; + } + + LLVOWater* water = (LLVOWater*) face->getViewerObject(); + gGL.getTexUnit(diffTex)->bind(face->getTexture()); + + sNeedsReflectionUpdate = TRUE; + + if (water->getUseTexture() || !water->getIsEdgePatch()) + { + sNeedsDistortionUpdate = TRUE; + face->renderIndexed(); + } + // using squash clip for deferred rendering makes the horizon lines match + // between ALM and non-ALM rendering (SL-1655), but introduces an ugly seem between + // near and far water(SL-9696)...we're going to live with the former and not cause the latter else if (gGLManager.mHasDepthClamp || deferred_render) - { - face->renderIndexed(); - } - else - { - LLGLSquashToFarClip far_clip(get_current_projection()); - face->renderIndexed(); - } - } - } - - shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); - shader->disableTexture(LLShaderMgr::WATER_SCREENTEX); - shader->disableTexture(LLShaderMgr::BUMP_MAP); - shader->disableTexture(LLShaderMgr::DIFFUSE_MAP); - shader->disableTexture(LLShaderMgr::WATER_REFTEX); - shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); - - shader->unbind(); - - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - if (!deferred_render) - { - gGL.setColorMask(true, false); - } - -} - -LLViewerTexture *LLDrawPoolWater::getDebugTexture() -{ - return LLViewerFetchedTexture::sSmokeImagep; -} - -LLColor3 LLDrawPoolWater::getDebugColor() const -{ - return LLColor3(0.f, 1.f, 1.f); -} + { + face->renderIndexed(); + } + else + { + LLGLSquashToFarClip far_clip(get_current_projection()); + face->renderIndexed(); + } + } + } + + shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); + shader->disableTexture(LLShaderMgr::WATER_SCREENTEX); + shader->disableTexture(LLShaderMgr::BUMP_MAP); + shader->disableTexture(LLShaderMgr::DIFFUSE_MAP); + shader->disableTexture(LLShaderMgr::WATER_REFTEX); + shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); + + shader->unbind(); + + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + if (!deferred_render) + { + gGL.setColorMask(true, false); + } + +} + +LLViewerTexture *LLDrawPoolWater::getDebugTexture() +{ + return LLViewerFetchedTexture::sSmokeImagep; +} + +LLColor3 LLDrawPoolWater::getDebugColor() const +{ + return LLColor3(0.f, 1.f, 1.f); +} diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index d74b77c880..302647215f 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -74,311 +74,311 @@ class LLVOCachePartition; class LLViewerRegion: public LLCapabilityProvider // implements this interface { public: - //MUST MATCH THE ORDER OF DECLARATION IN CONSTRUCTOR + //MUST MATCH THE ORDER OF DECLARATION IN CONSTRUCTOR typedef enum - { + { PARTITION_HUD=0, - PARTITION_TERRAIN, - PARTITION_VOIDWATER, - PARTITION_WATER, - PARTITION_TREE, - PARTITION_PARTICLE, - PARTITION_GRASS, - PARTITION_VOLUME, - PARTITION_BRIDGE, - PARTITION_HUD_PARTICLE, - PARTITION_VO_CACHE, - PARTITION_NONE, - NUM_PARTITIONS - } eObjectPartitions; + PARTITION_TERRAIN, + PARTITION_VOIDWATER, + PARTITION_WATER, + PARTITION_TREE, + PARTITION_PARTICLE, + PARTITION_GRASS, + PARTITION_VOLUME, + PARTITION_BRIDGE, + PARTITION_HUD_PARTICLE, + PARTITION_VO_CACHE, + PARTITION_NONE, + NUM_PARTITIONS + } eObjectPartitions; - typedef boost::signals2::signal caps_received_signal_t; + typedef boost::signals2::signal caps_received_signal_t; - LLViewerRegion(const U64 &handle, - const LLHost &host, - const U32 surface_grid_width, - const U32 patch_grid_width, - const F32 region_width_meters); - ~LLViewerRegion(); + LLViewerRegion(const U64 &handle, + const LLHost &host, + const U32 surface_grid_width, + const U32 patch_grid_width, + const F32 region_width_meters); + ~LLViewerRegion(); - // Call this after you have the region name and handle. - void loadObjectCache(); - void saveObjectCache(); + // Call this after you have the region name and handle. + void loadObjectCache(); + void saveObjectCache(); - void sendMessage(); // Send the current message to this region's simulator - void sendReliableMessage(); // Send the current message to this region's simulator + void sendMessage(); // Send the current message to this region's simulator + void sendReliableMessage(); // Send the current message to this region's simulator - void setOriginGlobal(const LLVector3d &origin); - //void setAgentOffset(const LLVector3d &offset); - void updateRenderMatrix(); + void setOriginGlobal(const LLVector3d &origin); + //void setAgentOffset(const LLVector3d &offset); + void updateRenderMatrix(); - void setAllowDamage(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DAMAGE, b); } - void setAllowLandmark(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_LANDMARK, b); } - void setAllowSetHome(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_SET_HOME, b); } - void setResetHomeOnTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_RESET_HOME_ON_TELEPORT, b); } - void setSunFixed(BOOL b) { setRegionFlag(REGION_FLAGS_SUN_FIXED, b); } - //void setBlockFly(BOOL b) { setRegionFlag(REGION_FLAGS_BLOCK_FLY, b); } Never used - void setAllowDirectTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT, b); } + void setAllowDamage(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DAMAGE, b); } + void setAllowLandmark(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_LANDMARK, b); } + void setAllowSetHome(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_SET_HOME, b); } + void setResetHomeOnTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_RESET_HOME_ON_TELEPORT, b); } + void setSunFixed(BOOL b) { setRegionFlag(REGION_FLAGS_SUN_FIXED, b); } + //void setBlockFly(BOOL b) { setRegionFlag(REGION_FLAGS_BLOCK_FLY, b); } Never used + void setAllowDirectTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT, b); } - inline BOOL getAllowDamage() const; - inline BOOL getAllowLandmark() const; - inline BOOL getAllowSetHome() const; - inline BOOL getResetHomeOnTeleport() const; - inline BOOL getSunFixed() const; - inline BOOL getBlockFly() const; - inline BOOL getAllowDirectTeleport() const; - inline BOOL isPrelude() const; - inline BOOL getAllowTerraform() const; - inline BOOL getRestrictPushObject() const; - inline BOOL getReleaseNotesRequested() const; + inline BOOL getAllowDamage() const; + inline BOOL getAllowLandmark() const; + inline BOOL getAllowSetHome() const; + inline BOOL getResetHomeOnTeleport() const; + inline BOOL getSunFixed() const; + inline BOOL getBlockFly() const; + inline BOOL getAllowDirectTeleport() const; + inline BOOL isPrelude() const; + inline BOOL getAllowTerraform() const; + inline BOOL getRestrictPushObject() const; + inline BOOL getReleaseNotesRequested() const; - bool isAlive(); // can become false if circuit disconnects + bool isAlive(); // can become false if circuit disconnects - void setWaterHeight(F32 water_level); - F32 getWaterHeight() const; + void setWaterHeight(F32 water_level); + F32 getWaterHeight() const; - BOOL isVoiceEnabled() const; + BOOL isVoiceEnabled() const; - void setBillableFactor(F32 billable_factor) { mBillableFactor = billable_factor; } - F32 getBillableFactor() const { return mBillableFactor; } + void setBillableFactor(F32 billable_factor) { mBillableFactor = billable_factor; } + F32 getBillableFactor() const { return mBillableFactor; } - // Maximum number of primitives allowed, regardless of object - // bonus factor. - U32 getMaxTasks() const { return mMaxTasks; } - void setMaxTasks(U32 max_tasks) { mMaxTasks = max_tasks; } + // Maximum number of primitives allowed, regardless of object + // bonus factor. + U32 getMaxTasks() const { return mMaxTasks; } + void setMaxTasks(U32 max_tasks) { mMaxTasks = max_tasks; } - // Draw lines in the dirt showing ownership. Return number of - // vertices drawn. - S32 renderPropertyLines(); + // Draw lines in the dirt showing ownership. Return number of + // vertices drawn. + S32 renderPropertyLines(); - // Call this whenever you change the height data in the region. - // (Automatically called by LLSurfacePatch's update routine) - void dirtyHeights(); + // Call this whenever you change the height data in the region. + // (Automatically called by LLSurfacePatch's update routine) + void dirtyHeights(); - LLViewerParcelOverlay *getParcelOverlay() const + LLViewerParcelOverlay *getParcelOverlay() const { return mParcelOverlay; } - inline void setRegionFlag(U64 flag, BOOL on); - inline BOOL getRegionFlag(U64 flag) const; - void setRegionFlags(U64 flags); - U64 getRegionFlags() const { return mRegionFlags; } + inline void setRegionFlag(U64 flag, BOOL on); + inline BOOL getRegionFlag(U64 flag) const; + void setRegionFlags(U64 flags); + U64 getRegionFlags() const { return mRegionFlags; } - inline void setRegionProtocol(U64 protocol, BOOL on); - BOOL getRegionProtocol(U64 protocol) const; - void setRegionProtocols(U64 protocols) { mRegionProtocols = protocols; } - U64 getRegionProtocols() const { return mRegionProtocols; } + inline void setRegionProtocol(U64 protocol, BOOL on); + BOOL getRegionProtocol(U64 protocol) const; + void setRegionProtocols(U64 protocols) { mRegionProtocols = protocols; } + U64 getRegionProtocols() const { return mRegionProtocols; } - void setTimeDilation(F32 time_dilation); - F32 getTimeDilation() const { return mTimeDilation; } + void setTimeDilation(F32 time_dilation); + F32 getTimeDilation() const { return mTimeDilation; } - // Origin height is at zero. - const LLVector3d &getOriginGlobal() const; - LLVector3 getOriginAgent() const; + // Origin height is at zero. + const LLVector3d &getOriginGlobal() const; + LLVector3 getOriginAgent() const; - // Center is at the height of the water table. - const LLVector3d &getCenterGlobal() const; - LLVector3 getCenterAgent() const; + // Center is at the height of the water table. + const LLVector3d &getCenterGlobal() const; + LLVector3 getCenterAgent() const; - void setRegionNameAndZone(const std::string& name_and_zone); - const std::string& getName() const { return mName; } - const std::string& getZoning() const { return mZoning; } + void setRegionNameAndZone(const std::string& name_and_zone); + const std::string& getName() const { return mName; } + const std::string& getZoning() const { return mZoning; } - void setOwner(const LLUUID& owner_id); - const LLUUID& getOwner() const; + void setOwner(const LLUUID& owner_id); + const LLUUID& getOwner() const; - // Is the current agent on the estate manager list for this region? - void setIsEstateManager(BOOL b) { mIsEstateManager = b; } - BOOL isEstateManager() const { return mIsEstateManager; } - BOOL canManageEstate() const; + // Is the current agent on the estate manager list for this region? + void setIsEstateManager(BOOL b) { mIsEstateManager = b; } + BOOL isEstateManager() const { return mIsEstateManager; } + BOOL canManageEstate() const; - void setSimAccess(U8 sim_access) { mSimAccess = sim_access; } - U8 getSimAccess() const { return mSimAccess; } - const std::string getSimAccessString() const; + void setSimAccess(U8 sim_access) { mSimAccess = sim_access; } + U8 getSimAccess() const { return mSimAccess; } + const std::string getSimAccessString() const; - // Homestead-related getters; there are no setters as nobody should be - // setting them other than the individual message handler which is a member - S32 getSimClassID() const { return mClassID; } - S32 getSimCPURatio() const { return mCPURatio; } - const std::string& getSimColoName() const { return mColoName; } - const std::string& getSimProductSKU() const { return mProductSKU; } - std::string getLocalizedSimProductName() const; + // Homestead-related getters; there are no setters as nobody should be + // setting them other than the individual message handler which is a member + S32 getSimClassID() const { return mClassID; } + S32 getSimCPURatio() const { return mCPURatio; } + const std::string& getSimColoName() const { return mColoName; } + const std::string& getSimProductSKU() const { return mProductSKU; } + std::string getLocalizedSimProductName() const; - // Returns "Sandbox", "Expensive", etc. - static std::string regionFlagsToString(U64 flags); + // Returns "Sandbox", "Expensive", etc. + static std::string regionFlagsToString(U64 flags); - // Returns translated version of "Mature", "PG", "Adult", etc. - static std::string accessToString(U8 sim_access); + // Returns translated version of "Mature", "PG", "Adult", etc. + static std::string accessToString(U8 sim_access); - // Returns "M", "PG", "A" etc. - static std::string accessToShortString(U8 sim_access); - static U8 shortStringToAccess(const std::string &sim_access); + // Returns "M", "PG", "A" etc. + static std::string accessToShortString(U8 sim_access); + static U8 shortStringToAccess(const std::string &sim_access); - // Return access icon name - static std::string getAccessIcon(U8 sim_access); + // Return access icon name + static std::string getAccessIcon(U8 sim_access); - // helper function which just makes sure all interested parties - // can process the message. - static void processRegionInfo(LLMessageSystem* msg, void**); + // helper function which just makes sure all interested parties + // can process the message. + static void processRegionInfo(LLMessageSystem* msg, void**); - //check if the viewer camera is static - static BOOL isViewerCameraStatic(); - static void calcNewObjectCreationThrottle(); + //check if the viewer camera is static + static BOOL isViewerCameraStatic(); + static void calcNewObjectCreationThrottle(); - void setCacheID(const LLUUID& id); + void setCacheID(const LLUUID& id); - F32 getWidth() const { return mWidth; } + F32 getWidth() const { return mWidth; } - void idleUpdate(F32 max_update_time); - void lightIdleUpdate(); - bool addVisibleGroup(LLViewerOctreeGroup* group); - void addVisibleChildCacheEntry(LLVOCacheEntry* parent, LLVOCacheEntry* child); - void addActiveCacheEntry(LLVOCacheEntry* entry); + void idleUpdate(F32 max_update_time); + void lightIdleUpdate(); + bool addVisibleGroup(LLViewerOctreeGroup* group); + void addVisibleChildCacheEntry(LLVOCacheEntry* parent, LLVOCacheEntry* child); + void addActiveCacheEntry(LLVOCacheEntry* entry); void removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep); - void killCacheEntry(U32 local_id); //physically delete the cache entry + void killCacheEntry(U32 local_id); //physically delete the cache entry - // Like idleUpdate, but forces everything to complete regardless of - // how long it takes. - void forceUpdate(); + // Like idleUpdate, but forces everything to complete regardless of + // how long it takes. + void forceUpdate(); - void connectNeighbor(LLViewerRegion *neighborp, U32 direction); + void connectNeighbor(LLViewerRegion *neighborp, U32 direction); - void updateNetStats(); + void updateNetStats(); - U32 getPacketsLost() const; + U32 getPacketsLost() const; - S32 getHttpResponderID() const; + S32 getHttpResponderID() const; - // Get/set named capability URLs for this region. - void setSeedCapability(const std::string& url); - S32 getNumSeedCapRetries(); - void setCapability(const std::string& name, const std::string& url); - void setCapabilityDebug(const std::string& name, const std::string& url); - bool isCapabilityAvailable(const std::string& name) const; - // implements LLCapabilityProvider + // Get/set named capability URLs for this region. + void setSeedCapability(const std::string& url); + S32 getNumSeedCapRetries(); + void setCapability(const std::string& name, const std::string& url); + void setCapabilityDebug(const std::string& name, const std::string& url); + bool isCapabilityAvailable(const std::string& name) const; + // implements LLCapabilityProvider virtual std::string getCapability(const std::string& name) const; std::string getCapabilityDebug(const std::string& name) const; - // has region received its final (not seed) capability list? - bool capabilitiesReceived() const; - void setCapabilitiesReceived(bool received); - boost::signals2::connection setCapabilitiesReceivedCallback(const caps_received_signal_t::slot_type& cb); + // has region received its final (not seed) capability list? + bool capabilitiesReceived() const; + void setCapabilitiesReceived(bool received); + boost::signals2::connection setCapabilitiesReceivedCallback(const caps_received_signal_t::slot_type& cb); - static bool isSpecialCapabilityName(const std::string &name); - void logActiveCapabilities() const; + static bool isSpecialCapabilityName(const std::string &name); + void logActiveCapabilities() const; /// implements LLCapabilityProvider - /*virtual*/ const LLHost& getHost() const; - const U64 &getHandle() const { return mHandle; } + /*virtual*/ const LLHost& getHost() const; + const U64 &getHandle() const { return mHandle; } - LLSurface &getLand() const; + LLSurface &getLand() const; - // set and get the region id - const LLUUID& getRegionID() const; - void setRegionID(const LLUUID& region_id); + // set and get the region id + const LLUUID& getRegionID() const; + void setRegionID(const LLUUID& region_id); - BOOL pointInRegionGlobal(const LLVector3d &point_global) const; - LLVector3 getPosRegionFromGlobal(const LLVector3d &point_global) const; - LLVector3 getPosRegionFromAgent(const LLVector3 &agent_pos) const; - LLVector3 getPosAgentFromRegion(const LLVector3 ®ion_pos) const; - LLVector3d getPosGlobalFromRegion(const LLVector3 &offset) const; + BOOL pointInRegionGlobal(const LLVector3d &point_global) const; + LLVector3 getPosRegionFromGlobal(const LLVector3d &point_global) const; + LLVector3 getPosRegionFromAgent(const LLVector3 &agent_pos) const; + LLVector3 getPosAgentFromRegion(const LLVector3 ®ion_pos) const; + LLVector3d getPosGlobalFromRegion(const LLVector3 &offset) const; - LLVLComposition *getComposition() const; - F32 getCompositionXY(const S32 x, const S32 y) const; + LLVLComposition *getComposition() const; + F32 getCompositionXY(const S32 x, const S32 y) const; - BOOL isOwnedSelf(const LLVector3& pos); + BOOL isOwnedSelf(const LLVector3& pos); - // Owned by a group you belong to? (officer OR member) - BOOL isOwnedGroup(const LLVector3& pos); + // Owned by a group you belong to? (officer OR member) + BOOL isOwnedGroup(const LLVector3& pos); - // deal with map object updates in the world. - void updateCoarseLocations(LLMessageSystem* msg); + // deal with map object updates in the world. + void updateCoarseLocations(LLMessageSystem* msg); - F32 getLandHeightRegion(const LLVector3& region_pos); + F32 getLandHeightRegion(const LLVector3& region_pos); - U8 getCentralBakeVersion() { return mCentralBakeVersion; } + U8 getCentralBakeVersion() { return mCentralBakeVersion; } - void getInfo(LLSD& info); + void getInfo(LLSD& info); - bool meshRezEnabled() const; - bool meshUploadEnabled() const; + bool meshRezEnabled() const; + bool meshUploadEnabled() const; - // has region received its simulator features list? Requires an additional query after caps received. - void setSimulatorFeaturesReceived(bool); - bool simulatorFeaturesReceived() const; - boost::signals2::connection setSimulatorFeaturesReceivedCallback(const caps_received_signal_t::slot_type& cb); + // has region received its simulator features list? Requires an additional query after caps received. + void setSimulatorFeaturesReceived(bool); + bool simulatorFeaturesReceived() const; + boost::signals2::connection setSimulatorFeaturesReceivedCallback(const caps_received_signal_t::slot_type& cb); void getSimulatorFeatures(LLSD& info) const; - void setSimulatorFeatures(const LLSD& info); + void setSimulatorFeatures(const LLSD& info); - bool dynamicPathfindingEnabled() const; + bool dynamicPathfindingEnabled() const; - bool avatarHoverHeightEnabled() const; + bool avatarHoverHeightEnabled() const; - typedef enum - { - CACHE_MISS_TYPE_FULL = 0, - CACHE_MISS_TYPE_CRC, - CACHE_MISS_TYPE_NONE - } eCacheMissType; + typedef enum + { + CACHE_MISS_TYPE_FULL = 0, + CACHE_MISS_TYPE_CRC, + CACHE_MISS_TYPE_NONE + } eCacheMissType; - typedef enum - { - CACHE_UPDATE_DUPE = 0, - CACHE_UPDATE_CHANGED, - CACHE_UPDATE_ADDED, - CACHE_UPDATE_REPLACED - } eCacheUpdateResult; + typedef enum + { + CACHE_UPDATE_DUPE = 0, + CACHE_UPDATE_CHANGED, + CACHE_UPDATE_ADDED, + CACHE_UPDATE_REPLACED + } eCacheUpdateResult; - // handle a full update message - eCacheUpdateResult cacheFullUpdate(LLDataPackerBinaryBuffer &dp, U32 flags); + // handle a full update message + eCacheUpdateResult cacheFullUpdate(LLDataPackerBinaryBuffer &dp, U32 flags); eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp, U32 flags); - LLVOCacheEntry* getCacheEntryForOctree(U32 local_id); - LLVOCacheEntry* getCacheEntry(U32 local_id, bool valid = true); - bool probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type); - U64 getRegionCacheHitCount() { return mRegionCacheHitCount; } - U64 getRegionCacheMissCount() { return mRegionCacheMissCount; } - void requestCacheMisses(); - void addCacheMissFull(const U32 local_id); - //update object cache if the object receives a full-update or terse update - LLViewerObject* updateCacheEntry(U32 local_id, LLViewerObject* objectp, U32 update_type); - void findOrphans(U32 parent_id); - void clearCachedVisibleObjects(); - void dumpCache(); + LLVOCacheEntry* getCacheEntryForOctree(U32 local_id); + LLVOCacheEntry* getCacheEntry(U32 local_id, bool valid = true); + bool probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type); + U64 getRegionCacheHitCount() { return mRegionCacheHitCount; } + U64 getRegionCacheMissCount() { return mRegionCacheMissCount; } + void requestCacheMisses(); + void addCacheMissFull(const U32 local_id); + //update object cache if the object receives a full-update or terse update + LLViewerObject* updateCacheEntry(U32 local_id, LLViewerObject* objectp, U32 update_type); + void findOrphans(U32 parent_id); + void clearCachedVisibleObjects(); + void dumpCache(); - void unpackRegionHandshake(); + void unpackRegionHandshake(); - void calculateCenterGlobal(); - void calculateCameraDistance(); + void calculateCenterGlobal(); + void calculateCameraDistance(); - friend std::ostream& operator<<(std::ostream &s, const LLViewerRegion ®ion); + friend std::ostream& operator<<(std::ostream &s, const LLViewerRegion ®ion); /// implements LLCapabilityProvider virtual std::string getDescription() const; std::string getViewerAssetUrl() const { return mViewerAssetUrl; } - U32 getNumOfVisibleGroups() const; - U32 getNumOfActiveCachedObjects() const; - LLSpatialPartition* getSpatialPartition(U32 type); - LLVOCachePartition* getVOCachePartition(); + U32 getNumOfVisibleGroups() const; + U32 getNumOfActiveCachedObjects() const; + LLSpatialPartition* getSpatialPartition(U32 type); + LLVOCachePartition* getVOCachePartition(); - bool objectIsReturnable(const LLVector3& pos, const std::vector& boxes) const; + bool objectIsReturnable(const LLVector3& pos, const std::vector& boxes) const; bool childrenObjectReturnable( const std::vector& boxes ) const; - bool objectsCrossParcel(const std::vector& boxes) const; + bool objectsCrossParcel(const std::vector& boxes) const; void getNeighboringRegions( std::vector& uniqueRegions ); void getNeighboringRegionsStatus( std::vector& regions ); - const LLViewerRegionImpl * getRegionImpl() const { return mImpl; } - LLViewerRegionImpl * getRegionImplNC() { return mImpl; } + const LLViewerRegionImpl * getRegionImpl() const { return mImpl; } + LLViewerRegionImpl * getRegionImplNC() { return mImpl; } - // implements the materials capability throttle - bool materialsCapThrottled() const { return !mMaterialsCapThrottleTimer.hasExpired(); } - void resetMaterialsCapThrottle(); + // implements the materials capability throttle + bool materialsCapThrottled() const { return !mMaterialsCapThrottleTimer.hasExpired(); } + void resetMaterialsCapThrottle(); - U32 getMaxMaterialsPerTransaction() const; + U32 getMaxMaterialsPerTransaction() const; - void removeFromCreatedList(U32 local_id); + void removeFromCreatedList(U32 local_id); void addToCreatedList(U32 local_id); BOOL isPaused() const {return mPaused;} diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index d4c8d4f923..f046a903ed 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2194,8 +2194,9 @@ bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture) mat->setSpecularID(LLUUID::null); } break; - default: - break; + case LLRender::NUM_TEXTURE_CHANNELS: + //nothing to do, make compiler happy + break; } //switch } //for diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 9531e0a349..cafa49a229 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9818,18 +9818,25 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point); + F32 to_clip = fabsf(camera_height-water_height); + F32 pad = -to_clip*0.05f; //amount to "pad" clip plane by + //plane params LLVector3 pnorm; + F32 pd; + S32 water_clip = 0; if (!LLViewerCamera::getInstance()->cameraUnderWater()) { //camera is above water, clip plane points up pnorm.setVec(0,0,1); + pd = -water_height; plane.setVec(pnorm, -distance_to_water); water_clip = -1; } else { //camera is below water, clip plane points down pnorm = LLVector3(0,0,-1); + pd = water_height; plane.setVec(pnorm, distance_to_water); water_clip = 1; } @@ -10024,7 +10031,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) { //clip out geometry on the same side of water as the camera mat = get_current_modelview(); - LLPlane plane(-pnorm, -distance_to_water); + LLPlane plane(-pnorm, -(pd+pad)); LLGLUserClipPlane clip_plane(plane, mat, projection); static LLCullResult result; @@ -10089,7 +10096,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) gPipeline.popRenderTypeMask(); LLDrawPoolWater::sNeedsReflectionUpdate = FALSE; LLDrawPoolWater::sNeedsDistortionUpdate = FALSE; - LLPlane npnorm(-pnorm, -distance_to_water); + LLPlane npnorm(-pnorm, -pd); LLViewerCamera::getInstance()->setUserClipPlane(npnorm); LLGLState::checkStates(); From 501cd7d9022d1ac719fb56d22c6a8e3fd5d122ca Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 24 Sep 2018 19:50:08 +0100 Subject: [PATCH 07/15] SL-9711 modify clamping range on atmospheric additive color to balance between maintaining old look of WL settings and fixing SL1491 lens flare bug --- .../shaders/class2/windlight/atmosphericsVarsV.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index 3b87c70932..414ba3236a 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -75,7 +75,7 @@ void setAdditiveColor(vec3 v) { // SL-1491 clamp additive term to something reasonable to prevent // lens flares over non-reflective surfaces - v = clamp(v, vec3(0), vec3(0.2)); + v = clamp(v, vec3(0), vec3(0.8)); additive_color = v; vary_AdditiveColor = v; } From 70c18ba14b4ea831c109030b48096d7c1fd5e510 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 24 Sep 2018 14:55:21 -0700 Subject: [PATCH 08/15] SL-9736: 0.0 is no motion for cloud scroll. --- indra/llinventory/llsettingssky.cpp | 3 ++- indra/newview/llenvironment.cpp | 2 +- indra/newview/llpaneleditsky.cpp | 6 +----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 399692d80b..36e203cbf5 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -645,7 +645,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); - dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); + dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(0.0f)(0.0f); dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); @@ -752,6 +752,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) { LLVector2 cloud_scroll(legacy[SETTING_CLOUD_SCROLL_RATE]); + cloud_scroll -= LLVector2(10, 10); if (legacy.has(SETTING_LEGACY_ENABLE_CLOUD_SCROLL)) { LLSD enabled = legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL]; diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 1b38fceef7..5abb1b2e55 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -880,7 +880,7 @@ void LLEnvironment::updateCloudScroll() if (mCurrentEnvironment->getSky() && !mCloudScrollPaused) { - LLVector2 cloud_delta = static_cast(delta_t)* (mCurrentEnvironment->getSky()->getCloudScrollRate() - LLVector2(10.0, 10.0)) / 100.0; + LLVector2 cloud_delta = static_cast(delta_t)* (mCurrentEnvironment->getSky()->getCloudScrollRate()) / 100.0; mCloudScrollDelta += cloud_delta; } diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index 1b41529795..0d36fce90a 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -96,8 +96,6 @@ namespace const F32 SLIDER_SCALE_BLUE_HORIZON_DENSITY(2.0f); const F32 SLIDER_SCALE_GLOW_R(20.0f); const F32 SLIDER_SCALE_GLOW_B(-5.0f); - - const LLVector2 CLOUD_SCROLL_ADJUST(10, 10); } static LLPanelInjector t_settings_atmos("panel_settings_atmos"); @@ -300,7 +298,6 @@ void LLPanelSettingsSkyCloudTab::refresh() getChild(FIELD_SKY_CLOUD_SCALE)->setValue(mSkySettings->getCloudScale()); LLVector2 cloudScroll(mSkySettings->getCloudScrollRate()); - cloudScroll -= CLOUD_SCROLL_ADJUST; getChild(FIELD_SKY_CLOUD_SCROLL_XY)->setValue(cloudScroll.getValue()); getChild(FIELD_SKY_CLOUD_MAP)->setValue(mSkySettings->getCloudNoiseTextureId()); @@ -340,7 +337,6 @@ void LLPanelSettingsSkyCloudTab::onCloudScaleChanged() void LLPanelSettingsSkyCloudTab::onCloudScrollChanged() { LLVector2 scroll(getChild(FIELD_SKY_CLOUD_SCROLL_XY)->getValue()); - scroll += CLOUD_SCROLL_ADJUST; mSkySettings->setCloudScrollRate(scroll); setIsDirty(); } @@ -356,7 +352,7 @@ void LLPanelSettingsSkyCloudTab::onCloudDensityChanged() LLColor3 density(getChild(FIELD_SKY_CLOUD_DENSITY_X)->getValue().asReal(), getChild(FIELD_SKY_CLOUD_DENSITY_Y)->getValue().asReal(), getChild(FIELD_SKY_CLOUD_DENSITY_D)->getValue().asReal()); - + mSkySettings->setCloudPosDensity1(density); setIsDirty(); } From ed2e333a544acc467df0f1d97b4fc5d2fd72b3b2 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 24 Sep 2018 17:00:01 -0700 Subject: [PATCH 09/15] MAINT-9734: Change limits on settings values. --- indra/llcommon/indra_constants.cpp | 1 - indra/llcommon/indra_constants.h | 1 - indra/llinventory/llsettingssky.cpp | 33 ++++++++++--------- indra/llinventory/llsettingswater.cpp | 14 ++++---- .../xui/en/panel_settings_sky_atmos.xml | 12 +++---- .../xui/en/panel_settings_sky_clouds.xml | 14 ++++---- .../xui/en/panel_settings_sky_sunmoon.xml | 8 ++--- .../default/xui/en/panel_settings_water.xml | 24 +++++++++----- 8 files changed, 57 insertions(+), 50 deletions(-) diff --git a/indra/llcommon/indra_constants.cpp b/indra/llcommon/indra_constants.cpp index 7ea42a3fc0..601eb45570 100644 --- a/indra/llcommon/indra_constants.cpp +++ b/indra/llcommon/indra_constants.cpp @@ -64,7 +64,6 @@ const LLUUID IMG_ALPHA_GRAD ("e97cf410-8e61-7005-ec06-629eba4cd1fb"); // VIEW const LLUUID IMG_ALPHA_GRAD_2D ("38b86f85-2575-52a9-a531-23108d8da837"); // VIEWER const LLUUID IMG_TRANSPARENT ("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); // VIEWER -const LLUUID IMG_BLOOM1 ("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); // VIEWER const LLUUID TERRAIN_DIRT_DETAIL ("0bc58228-74a0-7e83-89bc-5c23464bcec5"); // VIEWER const LLUUID TERRAIN_GRASS_DETAIL ("63338ede-0037-c4fd-855b-015d77112fc8"); // VIEWER const LLUUID TERRAIN_MOUNTAIN_DETAIL ("303cd381-8560-7579-23f1-f0a880799740"); // VIEWER diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index a00a82aff0..010a190181 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -201,7 +201,6 @@ LL_COMMON_API extern const LLUUID IMG_ALPHA_GRAD; LL_COMMON_API extern const LLUUID IMG_ALPHA_GRAD_2D; LL_COMMON_API extern const LLUUID IMG_TRANSPARENT; -LL_COMMON_API extern const LLUUID IMG_BLOOM1; LL_COMMON_API extern const LLUUID TERRAIN_DIRT_DETAIL; LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL; LL_COMMON_API extern const LLUUID TERRAIN_MOUNTAIN_DETAIL; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 36e203cbf5..4543f00454 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -33,8 +33,11 @@ #include "v3colorutil.h" //========================================================================= -static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees -static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); +namespace { + const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees + const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); + const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); +} namespace { LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) @@ -480,17 +483,17 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); validation.push_back(Validator(SETTING_HAZE_DENSITY, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); validation.push_back(Validator(SETTING_HAZE_HORIZON, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); validation.push_back(Validator(SETTING_AMBIENT, false, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1000.0f))))); validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); @@ -501,17 +504,17 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY1, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(1.68841f)(1.0f)(1.0f)("*"))))); + LLSD(LLSDArray(1.0f)(1.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY2, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(1.68841f)(1.0f)(1.0f)("*"))))); + LLSD(LLSDArray(1.0f)(1.0f)(1.0f)("*"))))); validation.push_back(Validator(SETTING_CLOUD_SCALE, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.001f)(0.999f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.001f)(3.0f))))); validation.push_back(Validator(SETTING_CLOUD_SCROLL_RATE, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.0f)(0.0f)), - LLSD(LLSDArray(20.0f)(20.0f))))); + LLSD(LLSDArray(-50.0f)(-50.0f)), + LLSD(LLSDArray(50.0f)(50.0f))))); validation.push_back(Validator(SETTING_CLOUD_SHADOW, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_CLOUD_TEXTUREID, false, LLSD::TypeUUID)); @@ -521,14 +524,14 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_DOME_RADIUS, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(2000.0f))))); validation.push_back(Validator(SETTING_GAMMA, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(10.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(20.0f))))); validation.push_back(Validator(SETTING_GLOW, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.2f)("*")(-2.5f)("*")), - LLSD(LLSDArray(20.0f)("*")(0.0f)("*"))))); + LLSD(LLSDArray(0.2f)("*")(-10.0f)("*")), + LLSD(LLSDArray(40.0f)("*")(10.0f)("*"))))); validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4000.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(10000.0f))))); validation.push_back(Validator(SETTING_MOON_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); validation.push_back(Validator(SETTING_MOON_SCALE, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 652e211ac4..33f824028b 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -213,7 +213,7 @@ LLSettingsWater::validation_list_t LLSettingsWater::validationList() // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] validation.push_back(Validator(SETTING_BLUR_MULTIPILER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.16f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-0.5f)(0.5f))))); validation.push_back(Validator(SETTING_FOG_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)(1.0f)), @@ -232,17 +232,17 @@ LLSettingsWater::validation_list_t LLSettingsWater::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)), LLSD(LLSDArray(10.0f)(10.0f)(10.0f))))); validation.push_back(Validator(SETTING_SCALE_ABOVE, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(3.0f))))); validation.push_back(Validator(SETTING_SCALE_BELOW, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(3.0f))))); validation.push_back(Validator(SETTING_WAVE1_DIR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(-4.0f)(-4.0f)), - LLSD(LLSDArray(4.0f)(4.0f))))); + LLSD(LLSDArray(-20.0f)(-20.0f)), + LLSD(LLSDArray(20.0f)(20.0f))))); validation.push_back(Validator(SETTING_WAVE2_DIR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(-4.0f)(-4.0f)), - LLSD(LLSDArray(4.0f)(4.0f))))); + LLSD(LLSDArray(-20.0f)(-20.0f)), + LLSD(LLSDArray(20.0f)(20.0f))))); } return validation; diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml index fd66df0f74..8ef96009d4 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml @@ -119,7 +119,7 @@ layout="topleft" left_delta="5" min_val="0" - max_val="1" + max_val="5" name="haze_horizon" top_delta="20" width="207" @@ -142,7 +142,7 @@ layout="topleft" left_delta="5" min_val="0" - max_val="1" + max_val="5" name="haze_density" top_delta="20" width="207" @@ -164,7 +164,7 @@ initial_value="0" layout="topleft" left_delta="5" - max_val="10" + max_val="20" name="scene_gamma" top_delta="20" width="214" @@ -195,7 +195,7 @@ layout="topleft" left_delta="5" min_val="0.0001" - max_val="0.9" + max_val="2" name="density_multip" top_delta="20" width="207" @@ -218,7 +218,7 @@ layout="topleft" left_delta="5" min_val="0" - max_val="100" + max_val="1000" name="distance_multip" top_delta="20" width="219" @@ -241,7 +241,7 @@ layout="topleft" left_delta="5" min_val="0" - max_val="4000" + max_val="10000" name="max_alt" top_delta="20" width="219" diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml index 412ed8bf82..568345e01f 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml @@ -83,7 +83,7 @@ layout="topleft" left_delta="5" min_val="0" - max_val="1" + max_val="3" name="cloud_scale" top_delta="20" width="214" @@ -105,10 +105,10 @@ visible="true" left_delta="0" top_delta="21" - min_val_x="-10" - max_val_x="10" - min_val_y="-10" - max_val_y="10" /> + min_val_x="-30" + max_val_x="30" + min_val_y="-30" + max_val_y="30" /> @@ -214,10 +215,10 @@ visible="true" left_delta="0" top_delta="21" - min_val_x="-4" - max_val_x="4" - min_val_y="-4" - max_val_y="4" + min_val_x="-20" + max_val_x="20" + min_val_y="-20" + max_val_y="20" arrow_color="white"/> Date: Tue, 25 Sep 2018 20:27:59 +0300 Subject: [PATCH 10/15] SL-1961 EEP Altitude labels auto-adjustment --- indra/newview/llfloaterland.cpp | 1 - indra/newview/llpanelenvironment.cpp | 130 ++++++++++++------ indra/newview/llpanelenvironment.h | 2 + .../xui/en/panel_region_environment.xml | 4 +- 4 files changed, 90 insertions(+), 47 deletions(-) diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 3d3f5e8cfa..1147f54853 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -3297,7 +3297,6 @@ void LLPanelLandEnvironment::refresh() } LLPanelEnvironmentInfo::refresh(); - getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); } void LLPanelLandEnvironment::refreshFromSource() diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 1beba9db0c..aa8c6cf724 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -65,6 +65,7 @@ const std::string LLPanelEnvironmentInfo::BTN_EDIT("btn_edit"); const std::string LLPanelEnvironmentInfo::SLD_DAYLENGTH("sld_day_length"); const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset"); const std::string LLPanelEnvironmentInfo::SLD_ALTITUDES("sld_altitudes"); +const std::string LLPanelEnvironmentInfo::ICN_GROUND("icon_ground"); const std::string LLPanelEnvironmentInfo::CHK_ALLOWOVERRIDE("chk_allow_override"); const std::string LLPanelEnvironmentInfo::BTN_APPLY("btn_apply"); const std::string LLPanelEnvironmentInfo::BTN_CANCEL("btn_cancel"); @@ -94,12 +95,8 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET | LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES); -#if 0 -// Because the OSX is Very cranky when I don't use a variable. const U32 ALTITUDE_SLIDER_COUNT = 3; -#endif - const std::string alt_sliders[] = { "sld1", "sld2", @@ -249,6 +246,7 @@ void LLPanelEnvironmentInfo::refresh() updateAltLabel(alt_labels[idx], idx + 2, altitudes[idx+1]); mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]); } + readjustAltLabels(); } #endif @@ -363,6 +361,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_SETTINGS)->setVisible(false); getChild(PNL_BUTTONS)->setVisible(false); getChild(PNL_DISABLED)->setVisible(true); + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); updateEditFloater(mCurrentEnvironment); @@ -372,6 +371,13 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_BUTTONS)->setVisible(true); getChild(PNL_DISABLED)->setVisible(false); +#if 1 + // hiding the controls until Rider can get the simulator code to adjust altitudes done. + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); +#else + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(isRegion()); +#endif + S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled); @@ -383,6 +389,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(BTN_EDIT)->setEnabled(enabled); getChild(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); getChild(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); + getChild(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(enabled && isRegion() && !is_legacy); getChild(CHK_ALLOWOVERRIDE)->setEnabled(enabled && isRegion() && !is_legacy); getChild(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0)); getChild(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0)); @@ -426,10 +433,10 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky { LLMultiSliderCtrl *sld = getChild(SLD_ALTITUDES); LLRect sld_rect = sld->getRect(); - U32 sld_range = sld_rect.getHeight(); - U32 sld_bottom = sld_rect.mBottom; - U32 sld_offset = sld_rect.getWidth(); // Roughly identical to thumb's width in slider. - U32 pos = (sld_range - sld_offset) * ((alt_value - 100) / (4000 - 100)); + S32 sld_range = sld_rect.getHeight(); + S32 sld_bottom = sld_rect.mBottom; + S32 sld_offset = sld_rect.getWidth(); // Roughly identical to thumb's width in slider. + S32 pos = (sld_range - sld_offset) * ((alt_value - 100) / (4000 - 100)); // get related text box LLTextBox* text = getChild(alt_name); @@ -437,7 +444,7 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky { // move related text box LLRect rect = text->getRect(); - U32 height = rect.getHeight(); + S32 height = rect.getHeight(); rect.mBottom = sld_bottom + (sld_offset / 2 + 1) + pos - (height / 2); rect.mTop = rect.mBottom + height; text->setRect(rect); @@ -453,6 +460,59 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky } } +void LLPanelEnvironmentInfo::readjustAltLabels() +{ + // Restore ground label position + LLView* icon = getChild(ICN_GROUND); + LLTextBox* text = getChild(alt_labels[ALTITUDE_SLIDER_COUNT]); // one more field then sliders + LLRect ground_text_rect = text->getRect(); + LLRect icon_rect = icon->getRect(); + S32 height = ground_text_rect.getHeight(); + ground_text_rect.mBottom = icon_rect.mBottom + (icon_rect.getHeight()/2) - (height/2); + ground_text_rect.mTop = ground_text_rect.mBottom + height; + text->setRect(ground_text_rect); + + // Re-adjust all labels + // Very simple "adjust after the fact" method + // Note: labels are unordered, labels are 1 above sliders due to 'ground' + + for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) + { + LLTextBox* text_cmp = getChild(alt_labels[i]); + + for (U32 j = i + 1; j <= ALTITUDE_SLIDER_COUNT; j++) + { + LLTextBox* text_intr = getChild(alt_labels[j]); + if (text_cmp && text_intr) + { + LLRect cmp_rect = text_cmp->getRect(); + LLRect intr_rect = text_intr->getRect(); + S32 shift = 0; + if (cmp_rect.mBottom <= intr_rect.mTop && cmp_rect.mBottom >= intr_rect.mBottom) + { + // Aproximate shift + // We probably will need more cycle runs over all labels to get accurate one + // At the moment single cycle should do since we have too little elements to do something complicated + shift = (cmp_rect.mBottom - intr_rect.mTop) / 2; + } + else if (cmp_rect.mTop >= intr_rect.mBottom && cmp_rect.mTop <= intr_rect.mTop) + { + // Aproximate shift + shift = (cmp_rect.mTop - intr_rect.mBottom) / 2; + } + if (shift != 0) + { + cmp_rect.translate(0, -shift); + text_cmp->setRect(cmp_rect); + + intr_rect.translate(0, shift); + text_intr->setRect(intr_rect); + } + } + } + } +} + void LLPanelEnvironmentInfo::onSwitchDefaultSelection() { bool can_edit = canEdit(); @@ -491,51 +551,33 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da LLMultiSliderCtrl *sld = (LLMultiSliderCtrl *)cntrl; std::string sld_name = sld->getCurSlider(); F32 sld_value = sld->getCurSliderValue(); - U32 alt_index = 1; mAltitudes[sld_name].mAltitude = sld_value; - // find index of sky layer/altitude - altitudes_data_t::iterator iter = mAltitudes.begin(); + // update all labels since we could have jumped multiple and we will need to readjust + // (or sort by altitude, too little elements, so I didn't bother with efficiency) altitudes_data_t::iterator end = mAltitudes.end(); - while (iter!=end) + altitudes_data_t::iterator iter = mAltitudes.begin(); + altitudes_data_t::iterator iter2; + U32 new_index; + while (iter != end) { - if (sld_value > iter->second.mAltitude) + iter2 = mAltitudes.begin(); + new_index = 1; + while (iter2 != end) { - alt_index++; + if (iter->second.mAltitude > iter2->second.mAltitude) + { + new_index++; + } + iter2++; } + iter->second.mAltitudeIndex = new_index; + updateAltLabel(alt_labels[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); iter++; } - if (mAltitudes[sld_name].mAltitudeIndex != alt_index) - { - // update all labels since we could have jumped multiple - // (or sort by altitude, too little elements, so I didn't bother with efficiency) - altitudes_data_t::iterator iter = mAltitudes.begin(); - altitudes_data_t::iterator iter2; - U32 new_index; - while (iter != end) - { - iter2 = mAltitudes.begin(); - new_index = 1; - while (iter2 != end) - { - if (iter->second.mAltitude > iter2->second.mAltitude) - { - new_index++; - } - iter2++; - } - iter->second.mAltitudeIndex = new_index; - updateAltLabel(alt_labels[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); - iter++; - } - } - else - { - updateAltLabel(alt_labels[mAltitudes[sld_name].mLabelIndex], alt_index + 1, sld_value); - } - + readjustAltLabels(); setDirtyFlag(DIRTY_FLAG_ALTITUDES); } diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 2753e766ac..93fe186d6f 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -71,6 +71,7 @@ protected: static const std::string SLD_DAYLENGTH; static const std::string SLD_DAYOFFSET; static const std::string SLD_ALTITUDES; + static const std::string ICN_GROUND; static const std::string CHK_ALLOWOVERRIDE; static const std::string BTN_APPLY; static const std::string BTN_CANCEL; @@ -104,6 +105,7 @@ protected: bool getIsDirtyFlag(U32 flag) const { return ((mDirtyFlag & flag) != 0); } U32 getDirtyFlag() const { return mDirtyFlag; } void updateAltLabel(const std::string &alt_name, U32 sky_index, F32 alt_value); + void readjustAltLabels(); void onSwitchDefaultSelection(); void onSldDayLengthChanged(F32 value); diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml index 539d5a636b..856559cec8 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -244,7 +244,7 @@ width="17" orientation="vertical" increment="10" - initial_value="100" + min_val="100" max_val="4000" layout="topleft" left="15" @@ -277,7 +277,7 @@ height="12" layout="topleft" left_pad="3" - top_delta="0" + top_delta="2" width="200" name="ground"> Ground From 3778dd40856a1a56a6ce595ae08fb7e94cabae0d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 25 Sep 2018 22:20:07 +0100 Subject: [PATCH 11/15] SL-1505 and SL-9608 Get both reflections and clip plane bugs fixed (at the same damn time). --- indra/newview/lldrawpoolwater.cpp | 2 +- indra/newview/pipeline.cpp | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 56f3b75792..7a25e62651 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -721,7 +721,7 @@ void LLDrawPoolWater::shade() // using squash clip for deferred rendering makes the horizon lines match // between ALM and non-ALM rendering (SL-1655), but introduces an ugly seem between // near and far water(SL-9696)...we're going to live with the former and not cause the latter - else if (gGLManager.mHasDepthClamp || deferred_render) + else if (gGLManager.mHasDepthClamp || deferred_render) { face->renderIndexed(); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index cafa49a229..a513588568 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9818,25 +9818,22 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point); - F32 to_clip = fabsf(camera_height-water_height); - F32 pad = -to_clip*0.05f; //amount to "pad" clip plane by - //plane params LLVector3 pnorm; - F32 pd; + F32 plane_d; S32 water_clip = 0; if (!LLViewerCamera::getInstance()->cameraUnderWater()) { //camera is above water, clip plane points up pnorm.setVec(0,0,1); - pd = -water_height; + plane_d = -water_height; plane.setVec(pnorm, -distance_to_water); water_clip = -1; } else { //camera is below water, clip plane points down pnorm = LLVector3(0,0,-1); - pd = water_height; + plane_d = water_height; plane.setVec(pnorm, distance_to_water); water_clip = 1; } @@ -9869,6 +9866,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) stop_glerror(); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); glh::matrix4f current = get_current_modelview(); @@ -9988,6 +9986,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLPipeline::sRenderingWaterReflection = false; glCullFace(GL_BACK); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); mWaterRef.flush(); set_current_modelview(current); @@ -10031,7 +10030,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) { //clip out geometry on the same side of water as the camera mat = get_current_modelview(); - LLPlane plane(-pnorm, -(pd+pad)); + LLPlane plane(-pnorm, -distance_to_water); LLGLUserClipPlane clip_plane(plane, mat, projection); static LLCullResult result; @@ -10096,7 +10095,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) gPipeline.popRenderTypeMask(); LLDrawPoolWater::sNeedsReflectionUpdate = FALSE; LLDrawPoolWater::sNeedsDistortionUpdate = FALSE; - LLPlane npnorm(-pnorm, -pd); + LLPlane npnorm(-pnorm, -plane_d); LLViewerCamera::getInstance()->setUserClipPlane(npnorm); LLGLState::checkStates(); From 2a1a7396b22246ae526731d02a8548990187fe1b Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 25 Sep 2018 15:12:46 -0700 Subject: [PATCH 12/15] Fix slider max to 168 --- indra/newview/skins/default/xui/en/panel_region_environment.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml index 856559cec8..cfbe25129b 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -161,7 +161,7 @@ top_pad="6" name="sld_day_length" min_val="4" - max_val="178" + max_val="168" width="180" /> Date: Wed, 26 Sep 2018 17:39:55 +0300 Subject: [PATCH 13/15] SL-9732 FIXED [EEP] Save As does not provide dialogue to supply new setting name --- indra/newview/llfloatereditextdaycycle.cpp | 20 ++++++++++++---- indra/newview/llfloatereditextdaycycle.h | 3 ++- indra/newview/llfloaterfixedenvironment.cpp | 21 ++++++++++++---- indra/newview/llfloaterfixedenvironment.h | 3 ++- indra/newview/llsettingsvo.cpp | 14 +++++++---- indra/newview/llsettingsvo.h | 4 ++-- .../skins/default/xui/en/notifications.xml | 24 +++++++++++++++++++ 7 files changed, 72 insertions(+), 17 deletions(-) diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 96af840bba..fac0ddc27b 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -517,7 +517,9 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data) } else if (ctrl_action == ACTION_SAVEAS) { - doApplyCreateNewInventory(dayclone); + LLSD args; + args["DESC"] = dayclone->getName(); + LLNotificationsUtil::add("SaveSettingAs", args, LLSD(), boost::bind(&LLFloaterEditExtDayCycle::onSaveAsCommit, this, _1, _2, dayclone)); } else if ((ctrl_action == ACTION_APPLY_LOCAL) || (ctrl_action == ACTION_APPLY_PARCEL) || @@ -535,6 +537,16 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data) } } +void LLFloaterEditExtDayCycle::onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsDay::ptr_t &day) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option) + { + std::string settings_name = response["message"].asString(); + LLStringUtil::trim(settings_name); + doApplyCreateNewInventory(day, settings_name); + } +} void LLFloaterEditExtDayCycle::onClickCloseBtn(bool app_quitting /*= false*/) { @@ -1232,19 +1244,19 @@ void LLFloaterEditExtDayCycle::reblendSettings() mWaterBlender->setPosition(position); } -void LLFloaterEditExtDayCycle::doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day) +void LLFloaterEditExtDayCycle::doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day, std::string settings_name) { // This method knows what sort of settings object to create. LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); - LLSettingsVOBase::createInventoryItem(day, parent_id, + LLSettingsVOBase::createInventoryItem(day, parent_id, settings_name, [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); } void LLFloaterEditExtDayCycle::doApplyUpdateInventory(const LLSettingsDay::ptr_t &day) { if (mInventoryId.isNull()) - LLSettingsVOBase::createInventoryItem(day, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), + LLSettingsVOBase::createInventoryItem(day, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), std::string(), [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); else LLSettingsVOBase::updateInventoryItem(day, mInventoryId, diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 0ab47fc1e5..1e40a9dc6e 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -108,6 +108,7 @@ private: void onCommitName(class LLLineEditor* caller, void* user_data); void onTrackSelectionCallback(const LLSD& user_data); void onPlayActionCallback(const LLSD& user_data); + void onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsDay::ptr_t &day); // time slider clicked void onTimeSliderCallback(); // a frame moved or frame selection changed @@ -137,7 +138,7 @@ private: void doImportFromDisk(); void loadSettingFromFile(const std::vector& filenames); - void doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day); + void doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day, std::string settings_name); void doApplyUpdateInventory(const LLSettingsDay::ptr_t &day); void doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day); void doApplyCommit(LLSettingsDay::ptr_t day); diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 2eda405f51..b9ea044a06 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -355,7 +355,9 @@ void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data) } else if (ctrl_action == ACTION_SAVEAS) { - doApplyCreateNewInventory(); + LLSD args; + args["DESC"] = mSettings->getName(); + LLNotificationsUtil::add("SaveSettingAs", args, LLSD(), boost::bind(&LLFloaterFixedEnvironment::onSaveAsCommit, this, _1, _2)); } else if ((ctrl_action == ACTION_APPLY_LOCAL) || (ctrl_action == ACTION_APPLY_PARCEL) || @@ -369,6 +371,17 @@ void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data) } } +void LLFloaterFixedEnvironment::onSaveAsCommit(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option) + { + std::string settings_name = response["message"].asString(); + LLStringUtil::trim(settings_name); + doApplyCreateNewInventory(settings_name); + } +} + void LLFloaterFixedEnvironment::onClickCloseBtn(bool app_quitting) { if (!app_quitting) @@ -382,11 +395,11 @@ void LLFloaterFixedEnvironment::onButtonLoad() checkAndConfirmSettingsLoss([this](){ doSelectFromInventory(); }); } -void LLFloaterFixedEnvironment::doApplyCreateNewInventory() +void LLFloaterFixedEnvironment::doApplyCreateNewInventory(std::string settings_name) { LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); // This method knows what sort of settings object to create. - LLSettingsVOBase::createInventoryItem(mSettings, parent_id, + LLSettingsVOBase::createInventoryItem(mSettings, parent_id, settings_name, [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); } @@ -396,7 +409,7 @@ void LLFloaterFixedEnvironment::doApplyUpdateInventory() if (mInventoryId.isNull()) { LL_WARNS("LAPRAS") << "Inventory ID is NULL. Creating New!!!" << LL_ENDL; - LLSettingsVOBase::createInventoryItem(mSettings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), + LLSettingsVOBase::createInventoryItem(mSettings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), std::string(), [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); } else diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index 3181d4cbda..d235491fd9 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -83,7 +83,7 @@ protected: LLSettingsBase::ptr_t mSettings; virtual void doImportFromDisk() = 0; - virtual void doApplyCreateNewInventory(); + virtual void doApplyCreateNewInventory(std::string settings_name); virtual void doApplyUpdateInventory(); virtual void doApplyEnvironment(const std::string &where); void doCloseInventoryFloater(bool quitting = false); @@ -111,6 +111,7 @@ protected: void onPanelDirtyFlagChanged(bool); virtual void onClickCloseBtn(bool app_quitting = false) override; + void onSaveAsCommit(const LLSD& notification, const LLSD& response); private: void onNameChanged(const std::string &name); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 4073639a20..26b0bcb5a3 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -119,7 +119,7 @@ void LLSettingsVOBase::createNewInventoryItem(LLSettingsType::type_e stype, cons } -void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings, const LLUUID &parent_id, inventory_result_fn callback) +void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings, const LLUUID &parent_id, std::string settings_name, inventory_result_fn callback) { LLTransactionID tid; U32 nextOwnerPerm = LLPermissions::DEFAULT.getMaskNextOwner(); @@ -137,9 +137,13 @@ void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings LLSettingsVOBase::onInventoryItemCreated(inventoryId, settings, callback); }); + if (settings_name.empty()) + { + settings_name = settings->getName(); + } create_inventory_settings(gAgent.getID(), gAgent.getSessionID(), parent_id, tid, - settings->getName(), "new settings collection.", + settings_name, "new settings collection.", settings->getSettingsTypeValue(), nextOwnerPerm, cb); } @@ -160,10 +164,10 @@ void LLSettingsVOBase::onInventoryItemCreated(const LLUUID &inventoryId, LLSetti return; } // We need to update some inventory stuff here.... maybe. - updateInventoryItem(settings, inventoryId, callback); + updateInventoryItem(settings, inventoryId, callback, false); } -void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID inv_item_id, inventory_result_fn callback) +void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID inv_item_id, inventory_result_fn callback, bool update_name) { const LLViewerRegion* region = gAgent.getRegion(); if (!region) @@ -195,7 +199,7 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings new_item->setPermissions(perm); need_update |= true; } - if (settings->getName() != new_item->getName()) + if (update_name && (settings->getName() != new_item->getName())) { new_item->rename(settings->getName()); settings->setName(new_item->getName()); // account for corrections diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h index 0d7b7902c1..0e8312b849 100644 --- a/indra/newview/llsettingsvo.h +++ b/indra/newview/llsettingsvo.h @@ -50,9 +50,9 @@ public: typedef std::function inventory_result_fn; static void createNewInventoryItem(LLSettingsType::type_e stype, const LLUUID &parent_id, inventory_result_fn callback = inventory_result_fn()); - static void createInventoryItem(const LLSettingsBase::ptr_t &settings, const LLUUID &parent_id, inventory_result_fn callback = inventory_result_fn()); + static void createInventoryItem(const LLSettingsBase::ptr_t &settings, const LLUUID &parent_id, std::string settings_name, inventory_result_fn callback = inventory_result_fn()); - static void updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID inv_item_id, inventory_result_fn callback = inventory_result_fn()); + static void updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID inv_item_id, inventory_result_fn callback = inventory_result_fn(), bool update_name = true); static void updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID object_id, LLUUID inv_item_id, inventory_result_fn callback = inventory_result_fn()); static void getSettingsAsset(const LLUUID &assetId, asset_download_fn callback); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 4813ae3468..d0dafdbc8d 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -11154,6 +11154,30 @@ Unable to apply those settings to the environment. This Region does not support environmental settings. fail + + + + Save current environmental settings as: + confirm +
+ + [DESC] (new) + +