From 88d4d85711a25772f3659850902e3a395ef2358c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 25 Jan 2019 10:34:42 -0800 Subject: SL-10303 Modify sun disc shader to better position itself within the sun glow and to fade as the sun approaches the horizon (to mask where the position difference is greatest). --- .../app_settings/shaders/class1/deferred/sunDiscF.glsl | 14 +++++++++----- .../app_settings/shaders/class1/deferred/sunDiscV.glsl | 16 ++++++++++------ .../app_settings/shaders/class1/windlight/sunDiscF.glsl | 11 +++++++---- .../app_settings/shaders/class1/windlight/sunDiscV.glsl | 14 ++++++++------ .../shaders/class2/windlight/atmosphericsV.glsl | 4 ++-- indra/newview/pipeline.cpp | 4 ---- .../skins/default/xui/en/panel_settings_sky_sunmoon.xml | 4 ++-- 7 files changed, 38 insertions(+), 29 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl index 3557c0766e..c66f3f62b2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl @@ -40,17 +40,21 @@ uniform sampler2D diffuseMap; uniform sampler2D altDiffuseMap; uniform float blend_factor; // interp factor between sunDisc A/B VARYING vec2 vary_texcoord0; +VARYING float sun_fade; void main() { - vec4 sunDiscA = texture2D(diffuseMap, vary_texcoord0.xy); - vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy); + vec4 sunDiscA = texture2D(diffuseMap, vary_texcoord0.xy); + vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(sunDiscA, sunDiscB, blend_factor); c.rgb = clamp(c.rgb, vec3(0), vec3(1)); - c.rgb = pow(c.rgb, vec3(0.7f)); - c.rgb = fullbrightAtmosTransport(c.rgb); + c.rgb = pow(c.rgb, vec3(0.7f)); + c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); - frag_data[0] = c; + + c.a *= sun_fade; + + frag_data[0] = c; frag_data[1] = vec4(0.0f); frag_data[2] = vec4(0.0, 1.0, 0.0, 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl index c67ed8e6d9..0d117c6bc7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl @@ -31,18 +31,22 @@ ATTRIBUTE vec3 position; ATTRIBUTE vec2 texcoord0; VARYING vec2 vary_texcoord0; +VARYING float sun_fade; void calcAtmospherics(vec3 eye_pos); void main() { - //transform vertex - vec4 vert = vec4(position.xyz - vec3(0, 0, 50), 1.0); - vec4 pos = modelview_projection_matrix*vert; + //transform vertex + vec3 offset = vec3(0, 0, 50); + vec4 vert = vec4(position.xyz - offset, 1.0); + vec4 pos = modelview_projection_matrix*vert; - gl_Position = pos; - + sun_fade = smoothstep(0.3, 1.0, (position.z + 50) / 512.0f); + + gl_Position = pos; + calcAtmospherics(pos.xyz); - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index 3f2375ee4d..668379164d 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -40,15 +40,18 @@ uniform sampler2D diffuseMap; uniform sampler2D altDiffuseMap; uniform float blend_factor; // interp factor between sun A/B VARYING vec2 vary_texcoord0; +VARYING float sun_fade; void main() { - vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); - vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); + vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); + vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(sunA, sunB, blend_factor); + c.a *= sun_fade; + c.rgb = pow(c.rgb, vec3(0.7f)); - c.rgb = fullbrightAtmosTransport(c.rgb); + c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); - frag_color = c; + frag_color = c; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl index dd33a4be60..1fa32c3f3b 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl @@ -31,18 +31,20 @@ ATTRIBUTE vec3 position; ATTRIBUTE vec2 texcoord0; VARYING vec2 vary_texcoord0; +VARYING float sun_fade; void calcAtmospherics(vec3 eye_pos); void main() { - //transform vertex - vec4 vert = vec4(position.xyz - vec3(0, 0, 50), 1.0); - vec4 pos = modelview_projection_matrix*vert; + //transform vertex + vec4 vert = vec4(position.xyz, 1.0); + vec4 pos = modelview_projection_matrix*vert; - gl_Position = pos; - + sun_fade = smoothstep(0.3, 1.0, (position.z + 50) / 512.0f); + gl_Position = pos; + calcAtmospherics(pos.xyz); - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl index 8c1a7c6281..5ccf786fce 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl @@ -62,8 +62,8 @@ void calcAtmospherics(vec3 inPositionEye) { setPositionEye(P); //(TERRAIN) limit altitude - if (P.y > max_y) P *= (max_y / P.y); - if (P.y < -max_y) P *= (-max_y / P.y); + //if (P.y > max_y) P *= (max_y / P.y); + //if (P.y < -max_y) P *= (-max_y / P.y); vec3 tmpLightnorm = lightnorm.xyz; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 9d8f98688f..9b89af20d2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -117,10 +117,6 @@ #include "llenvironment.h" -#if LL_WINDOWS -#pragma optimize("", off) -#endif - #ifdef _DEBUG // Debug indices is disabled for now for debug performance - djs 4/24/02 //#define DEBUG_INDICES diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml index e63b7e41b4..2aab41c5a0 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml @@ -78,7 +78,7 @@ decimal_digits="2" follows="left|top" height="16" - increment="0.25" + increment="0.01" initial_value="0" layout="topleft" left_delta="5" @@ -254,7 +254,7 @@ decimal_digits="2" follows="left|top" height="16" - increment="0.25" + increment="0.01" initial_value="0" layout="topleft" left_delta="5" -- cgit v1.2.3 From ac865de287b2e740acd9f6a8724301146df73ccf Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 25 Jan 2019 22:02:16 +0200 Subject: SL-1945 Day Cycle Editor Copy Track --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloateravatarpicker.cpp | 55 +-------- indra/newview/llfloatercolorpicker.cpp | 52 +-------- indra/newview/llfloatereditextdaycycle.cpp | 60 +++++++++- indra/newview/llfloatereditextdaycycle.h | 5 + indra/newview/llfloaterexperiencepicker.cpp | 55 +-------- indra/newview/llsettingspicker.cpp | 59 +--------- indra/newview/llsettingspicker.h | 3 - indra/newview/lltexturectrl.cpp | 58 +-------- indra/newview/lltrackpicker.cpp | 126 ++++++++++++++++++++ indra/newview/lltrackpicker.h | 58 +++++++++ .../skins/default/xui/en/floater_pick_track.xml | 129 +++++++++++++++++++++ 12 files changed, 386 insertions(+), 276 deletions(-) create mode 100644 indra/newview/lltrackpicker.cpp create mode 100644 indra/newview/lltrackpicker.h create mode 100644 indra/newview/skins/default/xui/en/floater_pick_track.xml (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 967ba2d8d9..9d4b58d216 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -605,6 +605,7 @@ set(viewer_SOURCE_FILES lltoolselectland.cpp lltoolselectrect.cpp lltracker.cpp + lltrackpicker.cpp lltransientdockablefloater.cpp lltransientfloatermgr.cpp lltranslate.cpp @@ -1219,6 +1220,7 @@ set(viewer_HEADER_FILES lltoolselectland.h lltoolselectrect.h lltracker.h + lltrackpicker.h lltransientdockablefloater.h lltransientfloatermgr.h lltranslate.h diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index c5561fe011..abf7b7f39d 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -361,59 +361,8 @@ void LLFloaterAvatarPicker::populateFriend() void LLFloaterAvatarPicker::drawFrustum() { - if(mFrustumOrigin.get()) - { - LLView * frustumOrigin = mFrustumOrigin.get(); - LLRect origin_rect; - frustumOrigin->localRectToOtherView(frustumOrigin->getLocalRect(), &origin_rect, this); - // draw context cone connecting color picker with color swatch in parent floater - LLRect local_rect = getLocalRect(); - if (hasFocus() && frustumOrigin->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); - gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); - gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); - } - gGL.end(); - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); - } - } + static LLCachedControl max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, mFrustumOrigin.get(), mContextConeFadeTime, mContextConeInAlpha, mContextConeOutAlpha); } void LLFloaterAvatarPicker::draw() diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index ec2c9740af..1a784223c2 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -485,56 +485,8 @@ BOOL LLFloaterColorPicker::isColorChanged() // void LLFloaterColorPicker::draw() { - LLRect swatch_rect; - mSwatch->localRectToOtherView(mSwatch->getLocalRect(), &swatch_rect, this); - // draw context cone connecting color picker with color swatch in parent floater - LLRect local_rect = getLocalRect(); - if (hasFocus() && mSwatch->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); - gGL.vertex2i(swatch_rect.mRight, swatch_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mBottom); - gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(swatch_rect.mRight, swatch_rect.mTop); - gGL.vertex2i(swatch_rect.mRight, swatch_rect.mBottom); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(swatch_rect.mRight, swatch_rect.mBottom); - gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mBottom); - } - gGL.end(); - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), - LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); - } + static LLCachedControl max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, mSwatch, mContextConeFadeTime, mContextConeInAlpha, mContextConeOutAlpha); mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); mApplyImmediateCheck->setEnabled(mActive && mCanApplyImmediately); diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index d6c104547d..33f3fcfecc 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -48,6 +48,7 @@ #include "llviewerparcelmgr.h" #include "llsettingspicker.h" +#include "lltrackpicker.h" // newview #include "llagent.h" @@ -425,6 +426,7 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) void LLFloaterEditExtDayCycle::onClose(bool app_quitting) { doCloseInventoryFloater(app_quitting); + doCloseTrackFloater(app_quitting); // there's no point to change environment if we're quitting // or if we already restored environment stopPlay(); @@ -802,7 +804,7 @@ void LLFloaterEditExtDayCycle::onRemoveFrame() void LLFloaterEditExtDayCycle::onCloneTrack() { - + doOpenTrackFloater(); } @@ -1228,8 +1230,7 @@ void LLFloaterEditExtDayCycle::updateButtons() } can_clear = (mCurrentTrack > 1) ? (!mEditDay->getCycleTrack(mCurrentTrack).empty()) : (mEditDay->getCycleTrack(mCurrentTrack).size() > 1); - mCloneTrack->setEnabled(can_clone && false); - mCloneTrack->setVisible(false); + mCloneTrack->setEnabled(can_clone); mLoadTrack->setEnabled(can_load); mClearTrack->setEnabled(can_clear); @@ -1509,6 +1510,7 @@ void LLFloaterEditExtDayCycle::synchronizeTabs() mEditSky = psettingS; doCloseInventoryFloater(); + doCloseTrackFloater(); setTabsData(tabs, psettingS, canedit); LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mEditSky, mEditWater); @@ -1741,6 +1743,7 @@ bool LLFloaterEditExtDayCycle::canApplyParcel() const void LLFloaterEditExtDayCycle::startPlay() { doCloseInventoryFloater(); + doCloseTrackFloater(); mIsPlaying = true; mFramesSlider->resetCurSlider(); @@ -1814,6 +1817,55 @@ void LLFloaterEditExtDayCycle::clearDirtyFlag() } +void LLFloaterEditExtDayCycle::doOpenTrackFloater() +{ + LLFloaterTrackPicker *picker = static_cast(mTrackFloater.get()); + + // Show the dialog + if (!picker) + { + picker = new LLFloaterTrackPicker(this); + + mTrackFloater = picker->getHandle(); + + picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitTrackId(data.asInteger()); }); + } + + const LLEnvironment::altitude_list_t &altitudes = LLEnvironment::instance().getRegionAltitudes(); + bool use_altitudes = altitudes.size() > 0 && ((mEditContext == CONTEXT_PARCEL) || (mEditContext == CONTEXT_REGION)); + + LLSD args = LLSD::emptyArray(); + + for (U32 i = 1; i < LLSettingsDay::TRACK_MAX; i++) + { + LLSD track; + track["id"] = LLSD::Integer(i); + track["enabled"] = !mEditDay->isTrackEmpty(i); + if (use_altitudes) + { + track["altitude"] = altitudes[i - 1]; + } + args.append(track); + } + + picker->showPicker(args); +} + +void LLFloaterEditExtDayCycle::doCloseTrackFloater(bool quitting) +{ + LLFloater* floaterp = mTrackFloater.get(); + + if (floaterp) + { + floaterp->closeFloater(quitting); + } +} + +void LLFloaterEditExtDayCycle::onPickerCommitTrackId(U32 track_id) +{ + cloneTrack(track_id, mCurrentTrack); +} + void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem) { // LLUI::sWindow->setCursor(UI_CURSOR_WAIT); @@ -1832,9 +1884,9 @@ void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e typ picker->setSettingsFilter(type); picker->setSettingsItemId(curritem); + picker->setTrackWater(mCurrentTrack == LLSettingsDay::TRACK_WATER); picker->openFloater(); picker->setFocus(TRUE); - picker->setTrackWater(mCurrentTrack == LLSettingsDay::TRACK_WATER); } void LLFloaterEditExtDayCycle::doCloseInventoryFloater(bool quitting) diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index e808ab8a46..d780d5c993 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -160,6 +160,10 @@ private: void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); + void doOpenTrackFloater(); + void doCloseTrackFloater(bool quitting = false); + void onPickerCommitTrackId(U32 track_id); + void doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem); void doCloseInventoryFloater(bool quitting = false); void onPickerCommitSetting(LLUUID item_id, S32 track); @@ -218,6 +222,7 @@ private: LLFlyoutComboBtnCtrl * mFlyoutControl; LLHandle mInventoryFloater; + LLHandle mTrackFloater; LLTrackBlenderLoopingManual::ptr_t mSkyBlender; LLTrackBlenderLoopingManual::ptr_t mWaterBlender; diff --git a/indra/newview/llfloaterexperiencepicker.cpp b/indra/newview/llfloaterexperiencepicker.cpp index bb54c57baf..c642da7b83 100644 --- a/indra/newview/llfloaterexperiencepicker.cpp +++ b/indra/newview/llfloaterexperiencepicker.cpp @@ -74,59 +74,8 @@ LLFloaterExperiencePicker* LLFloaterExperiencePicker::show( select_callback_t ca void LLFloaterExperiencePicker::drawFrustum() { - if(mFrustumOrigin.get()) - { - LLView * frustumOrigin = mFrustumOrigin.get(); - LLRect origin_rect; - frustumOrigin->localRectToOtherView(frustumOrigin->getLocalRect(), &origin_rect, this); - // draw context cone connecting color picker with color swatch in parent floater - LLRect local_rect = getLocalRect(); - if (hasFocus() && frustumOrigin->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); - gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); - gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); - } - gGL.end(); - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(mContextConeFadeTime)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(mContextConeFadeTime)); - } - } + static LLCachedControl max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, mFrustumOrigin.get(), mContextConeFadeTime, mContextConeInAlpha, mContextConeOutAlpha); } void LLFloaterExperiencePicker::draw() diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index 7aa9cf0ae8..5812fc59cd 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -55,10 +55,6 @@ namespace const std::string BTN_SELECT("btn_select"); const std::string BTN_CANCEL("btn_cancel"); - const F32 CONTEXT_CONE_IN_ALPHA(0.0f); - const F32 CONTEXT_CONE_OUT_ALPHA(1.0f); - const F32 CONTEXT_FADE_TIME(0.08f); - // strings in xml const std::string STR_TITLE_PREFIX = "pick title"; @@ -194,59 +190,8 @@ void LLFloaterSettingsPicker::setSettingsFilter(LLSettingsType::type_e type) void LLFloaterSettingsPicker::draw() { LLView *owner = mOwnerHandle.get(); - if (owner) - { - // draw cone of context pointing back to texture swatch - LLRect owner_rect; - owner->localRectToOtherView(owner->getLocalRect(), &owner_rect, this); - LLRect local_rect = getLocalRect(); - if (gFocusMgr.childHasKeyboardFocus(this) && owner->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - } - gGL.end(); - } - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } + static LLCachedControl max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, owner); LLFloater::draw(); } diff --git a/indra/newview/llsettingspicker.h b/indra/newview/llsettingspicker.h index 941fe752b0..f5aecf4417 100644 --- a/indra/newview/llsettingspicker.h +++ b/indra/newview/llsettingspicker.h @@ -45,7 +45,6 @@ class LLInventoryPanel; class LLFloaterSettingsPicker : public LLFloater { public: - typedef std::function commit_callback_t; typedef std::function close_callback_t; typedef std::function id_changed_callback_t; @@ -117,8 +116,6 @@ private: F32 mContextConeOpacity; PermissionMask mImmediateFilterPermMask; -// PermissionMask mDnDFilterPermMask; -// PermissionMask mNonImmediateFilterPermMask; bool mActive; bool mNoCopySettingsSelected; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index a5a2eec246..5ca77ad3c3 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -70,9 +70,6 @@ #include "lllocalbitmaps.h" #include "llerror.h" -static const F32 CONTEXT_CONE_IN_ALPHA = 0.0f; -static const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; -static const F32 CONTEXT_FADE_TIME = 0.08f; static const S32 LOCAL_TRACKING_ID_COLUMN = 1; @@ -410,59 +407,8 @@ BOOL LLFloaterTexturePicker::postBuild() // virtual void LLFloaterTexturePicker::draw() { - if (mOwner) - { - // draw cone of context pointing back to texture swatch - LLRect owner_rect; - mOwner->localRectToOtherView(mOwner->getLocalRect(), &owner_rect, this); - LLRect local_rect = getLocalRect(); - if (gFocusMgr.childHasKeyboardFocus(this) && mOwner->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - } - gGL.end(); - } - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } + static LLCachedControl max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, mOwner); updateImageStats(); diff --git a/indra/newview/lltrackpicker.cpp b/indra/newview/lltrackpicker.cpp new file mode 100644 index 0000000000..07fdb5f476 --- /dev/null +++ b/indra/newview/lltrackpicker.cpp @@ -0,0 +1,126 @@ +/** +* @author AndreyK Productengine +* @brief LLTrackPicker class header file including related functions +* +* $LicenseInfo:firstyear=2018&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2018, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "lltrackpicker.h" + +#include "llradiogroup.h" +#include "llviewercontrol.h" + + +//========================================================================= +namespace +{ + const std::string FLOATER_DEFINITION_XML("floater_pick_track.xml"); + + const std::string BTN_SELECT("btn_select"); + const std::string BTN_CANCEL("btn_cancel"); + const std::string RDO_TRACK_SELECTION("track_selection"); + const std::string RDO_TRACK_PREFIX("radio_sky"); +} +//========================================================================= + +LLFloaterTrackPicker::LLFloaterTrackPicker(LLView * owner, const LLSD ¶ms) : + LLFloater(params), + mContextConeOpacity(0.0f), + mOwnerHandle() +{ + mOwnerHandle = owner->getHandle(); + buildFromFile(FLOATER_DEFINITION_XML); +} + +LLFloaterTrackPicker::~LLFloaterTrackPicker() +{ +} + +BOOL LLFloaterTrackPicker::postBuild() +{ + childSetAction(BTN_CANCEL, [this](LLUICtrl*, const LLSD& param){ onButtonCancel(); }); + childSetAction(BTN_SELECT, [this](LLUICtrl*, const LLSD& param){ onButtonSelect(); }); + return TRUE; +} + +void LLFloaterTrackPicker::onClose(bool app_quitting) +{ + if (app_quitting) + return; + + LLView *owner = mOwnerHandle.get(); + if (owner) + { + owner->setFocus(TRUE); + } +} + +void LLFloaterTrackPicker::showPicker(LLSD &args) +{ + LLSD::array_const_iterator iter; + LLSD::array_const_iterator end = args.endArray(); + + for (iter = args.beginArray(); iter != end; ++iter) + { + S32 track_id = (*iter)["id"].asInteger(); + bool can_enable = (*iter)["enabled"].asBoolean(); + LLView *view = getChild(RDO_TRACK_PREFIX + llformat("%d", track_id), true); + view->setEnabled(can_enable); + view->setLabelArg("[ALT]", (*iter).has("altitude") ? ((*iter)["altitude"].asString() + "m") : " "); + } + + openFloater(getKey()); + setFocus(TRUE); +} + +void LLFloaterTrackPicker::draw() +{ + LLView *owner = mOwnerHandle.get(); + static LLCachedControl max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, owner); + + LLFloater::draw(); +} + +void LLFloaterTrackPicker::onButtonCancel() +{ + closeFloater(); +} + +void LLFloaterTrackPicker::onButtonSelect() +{ + if (mCommitSignal) + { + (*mCommitSignal)(this, getChild(RDO_TRACK_SELECTION, true)->getSelectedValue()); + } + closeFloater(); +} + +void LLFloaterTrackPicker::onFocusLost() +{ + if (isInVisibleChain()) + { + closeFloater(); + } +} diff --git a/indra/newview/lltrackpicker.h b/indra/newview/lltrackpicker.h new file mode 100644 index 0000000000..601af27b61 --- /dev/null +++ b/indra/newview/lltrackpicker.h @@ -0,0 +1,58 @@ +/** + * @file lltrackpicker.h + * @author AndreyK Productengine + * @brief LLTrackPicker class header file including related functions + * + * $LicenseInfo:firstyear=2018&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2018, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_TRACKPICKER_H +#define LL_TRACKPICKER_H + +#include "llfloater.h" + + +//========================================================================= + +class LLFloaterTrackPicker : public LLFloater +{ +public: + LLFloaterTrackPicker(LLView * owner, const LLSD ¶ms = LLSD()); + virtual ~LLFloaterTrackPicker() override; + + virtual BOOL postBuild() override; + virtual void onClose(bool app_quitting) override; + void showPicker(LLSD &args); + + virtual void draw() override; + + void onButtonCancel(); + void onButtonSelect(); + +private: + void onFocusLost() override; + + F32 mContextConeOpacity; + LLHandle mOwnerHandle; +}; + +#endif // LL_TRACKPICKER_H diff --git a/indra/newview/skins/default/xui/en/floater_pick_track.xml b/indra/newview/skins/default/xui/en/floater_pick_track.xml new file mode 100644 index 0000000000..d8a9877be2 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_pick_track.xml @@ -0,0 +1,129 @@ + + + + + + + Select source sky: + + + + + + + + + + + +