aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llmaniptranslate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llmaniptranslate.cpp')
-rw-r--r--linden/indra/newview/llmaniptranslate.cpp240
1 files changed, 177 insertions, 63 deletions
diff --git a/linden/indra/newview/llmaniptranslate.cpp b/linden/indra/newview/llmaniptranslate.cpp
index fea6092..bb58a9c 100644
--- a/linden/indra/newview/llmaniptranslate.cpp
+++ b/linden/indra/newview/llmaniptranslate.cpp
@@ -59,6 +59,7 @@
59#include "llworld.h" 59#include "llworld.h"
60#include "viewer.h" 60#include "viewer.h"
61#include "llui.h" 61#include "llui.h"
62#include "pipeline.h"
62 63
63const S32 NUM_AXES = 3; 64const S32 NUM_AXES = 3;
64const S32 MOUSE_DRAG_SLOP = 2; // pixels 65const S32 MOUSE_DRAG_SLOP = 2; // pixels
@@ -257,6 +258,7 @@ void LLManipTranslate::handleSelect()
257{ 258{
258 gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); 259 gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
259 gFloaterTools->setStatusText("Drag to move, shift-drag to copy"); 260 gFloaterTools->setStatusText("Drag to move, shift-drag to copy");
261 LLManip::handleSelect();
260} 262}
261 263
262void LLManipTranslate::handleDeselect() 264void LLManipTranslate::handleDeselect()
@@ -264,6 +266,7 @@ void LLManipTranslate::handleDeselect()
264 mHighlightedPart = LL_NO_PART; 266 mHighlightedPart = LL_NO_PART;
265 mManipPart = LL_NO_PART; 267 mManipPart = LL_NO_PART;
266 gFloaterTools->setStatusText(""); 268 gFloaterTools->setStatusText("");
269 LLManip::handleDeselect();
267} 270}
268 271
269BOOL LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask) 272BOOL LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -289,10 +292,10 @@ BOOL LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask)
289// Assumes that one of the arrows on an object was hit. 292// Assumes that one of the arrows on an object was hit.
290BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) 293BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
291{ 294{
292 BOOL can_move = gSelectMgr->getObjectCount() != 0; 295 BOOL can_move = mObjectSelection->getObjectCount() != 0;
293 for (LLViewerObject* objectp = gSelectMgr->getFirstObject(); 296 for (LLViewerObject* objectp = mObjectSelection->getFirstObject();
294 objectp; 297 objectp;
295 objectp = gSelectMgr->getNextObject()) 298 objectp = mObjectSelection->getNextObject())
296 { 299 {
297 can_move = can_move && objectp->permMove() && (objectp->permModify() || gSavedSettings.getBOOL("SelectLinkedSet")); 300 can_move = can_move && objectp->permMove() && (objectp->permModify() || gSavedSettings.getBOOL("SelectLinkedSet"));
298 } 301 }
@@ -332,7 +335,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
332 335
333 LLVector3 axis; 336 LLVector3 axis;
334 337
335 LLSelectNode *selectNode = gSelectMgr->getFirstMoveableNode(TRUE); 338 LLSelectNode *selectNode = mObjectSelection->getFirstMoveableNode(TRUE);
336 339
337 if (!selectNode) 340 if (!selectNode)
338 { 341 {
@@ -407,7 +410,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
407 BOOL rotated = FALSE; 410 BOOL rotated = FALSE;
408 411
409 // ...build mode moves camera about focus point 412 // ...build mode moves camera about focus point
410 if (gSelectMgr->getSelectType() != SELECT_TYPE_HUD) 413 if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
411 { 414 {
412 if (x < ROTATE_H_MARGIN) 415 if (x < ROTATE_H_MARGIN)
413 { 416 {
@@ -421,6 +424,8 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
421 } 424 }
422 } 425 }
423 426
427 LLViewerObject *object;
428
424 // Suppress processing if mouse hasn't actually moved. 429 // Suppress processing if mouse hasn't actually moved.
425 // This may cause problems if the camera moves outside of the 430 // This may cause problems if the camera moves outside of the
426 // rotation above. 431 // rotation above.
@@ -467,11 +472,10 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
467 472
468 LLVector3 axis_f; 473 LLVector3 axis_f;
469 LLVector3d axis_d; 474 LLVector3d axis_d;
470 LLViewerObject *object;
471 475
472 // pick the first object to constrain to grid w/ common origin 476 // pick the first object to constrain to grid w/ common origin
473 // this is so we don't screw up groups 477 // this is so we don't screw up groups
474 LLSelectNode* selectNode = gSelectMgr->getFirstMoveableNode(TRUE); 478 LLSelectNode* selectNode = mObjectSelection->getFirstMoveableNode(TRUE);
475 if (!selectNode) 479 if (!selectNode)
476 { 480 {
477 // somehow we lost the object! 481 // somehow we lost the object!
@@ -643,12 +647,12 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
643 LLVector3d clamped_relative_move = axis_magnitude * axis_d; // scalar multiply 647 LLVector3d clamped_relative_move = axis_magnitude * axis_d; // scalar multiply
644 LLVector3 clamped_relative_move_f = (F32)axis_magnitude * axis_f; // scalar multiply 648 LLVector3 clamped_relative_move_f = (F32)axis_magnitude * axis_f; // scalar multiply
645 649
646 for(selectNode = gSelectMgr->getFirstNode(); 650 for(selectNode = mObjectSelection->getFirstNode();
647 selectNode; 651 selectNode;
648 selectNode = gSelectMgr->getNextNode() ) 652 selectNode = mObjectSelection->getNextNode() )
649 { 653 {
650 object = selectNode->getObject(); 654 object = selectNode->getObject();
651 655
652 // Only apply motion to root objects and objects selected 656 // Only apply motion to root objects and objects selected
653 // as "individual". 657 // as "individual".
654 if (!object->isRootEdit() && !selectNode->mIndividualSelection) 658 if (!object->isRootEdit() && !selectNode->mIndividualSelection)
@@ -779,27 +783,12 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
779 send_update = TRUE; 783 send_update = TRUE;
780 } 784 }
781 } 785 }
786 selectNode->mLastPositionLocal = object->getPosition();
782 } 787 }
783 } 788 }
784 789
785 // Handle throttling to 10 updates per second.
786 F32 elapsed_time = mUpdateTimer.getElapsedTimeF32();
787 const F32 UPDATE_DELAY = 0.1f; // min time between transmitted updates
788 if (send_update && (elapsed_time > UPDATE_DELAY))
789 {
790 gSelectMgr->sendMultipleUpdate(UPD_POSITION);
791 mUpdateTimer.reset();
792 mSendUpdateOnMouseUp = FALSE;
793 }
794 else
795 {
796 // ...suppressed update
797 mSendUpdateOnMouseUp = TRUE;
798 }
799
800 gSelectMgr->updateSelectionCenter(); 790 gSelectMgr->updateSelectionCenter();
801 gAgent.clearFocusObject(); 791 gAgent.clearFocusObject();
802 //gAgent.setObjectTracking(FALSE);
803 dialog_refresh_all(); // ??? is this necessary? 792 dialog_refresh_all(); // ??? is this necessary?
804 793
805 lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (active)" << llendl; 794 lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (active)" << llendl;
@@ -811,7 +800,7 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y)
811{ 800{
812 mHighlightedPart = LL_NO_PART; 801 mHighlightedPart = LL_NO_PART;
813 802
814 if (!gSelectMgr->getObjectCount()) 803 if (!mObjectSelection->getObjectCount())
815 { 804 {
816 return; 805 return;
817 } 806 }
@@ -832,7 +821,7 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y)
832 821
833 LLMatrix4 transform; 822 LLMatrix4 transform;
834 823
835 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) 824 if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
836 { 825 {
837 relative_camera_dir = LLVector3(1.f, 0.f, 0.f) * ~grid_rotation; 826 relative_camera_dir = LLVector3(1.f, 0.f, 0.f) * ~grid_rotation;
838 LLVector4 translation(object_position); 827 LLVector4 translation(object_position);
@@ -1056,17 +1045,8 @@ BOOL LLManipTranslate::handleMouseUp(S32 x, S32 y, MASK mask)
1056 gSelectMgr->enableSilhouette(TRUE); 1045 gSelectMgr->enableSilhouette(TRUE);
1057 1046
1058 // Might have missed last update due to UPDATE_DELAY timing. 1047 // Might have missed last update due to UPDATE_DELAY timing.
1059 if (mSendUpdateOnMouseUp) 1048 gSelectMgr->sendMultipleUpdate( UPD_POSITION );
1060 { 1049
1061 gSelectMgr->sendMultipleUpdate( UPD_POSITION );
1062 mSendUpdateOnMouseUp = FALSE;
1063 }
1064
1065// if (mCopyMadeThisDrag)
1066// {
1067// gSelectMgr->clearGridObjects();
1068// }
1069
1070 mInSnapRegime = FALSE; 1050 mInSnapRegime = FALSE;
1071 gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); 1051 gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
1072 //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); 1052 //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject"));
@@ -1079,7 +1059,7 @@ void LLManipTranslate::render()
1079{ 1059{
1080 glMatrixMode(GL_MODELVIEW); 1060 glMatrixMode(GL_MODELVIEW);
1081 glPushMatrix(); 1061 glPushMatrix();
1082 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) 1062 if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
1083 { 1063 {
1084 F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom; 1064 F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom;
1085 glScalef(zoom, zoom, zoom); 1065 glScalef(zoom, zoom, zoom);
@@ -1117,7 +1097,7 @@ void LLManipTranslate::renderSnapGuides()
1117 return; 1097 return;
1118 } 1098 }
1119 1099
1120 LLSelectNode *first_node = gSelectMgr->getFirstMoveableNode(TRUE); 1100 LLSelectNode *first_node = mObjectSelection->getFirstMoveableNode(TRUE);
1121 if (!first_node) 1101 if (!first_node)
1122 { 1102 {
1123 return; 1103 return;
@@ -1139,10 +1119,36 @@ void LLManipTranslate::renderSnapGuides()
1139 //pick appropriate projection plane for snap rulers according to relative camera position 1119 //pick appropriate projection plane for snap rulers according to relative camera position
1140 if (mManipPart >= LL_X_ARROW && mManipPart <= LL_Z_ARROW) 1120 if (mManipPart >= LL_X_ARROW && mManipPart <= LL_Z_ARROW)
1141 { 1121 {
1122 LLVector3 normal;
1123 LLColor4 inner_color;
1124 LLManip::EManipPart temp_manip = mManipPart;
1125 switch (mManipPart)
1126 {
1127 case LL_X_ARROW:
1128 normal.setVec(1,0,0);
1129 inner_color.setVec(0,1,1,line_alpha);
1130 mManipPart = LL_YZ_PLANE;
1131 break;
1132 case LL_Y_ARROW:
1133 normal.setVec(0,1,0);
1134 inner_color.setVec(1,0,1,line_alpha);
1135 mManipPart = LL_XZ_PLANE;
1136 break;
1137 case LL_Z_ARROW:
1138 normal.setVec(0,0,1);
1139 inner_color.setVec(1,1,0,line_alpha);
1140 mManipPart = LL_XY_PLANE;
1141 break;
1142 default:
1143 break;
1144 }
1145
1146 highlightIntersection(normal, selection_center, grid_rotation, inner_color);
1147 mManipPart = temp_manip;
1142 getManipAxis(first_object, mManipPart, translate_axis); 1148 getManipAxis(first_object, mManipPart, translate_axis);
1143 1149
1144 LLVector3 at_axis_abs; 1150 LLVector3 at_axis_abs;
1145 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) 1151 if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
1146 { 1152 {
1147 at_axis_abs = LLVector3::x_axis * ~grid_rotation; 1153 at_axis_abs = LLVector3::x_axis * ~grid_rotation;
1148 } 1154 }
@@ -1217,7 +1223,7 @@ void LLManipTranslate::renderSnapGuides()
1217 1223
1218 F32 guide_size_meters; 1224 F32 guide_size_meters;
1219 1225
1220 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) 1226 if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
1221 { 1227 {
1222 guide_size_meters = 1.f / gAgent.getAvatarObject()->mHUDCurZoom; 1228 guide_size_meters = 1.f / gAgent.getAvatarObject()->mHUDCurZoom;
1223 mSnapOffsetMeters = mArrowLengthMeters * 1.5f; 1229 mSnapOffsetMeters = mArrowLengthMeters * 1.5f;
@@ -1419,7 +1425,7 @@ void LLManipTranslate::renderSnapGuides()
1419 } 1425 }
1420 } 1426 }
1421 } 1427 }
1422 if (gSelectMgr->getSelectType() != SELECT_TYPE_HUD) 1428 if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
1423 { 1429 {
1424 // render helpful text 1430 // render helpful text
1425 if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText) 1431 if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText)
@@ -1443,10 +1449,10 @@ void LLManipTranslate::renderSnapGuides()
1443 std::string help_text = "Move mouse cursor over ruler to snap"; 1449 std::string help_text = "Move mouse cursor over ruler to snap";
1444 LLColor4 help_text_color = LLColor4::white; 1450 LLColor4 help_text_color = LLColor4::white;
1445 help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f); 1451 help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f);
1446 hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, gSelectMgr->getSelectType() == SELECT_TYPE_HUD); 1452 hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
1447 help_text = "to snap to grid"; 1453 help_text = "to snap to grid";
1448 help_text_pos -= gCamera->getUpAxis() * mSnapOffsetMeters * 0.2f; 1454 help_text_pos -= gCamera->getUpAxis() * mSnapOffsetMeters * 0.2f;
1449 hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, gSelectMgr->getSelectType() == SELECT_TYPE_HUD); 1455 hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
1450 } 1456 }
1451 } 1457 }
1452 } 1458 }
@@ -1455,18 +1461,13 @@ void LLManipTranslate::renderSnapGuides()
1455 // render gridlines for planar snapping 1461 // render gridlines for planar snapping
1456 1462
1457 F32 u = 0, v = 0; 1463 F32 u = 0, v = 0;
1458 glPushMatrix(); 1464 LLColor4 inner_color;
1459 1465 LLVector3 normal;
1460 F32 x,y,z,angle_radians;
1461 grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
1462 glTranslatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
1463 glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
1464
1465 LLVector3 grid_center = selection_center - grid_origin; 1466 LLVector3 grid_center = selection_center - grid_origin;
1466 grid_center *= ~grid_rotation;
1467
1468 F32 usc = 1; 1467 F32 usc = 1;
1469 F32 vsc = 1; 1468 F32 vsc = 1;
1469
1470 grid_center *= ~grid_rotation;
1470 1471
1471 switch (mManipPart) 1472 switch (mManipPart)
1472 { 1473 {
@@ -1475,23 +1476,38 @@ void LLManipTranslate::renderSnapGuides()
1475 v = grid_center.mV[VZ]; 1476 v = grid_center.mV[VZ];
1476 usc = grid_scale.mV[VY]; 1477 usc = grid_scale.mV[VY];
1477 vsc = grid_scale.mV[VZ]; 1478 vsc = grid_scale.mV[VZ];
1479 inner_color.setVec(0,1,1,line_alpha);
1480 normal.setVec(1,0,0);
1478 break; 1481 break;
1479 case LL_XZ_PLANE: 1482 case LL_XZ_PLANE:
1480 u = grid_center.mV[VX]; 1483 u = grid_center.mV[VX];
1481 v = grid_center.mV[VZ]; 1484 v = grid_center.mV[VZ];
1482 usc = grid_scale.mV[VX]; 1485 usc = grid_scale.mV[VX];
1483 vsc = grid_scale.mV[VZ]; 1486 vsc = grid_scale.mV[VZ];
1487 inner_color.setVec(1,0,1,line_alpha);
1488 normal.setVec(0,1,0);
1484 break; 1489 break;
1485 case LL_XY_PLANE: 1490 case LL_XY_PLANE:
1486 u = grid_center.mV[VX]; 1491 u = grid_center.mV[VX];
1487 v = grid_center.mV[VY]; 1492 v = grid_center.mV[VY];
1488 usc = grid_scale.mV[VX]; 1493 usc = grid_scale.mV[VX];
1489 vsc = grid_scale.mV[VY]; 1494 vsc = grid_scale.mV[VY];
1495 inner_color.setVec(1,1,0,line_alpha);
1496 normal.setVec(0,0,1);
1490 break; 1497 break;
1491 default: 1498 default:
1492 break; 1499 break;
1493 } 1500 }
1494 1501
1502 highlightIntersection(normal, selection_center, grid_rotation, inner_color);
1503
1504 glPushMatrix();
1505
1506 F32 x,y,z,angle_radians;
1507 grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
1508 glTranslatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
1509 glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
1510
1495 F32 sz = mGridSizeMeters; 1511 F32 sz = mGridSizeMeters;
1496 F32 tiles = sz; 1512 F32 tiles = sz;
1497 glMatrixMode(GL_TEXTURE); 1513 glMatrixMode(GL_TEXTURE);
@@ -1608,20 +1624,118 @@ void LLManipTranslate::renderGrid(F32 x, F32 y, F32 size, F32 r, F32 g, F32 b, F
1608 1624
1609} 1625}
1610 1626
1627void LLManipTranslate::highlightIntersection(LLVector3 normal,
1628 LLVector3 selection_center,
1629 LLQuaternion grid_rotation,
1630 LLColor4 inner_color)
1631{
1632 if (!gSavedSettings.getBOOL("GridCrossSections"))
1633 {
1634 return;
1635 }
1636
1637 U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_ALPHA, LLRenderPass::PASS_FULLBRIGHT };
1638
1639 GLuint stencil_mask = 0xFFFFFFFF;
1640 //stencil in volumes
1641 {
1642 glStencilMask(stencil_mask);
1643 glClearStencil(1);
1644 glClear(GL_STENCIL_BUFFER_BIT);
1645 LLGLEnable cull_face(GL_CULL_FACE);
1646 LLGLEnable stencil(GL_STENCIL_TEST);
1647 LLGLDepthTest depth (GL_TRUE, GL_FALSE, GL_ALWAYS);
1648 glStencilFunc(GL_ALWAYS, 0, stencil_mask);
1649 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
1650 LLGLDisable tex(GL_TEXTURE_2D);
1651 glColor4f(1,1,1,1);
1652
1653 //setup clip plane
1654 normal = normal * grid_rotation;
1655 if (normal * (gCamera->getOrigin()-selection_center) < 0)
1656 {
1657 normal = -normal;
1658 }
1659 F32 d = -(selection_center * normal);
1660 F64 plane[] = { normal.mV[0], normal.mV[1], normal.mV[2], d };
1661 LLGLEnable clip(GL_CLIP_PLANE0);
1662 glClipPlane(GL_CLIP_PLANE0, plane);
1663
1664 BOOL particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
1665 BOOL clouds = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS);
1666
1667 if (particles)
1668 {
1669 LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
1670 }
1671 if (clouds)
1672 {
1673 LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_CLOUDS);
1674 }
1675
1676 //stencil in volumes
1677 glStencilOp(GL_INCR, GL_INCR, GL_INCR);
1678 glCullFace(GL_FRONT);
1679 for (U32 i = 0; i < 3; i++)
1680 {
1681 gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE);
1682 }
1683
1684 glStencilOp(GL_DECR, GL_DECR, GL_DECR);
1685 glCullFace(GL_BACK);
1686 for (U32 i = 0; i < 3; i++)
1687 {
1688 gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE);
1689 }
1690
1691 if (particles)
1692 {
1693 LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
1694 }
1695 if (clouds)
1696 {
1697 LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_CLOUDS);
1698 }
1699
1700 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
1701 }
1702
1703 glPushMatrix();
1704
1705 F32 x,y,z,angle_radians;
1706 grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
1707 glTranslatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
1708 glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
1709
1710 F32 sz = mGridSizeMeters;
1711 F32 tiles = sz;
1712
1713 //draw volume/plane intersections
1714 {
1715 LLGLDisable tex(GL_TEXTURE_2D);
1716 LLGLDepthTest depth(GL_FALSE);
1717 LLGLEnable stencil(GL_STENCIL_TEST);
1718 glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
1719 glStencilFunc(GL_EQUAL, 0, stencil_mask);
1720 renderGrid(0,0,tiles,inner_color.mV[0], inner_color.mV[1], inner_color.mV[2], 0.25f);
1721 }
1722
1723 glPopMatrix();
1724}
1611 1725
1612void LLManipTranslate::renderText() 1726void LLManipTranslate::renderText()
1613{ 1727{
1614 if (gSelectMgr->getRootObjectCount() && !gSelectMgr->selectionIsAttachment()) 1728 if (mObjectSelection->getRootObjectCount() && !mObjectSelection->isAttachment())
1615 { 1729 {
1616 LLVector3 pos = getPivotPoint(); 1730 LLVector3 pos = getPivotPoint();
1617 renderXYZ(pos); 1731 renderXYZ(pos);
1618 } 1732 }
1619 else 1733 else
1620 { 1734 {
1621 LLViewerObject* objectp = gSelectMgr->getFirstRootObject(); 1735 LLViewerObject* objectp = mObjectSelection->getFirstRootObject();
1622 if(!objectp) 1736 if(!objectp)
1623 { 1737 {
1624 objectp = gSelectMgr->getFirstObject(); 1738 objectp = mObjectSelection->getFirstObject();
1625 } 1739 }
1626 1740
1627 if (objectp) 1741 if (objectp)
@@ -1640,7 +1754,7 @@ void LLManipTranslate::renderTranslationHandles()
1640 1754
1641 gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); 1755 gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale);
1642 LLVector3 at_axis; 1756 LLVector3 at_axis;
1643 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) 1757 if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
1644 { 1758 {
1645 at_axis = LLVector3::x_axis * ~grid_rotation; 1759 at_axis = LLVector3::x_axis * ~grid_rotation;
1646 } 1760 }
@@ -1676,13 +1790,13 @@ void LLManipTranslate::renderTranslationHandles()
1676 mPlaneManipPositions.mV[VZ] = -1.f; 1790 mPlaneManipPositions.mV[VZ] = -1.f;
1677 } 1791 }
1678 1792
1679 LLViewerObject *first_object = gSelectMgr->getFirstMoveableObject(TRUE); 1793 LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE);
1680 if (!first_object) return; 1794 if (!first_object) return;
1681 1795
1682 LLVector3 selection_center = getPivotPoint(); 1796 LLVector3 selection_center = getPivotPoint();
1683 1797
1684 // Drag handles 1798 // Drag handles
1685 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) 1799 if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
1686 { 1800 {
1687 mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWindowHeight(); 1801 mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWindowHeight();
1688 mArrowLengthMeters /= gAgent.getAvatarObject()->mHUDCurZoom; 1802 mArrowLengthMeters /= gAgent.getAvatarObject()->mHUDCurZoom;
@@ -1735,7 +1849,7 @@ void LLManipTranslate::renderTranslationHandles()
1735 1849
1736 LLVector3 relative_camera_dir; 1850 LLVector3 relative_camera_dir;
1737 1851
1738 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) 1852 if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
1739 { 1853 {
1740 relative_camera_dir = LLVector3::x_axis * invRotation; 1854 relative_camera_dir = LLVector3::x_axis * invRotation;
1741 } 1855 }
@@ -2007,7 +2121,7 @@ void LLManipTranslate::renderTranslationHandles()
2007 2121
2008 // draw arrows for deeper faces first, closer faces last 2122 // draw arrows for deeper faces first, closer faces last
2009 LLVector3 camera_axis; 2123 LLVector3 camera_axis;
2010 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) 2124 if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
2011 { 2125 {
2012 camera_axis = LLVector3::x_axis; 2126 camera_axis = LLVector3::x_axis;
2013 } 2127 }