diff options
Diffstat (limited to 'linden/indra/newview/llmaniprotate.cpp')
-rw-r--r-- | linden/indra/newview/llmaniprotate.cpp | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/linden/indra/newview/llmaniprotate.cpp b/linden/indra/newview/llmaniprotate.cpp index bd951a6..94bbe7d 100644 --- a/linden/indra/newview/llmaniprotate.cpp +++ b/linden/indra/newview/llmaniprotate.cpp | |||
@@ -54,7 +54,6 @@ | |||
54 | #include "llstatusbar.h" | 54 | #include "llstatusbar.h" |
55 | #include "llui.h" | 55 | #include "llui.h" |
56 | #include "llvoavatar.h" | 56 | #include "llvoavatar.h" |
57 | #include "llviewborder.h" | ||
58 | #include "llviewercamera.h" | 57 | #include "llviewercamera.h" |
59 | #include "llviewerobject.h" | 58 | #include "llviewerobject.h" |
60 | #include "llviewerobject.h" | 59 | #include "llviewerobject.h" |
@@ -109,7 +108,7 @@ LLManipRotate::LLManipRotate( LLToolComposite* composite ) | |||
109 | void LLManipRotate::handleSelect() | 108 | void LLManipRotate::handleSelect() |
110 | { | 109 | { |
111 | // *FIX: put this in mouseDown? | 110 | // *FIX: put this in mouseDown? |
112 | gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); | 111 | LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); |
113 | gFloaterTools->setStatusText("rotate"); | 112 | gFloaterTools->setStatusText("rotate"); |
114 | LLManip::handleSelect(); | 113 | LLManip::handleSelect(); |
115 | } | 114 | } |
@@ -225,7 +224,7 @@ void LLManipRotate::render() | |||
225 | LLVector3 grid_scale; | 224 | LLVector3 grid_scale; |
226 | LLQuaternion grid_rotation; | 225 | LLQuaternion grid_rotation; |
227 | 226 | ||
228 | gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); | 227 | LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); |
229 | 228 | ||
230 | grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z); | 229 | grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z); |
231 | glRotatef(angle_radians * RAD_TO_DEG, x, y, z); | 230 | glRotatef(angle_radians * RAD_TO_DEG, x, y, z); |
@@ -386,10 +385,10 @@ BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) | |||
386 | highlightManipulators(x, y); | 385 | highlightManipulators(x, y); |
387 | S32 hit_part = mHighlightedPart; | 386 | S32 hit_part = mHighlightedPart; |
388 | // we just started a drag, so save initial object positions | 387 | // we just started a drag, so save initial object positions |
389 | gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_ROTATE); | 388 | LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_ROTATE); |
390 | 389 | ||
391 | // save selection center | 390 | // save selection center |
392 | mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() ); //gSelectMgr->getSelectionCenterGlobal(); | 391 | mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() ); //LLSelectMgr::getInstance()->getSelectionCenterGlobal(); |
393 | 392 | ||
394 | mManipPart = (EManipPart)hit_part; | 393 | mManipPart = (EManipPart)hit_part; |
395 | LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); | 394 | LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); |
@@ -435,7 +434,7 @@ BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) | |||
435 | 434 | ||
436 | // Route future Mouse messages here preemptively. (Release on mouse up.) | 435 | // Route future Mouse messages here preemptively. (Release on mouse up.) |
437 | setMouseCapture( TRUE ); | 436 | setMouseCapture( TRUE ); |
438 | gSelectMgr->enableSilhouette(FALSE); | 437 | LLSelectMgr::getInstance()->enableSilhouette(FALSE); |
439 | return TRUE; | 438 | return TRUE; |
440 | } | 439 | } |
441 | 440 | ||
@@ -461,12 +460,12 @@ BOOL LLManipRotate::handleMouseUp(S32 x, S32 y, MASK mask) | |||
461 | mManipPart = LL_NO_PART; | 460 | mManipPart = LL_NO_PART; |
462 | 461 | ||
463 | // Might have missed last update due to timing. | 462 | // Might have missed last update due to timing. |
464 | gSelectMgr->sendMultipleUpdate( UPD_ROTATION | UPD_POSITION ); | 463 | LLSelectMgr::getInstance()->sendMultipleUpdate( UPD_ROTATION | UPD_POSITION ); |
465 | gSelectMgr->enableSilhouette(TRUE); | 464 | LLSelectMgr::getInstance()->enableSilhouette(TRUE); |
466 | //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); | 465 | //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); |
467 | 466 | ||
468 | gSelectMgr->updateSelectionCenter(); | 467 | LLSelectMgr::getInstance()->updateSelectionCenter(); |
469 | gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); | 468 | LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); |
470 | } | 469 | } |
471 | 470 | ||
472 | return LLManip::handleMouseUp(x, y, mask); | 471 | return LLManip::handleMouseUp(x, y, mask); |
@@ -635,7 +634,7 @@ void LLManipRotate::drag( S32 x, S32 y ) | |||
635 | if (object->isRootEdit() && !object->isAttachment()) | 634 | if (object->isRootEdit() && !object->isAttachment()) |
636 | { | 635 | { |
637 | LLVector3d new_pos_global = gAgent.getPosGlobalFromAgent(new_position); | 636 | LLVector3d new_pos_global = gAgent.getPosGlobalFromAgent(new_position); |
638 | new_pos_global = gWorldp->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global); | 637 | new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global); |
639 | new_position = gAgent.getPosAgentFromGlobal(new_pos_global); | 638 | new_position = gAgent.getPosAgentFromGlobal(new_pos_global); |
640 | } | 639 | } |
641 | 640 | ||
@@ -704,8 +703,8 @@ void LLManipRotate::drag( S32 x, S32 y ) | |||
704 | } | 703 | } |
705 | 704 | ||
706 | // store changes to override updates | 705 | // store changes to override updates |
707 | for (LLObjectSelection::iterator iter = gSelectMgr->getSelection()->begin(); | 706 | for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin(); |
708 | iter != gSelectMgr->getSelection()->end(); iter++) | 707 | iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++) |
709 | { | 708 | { |
710 | LLSelectNode* selectNode = *iter; | 709 | LLSelectNode* selectNode = *iter; |
711 | LLViewerObject*cur = selectNode->getObject(); | 710 | LLViewerObject*cur = selectNode->getObject(); |
@@ -716,7 +715,7 @@ void LLManipRotate::drag( S32 x, S32 y ) | |||
716 | } | 715 | } |
717 | } | 716 | } |
718 | 717 | ||
719 | gSelectMgr->updateSelectionCenter(); | 718 | LLSelectMgr::getInstance()->updateSelectionCenter(); |
720 | 719 | ||
721 | // RN: just clear focus so camera doesn't follow spurious object updates | 720 | // RN: just clear focus so camera doesn't follow spurious object updates |
722 | gAgent.clearFocusObject(); | 721 | gAgent.clearFocusObject(); |
@@ -744,7 +743,7 @@ void LLManipRotate::renderSnapGuides() | |||
744 | LLQuaternion grid_rotation; | 743 | LLQuaternion grid_rotation; |
745 | LLVector3 constraint_axis = getConstraintAxis(); | 744 | LLVector3 constraint_axis = getConstraintAxis(); |
746 | 745 | ||
747 | gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); | 746 | LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); |
748 | 747 | ||
749 | if (!gSavedSettings.getBOOL("SnapEnabled")) | 748 | if (!gSavedSettings.getBOOL("SnapEnabled")) |
750 | { | 749 | { |
@@ -771,7 +770,7 @@ void LLManipRotate::renderSnapGuides() | |||
771 | { | 770 | { |
772 | test_axis = test_axis * ~grid_rotation; | 771 | test_axis = test_axis * ~grid_rotation; |
773 | } | 772 | } |
774 | else if (gSelectMgr->getGridMode() == GRID_MODE_REF_OBJECT) | 773 | else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT) |
775 | { | 774 | { |
776 | test_axis = test_axis * ~grid_rotation; | 775 | test_axis = test_axis * ~grid_rotation; |
777 | constrain_to_ref_object = TRUE; | 776 | constrain_to_ref_object = TRUE; |
@@ -1118,7 +1117,7 @@ BOOL LLManipRotate::updateVisiblity() | |||
1118 | // JC - 03.26.2002 | 1117 | // JC - 03.26.2002 |
1119 | if (!hasMouseCapture()) | 1118 | if (!hasMouseCapture()) |
1120 | { | 1119 | { |
1121 | mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() );//gSelectMgr->getSelectionCenterGlobal(); | 1120 | mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() );//LLSelectMgr::getInstance()->getSelectionCenterGlobal(); |
1122 | } | 1121 | } |
1123 | 1122 | ||
1124 | BOOL visible = FALSE; | 1123 | BOOL visible = FALSE; |
@@ -1130,7 +1129,7 @@ BOOL LLManipRotate::updateVisiblity() | |||
1130 | mCenterToCamNorm = mCenterToCam; | 1129 | mCenterToCamNorm = mCenterToCam; |
1131 | mCenterToCamMag = mCenterToCamNorm.normVec(); | 1130 | mCenterToCamMag = mCenterToCamNorm.normVec(); |
1132 | 1131 | ||
1133 | mRadiusMeters = RADIUS_PIXELS / (F32) gCamera->getViewHeightInPixels(); | 1132 | mRadiusMeters = RADIUS_PIXELS / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); |
1134 | mRadiusMeters /= gAgent.getAvatarObject()->mHUDCurZoom; | 1133 | mRadiusMeters /= gAgent.getAvatarObject()->mHUDCurZoom; |
1135 | 1134 | ||
1136 | mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag; | 1135 | mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag; |
@@ -1142,13 +1141,13 @@ BOOL LLManipRotate::updateVisiblity() | |||
1142 | } | 1141 | } |
1143 | else | 1142 | else |
1144 | { | 1143 | { |
1145 | visible = gCamera->projectPosAgentToScreen(center, mCenterScreen ); | 1144 | visible = LLViewerCamera::getInstance()->projectPosAgentToScreen(center, mCenterScreen ); |
1146 | if( visible ) | 1145 | if( visible ) |
1147 | { | 1146 | { |
1148 | mCenterToCam = gAgent.getCameraPositionAgent() - center; | 1147 | mCenterToCam = gAgent.getCameraPositionAgent() - center; |
1149 | mCenterToCamNorm = mCenterToCam; | 1148 | mCenterToCamNorm = mCenterToCam; |
1150 | mCenterToCamMag = mCenterToCamNorm.normVec(); | 1149 | mCenterToCamMag = mCenterToCamNorm.normVec(); |
1151 | LLVector3 cameraAtAxis = gCamera->getAtAxis(); | 1150 | LLVector3 cameraAtAxis = LLViewerCamera::getInstance()->getAtAxis(); |
1152 | cameraAtAxis.normVec(); | 1151 | cameraAtAxis.normVec(); |
1153 | 1152 | ||
1154 | F32 z_dist = -1.f * (mCenterToCam * cameraAtAxis); | 1153 | F32 z_dist = -1.f * (mCenterToCam * cameraAtAxis); |
@@ -1165,8 +1164,8 @@ BOOL LLManipRotate::updateVisiblity() | |||
1165 | 1164 | ||
1166 | if (mCenterToCamMag > 0.001f) | 1165 | if (mCenterToCamMag > 0.001f) |
1167 | { | 1166 | { |
1168 | F32 fraction_of_fov = RADIUS_PIXELS / (F32) gCamera->getViewHeightInPixels(); | 1167 | F32 fraction_of_fov = RADIUS_PIXELS / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); |
1169 | F32 apparent_angle = fraction_of_fov * gCamera->getView(); // radians | 1168 | F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians |
1170 | mRadiusMeters = z_dist * tan(apparent_angle); | 1169 | mRadiusMeters = z_dist * tan(apparent_angle); |
1171 | 1170 | ||
1172 | mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag; | 1171 | mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag; |
@@ -1274,7 +1273,7 @@ LLVector3 LLManipRotate::getConstraintAxis() | |||
1274 | LLVector3 grid_scale; | 1273 | LLVector3 grid_scale; |
1275 | LLQuaternion grid_rotation; | 1274 | LLQuaternion grid_rotation; |
1276 | 1275 | ||
1277 | gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); | 1276 | LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); |
1278 | 1277 | ||
1279 | LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE); | 1278 | LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE); |
1280 | if (first_node) | 1279 | if (first_node) |
@@ -1301,7 +1300,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) | |||
1301 | LLVector3 grid_scale; | 1300 | LLVector3 grid_scale; |
1302 | LLQuaternion grid_rotation; | 1301 | LLQuaternion grid_rotation; |
1303 | 1302 | ||
1304 | gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); | 1303 | LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); |
1305 | 1304 | ||
1306 | LLVector3 axis1; | 1305 | LLVector3 axis1; |
1307 | LLVector3 axis2; | 1306 | LLVector3 axis2; |
@@ -1311,7 +1310,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) | |||
1311 | { | 1310 | { |
1312 | test_axis = test_axis * ~grid_rotation; | 1311 | test_axis = test_axis * ~grid_rotation; |
1313 | } | 1312 | } |
1314 | else if (gSelectMgr->getGridMode() == GRID_MODE_REF_OBJECT) | 1313 | else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT) |
1315 | { | 1314 | { |
1316 | test_axis = test_axis * ~grid_rotation; | 1315 | test_axis = test_axis * ~grid_rotation; |
1317 | } | 1316 | } |
@@ -1335,7 +1334,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) | |||
1335 | { | 1334 | { |
1336 | axis1 = axis1 * grid_rotation; | 1335 | axis1 = axis1 * grid_rotation; |
1337 | } | 1336 | } |
1338 | else if (gSelectMgr->getGridMode() == GRID_MODE_REF_OBJECT) | 1337 | else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT) |
1339 | { | 1338 | { |
1340 | axis1 = axis1 * grid_rotation; | 1339 | axis1 = axis1 * grid_rotation; |
1341 | } | 1340 | } |
@@ -1651,7 +1650,7 @@ LLVector3 LLManipRotate::intersectRayWithSphere( const LLVector3& ray_pt, const | |||
1651 | //static | 1650 | //static |
1652 | void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir ) | 1651 | void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir ) |
1653 | { | 1652 | { |
1654 | if (gSelectMgr->getSelection()->getSelectType() == SELECT_TYPE_HUD) | 1653 | if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD) |
1655 | { | 1654 | { |
1656 | F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; | 1655 | F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; |
1657 | F32 mouse_y = ((((F32)y) / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; | 1656 | F32 mouse_y = ((((F32)y) / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; |
@@ -1662,7 +1661,7 @@ void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_ | |||
1662 | else | 1661 | else |
1663 | { | 1662 | { |
1664 | *ray_pt = gAgent.getCameraPositionAgent(); | 1663 | *ray_pt = gAgent.getCameraPositionAgent(); |
1665 | gCamera->projectScreenToPosAgent(x, y, ray_dir); | 1664 | LLViewerCamera::getInstance()->projectScreenToPosAgent(x, y, ray_dir); |
1666 | *ray_dir -= *ray_pt; | 1665 | *ray_dir -= *ray_pt; |
1667 | ray_dir->normVec(); | 1666 | ray_dir->normVec(); |
1668 | } | 1667 | } |
@@ -1672,7 +1671,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y ) | |||
1672 | { | 1671 | { |
1673 | mHighlightedPart = LL_NO_PART; | 1672 | mHighlightedPart = LL_NO_PART; |
1674 | 1673 | ||
1675 | //LLBBox bbox = gSelectMgr->getBBoxOfSelection(); | 1674 | //LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); |
1676 | LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE); | 1675 | LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE); |
1677 | 1676 | ||
1678 | if (!first_object) | 1677 | if (!first_object) |
@@ -1691,7 +1690,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y ) | |||
1691 | LLVector3 grid_scale; | 1690 | LLVector3 grid_scale; |
1692 | LLQuaternion grid_rotation; | 1691 | LLQuaternion grid_rotation; |
1693 | 1692 | ||
1694 | gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); | 1693 | LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); |
1695 | 1694 | ||
1696 | LLVector3 rot_x_axis = LLVector3::x_axis * grid_rotation; | 1695 | LLVector3 rot_x_axis = LLVector3::x_axis * grid_rotation; |
1697 | LLVector3 rot_y_axis = LLVector3::y_axis * grid_rotation; | 1696 | LLVector3 rot_y_axis = LLVector3::y_axis * grid_rotation; |