diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-10-01 20:35:59 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-06-23 14:49:39 +0300 |
commit | 0147a8c989b2bd423077aa8a416298b33bde9dcf (patch) | |
tree | 7b51355cc83b8d08d78d593e4857ed187640f956 /indra | |
parent | 0b8021870335ff9b9684fb193c6e0fe2f02b4091 (diff) |
SL-6109 Implemented LLDrawFrustum
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llfloateravatarpicker.cpp | 75 | ||||
-rw-r--r-- | indra/newview/llfloateravatarpicker.h | 9 | ||||
-rw-r--r-- | indra/newview/llfloatercolorpicker.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llfloatercolorpicker.h | 11 | ||||
-rw-r--r-- | indra/newview/llfloaterexperiencepicker.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llfloaterexperiencepicker.h | 10 | ||||
-rw-r--r-- | indra/newview/lltexturectrl.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lltexturectrl.h | 6 |
9 files changed, 22 insertions, 119 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 41f455d63a..340f1f8a22 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -179,6 +179,7 @@ set(viewer_SOURCE_FILES lldonotdisturbnotificationstorage.cpp lldndbutton.cpp lldrawable.cpp + lldrawfrustum.cpp lldrawpool.cpp lldrawpoolalpha.cpp lldrawpoolavatar.cpp @@ -810,6 +811,7 @@ set(viewer_HEADER_FILES lldonotdisturbnotificationstorage.h lldndbutton.h lldrawable.h + lldrawfrustum.h lldrawpool.h lldrawpoolalpha.h lldrawpoolavatar.h diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 33099db1b9..e86c10d00b 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -81,6 +81,7 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback, floater->mNearMeListComplete = FALSE; floater->mCloseOnSelect = closeOnSelect; floater->mExcludeAgentFromSearchResults = skip_agent; + floater->setFrustumOrigin(frustumOrigin); if (!closeOnSelect) { @@ -91,10 +92,6 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback, floater->getChild<LLButton>("cancel_btn")->setLabel(close_string); } - if(frustumOrigin) - { - floater->mFrustumOrigin = frustumOrigin->getHandle(); - } return floater; } @@ -104,17 +101,9 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key) : LLFloater(key), mNumResultsReturned(0), mNearMeListComplete(FALSE), - mCloseOnSelect(FALSE), - mContextConeOpacity (0.f), - mContextConeInAlpha(0.f), - mContextConeOutAlpha(0.f), - mContextConeFadeTime(0.f) + mCloseOnSelect(FALSE) { mCommitCallbackRegistrar.add("Refresh.FriendList", boost::bind(&LLFloaterAvatarPicker::populateFriend, this)); - - mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha"); - mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha"); - mContextConeFadeTime = gSavedSettings.getF32("ContextConeFadeTime"); } BOOL LLFloaterAvatarPicker::postBuild() @@ -359,66 +348,10 @@ void LLFloaterAvatarPicker::populateFriend() friends_scroller->sortByColumnIndex(0, TRUE); } -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)); - } - } -} - void LLFloaterAvatarPicker::draw() { - drawFrustum(); + LLRect local_rect = getLocalRect(); + drawFrustum(local_rect, this, getDragHandle(), hasFocus()); // sometimes it is hard to determine when Select/Ok button should be disabled (see LLAvatarActions::shareWithAvatars). // lets check this via mOkButtonValidateSignal callback periodically. diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index fbee61b054..7d94199786 100644 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -28,6 +28,7 @@ #define LLFLOATERAVATARPICKER_H #include "llfloater.h" +#include "lldrawfrustum.h" #include "lleventcoro.h" #include "llcoros.h" @@ -36,7 +37,7 @@ class LLAvatarName; class LLScrollListCtrl; -class LLFloaterAvatarPicker :public LLFloater +class LLFloaterAvatarPicker :public LLFloater, public LLDrawFrustum { public: typedef boost::signals2::signal<bool(const uuid_vec_t&), boost_boolean_combiner> validate_signal_t; @@ -91,7 +92,6 @@ private: void setAllowMultiple(BOOL allow_multiple); LLScrollListCtrl* getActiveList(); - void drawFrustum(); virtual void draw(); virtual BOOL handleKeyHere(KEY key, MASK mask); @@ -100,11 +100,6 @@ private: BOOL mNearMeListComplete; BOOL mCloseOnSelect; BOOL mExcludeAgentFromSearchResults; - LLHandle <LLView> mFrustumOrigin; - F32 mContextConeOpacity; - F32 mContextConeInAlpha; - F32 mContextConeOutAlpha; - F32 mContextConeFadeTime; validate_signal_t mOkButtonValidateSignal; select_callback_t mSelectionCallback; diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 1a784223c2..273dfe72d6 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -70,6 +70,7 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate ) : LLFloater(LLSD()), + LLDrawFrustum(swatch), mComponents ( 3 ), mMouseDownInLumRegion ( FALSE ), mMouseDownInHueRegion ( FALSE ), @@ -100,11 +101,7 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show mPaletteRegionHeight ( 40 ), mSwatch ( swatch ), mActive ( TRUE ), - mCanApplyImmediately ( show_apply_immediate ), - mContextConeOpacity ( 0.f ), - mContextConeInAlpha ( 0.f ), - mContextConeOutAlpha ( 0.f ), - mContextConeFadeTime ( 0.f ) + mCanApplyImmediately ( show_apply_immediate ) { buildFromFile ( "floater_color_picker.xml"); @@ -116,10 +113,6 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show mApplyImmediateCheck->setEnabled(FALSE); mApplyImmediateCheck->set(FALSE); } - - mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha"); - mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha"); - mContextConeFadeTime = gSavedSettings.getF32("ContextConeFadeTime"); } LLFloaterColorPicker::~LLFloaterColorPicker() diff --git a/indra/newview/llfloatercolorpicker.h b/indra/newview/llfloatercolorpicker.h index 16974a872e..74b99d5e68 100644 --- a/indra/newview/llfloatercolorpicker.h +++ b/indra/newview/llfloatercolorpicker.h @@ -30,6 +30,7 @@ #include <vector> #include "llfloater.h" +#include "lldrawfrustum.h" #include "llpointer.h" #include "llcolorswatch.h" #include "llspinctrl.h" @@ -41,7 +42,7 @@ class LLCheckBoxCtrl; ////////////////////////////////////////////////////////////////////////////// // floater class class LLFloaterColorPicker - : public LLFloater + : public LLFloater, public LLDrawFrustum { public: LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate = FALSE); @@ -63,7 +64,7 @@ class LLFloaterColorPicker void destroyUI (); void cancelSelection (); LLColorSwatchCtrl* getSwatch () { return mSwatch; }; - void setSwatch( LLColorSwatchCtrl* swatch) { mSwatch = swatch; } + void setSwatch(LLColorSwatchCtrl* swatch) { mSwatch = swatch; setFrustumOrigin(mSwatch); } // mutator / accessor for original RGB value void setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn ); @@ -196,12 +197,6 @@ class LLFloaterColorPicker LLButton* mCancelBtn; LLButton* mPipetteBtn; - - F32 mContextConeOpacity; - F32 mContextConeInAlpha; - F32 mContextConeOutAlpha; - F32 mContextConeFadeTime; - }; #endif // LL_LLFLOATERCOLORPICKER_H diff --git a/indra/newview/llfloaterexperiencepicker.cpp b/indra/newview/llfloaterexperiencepicker.cpp index c642da7b83..54d27be825 100644 --- a/indra/newview/llfloaterexperiencepicker.cpp +++ b/indra/newview/llfloaterexperiencepicker.cpp @@ -64,10 +64,7 @@ LLFloaterExperiencePicker* LLFloaterExperiencePicker::show( select_callback_t ca floater->mSearchPanel->filterContent(); } - if(frustumOrigin) - { - floater->mFrustumOrigin = frustumOrigin->getHandle(); - } + floater->setFrustumOrigin(frustumOrigin); return floater; } @@ -80,21 +77,15 @@ void LLFloaterExperiencePicker::drawFrustum() void LLFloaterExperiencePicker::draw() { - drawFrustum(); + LLRect local_rect = getLocalRect(); + drawFrustum(local_rect, this, getDragHandle(), hasFocus()); LLFloater::draw(); } LLFloaterExperiencePicker::LLFloaterExperiencePicker( const LLSD& key ) :LLFloater(key) ,mSearchPanel(NULL) - ,mContextConeOpacity(0.f) - ,mContextConeInAlpha(0.f) - ,mContextConeOutAlpha(0.f) - ,mContextConeFadeTime(0.f) { - mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha"); - mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha"); - mContextConeFadeTime = gSavedSettings.getF32("ContextConeFadeTime"); } LLFloaterExperiencePicker::~LLFloaterExperiencePicker() diff --git a/indra/newview/llfloaterexperiencepicker.h b/indra/newview/llfloaterexperiencepicker.h index 29054a57db..55fc632e18 100644 --- a/indra/newview/llfloaterexperiencepicker.h +++ b/indra/newview/llfloaterexperiencepicker.h @@ -28,13 +28,14 @@ #define LL_LLFLOATEREXPERIENCEPICKER_H #include "llfloater.h" +#include "lldrawfrustum.h" class LLScrollListCtrl; class LLLineEditor; class LLPanelExperiencePicker; -class LLFloaterExperiencePicker : public LLFloater +class LLFloaterExperiencePicker : public LLFloater, public LLDrawFrustum { public: @@ -54,13 +55,6 @@ public: private: LLPanelExperiencePicker* mSearchPanel; - - void drawFrustum(); - LLHandle <LLView> mFrustumOrigin; - F32 mContextConeOpacity; - F32 mContextConeInAlpha; - F32 mContextConeOutAlpha; - F32 mContextConeFadeTime; }; #endif // LL_LLFLOATEREXPERIENCEPICKER_H diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 6a0464c657..7fcc1f4977 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -109,7 +109,6 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mImmediateFilterPermMask(immediate_filter_perm_mask), mDnDFilterPermMask(dnd_filter_perm_mask), mNonImmediateFilterPermMask(non_immediate_filter_perm_mask), - mContextConeOpacity(0.f), mSelectedItemPinned( FALSE ), mCanApply(true), mCanPreview(true), @@ -123,6 +122,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( buildFromFile("floater_texture_ctrl.xml"); mCanApplyImmediately = can_apply_immediately; setCanMinimize(FALSE); + setFrustumOrigin(mOwner); } LLFloaterTexturePicker::~LLFloaterTexturePicker() diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index b2a34a37c4..c962cf98a2 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -29,6 +29,7 @@ #define LL_LLTEXTURECTRL_H #include "llcoord.h" +#include "lldrawfrustum.h" #include "llfiltereditor.h" #include "llfloater.h" #include "llfolderview.h" @@ -249,7 +250,7 @@ typedef boost::function<void()> floater_close_callback; typedef boost::function<void(const LLUUID& asset_id)> set_image_asset_id_callback; typedef boost::function<void(LLPointer<LLViewerTexture> texture)> set_on_update_image_stats_callback; -class LLFloaterTexturePicker : public LLFloater +class LLFloaterTexturePicker : public LLFloater, public LLDrawFrustum { public: LLFloaterTexturePicker( @@ -291,7 +292,7 @@ public: void setActive(BOOL active); LLView* getOwner() const { return mOwner; } - void setOwner(LLView* owner) { mOwner = owner; } + void setOwner(LLView* owner) { mOwner = owner; setFrustumOrigin(owner); } void stopUsingPipette(); PermissionMask getFilterPermMask(); @@ -363,7 +364,6 @@ protected: PermissionMask mNonImmediateFilterPermMask; BOOL mCanApplyImmediately; BOOL mNoCopyTextureSelected; - F32 mContextConeOpacity; LLSaveFolderState mSavedFolderState; BOOL mSelectedItemPinned; |