aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltoolfocus.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/lltoolfocus.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/lltoolfocus.cpp')
-rw-r--r--linden/indra/newview/lltoolfocus.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/linden/indra/newview/lltoolfocus.cpp b/linden/indra/newview/lltoolfocus.cpp
index 2e046c4..c526e6e 100644
--- a/linden/indra/newview/lltoolfocus.cpp
+++ b/linden/indra/newview/lltoolfocus.cpp
@@ -50,7 +50,6 @@
50#include "llselectmgr.h" 50#include "llselectmgr.h"
51#include "llstatusbar.h" 51#include "llstatusbar.h"
52#include "lltoolmgr.h" 52#include "lltoolmgr.h"
53#include "lltoolselect.h"
54#include "llviewercamera.h" 53#include "llviewercamera.h"
55#include "llviewerobject.h" 54#include "llviewerobject.h"
56#include "llviewerwindow.h" 55#include "llviewerwindow.h"
@@ -58,9 +57,9 @@
58#include "llmorphview.h" 57#include "llmorphview.h"
59 58
60// Globals 59// Globals
61LLToolCamera *gToolCamera = NULL;
62BOOL gCameraBtnOrbit = FALSE; 60BOOL gCameraBtnOrbit = FALSE;
63BOOL gCameraBtnPan = FALSE; 61BOOL gCameraBtnPan = FALSE;
62
64const S32 SLOP_RANGE = 4; 63const S32 SLOP_RANGE = 4;
65const F32 FOCUS_OFFSET_FACTOR = 1.f; 64const F32 FOCUS_OFFSET_FACTOR = 1.f;
66 65
@@ -133,13 +132,13 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask)
133 132
134void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask) 133void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask)
135{ 134{
136 if (!gToolCamera->hasMouseCapture()) 135 if (!LLToolCamera::getInstance()->hasMouseCapture())
137 { 136 {
138 return; 137 return;
139 } 138 }
140 139
141 gToolCamera->mMouseDownX = x; 140 LLToolCamera::getInstance()->mMouseDownX = x;
142 gToolCamera->mMouseDownY = y; 141 LLToolCamera::getInstance()->mMouseDownY = y;
143 142
144 gViewerWindow->moveCursorToCenter(); 143 gViewerWindow->moveCursorToCenter();
145 144
@@ -149,17 +148,17 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask)
149 // Check for hit the sky, or some other invalid point 148 // Check for hit the sky, or some other invalid point
150 if (!hit_obj && gLastHitPosGlobal.isExactlyZero()) 149 if (!hit_obj && gLastHitPosGlobal.isExactlyZero())
151 { 150 {
152 gToolCamera->mValidClickPoint = FALSE; 151 LLToolCamera::getInstance()->mValidClickPoint = FALSE;
153 return; 152 return;
154 } 153 }
155 154
156 // check for hud attachments 155 // check for hud attachments
157 if (hit_obj && hit_obj->isHUDAttachment()) 156 if (hit_obj && hit_obj->isHUDAttachment())
158 { 157 {
159 LLObjectSelectionHandle selection = gSelectMgr->getSelection(); 158 LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
160 if (!selection->getObjectCount() || selection->getSelectType() != SELECT_TYPE_HUD) 159 if (!selection->getObjectCount() || selection->getSelectType() != SELECT_TYPE_HUD)
161 { 160 {
162 gToolCamera->mValidClickPoint = FALSE; 161 LLToolCamera::getInstance()->mValidClickPoint = FALSE;
163 return; 162 return;
164 } 163 }
165 } 164 }
@@ -185,7 +184,7 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask)
185 184
186 if( !good_customize_avatar_hit ) 185 if( !good_customize_avatar_hit )
187 { 186 {
188 gToolCamera->mValidClickPoint = FALSE; 187 LLToolCamera::getInstance()->mValidClickPoint = FALSE;
189 return; 188 return;
190 } 189 }
191 190
@@ -196,7 +195,7 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask)
196 } 195 }
197 //RN: check to see if this is mouse-driving as opposed to ALT-zoom or Focus tool 196 //RN: check to see if this is mouse-driving as opposed to ALT-zoom or Focus tool
198 else if (mask & MASK_ALT || 197 else if (mask & MASK_ALT ||
199 (gToolMgr->getCurrentTool()->getName() == "Camera")) 198 (LLToolMgr::getInstance()->getCurrentTool()->getName() == "Camera"))
200 { 199 {
201 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); 200 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
202 if (hit_obj) 201 if (hit_obj)
@@ -224,19 +223,19 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask)
224 (hit_obj == gAgent.getAvatarObject() || 223 (hit_obj == gAgent.getAvatarObject() ||
225 (hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->mIsSelf))) 224 (hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->mIsSelf)))
226 { 225 {
227 gToolCamera->mMouseSteering = TRUE; 226 LLToolCamera::getInstance()->mMouseSteering = TRUE;
228 } 227 }
229 228
230 } 229 }
231 230
232 gToolCamera->mValidClickPoint = TRUE; 231 LLToolCamera::getInstance()->mValidClickPoint = TRUE;
233 232
234 if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode() ) 233 if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode() )
235 { 234 {
236 gAgent.setFocusOnAvatar(FALSE, FALSE); 235 gAgent.setFocusOnAvatar(FALSE, FALSE);
237 236
238 LLVector3d cam_pos = gAgent.getCameraPositionGlobal(); 237 LLVector3d cam_pos = gAgent.getCameraPositionGlobal();
239 cam_pos -= LLVector3d(gCamera->getLeftAxis() * gAgent.calcCustomizeAvatarUIOffset( cam_pos )); 238 cam_pos -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * gAgent.calcCustomizeAvatarUIOffset( cam_pos ));
240 239
241 gAgent.setCameraPosAndFocusGlobal( cam_pos, gLastHitObjectOffset + gLastHitPosGlobal, gLastHitObjectID); 240 gAgent.setCameraPosAndFocusGlobal( cam_pos, gLastHitObjectOffset + gLastHitPosGlobal, gLastHitObjectID);
242 } 241 }
@@ -255,7 +254,7 @@ void LLToolCamera::releaseMouse()
255 254
256 gViewerWindow->showCursor(); 255 gViewerWindow->showCursor();
257 256
258 gToolMgr->clearTransientTool(); 257 LLToolMgr::getInstance()->clearTransientTool();
259 258
260 mMouseSteering = FALSE; 259 mMouseSteering = FALSE;
261 mValidClickPoint = FALSE; 260 mValidClickPoint = FALSE;
@@ -279,7 +278,7 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask)
279 { 278 {
280 LLCoordGL mouse_pos; 279 LLCoordGL mouse_pos;
281 LLVector3 focus_pos = gAgent.getPosAgentFromGlobal(gAgent.getFocusGlobal()); 280 LLVector3 focus_pos = gAgent.getPosAgentFromGlobal(gAgent.getFocusGlobal());
282 BOOL success = gCamera->projectPosAgentToScreen(focus_pos, mouse_pos); 281 BOOL success = LLViewerCamera::getInstance()->projectPosAgentToScreen(focus_pos, mouse_pos);
283 if (success) 282 if (success)
284 { 283 {
285 LLUI::setCursorPositionScreen(mouse_pos.mX, mouse_pos.mY); 284 LLUI::setCursorPositionScreen(mouse_pos.mX, mouse_pos.mY);