From fc49539b36adfd4c87d7824db5d94a7858683f3d Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 23 Mar 2010 15:59:52 -0400 Subject: EXT-2959 : Full out camera functions from llagent to llagentcamera First check-in; only compiles, nothing more. --- indra/newview/llmaniprotate.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'indra/newview/llmaniprotate.cpp') diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 8535d52015..6dc0a929c8 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -45,6 +45,7 @@ // viewer includes #include "llagent.h" +#include "llagentcamera.h" #include "llbox.h" #include "llbutton.h" #include "llviewercontrol.h" @@ -138,7 +139,7 @@ void LLManipRotate::render() glPushMatrix(); if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - F32 zoom = gAgent.mHUDCurZoom; + F32 zoom = gAgentCamera.mHUDCurZoom; glScalef(zoom, zoom, zoom); } @@ -690,7 +691,7 @@ void LLManipRotate::drag( S32 x, S32 y ) LLSelectMgr::getInstance()->updateSelectionCenter(); // RN: just clear focus so camera doesn't follow spurious object updates - gAgent.clearFocusObject(); + gAgentCamera.clearFocusObject(); dialog_refresh_all(); } @@ -730,7 +731,7 @@ void LLManipRotate::renderSnapGuides() } else { - cam_at_axis = center - gAgent.getCameraPositionAgent(); + cam_at_axis = center - gAgentCamera.getCameraPositionAgent(); cam_at_axis.normVec(); } @@ -1097,12 +1098,12 @@ BOOL LLManipRotate::updateVisiblity() LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - mCenterToCam = LLVector3(-1.f / gAgent.mHUDCurZoom, 0.f, 0.f); + mCenterToCam = LLVector3(-1.f / gAgentCamera.mHUDCurZoom, 0.f, 0.f); mCenterToCamNorm = mCenterToCam; mCenterToCamMag = mCenterToCamNorm.normVec(); mRadiusMeters = RADIUS_PIXELS / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); - mRadiusMeters /= gAgent.mHUDCurZoom; + mRadiusMeters /= gAgentCamera.mHUDCurZoom; mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag; mCenterToProfilePlane = -mCenterToProfilePlaneMag * mCenterToCamNorm; @@ -1110,8 +1111,8 @@ BOOL LLManipRotate::updateVisiblity() // x axis range is (-aspect * 0.5f, +aspect * 0.5) // y axis range is (-0.5, 0.5) // so use getWorldViewHeightRaw as scale factor when converting to pixel coordinates - mCenterScreen.set((S32)((0.5f - center.mV[VY]) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()), - (S32)((center.mV[VZ] + 0.5f) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled())); + mCenterScreen.set((S32)((0.5f - center.mV[VY]) / gAgentCamera.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()), + (S32)((center.mV[VZ] + 0.5f) / gAgentCamera.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled())); visible = TRUE; } else @@ -1119,7 +1120,7 @@ BOOL LLManipRotate::updateVisiblity() visible = LLViewerCamera::getInstance()->projectPosAgentToScreen(center, mCenterScreen ); if( visible ) { - mCenterToCam = gAgent.getCameraPositionAgent() - center; + mCenterToCam = gAgentCamera.getCameraPositionAgent() - center; mCenterToCamNorm = mCenterToCam; mCenterToCamMag = mCenterToCamNorm.normVec(); LLVector3 cameraAtAxis = LLViewerCamera::getInstance()->getAtAxis(); @@ -1165,7 +1166,7 @@ BOOL LLManipRotate::updateVisiblity() LLQuaternion LLManipRotate::dragUnconstrained( S32 x, S32 y ) { - LLVector3 cam = gAgent.getCameraPositionAgent(); + LLVector3 cam = gAgentCamera.getCameraPositionAgent(); LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); mMouseCur = intersectMouseWithSphere( x, y, center, mRadiusMeters); @@ -1333,7 +1334,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) } else { - cam_to_snap_plane = snap_plane_center - gAgent.getCameraPositionAgent(); + cam_to_snap_plane = snap_plane_center - gAgentCamera.getCameraPositionAgent(); cam_to_snap_plane.normVec(); } @@ -1383,7 +1384,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) } else { - cam_to_snap_plane = snap_plane_center - gAgent.getCameraPositionAgent(); + cam_to_snap_plane = snap_plane_center - gAgentCamera.getCameraPositionAgent(); cam_to_snap_plane.normVec(); } @@ -1430,7 +1431,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) } else { - cam_at_axis = snap_plane_center - gAgent.getCameraPositionAgent(); + cam_at_axis = snap_plane_center - gAgentCamera.getCameraPositionAgent(); cam_at_axis.normVec(); } @@ -1627,15 +1628,15 @@ void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_ { if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD) { - F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewRectScaled().getWidth()) - 0.5f) / gAgent.mHUDCurZoom; - F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewRectScaled().getHeight()) - 0.5f) / gAgent.mHUDCurZoom; + F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewRectScaled().getWidth()) - 0.5f) / gAgentCamera.mHUDCurZoom; + F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewRectScaled().getHeight()) - 0.5f) / gAgentCamera.mHUDCurZoom; *ray_pt = LLVector3(-1.f, -mouse_x, mouse_y); *ray_dir = LLVector3(1.f, 0.f, 0.f); } else { - *ray_pt = gAgent.getCameraPositionAgent(); + *ray_pt = gAgentCamera.getCameraPositionAgent(); LLViewerCamera::getInstance()->projectScreenToPosAgent(x, y, ray_dir); *ray_dir -= *ray_pt; ray_dir->normVec(); -- cgit v1.2.3 From 94e6e10739c8321b6fb651a109901380ef92975a Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Mon, 29 Mar 2010 12:00:26 -0400 Subject: EXT-6536 : Make LLVOAvatarSelf a singleton Superficial cleanup to replace all instances of "LLVOAvatarSelf *avatarp = gAgent.getAvatarObject" with "gAgentAvatar". --- indra/newview/llmaniprotate.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/newview/llmaniprotate.cpp') diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 6dc0a929c8..6747bcb9c9 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -65,6 +65,7 @@ #include "lldrawable.h" #include "llglheaders.h" #include "lltrans.h" +#include "llvoavatarself.h" const F32 RADIUS_PIXELS = 100.f; // size in screen space const F32 SQ_RADIUS = RADIUS_PIXELS * RADIUS_PIXELS; @@ -739,7 +740,7 @@ void LLManipRotate::renderSnapGuides() LLVector3 test_axis = constraint_axis; BOOL constrain_to_ref_object = FALSE; - if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) + if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid()) { test_axis = test_axis * ~grid_rotation; } @@ -766,7 +767,7 @@ void LLManipRotate::renderSnapGuides() } LLVector3 projected_snap_axis = world_snap_axis; - if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) + if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid()) { projected_snap_axis = projected_snap_axis * grid_rotation; } @@ -1282,7 +1283,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) LLVector3 axis2; LLVector3 test_axis = constraint_axis; - if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) + if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid()) { test_axis = test_axis * ~grid_rotation; } @@ -1306,7 +1307,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) axis1 = LLVector3::x_axis; } - if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) + if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid()) { axis1 = axis1 * grid_rotation; } -- cgit v1.2.3