diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llmanip.cpp | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/linden/indra/newview/llmanip.cpp b/linden/indra/newview/llmanip.cpp index 9d9103f..8934266 100644 --- a/linden/indra/newview/llmanip.cpp +++ b/linden/indra/newview/llmanip.cpp | |||
@@ -53,7 +53,7 @@ | |||
53 | #include "llviewerobject.h" | 53 | #include "llviewerobject.h" |
54 | #include "llviewerwindow.h" | 54 | #include "llviewerwindow.h" |
55 | #include "llvoavatar.h" | 55 | #include "llvoavatar.h" |
56 | #include "llworld.h" // for gWorldPointer | 56 | #include "llworld.h" // for LLWorld::getInstance() |
57 | #include "llresmgr.h" | 57 | #include "llresmgr.h" |
58 | #include "pipeline.h" | 58 | #include "pipeline.h" |
59 | #include "llglheaders.h" | 59 | #include "llglheaders.h" |
@@ -106,14 +106,14 @@ void LLManip::getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 | |||
106 | LLVector3 grid_scale; | 106 | LLVector3 grid_scale; |
107 | LLQuaternion grid_rotation; | 107 | LLQuaternion grid_rotation; |
108 | 108 | ||
109 | gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); | 109 | LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); |
110 | 110 | ||
111 | if (manip >= LL_X_ARROW && manip <= LL_Z_ARROW) | 111 | if (manip >= LL_X_ARROW && manip <= LL_Z_ARROW) |
112 | { | 112 | { |
113 | LLVector3 arrow_axis; | 113 | LLVector3 arrow_axis; |
114 | getManipAxis(object, manip, arrow_axis); | 114 | getManipAxis(object, manip, arrow_axis); |
115 | 115 | ||
116 | LLVector3 cross = arrow_axis % gCamera->getAtAxis(); | 116 | LLVector3 cross = arrow_axis % LLViewerCamera::getInstance()->getAtAxis(); |
117 | normal = cross % arrow_axis; | 117 | normal = cross % arrow_axis; |
118 | normal.normVec(); | 118 | normal.normVec(); |
119 | } | 119 | } |
@@ -148,7 +148,7 @@ BOOL LLManip::getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 & | |||
148 | LLVector3 grid_scale; | 148 | LLVector3 grid_scale; |
149 | LLQuaternion grid_rotation; | 149 | LLQuaternion grid_rotation; |
150 | 150 | ||
151 | gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); | 151 | LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); |
152 | 152 | ||
153 | if (manip == LL_X_ARROW) | 153 | if (manip == LL_X_ARROW) |
154 | { | 154 | { |
@@ -181,12 +181,12 @@ F32 LLManip::getSubdivisionLevel(const LLVector3 &reference_point, const LLVecto | |||
181 | } | 181 | } |
182 | else | 182 | else |
183 | { | 183 | { |
184 | cam_to_reference = reference_point - gCamera->getOrigin(); | 184 | cam_to_reference = reference_point - LLViewerCamera::getInstance()->getOrigin(); |
185 | } | 185 | } |
186 | F32 current_range = cam_to_reference.normVec(); | 186 | F32 current_range = cam_to_reference.normVec(); |
187 | 187 | ||
188 | F32 projected_translation_axis_length = (translate_axis % cam_to_reference).magVec(); | 188 | F32 projected_translation_axis_length = (translate_axis % cam_to_reference).magVec(); |
189 | F32 subdivisions = llmax(projected_translation_axis_length * grid_scale / (current_range / gCamera->getPixelMeterRatio() * min_pixel_spacing), 0.f); | 189 | F32 subdivisions = llmax(projected_translation_axis_length * grid_scale / (current_range / LLViewerCamera::getInstance()->getPixelMeterRatio() * min_pixel_spacing), 0.f); |
190 | subdivisions = llclamp((F32)pow(2.f, llfloor(log(subdivisions) / log(2.f))), 1.f / 32.f, 32.f); | 190 | subdivisions = llclamp((F32)pow(2.f, llfloor(log(subdivisions) / log(2.f))), 1.f / 32.f, 32.f); |
191 | 191 | ||
192 | return subdivisions; | 192 | return subdivisions; |
@@ -194,7 +194,7 @@ F32 LLManip::getSubdivisionLevel(const LLVector3 &reference_point, const LLVecto | |||
194 | 194 | ||
195 | void LLManip::handleSelect() | 195 | void LLManip::handleSelect() |
196 | { | 196 | { |
197 | mObjectSelection = gSelectMgr->getEditSelection(); | 197 | mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); |
198 | } | 198 | } |
199 | 199 | ||
200 | void LLManip::handleDeselect() | 200 | void LLManip::handleDeselect() |
@@ -255,12 +255,12 @@ BOOL LLManip::getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector | |||
255 | return result; | 255 | return result; |
256 | } | 256 | } |
257 | 257 | ||
258 | BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) | 258 | BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) const |
259 | { | 259 | { |
260 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) | 260 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
261 | { | 261 | { |
262 | BOOL result = FALSE; | 262 | BOOL result = FALSE; |
263 | F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidth() - 0.5f) * gCamera->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom; | 263 | F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidth() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom; |
264 | F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeight() - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; | 264 | F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeight() - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; |
265 | 265 | ||
266 | LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin); | 266 | LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin); |
@@ -299,7 +299,7 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co | |||
299 | 299 | ||
300 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) | 300 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
301 | { | 301 | { |
302 | F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) * gCamera->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom; | 302 | F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom; |
303 | F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; | 303 | F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; |
304 | a1 = LLVector3(llmin(b1.mV[VX] - 0.1f, b2.mV[VX] - 0.1f, 0.f), -mouse_x, mouse_y); | 304 | a1 = LLVector3(llmin(b1.mV[VX] - 0.1f, b2.mV[VX] - 0.1f, 0.f), -mouse_x, mouse_y); |
305 | a2 = a1 + LLVector3(1.f, 0.f, 0.f); | 305 | a2 = a1 + LLVector3(1.f, 0.f, 0.f); |
@@ -342,7 +342,7 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co | |||
342 | 342 | ||
343 | LLVector3 LLManip::getSavedPivotPoint() const | 343 | LLVector3 LLManip::getSavedPivotPoint() const |
344 | { | 344 | { |
345 | return gSelectMgr->getSavedBBoxOfSelection().getCenterAgent(); | 345 | return LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent(); |
346 | } | 346 | } |
347 | 347 | ||
348 | LLVector3 LLManip::getPivotPoint() | 348 | LLVector3 LLManip::getPivotPoint() |
@@ -351,7 +351,7 @@ LLVector3 LLManip::getPivotPoint() | |||
351 | { | 351 | { |
352 | return mObjectSelection->getFirstObject()->getPivotPositionAgent(); | 352 | return mObjectSelection->getFirstObject()->getPivotPositionAgent(); |
353 | } | 353 | } |
354 | return gSelectMgr->getBBoxOfSelection().getCenterAgent(); | 354 | return LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent(); |
355 | } | 355 | } |
356 | 356 | ||
357 | 357 | ||
@@ -360,7 +360,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) | |||
360 | LLVector3 grid_origin; | 360 | LLVector3 grid_origin; |
361 | LLQuaternion grid_rot; | 361 | LLQuaternion grid_rot; |
362 | LLVector3 grid_scale; | 362 | LLVector3 grid_scale; |
363 | gSelectMgr->getGrid(grid_origin, grid_rot, grid_scale); | 363 | LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rot, grid_scale); |
364 | 364 | ||
365 | const BOOL children_ok = TRUE; | 365 | const BOOL children_ok = TRUE; |
366 | LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok); | 366 | LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok); |
@@ -369,7 +369,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) | |||
369 | return; | 369 | return; |
370 | } | 370 | } |
371 | 371 | ||
372 | //LLVector3 center_agent = gSelectMgr->getBBoxOfSelection().getCenterAgent(); | 372 | //LLVector3 center_agent = LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent(); |
373 | LLVector3 center_agent = getPivotPoint(); | 373 | LLVector3 center_agent = getPivotPoint(); |
374 | 374 | ||
375 | glPushMatrix(); | 375 | glPushMatrix(); |
@@ -381,7 +381,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) | |||
381 | grid_rot.getAngleAxis(&angle_radians, &x, &y, &z); | 381 | grid_rot.getAngleAxis(&angle_radians, &x, &y, &z); |
382 | glRotatef(angle_radians * RAD_TO_DEG, x, y, z); | 382 | glRotatef(angle_radians * RAD_TO_DEG, x, y, z); |
383 | 383 | ||
384 | F32 region_size = gWorldPointer->getRegionWidthInMeters(); | 384 | F32 region_size = LLWorld::getInstance()->getRegionWidthInMeters(); |
385 | 385 | ||
386 | const F32 LINE_ALPHA = 0.33f; | 386 | const F32 LINE_ALPHA = 0.33f; |
387 | 387 | ||
@@ -423,29 +423,24 @@ void LLManip::renderXYZ(const LLVector3 &vec) | |||
423 | { | 423 | { |
424 | const S32 PAD = 10; | 424 | const S32 PAD = 10; |
425 | char feedback_string[128]; /*Flawfinder: ignore*/ | 425 | char feedback_string[128]; /*Flawfinder: ignore*/ |
426 | LLVector3 camera_pos = gCamera->getOrigin() + gCamera->getAtAxis(); | 426 | LLVector3 camera_pos = LLViewerCamera::getInstance()->getOrigin() + LLViewerCamera::getInstance()->getAtAxis(); |
427 | S32 vertical_offset = gViewerWindow->getWindowHeight() / 2 - VERTICAL_OFFSET; | 427 | S32 vertical_offset = gViewerWindow->getWindowHeight() / 2 - VERTICAL_OFFSET; |
428 | S32 window_center_x = gViewerWindow->getWindowWidth() / 2; | 428 | S32 window_center_x = gViewerWindow->getWindowWidth() / 2; |
429 | S32 window_center_y = gViewerWindow->getWindowHeight() / 2; | 429 | S32 window_center_y = gViewerWindow->getWindowHeight() / 2; |
430 | 430 | ||
431 | LLUUID image_id; | ||
432 | image_id.set(gViewerArt.getString("rounded_square.tga")); | ||
433 | LLViewerImage* imagep = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); | ||
434 | |||
435 | glPushMatrix(); | 431 | glPushMatrix(); |
436 | { | 432 | { |
433 | LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga"); | ||
437 | gViewerWindow->setup2DRender(); | 434 | gViewerWindow->setup2DRender(); |
438 | const LLVector2& display_scale = gViewerWindow->getDisplayScale(); | 435 | const LLVector2& display_scale = gViewerWindow->getDisplayScale(); |
439 | glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f); | 436 | glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f); |
440 | gGL.color4f(0.f, 0.f, 0.f, 0.7f); | 437 | gGL.color4f(0.f, 0.f, 0.f, 0.7f); |
441 | 438 | ||
442 | gl_draw_scaled_image_with_border(window_center_x - 115, | 439 | imagep->draw( |
440 | window_center_x - 115, | ||
443 | window_center_y + vertical_offset - PAD, | 441 | window_center_y + vertical_offset - PAD, |
444 | 16, | ||
445 | 16, | ||
446 | 235, | 442 | 235, |
447 | PAD * 2 + 10, | 443 | PAD * 2 + 10, |
448 | imagep, | ||
449 | LLColor4(0.f, 0.f, 0.f, 0.7f) ); | 444 | LLColor4(0.f, 0.f, 0.f, 0.7f) ); |
450 | } | 445 | } |
451 | glPopMatrix(); | 446 | glPopMatrix(); |
@@ -457,31 +452,31 @@ void LLManip::renderXYZ(const LLVector3 &vec) | |||
457 | LLGLDepthTest gls_depth(GL_FALSE); | 452 | LLGLDepthTest gls_depth(GL_FALSE); |
458 | // render drop shadowed text | 453 | // render drop shadowed text |
459 | snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]); /* Flawfinder: ignore */ | 454 | snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]); /* Flawfinder: ignore */ |
460 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); | 455 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); |
461 | 456 | ||
462 | snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]); /* Flawfinder: ignore */ | 457 | snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]); /* Flawfinder: ignore */ |
463 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); | 458 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); |
464 | 459 | ||
465 | snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]); /* Flawfinder: ignore */ | 460 | snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]); /* Flawfinder: ignore */ |
466 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); | 461 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); |
467 | 462 | ||
468 | // render text on top | 463 | // render text on top |
469 | snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]); /* Flawfinder: ignore */ | 464 | snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]); /* Flawfinder: ignore */ |
470 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE); | 465 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE); |
471 | 466 | ||
472 | glColor3f(0.5f, 1.f, 0.5f); | 467 | glColor3f(0.5f, 1.f, 0.5f); |
473 | snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]); /* Flawfinder: ignore */ | 468 | snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]); /* Flawfinder: ignore */ |
474 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE); | 469 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE); |
475 | 470 | ||
476 | glColor3f(0.5f, 0.5f, 1.f); | 471 | glColor3f(0.5f, 0.5f, 1.f); |
477 | snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]); /* Flawfinder: ignore */ | 472 | snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]); /* Flawfinder: ignore */ |
478 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE); | 473 | hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE); |
479 | } | 474 | } |
480 | } | 475 | } |
481 | 476 | ||
482 | void LLManip::renderTickText(const LLVector3& pos, const char* text, const LLColor4 &color) | 477 | void LLManip::renderTickText(const LLVector3& pos, const char* text, const LLColor4 &color) |
483 | { | 478 | { |
484 | const LLFontGL* big_fontp = gResMgr->getRes( LLFONT_SANSSERIF ); | 479 | const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); |
485 | 480 | ||
486 | BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; | 481 | BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; |
487 | glMatrixMode(GL_MODELVIEW); | 482 | glMatrixMode(GL_MODELVIEW); |
@@ -511,8 +506,8 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffi | |||
511 | { | 506 | { |
512 | LLLocale locale(LLLocale::USER_LOCALE); | 507 | LLLocale locale(LLLocale::USER_LOCALE); |
513 | 508 | ||
514 | const LLFontGL* big_fontp = gResMgr->getRes( LLFONT_SANSSERIF ); | 509 | const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); |
515 | const LLFontGL* small_fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL ); | 510 | const LLFontGL* small_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); |
516 | 511 | ||
517 | char val_string[128]; /*Flawfinder: ignore*/ | 512 | char val_string[128]; /*Flawfinder: ignore*/ |
518 | char fraction_string[128]; /*Flawfinder: ignore*/ | 513 | char fraction_string[128]; /*Flawfinder: ignore*/ |
@@ -559,7 +554,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffi | |||
559 | 554 | ||
560 | if (fractional_portion != 0) | 555 | if (fractional_portion != 0) |
561 | { | 556 | { |
562 | snprintf(fraction_string, sizeof(fraction_string), "%c%02d%s", gResMgr->getDecimalPoint(), fractional_portion, suffix); /* Flawfinder: ignore */ | 557 | snprintf(fraction_string, sizeof(fraction_string), "%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix); /* Flawfinder: ignore */ |
563 | 558 | ||
564 | gViewerWindow->setupViewport(1, -1); | 559 | gViewerWindow->setupViewport(1, -1); |
565 | hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -1.f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection); | 560 | hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -1.f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection); |