diff options
Diffstat (limited to 'linden/indra/newview/llmanipscale.cpp')
-rw-r--r-- | linden/indra/newview/llmanipscale.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/linden/indra/newview/llmanipscale.cpp b/linden/indra/newview/llmanipscale.cpp index 883c3d7..86bfba9 100644 --- a/linden/indra/newview/llmanipscale.cpp +++ b/linden/indra/newview/llmanipscale.cpp | |||
@@ -159,9 +159,9 @@ inline void LLManipScale::conditionalHighlight( U32 part, const LLColor4* highli | |||
159 | 159 | ||
160 | void LLManipScale::handleSelect() | 160 | void LLManipScale::handleSelect() |
161 | { | 161 | { |
162 | LLBBox bbox = gSelectMgr->getBBoxOfSelection(); | 162 | LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); |
163 | updateSnapGuides(bbox); | 163 | updateSnapGuides(bbox); |
164 | gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); | 164 | LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); |
165 | gFloaterTools->setStatusText("scale"); | 165 | gFloaterTools->setStatusText("scale"); |
166 | LLManip::handleSelect(); | 166 | LLManip::handleSelect(); |
167 | } | 167 | } |
@@ -226,13 +226,13 @@ void LLManipScale::render() | |||
226 | const F32 BOX_HANDLE_BASE_SIZE = 50.0f; // box size in pixels = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR | 226 | const F32 BOX_HANDLE_BASE_SIZE = 50.0f; // box size in pixels = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR |
227 | const F32 BOX_HANDLE_BASE_FACTOR = 0.2f; | 227 | const F32 BOX_HANDLE_BASE_FACTOR = 0.2f; |
228 | 228 | ||
229 | LLVector3 center_agent = gAgent.getPosAgentFromGlobal(gSelectMgr->getSelectionCenterGlobal()); | 229 | LLVector3 center_agent = gAgent.getPosAgentFromGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal()); |
230 | 230 | ||
231 | F32 range; | 231 | F32 range; |
232 | F32 range_from_agent; | 232 | F32 range_from_agent; |
233 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) | 233 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
234 | { | 234 | { |
235 | mBoxHandleSize = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR / (F32) gCamera->getViewHeightInPixels(); | 235 | mBoxHandleSize = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); |
236 | mBoxHandleSize /= gAgent.getAvatarObject()->mHUDCurZoom; | 236 | mBoxHandleSize /= gAgent.getAvatarObject()->mHUDCurZoom; |
237 | } | 237 | } |
238 | else | 238 | else |
@@ -253,8 +253,8 @@ void LLManipScale::render() | |||
253 | if (range > 0.001f) | 253 | if (range > 0.001f) |
254 | { | 254 | { |
255 | // range != zero | 255 | // range != zero |
256 | F32 fraction_of_fov = BOX_HANDLE_BASE_SIZE / (F32) gCamera->getViewHeightInPixels(); | 256 | F32 fraction_of_fov = BOX_HANDLE_BASE_SIZE / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); |
257 | F32 apparent_angle = fraction_of_fov * gCamera->getView(); // radians | 257 | F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians |
258 | mBoxHandleSize = range * tan(apparent_angle) * BOX_HANDLE_BASE_FACTOR; | 258 | mBoxHandleSize = range * tan(apparent_angle) * BOX_HANDLE_BASE_FACTOR; |
259 | } | 259 | } |
260 | else | 260 | else |
@@ -267,7 +267,7 @@ void LLManipScale::render() | |||
267 | //////////////////////////////////////////////////////////////////////// | 267 | //////////////////////////////////////////////////////////////////////// |
268 | // Draw bounding box | 268 | // Draw bounding box |
269 | 269 | ||
270 | LLBBox bbox = gSelectMgr->getBBoxOfSelection(); | 270 | LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); |
271 | LLVector3 pos_agent = bbox.getPositionAgent(); | 271 | LLVector3 pos_agent = bbox.getPositionAgent(); |
272 | LLQuaternion rot = bbox.getRotation(); | 272 | LLQuaternion rot = bbox.getRotation(); |
273 | 273 | ||
@@ -338,10 +338,10 @@ BOOL LLManipScale::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) | |||
338 | highlightManipulators(x, y); | 338 | highlightManipulators(x, y); |
339 | S32 hit_part = mHighlightedPart; | 339 | S32 hit_part = mHighlightedPart; |
340 | 340 | ||
341 | gSelectMgr->enableSilhouette(FALSE); | 341 | LLSelectMgr::getInstance()->enableSilhouette(FALSE); |
342 | mManipPart = (EManipPart)hit_part; | 342 | mManipPart = (EManipPart)hit_part; |
343 | 343 | ||
344 | LLBBox bbox = gSelectMgr->getBBoxOfSelection(); | 344 | LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); |
345 | LLVector3 box_center_agent = bbox.getCenterAgent(); | 345 | LLVector3 box_center_agent = bbox.getCenterAgent(); |
346 | LLVector3 box_corner_agent = bbox.localToAgent( unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox ) ); | 346 | LLVector3 box_corner_agent = bbox.localToAgent( unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox ) ); |
347 | 347 | ||
@@ -354,7 +354,7 @@ BOOL LLManipScale::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) | |||
354 | mDragPointGlobal = mDragStartPointGlobal; | 354 | mDragPointGlobal = mDragStartPointGlobal; |
355 | 355 | ||
356 | // we just started a drag, so save initial object positions, orientations, and scales | 356 | // we just started a drag, so save initial object positions, orientations, and scales |
357 | gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE); | 357 | LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE); |
358 | // Route future Mouse messages here preemptively. (Release on mouse up.) | 358 | // Route future Mouse messages here preemptively. (Release on mouse up.) |
359 | setMouseCapture( TRUE ); | 359 | setMouseCapture( TRUE ); |
360 | 360 | ||
@@ -384,16 +384,16 @@ BOOL LLManipScale::handleMouseUp(S32 x, S32 y, MASK mask) | |||
384 | } | 384 | } |
385 | 385 | ||
386 | //send texture update | 386 | //send texture update |
387 | gSelectMgr->adjustTexturesByScale(TRUE, getStretchTextures()); | 387 | LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, getStretchTextures()); |
388 | 388 | ||
389 | gSelectMgr->enableSilhouette(TRUE); | 389 | LLSelectMgr::getInstance()->enableSilhouette(TRUE); |
390 | mManipPart = LL_NO_PART; | 390 | mManipPart = LL_NO_PART; |
391 | 391 | ||
392 | // Might have missed last update due to UPDATE_DELAY timing | 392 | // Might have missed last update due to UPDATE_DELAY timing |
393 | gSelectMgr->sendMultipleUpdate( mLastUpdateFlags ); | 393 | LLSelectMgr::getInstance()->sendMultipleUpdate( mLastUpdateFlags ); |
394 | 394 | ||
395 | //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); | 395 | //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); |
396 | gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); | 396 | LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); |
397 | } | 397 | } |
398 | return LLManip::handleMouseUp(x, y, mask); | 398 | return LLManip::handleMouseUp(x, y, mask); |
399 | } | 399 | } |
@@ -422,7 +422,7 @@ BOOL LLManipScale::handleHover(S32 x, S32 y, MASK mask) | |||
422 | } | 422 | } |
423 | 423 | ||
424 | // Patch up textures, if possible. | 424 | // Patch up textures, if possible. |
425 | gSelectMgr->adjustTexturesByScale(FALSE, getStretchTextures()); | 425 | LLSelectMgr::getInstance()->adjustTexturesByScale(FALSE, getStretchTextures()); |
426 | 426 | ||
427 | gViewerWindow->getWindow()->setCursor(UI_CURSOR_TOOLSCALE); | 427 | gViewerWindow->getWindow()->setCursor(UI_CURSOR_TOOLSCALE); |
428 | return TRUE; | 428 | return TRUE; |
@@ -434,7 +434,7 @@ void LLManipScale::highlightManipulators(S32 x, S32 y) | |||
434 | 434 | ||
435 | // If we have something selected, try to hit its manipulator handles. | 435 | // If we have something selected, try to hit its manipulator handles. |
436 | // Don't do this with nothing selected, as it kills the framerate. | 436 | // Don't do this with nothing selected, as it kills the framerate. |
437 | LLBBox bbox = gSelectMgr->getBBoxOfSelection(); | 437 | LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); |
438 | 438 | ||
439 | if( canAffectSelection() ) | 439 | if( canAffectSelection() ) |
440 | { | 440 | { |
@@ -447,15 +447,15 @@ void LLManipScale::highlightManipulators(S32 x, S32 y) | |||
447 | transform *= cfr; | 447 | transform *= cfr; |
448 | LLMatrix4 window_scale; | 448 | LLMatrix4 window_scale; |
449 | F32 zoom_level = 2.f * gAgent.getAvatarObject()->mHUDCurZoom; | 449 | F32 zoom_level = 2.f * gAgent.getAvatarObject()->mHUDCurZoom; |
450 | window_scale.initAll(LLVector3(zoom_level / gCamera->getAspect(), zoom_level, 0.f), | 450 | window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f), |
451 | LLQuaternion::DEFAULT, | 451 | LLQuaternion::DEFAULT, |
452 | LLVector3::zero); | 452 | LLVector3::zero); |
453 | transform *= window_scale; | 453 | transform *= window_scale; |
454 | } | 454 | } |
455 | else | 455 | else |
456 | { | 456 | { |
457 | LLMatrix4 projMatrix = gCamera->getProjection(); | 457 | LLMatrix4 projMatrix = LLViewerCamera::getInstance()->getProjection(); |
458 | LLMatrix4 modelView = gCamera->getModelview(); | 458 | LLMatrix4 modelView = LLViewerCamera::getInstance()->getModelview(); |
459 | transform.initAll(LLVector3(1.f, 1.f, 1.f), bbox.getRotation(), bbox.getPositionAgent()); | 459 | transform.initAll(LLVector3(1.f, 1.f, 1.f), bbox.getRotation(), bbox.getPositionAgent()); |
460 | 460 | ||
461 | transform *= modelView; | 461 | transform *= modelView; |
@@ -819,8 +819,8 @@ void LLManipScale::drag( S32 x, S32 y ) | |||
819 | } | 819 | } |
820 | 820 | ||
821 | // store changes to override updates | 821 | // store changes to override updates |
822 | for (LLObjectSelection::iterator iter = gSelectMgr->getSelection()->begin(); | 822 | for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin(); |
823 | iter != gSelectMgr->getSelection()->end(); iter++) | 823 | iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++) |
824 | { | 824 | { |
825 | LLSelectNode* selectNode = *iter; | 825 | LLSelectNode* selectNode = *iter; |
826 | LLViewerObject*cur = selectNode->getObject(); | 826 | LLViewerObject*cur = selectNode->getObject(); |
@@ -831,14 +831,14 @@ void LLManipScale::drag( S32 x, S32 y ) | |||
831 | } | 831 | } |
832 | } | 832 | } |
833 | 833 | ||
834 | gSelectMgr->updateSelectionCenter(); | 834 | LLSelectMgr::getInstance()->updateSelectionCenter(); |
835 | gAgent.clearFocusObject(); | 835 | gAgent.clearFocusObject(); |
836 | } | 836 | } |
837 | 837 | ||
838 | // Scale around the | 838 | // Scale around the |
839 | void LLManipScale::dragCorner( S32 x, S32 y ) | 839 | void LLManipScale::dragCorner( S32 x, S32 y ) |
840 | { | 840 | { |
841 | LLBBox bbox = gSelectMgr->getBBoxOfSelection(); | 841 | LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); |
842 | 842 | ||
843 | // Suppress scale if mouse hasn't moved. | 843 | // Suppress scale if mouse hasn't moved. |
844 | if (x == mLastMouseX && y == mLastMouseY) | 844 | if (x == mLastMouseX && y == mLastMouseY) |
@@ -962,8 +962,8 @@ void LLManipScale::dragCorner( S32 x, S32 y ) | |||
962 | mInSnapRegime = FALSE; | 962 | mInSnapRegime = FALSE; |
963 | } | 963 | } |
964 | 964 | ||
965 | F32 max_scale_factor = MAX_OBJECT_SCALE / MIN_OBJECT_SCALE; | 965 | F32 max_scale_factor = DEFAULT_MAX_PRIM_SCALE / MIN_PRIM_SCALE; |
966 | F32 min_scale_factor = MIN_OBJECT_SCALE / MAX_OBJECT_SCALE; | 966 | F32 min_scale_factor = MIN_PRIM_SCALE / DEFAULT_MAX_PRIM_SCALE; |
967 | 967 | ||
968 | // find max and min scale factors that will make biggest object hit max absolute scale and smallest object hit min absolute scale | 968 | // find max and min scale factors that will make biggest object hit max absolute scale and smallest object hit min absolute scale |
969 | for (LLObjectSelection::iterator iter = mObjectSelection->begin(); | 969 | for (LLObjectSelection::iterator iter = mObjectSelection->begin(); |
@@ -975,10 +975,10 @@ void LLManipScale::dragCorner( S32 x, S32 y ) | |||
975 | { | 975 | { |
976 | const LLVector3& scale = selectNode->mSavedScale; | 976 | const LLVector3& scale = selectNode->mSavedScale; |
977 | 977 | ||
978 | F32 cur_max_scale_factor = llmin( MAX_OBJECT_SCALE / scale.mV[VX], MAX_OBJECT_SCALE / scale.mV[VY], MAX_OBJECT_SCALE / scale.mV[VZ] ); | 978 | F32 cur_max_scale_factor = llmin( DEFAULT_MAX_PRIM_SCALE / scale.mV[VX], DEFAULT_MAX_PRIM_SCALE / scale.mV[VY], DEFAULT_MAX_PRIM_SCALE / scale.mV[VZ] ); |
979 | max_scale_factor = llmin( max_scale_factor, cur_max_scale_factor ); | 979 | max_scale_factor = llmin( max_scale_factor, cur_max_scale_factor ); |
980 | 980 | ||
981 | F32 cur_min_scale_factor = llmax( MIN_OBJECT_SCALE / scale.mV[VX], MIN_OBJECT_SCALE / scale.mV[VY], MIN_OBJECT_SCALE / scale.mV[VZ] ); | 981 | F32 cur_min_scale_factor = llmax( MIN_PRIM_SCALE / scale.mV[VX], MIN_PRIM_SCALE / scale.mV[VY], MIN_PRIM_SCALE / scale.mV[VZ] ); |
982 | min_scale_factor = llmax( min_scale_factor, cur_min_scale_factor ); | 982 | min_scale_factor = llmax( min_scale_factor, cur_min_scale_factor ); |
983 | } | 983 | } |
984 | } | 984 | } |
@@ -1003,7 +1003,7 @@ void LLManipScale::dragCorner( S32 x, S32 y ) | |||
1003 | LLVector3d new_pos_global = drag_global + (selectNode->mSavedPositionGlobal - drag_global) * scale_factor; | 1003 | LLVector3d new_pos_global = drag_global + (selectNode->mSavedPositionGlobal - drag_global) * scale_factor; |
1004 | if (!cur->isAttachment()) | 1004 | if (!cur->isAttachment()) |
1005 | { | 1005 | { |
1006 | new_pos_global = gWorldp->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global); | 1006 | new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global); |
1007 | } | 1007 | } |
1008 | cur->setPositionAbsoluteGlobal( new_pos_global ); | 1008 | cur->setPositionAbsoluteGlobal( new_pos_global ); |
1009 | rebuild(cur); | 1009 | rebuild(cur); |
@@ -1081,7 +1081,7 @@ void LLManipScale::dragFace( S32 x, S32 y ) | |||
1081 | LLVector3 drag_start_dir_f; | 1081 | LLVector3 drag_start_dir_f; |
1082 | drag_start_dir_f.setVec(drag_start_dir_d); | 1082 | drag_start_dir_f.setVec(drag_start_dir_d); |
1083 | 1083 | ||
1084 | LLBBox bbox = gSelectMgr->getBBoxOfSelection(); | 1084 | LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); |
1085 | 1085 | ||
1086 | F32 s = 0; | 1086 | F32 s = 0; |
1087 | F32 t = 0; | 1087 | F32 t = 0; |
@@ -1224,7 +1224,7 @@ void LLManipScale::sendUpdates( BOOL send_position_update, BOOL send_scale_updat | |||
1224 | // enforce minimum update delay and don't stream updates on sub-object selections | 1224 | // enforce minimum update delay and don't stream updates on sub-object selections |
1225 | if( elapsed_time > UPDATE_DELAY && !gSavedSettings.getBOOL("EditLinkedParts") ) | 1225 | if( elapsed_time > UPDATE_DELAY && !gSavedSettings.getBOOL("EditLinkedParts") ) |
1226 | { | 1226 | { |
1227 | gSelectMgr->sendMultipleUpdate( update_flags ); | 1227 | LLSelectMgr::getInstance()->sendMultipleUpdate( update_flags ); |
1228 | update_timer.reset(); | 1228 | update_timer.reset(); |
1229 | mSendUpdateOnMouseUp = FALSE; | 1229 | mSendUpdateOnMouseUp = FALSE; |
1230 | } | 1230 | } |
@@ -1270,7 +1270,7 @@ void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVecto | |||
1270 | 1270 | ||
1271 | F32 denom = axis * dir_local; | 1271 | F32 denom = axis * dir_local; |
1272 | F32 desired_delta_size = is_approx_zero(denom) ? 0.f : (delta_local_mag / denom); // in meters | 1272 | F32 desired_delta_size = is_approx_zero(denom) ? 0.f : (delta_local_mag / denom); // in meters |
1273 | F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, MIN_OBJECT_SCALE, MAX_OBJECT_SCALE); | 1273 | F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, MIN_PRIM_SCALE, DEFAULT_MAX_PRIM_SCALE); |
1274 | // propagate scale constraint back to position offset | 1274 | // propagate scale constraint back to position offset |
1275 | desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position | 1275 | desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position |
1276 | 1276 | ||
@@ -1288,7 +1288,7 @@ void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVecto | |||
1288 | 1288 | ||
1289 | if (cur->isRootEdit() && !cur->isAttachment()) | 1289 | if (cur->isRootEdit() && !cur->isAttachment()) |
1290 | { | 1290 | { |
1291 | LLVector3d new_pos_global = gWorldp->clipToVisibleRegions(selectNode->mSavedPositionGlobal, selectNode->mSavedPositionGlobal + delta_pos_global); | 1291 | LLVector3d new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, selectNode->mSavedPositionGlobal + delta_pos_global); |
1292 | cur->setPositionGlobal( new_pos_global ); | 1292 | cur->setPositionGlobal( new_pos_global ); |
1293 | } | 1293 | } |
1294 | else | 1294 | else |
@@ -1340,7 +1340,7 @@ void LLManipScale::renderGuidelinesPart( const LLBBox& bbox ) | |||
1340 | 1340 | ||
1341 | guideline_end -= guideline_start; | 1341 | guideline_end -= guideline_start; |
1342 | guideline_end.normVec(); | 1342 | guideline_end.normVec(); |
1343 | guideline_end *= gWorldPointer->getRegionWidthInMeters(); | 1343 | guideline_end *= LLWorld::getInstance()->getRegionWidthInMeters(); |
1344 | guideline_end += guideline_start; | 1344 | guideline_end += guideline_start; |
1345 | 1345 | ||
1346 | { | 1346 | { |
@@ -1358,7 +1358,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) | |||
1358 | LLVector3 grid_origin; | 1358 | LLVector3 grid_origin; |
1359 | LLVector3 grid_scale; | 1359 | LLVector3 grid_scale; |
1360 | LLQuaternion grid_rotation; | 1360 | LLQuaternion grid_rotation; |
1361 | gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); | 1361 | LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); |
1362 | 1362 | ||
1363 | LLVector3 box_corner_agent = bbox.localToAgent(unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox )); | 1363 | LLVector3 box_corner_agent = bbox.localToAgent(unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox )); |
1364 | mScaleCenter = getUniform() ? bbox.getCenterAgent() : bbox.localToAgent(unitVectorToLocalBBoxExtent( -1.f * partToUnitVector( mManipPart ), bbox )); | 1364 | mScaleCenter = getUniform() ? bbox.getCenterAgent() : bbox.localToAgent(unitVectorToLocalBBoxExtent( -1.f * partToUnitVector( mManipPart ), bbox )); |
@@ -1372,8 +1372,8 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) | |||
1372 | } | 1372 | } |
1373 | else | 1373 | else |
1374 | { | 1374 | { |
1375 | F32 object_distance = dist_vec(mScaleCenter, gCamera->getOrigin()); | 1375 | F32 object_distance = dist_vec(mScaleCenter, LLViewerCamera::getInstance()->getOrigin()); |
1376 | mSnapRegimeOffset = (SNAP_GUIDE_SCREEN_OFFSET * gViewerWindow->getWindowWidth() * object_distance) / gCamera->getPixelMeterRatio(); | 1376 | mSnapRegimeOffset = (SNAP_GUIDE_SCREEN_OFFSET * gViewerWindow->getWindowWidth() * object_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio(); |
1377 | } | 1377 | } |
1378 | LLVector3 cam_at_axis; | 1378 | LLVector3 cam_at_axis; |
1379 | F32 snap_guide_length; | 1379 | F32 snap_guide_length; |
@@ -1384,9 +1384,9 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) | |||
1384 | } | 1384 | } |
1385 | else | 1385 | else |
1386 | { | 1386 | { |
1387 | cam_at_axis = gCamera->getAtAxis(); | 1387 | cam_at_axis = LLViewerCamera::getInstance()->getAtAxis(); |
1388 | F32 manipulator_distance = dist_vec(box_corner_agent, gCamera->getOrigin()); | 1388 | F32 manipulator_distance = dist_vec(box_corner_agent, LLViewerCamera::getInstance()->getOrigin()); |
1389 | snap_guide_length = (SNAP_GUIDE_SCREEN_LENGTH * gViewerWindow->getWindowWidth() * manipulator_distance) / gCamera->getPixelMeterRatio(); | 1389 | snap_guide_length = (SNAP_GUIDE_SCREEN_LENGTH * gViewerWindow->getWindowWidth() * manipulator_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio(); |
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | mSnapGuideLength = snap_guide_length / llmax(0.1f, (llmin(mSnapGuideDir1 * cam_at_axis, mSnapGuideDir2 * cam_at_axis))); | 1392 | mSnapGuideLength = snap_guide_length / llmax(0.1f, (llmin(mSnapGuideDir1 * cam_at_axis, mSnapGuideDir2 * cam_at_axis))); |
@@ -1415,7 +1415,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) | |||
1415 | LLVector3 scale_snap = grid_scale; | 1415 | LLVector3 scale_snap = grid_scale; |
1416 | mScaleSnapUnit1 = scale_snap.scaleVec(partToUnitVector( mManipPart )).magVec(); | 1416 | mScaleSnapUnit1 = scale_snap.scaleVec(partToUnitVector( mManipPart )).magVec(); |
1417 | mScaleSnapUnit2 = mScaleSnapUnit1; | 1417 | mScaleSnapUnit2 = mScaleSnapUnit1; |
1418 | mSnapGuideDir1 *= mSnapGuideDir1 * gCamera->getUpAxis() > 0.f ? 1.f : -1.f; | 1418 | mSnapGuideDir1 *= mSnapGuideDir1 * LLViewerCamera::getInstance()->getUpAxis() > 0.f ? 1.f : -1.f; |
1419 | mSnapGuideDir2 = mSnapGuideDir1 * -1.f; | 1419 | mSnapGuideDir2 = mSnapGuideDir1 * -1.f; |
1420 | mSnapDir1 = mScaleDir; | 1420 | mSnapDir1 = mScaleDir; |
1421 | mSnapDir2 = mScaleDir; | 1421 | mSnapDir2 = mScaleDir; |
@@ -1430,7 +1430,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) | |||
1430 | } | 1430 | } |
1431 | else | 1431 | else |
1432 | { | 1432 | { |
1433 | local_camera_dir = (gCamera->getOrigin() - bbox.getCenterAgent()) * ~bbox.getRotation(); | 1433 | local_camera_dir = (LLViewerCamera::getInstance()->getOrigin() - bbox.getCenterAgent()) * ~bbox.getRotation(); |
1434 | local_camera_dir.normVec(); | 1434 | local_camera_dir.normVec(); |
1435 | } | 1435 | } |
1436 | local_scale_dir -= projected_vec(local_scale_dir, local_camera_dir); | 1436 | local_scale_dir -= projected_vec(local_scale_dir, local_camera_dir); |
@@ -1622,7 +1622,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) | |||
1622 | gGL.end(); | 1622 | gGL.end(); |
1623 | } | 1623 | } |
1624 | 1624 | ||
1625 | LLVector2 screen_translate_axis(llabs(mScaleDir * gCamera->getLeftAxis()), llabs(mScaleDir * gCamera->getUpAxis())); | 1625 | LLVector2 screen_translate_axis(llabs(mScaleDir * LLViewerCamera::getInstance()->getLeftAxis()), llabs(mScaleDir * LLViewerCamera::getInstance()->getUpAxis())); |
1626 | screen_translate_axis.normVec(); | 1626 | screen_translate_axis.normVec(); |
1627 | 1627 | ||
1628 | S32 tick_label_spacing = llround(screen_translate_axis * sTickLabelSpacing); | 1628 | S32 tick_label_spacing = llround(screen_translate_axis * sTickLabelSpacing); |
@@ -1728,7 +1728,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) | |||
1728 | LLVector3 text_origin = tick_pos + | 1728 | LLVector3 text_origin = tick_pos + |
1729 | (mSnapGuideDir1 * mSnapRegimeOffset * (1.f + tick_scale)); | 1729 | (mSnapGuideDir1 * mSnapRegimeOffset * (1.f + tick_scale)); |
1730 | 1730 | ||
1731 | EGridMode grid_mode = gSelectMgr->getGridMode(); | 1731 | EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode(); |
1732 | F32 tick_val; | 1732 | F32 tick_val; |
1733 | if (grid_mode == GRID_MODE_WORLD) | 1733 | if (grid_mode == GRID_MODE_WORLD) |
1734 | { | 1734 | { |
@@ -1780,7 +1780,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) | |||
1780 | LLVector3 text_origin = tick_pos + | 1780 | LLVector3 text_origin = tick_pos + |
1781 | (mSnapGuideDir2 * mSnapRegimeOffset * (1.f + tick_scale)); | 1781 | (mSnapGuideDir2 * mSnapRegimeOffset * (1.f + tick_scale)); |
1782 | 1782 | ||
1783 | EGridMode grid_mode = gSelectMgr->getGridMode(); | 1783 | EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode(); |
1784 | F32 tick_val; | 1784 | F32 tick_val; |
1785 | if (grid_mode == GRID_MODE_WORLD) | 1785 | if (grid_mode == GRID_MODE_WORLD) |
1786 | { | 1786 | { |
@@ -1814,10 +1814,10 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) | |||
1814 | { | 1814 | { |
1815 | if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText) | 1815 | if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText) |
1816 | { | 1816 | { |
1817 | LLVector3 selection_center_start = gSelectMgr->getSavedBBoxOfSelection().getCenterAgent(); | 1817 | LLVector3 selection_center_start = LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent(); |
1818 | 1818 | ||
1819 | LLVector3 offset_dir; | 1819 | LLVector3 offset_dir; |
1820 | if (mSnapGuideDir1 * gCamera->getAtAxis() > mSnapGuideDir2 * gCamera->getAtAxis()) | 1820 | if (mSnapGuideDir1 * LLViewerCamera::getInstance()->getAtAxis() > mSnapGuideDir2 * LLViewerCamera::getInstance()->getAtAxis()) |
1821 | { | 1821 | { |
1822 | offset_dir = mSnapGuideDir2; | 1822 | offset_dir = mSnapGuideDir2; |
1823 | } | 1823 | } |
@@ -1834,7 +1834,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) | |||
1834 | help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f); | 1834 | help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f); |
1835 | 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); | 1835 | 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); |
1836 | help_text = "to snap to grid"; | 1836 | help_text = "to snap to grid"; |
1837 | help_text_pos -= gCamera->getUpAxis() * mSnapRegimeOffset * 0.4f; | 1837 | help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapRegimeOffset * 0.4f; |
1838 | 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); | 1838 | 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); |
1839 | } | 1839 | } |
1840 | } | 1840 | } |
@@ -1968,7 +1968,7 @@ F32 LLManipScale::partToMaxScale( S32 part, const LLBBox &bbox ) const | |||
1968 | max_extent = bbox_extents.mV[i]; | 1968 | max_extent = bbox_extents.mV[i]; |
1969 | } | 1969 | } |
1970 | } | 1970 | } |
1971 | max_scale_factor = bbox_extents.magVec() * MAX_OBJECT_SCALE / max_extent; | 1971 | max_scale_factor = bbox_extents.magVec() * DEFAULT_MAX_PRIM_SCALE / max_extent; |
1972 | 1972 | ||
1973 | if (getUniform()) | 1973 | if (getUniform()) |
1974 | { | 1974 | { |
@@ -1983,7 +1983,7 @@ F32 LLManipScale::partToMinScale( S32 part, const LLBBox &bbox ) const | |||
1983 | { | 1983 | { |
1984 | LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox ); | 1984 | LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox ); |
1985 | bbox_extents.abs(); | 1985 | bbox_extents.abs(); |
1986 | F32 min_extent = MAX_OBJECT_SCALE; | 1986 | F32 min_extent = DEFAULT_MAX_PRIM_SCALE; |
1987 | for (U32 i = VX; i <= VZ; i++) | 1987 | for (U32 i = VX; i <= VZ; i++) |
1988 | { | 1988 | { |
1989 | if (bbox_extents.mV[i] > 0.f && bbox_extents.mV[i] < min_extent) | 1989 | if (bbox_extents.mV[i] > 0.f && bbox_extents.mV[i] < min_extent) |
@@ -1991,7 +1991,7 @@ F32 LLManipScale::partToMinScale( S32 part, const LLBBox &bbox ) const | |||
1991 | min_extent = bbox_extents.mV[i]; | 1991 | min_extent = bbox_extents.mV[i]; |
1992 | } | 1992 | } |
1993 | } | 1993 | } |
1994 | F32 min_scale_factor = bbox_extents.magVec() * MIN_OBJECT_SCALE / min_extent; | 1994 | F32 min_scale_factor = bbox_extents.magVec() * MIN_PRIM_SCALE / min_extent; |
1995 | 1995 | ||
1996 | if (getUniform()) | 1996 | if (getUniform()) |
1997 | { | 1997 | { |