diff options
author | Richard Linden <none@none> | 2011-03-11 20:44:57 -0800 |
---|---|---|
committer | Richard Linden <none@none> | 2011-03-11 20:44:57 -0800 |
commit | 184c454222ff509629de8abc49a72122c75f0487 (patch) | |
tree | 5527a918e6ab7ccdd9abf0991997c3d44fba5b93 /indra/newview | |
parent | 426ff3fbbbd5b274c7258adabfea2802d93d27fd (diff) |
visual feedback for click to walk
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llhudeffectblob.cpp | 42 | ||||
-rw-r--r-- | indra/newview/llhudeffectblob.h | 47 | ||||
-rw-r--r-- | indra/newview/llhudobject.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llhudobject.h | 3 | ||||
-rw-r--r-- | indra/newview/lltoolpie.cpp | 39 | ||||
-rw-r--r-- | indra/newview/lltoolpie.h | 5 |
7 files changed, 133 insertions, 8 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 4ed59f039e..66869288b6 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -246,6 +246,7 @@ set(viewer_SOURCE_FILES llhudeffectlookat.cpp llhudeffectpointat.cpp llhudeffecttrail.cpp + llhudeffectblob.cpp llhudicon.cpp llhudmanager.cpp llhudnametag.cpp @@ -786,6 +787,7 @@ set(viewer_HEADER_FILES llhudeffectlookat.h llhudeffectpointat.h llhudeffecttrail.h + llhudeffectblob.h llhudicon.h llhudmanager.h llhudnametag.h diff --git a/indra/newview/llhudeffectblob.cpp b/indra/newview/llhudeffectblob.cpp new file mode 100644 index 0000000000..e790c954b0 --- /dev/null +++ b/indra/newview/llhudeffectblob.cpp @@ -0,0 +1,42 @@ +/** + * @file llhudeffecttrail.cpp + * @brief LLHUDEffectSpiral 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 "llhudeffectblob.h" + +LLHUDEffectBlob::LLHUDEffectBlob(const U8 type) : LLHUDEffect(type) +{ +} + +LLHUDEffectBlob::~LLHUDEffectBlob() +{ +} + +void LLHUDEffectBlob::render() +{ +} + diff --git a/indra/newview/llhudeffectblob.h b/indra/newview/llhudeffectblob.h new file mode 100644 index 0000000000..7757dc787c --- /dev/null +++ b/indra/newview/llhudeffectblob.h @@ -0,0 +1,47 @@ +/** + * @file llhudeffectblob.h + * @brief LLHUDEffectBlob class definition + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLHUDEFFECTBLOB_H +#define LL_LLHUDEFFECTBLOB_H + +#include "llhudeffect.h" + +class LLHUDEffectBlob : public LLHUDEffect +{ +public: + friend class LLHUDObject; + +protected: + LLHUDEffectBlob(const U8 type); + ~LLHUDEffectBlob(); + + /*virtual*/ void render(); + /*virtual*/ void renderForTimer(); +private: + +}; + +#endif // LL_LLHUDEFFECTBLOB_H diff --git a/indra/newview/llhudobject.cpp b/indra/newview/llhudobject.cpp index 5e762ee037..3efb8d287d 100644 --- a/indra/newview/llhudobject.cpp +++ b/indra/newview/llhudobject.cpp @@ -32,6 +32,7 @@ #include "llhudtext.h" #include "llhudicon.h" #include "llhudeffectbeam.h" +#include "llhudeffectblob.h" #include "llhudeffecttrail.h" #include "llhudeffectlookat.h" #include "llhudeffectpointat.h" @@ -237,6 +238,8 @@ LLHUDEffect *LLHUDObject::addHUDEffect(const U8 type) case LL_HUD_EFFECT_POINTAT: hud_objectp = new LLHUDEffectPointAt(type); break; + case LL_HUD_EFFECT_BLOB: + hud_objectp = new LLHUDEffectBlob(type); default: llwarns << "Unknown type of hud effect:" << (U32) type << llendl; } diff --git a/indra/newview/llhudobject.h b/indra/newview/llhudobject.h index 33e6394445..2f7a98c86c 100644 --- a/indra/newview/llhudobject.h +++ b/indra/newview/llhudobject.h @@ -95,7 +95,8 @@ public: LL_HUD_EFFECT_LOOKAT, LL_HUD_EFFECT_POINTAT, LL_HUD_EFFECT_VOICE_VISUALIZER, // Ventrella - LL_HUD_NAME_TAG + LL_HUD_NAME_TAG, + LL_HUD_EFFECT_BLOB }; protected: static void sortObjects(); diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index b6e99ac09f..5bfc69016b 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -42,6 +42,7 @@ #include "llfloaterreg.h" #include "llfloaterscriptdebug.h" #include "lltooltip.h" +#include "llhudeffectblob.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" #include "llkeyboard.h" @@ -81,6 +82,8 @@ LLToolPie::LLToolPie() : LLTool(std::string("Pie")), mMouseButtonDown( false ), mMouseOutsideSlop( false ), + mMouseSteerX(-1), + mMouseSteerY(-1), mClickAction(0), mClickActionBuyEnabled( gSavedSettings.getBOOL("ClickActionBuyEnabled") ), mClickActionPayEnabled( gSavedSettings.getBOOL("ClickActionPayEnabled") ) @@ -529,14 +532,12 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) if (delta_x * delta_x + delta_y * delta_y > threshold * threshold) { startCameraSteering(); - mMouseOutsideSlop = TRUE; - setMouseCapture(TRUE); } } mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE); - if (mMouseOutsideSlop) + if (inCameraSteerMode()) { steerCameraWithMouse(x, y); gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); @@ -617,16 +618,23 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) bool media_handled_click = handleMediaMouseUp() || LLViewerMediaFocus::getInstance()->getFocus(); bool mouse_moved = mMouseOutsideSlop; - mMouseOutsideSlop = false; + stopCameraSteering(); mMouseButtonDown = false; if (!media_handled_click && click_action == CLICK_ACTION_NONE && !mouse_moved) { if (gSavedSettings.getBOOL("ClickToWalk") // click to walk enabled + && !gFocusMgr.getKeyboardFocus() // focus is on world && !mPick.mPosGlobal.isExactlyZero() // valid coordinates for pick && (mPick.mPickType == LLPickInfo::PICK_LAND // we clicked on land || mPick.mObjectID.notNull())) // or on an object { + gAgentCamera.setFocusOnAvatar(TRUE, TRUE); + mAutoPilotDestination = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE); + mAutoPilotDestination->setPositionGlobal(mPick.mPosGlobal); + mAutoPilotDestination->setColor(LLColor4U::white); + mAutoPilotDestination->setDuration(5.f); + handle_go_to(); return TRUE; } @@ -1297,11 +1305,21 @@ void LLToolPie::stopEditing() void LLToolPie::onMouseCaptureLost() { - mMouseOutsideSlop = false; + stopCameraSteering(); mMouseButtonDown = false; handleMediaMouseUp(); } +void LLToolPie::stopCameraSteering() +{ + mMouseOutsideSlop = false; + mMouseSteerGrabPoint = NULL; +} + +bool LLToolPie::inCameraSteerMode() +{ + return mMouseButtonDown && mMouseOutsideSlop; +} // true if x,y outside small box around start_x,start_y BOOL LLToolPie::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) @@ -1687,12 +1705,19 @@ bool intersect_ray_with_sphere( const LLVector3& ray_pt, const LLVector3& ray_di void LLToolPie::startCameraSteering() { + mMouseOutsideSlop = true; + setMouseCapture(TRUE); + mMouseSteerX = mMouseDownX; mMouseSteerY = mMouseDownY; - const LLVector3 camera_to_rotation_center = gAgent.getFrameAgent().getOrigin() - LLViewerCamera::instance().getOrigin(); - const LLVector3 rotation_center_to_pick = gAgent.getPosAgentFromGlobal(mDragPick.mPosGlobal) - gAgent.getFrameAgent().getOrigin(); + const LLVector3 camera_to_rotation_center = gAgent.getFrameAgent().getOrigin() - LLViewerCamera::instance().getOrigin(); + const LLVector3 rotation_center_to_pick = gAgent.getPosAgentFromGlobal(mDragPick.mPosGlobal) - gAgent.getFrameAgent().getOrigin(); mClockwise = camera_to_rotation_center * rotation_center_to_pick < 0.f; + mMouseSteerGrabPoint= (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE); + mMouseSteerGrabPoint->setPositionGlobal(mPick.mPosGlobal); + mMouseSteerGrabPoint->setColor(LLColor4U::white); + mMouseSteerGrabPoint->setDuration(1000.f); } void LLToolPie::steerCameraWithMouse(S32 x, S32 y) diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 26dcbd35e6..1ac1c35bcc 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -33,6 +33,7 @@ class LLViewerObject; class LLObjectSelection; +class LLHUDEffectBlob; class LLToolPie : public LLTool, public LLSingleton<LLToolPie> { @@ -90,6 +91,8 @@ private: void steerCameraWithMouse(S32 x, S32 y); void startCameraSteering(); + void stopCameraSteering(); + bool inCameraSteerMode(); private: bool mMouseButtonDown; @@ -98,6 +101,8 @@ private: S32 mMouseDownY; S32 mMouseSteerX; S32 mMouseSteerY; + LLHUDEffectBlob* mAutoPilotDestination; + LLHUDEffectBlob* mMouseSteerGrabPoint; bool mClockwise; LLUUID mMediaMouseCaptureID; LLPickInfo mPick; |