Skip to content
Snippets Groups Projects
Commit 184c4542 authored by Richard Linden's avatar Richard Linden
Browse files

visual feedback for click to walk

parent 426ff3fb
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
/**
* @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()
{
}
/**
* @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
......@@ -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;
}
......
......@@ -95,7 +95,8 @@ class LLHUDObject : public LLRefCount
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();
......
......@@ -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)
......
......@@ -33,6 +33,7 @@
class LLViewerObject;
class LLObjectSelection;
class LLHUDEffectBlob;
class LLToolPie : public LLTool, public LLSingleton<LLToolPie>
{
......@@ -90,6 +91,8 @@ class LLToolPie : public LLTool, public LLSingleton<LLToolPie>
void steerCameraWithMouse(S32 x, S32 y);
void startCameraSteering();
void stopCameraSteering();
bool inCameraSteerMode();
private:
bool mMouseButtonDown;
......@@ -98,6 +101,8 @@ class LLToolPie : public LLTool, public LLSingleton<LLToolPie>
S32 mMouseDownY;
S32 mMouseSteerX;
S32 mMouseSteerY;
LLHUDEffectBlob* mAutoPilotDestination;
LLHUDEffectBlob* mMouseSteerGrabPoint;
bool mClockwise;
LLUUID mMediaMouseCaptureID;
LLPickInfo mPick;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment