diff options
Diffstat (limited to 'linden/indra/newview/llmanip.cpp')
-rw-r--r-- | linden/indra/newview/llmanip.cpp | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/linden/indra/newview/llmanip.cpp b/linden/indra/newview/llmanip.cpp index 5c19685..89f13fe 100644 --- a/linden/indra/newview/llmanip.cpp +++ b/linden/indra/newview/llmanip.cpp | |||
@@ -92,11 +92,12 @@ void LLManip::rebuild(LLViewerObject* vobj) | |||
92 | // LLManip | 92 | // LLManip |
93 | 93 | ||
94 | 94 | ||
95 | LLManip::LLManip( const LLString& name, LLToolComposite* composite ) | 95 | LLManip::LLManip( const std::string& name, LLToolComposite* composite ) |
96 | : | 96 | : |
97 | LLTool( name, composite ), | 97 | LLTool( name, composite ), |
98 | mInSnapRegime(FALSE), | 98 | mInSnapRegime(FALSE), |
99 | mHighlightedPart(LL_NO_PART) | 99 | mHighlightedPart(LL_NO_PART), |
100 | mManipPart(LL_NO_PART) | ||
100 | { | 101 | { |
101 | } | 102 | } |
102 | 103 | ||
@@ -177,7 +178,7 @@ F32 LLManip::getSubdivisionLevel(const LLVector3 &reference_point, const LLVecto | |||
177 | LLVector3 cam_to_reference; | 178 | LLVector3 cam_to_reference; |
178 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) | 179 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
179 | { | 180 | { |
180 | cam_to_reference = LLVector3(1.f / gAgent.getAvatarObject()->mHUDCurZoom, 0.f, 0.f); | 181 | cam_to_reference = LLVector3(1.f / gAgent.mHUDCurZoom, 0.f, 0.f); |
181 | } | 182 | } |
182 | else | 183 | else |
183 | { | 184 | { |
@@ -199,6 +200,8 @@ void LLManip::handleSelect() | |||
199 | 200 | ||
200 | void LLManip::handleDeselect() | 201 | void LLManip::handleDeselect() |
201 | { | 202 | { |
203 | mHighlightedPart = LL_NO_PART; | ||
204 | mManipPart = LL_NO_PART; | ||
202 | mObjectSelection = NULL; | 205 | mObjectSelection = NULL; |
203 | } | 206 | } |
204 | 207 | ||
@@ -260,8 +263,8 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect | |||
260 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) | 263 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
261 | { | 264 | { |
262 | BOOL result = FALSE; | 265 | BOOL result = FALSE; |
263 | F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidth() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom; | 266 | F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidth() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom; |
264 | F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeight() - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; | 267 | F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeight() - 0.5f) / gAgent.mHUDCurZoom; |
265 | 268 | ||
266 | LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin); | 269 | LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin); |
267 | LLVector3 mouse_pos = LLVector3(0.f, -mouse_x, mouse_y); | 270 | LLVector3 mouse_pos = LLVector3(0.f, -mouse_x, mouse_y); |
@@ -299,8 +302,8 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co | |||
299 | 302 | ||
300 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) | 303 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
301 | { | 304 | { |
302 | F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom; | 305 | F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom; |
303 | F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; | 306 | F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.mHUDCurZoom; |
304 | a1 = LLVector3(llmin(b1.mV[VX] - 0.1f, b2.mV[VX] - 0.1f, 0.f), -mouse_x, mouse_y); | 307 | 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); | 308 | a2 = a1 + LLVector3(1.f, 0.f, 0.f); |
306 | } | 309 | } |
@@ -422,7 +425,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) | |||
422 | void LLManip::renderXYZ(const LLVector3 &vec) | 425 | void LLManip::renderXYZ(const LLVector3 &vec) |
423 | { | 426 | { |
424 | const S32 PAD = 10; | 427 | const S32 PAD = 10; |
425 | char feedback_string[128]; /*Flawfinder: ignore*/ | 428 | std::string feedback_string; |
426 | LLVector3 camera_pos = LLViewerCamera::getInstance()->getOrigin() + LLViewerCamera::getInstance()->getAtAxis(); | 429 | LLVector3 camera_pos = LLViewerCamera::getInstance()->getOrigin() + LLViewerCamera::getInstance()->getAtAxis(); |
427 | S32 vertical_offset = gViewerWindow->getWindowHeight() / 2 - VERTICAL_OFFSET; | 430 | S32 vertical_offset = gViewerWindow->getWindowHeight() / 2 - VERTICAL_OFFSET; |
428 | S32 window_center_x = gViewerWindow->getWindowWidth() / 2; | 431 | S32 window_center_x = gViewerWindow->getWindowWidth() / 2; |
@@ -451,30 +454,30 @@ void LLManip::renderXYZ(const LLVector3 &vec) | |||
451 | LLLocale locale(LLLocale::USER_LOCALE); | 454 | LLLocale locale(LLLocale::USER_LOCALE); |
452 | LLGLDepthTest gls_depth(GL_FALSE); | 455 | LLGLDepthTest gls_depth(GL_FALSE); |
453 | // render drop shadowed text | 456 | // render drop shadowed text |
454 | snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]); /* Flawfinder: ignore */ | 457 | feedback_string = llformat("X: %.3f", vec.mV[VX]); |
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); | 458 | 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); |
456 | 459 | ||
457 | snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]); /* Flawfinder: ignore */ | 460 | feedback_string = llformat("Y: %.3f", vec.mV[VY]); |
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); | 461 | 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); |
459 | 462 | ||
460 | snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]); /* Flawfinder: ignore */ | 463 | feedback_string = llformat("Z: %.3f", vec.mV[VZ]); |
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); | 464 | 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); |
462 | 465 | ||
463 | // render text on top | 466 | // render text on top |
464 | snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]); /* Flawfinder: ignore */ | 467 | feedback_string = llformat("X: %.3f", vec.mV[VX]); |
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); | 468 | 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); |
466 | 469 | ||
467 | glColor3f(0.5f, 1.f, 0.5f); | 470 | glColor3f(0.5f, 1.f, 0.5f); |
468 | snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]); /* Flawfinder: ignore */ | 471 | feedback_string = llformat("Y: %.3f", vec.mV[VY]); |
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); | 472 | 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); |
470 | 473 | ||
471 | glColor3f(0.5f, 0.5f, 1.f); | 474 | glColor3f(0.5f, 0.5f, 1.f); |
472 | snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]); /* Flawfinder: ignore */ | 475 | feedback_string = llformat("Z: %.3f", vec.mV[VZ]); |
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); | 476 | 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); |
474 | } | 477 | } |
475 | } | 478 | } |
476 | 479 | ||
477 | void LLManip::renderTickText(const LLVector3& pos, const char* text, const LLColor4 &color) | 480 | void LLManip::renderTickText(const LLVector3& pos, const std::string& text, const LLColor4 &color) |
478 | { | 481 | { |
479 | const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); | 482 | const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); |
480 | 483 | ||
@@ -484,7 +487,7 @@ void LLManip::renderTickText(const LLVector3& pos, const char* text, const LLCol | |||
484 | LLVector3 render_pos = pos; | 487 | LLVector3 render_pos = pos; |
485 | if (hud_selection) | 488 | if (hud_selection) |
486 | { | 489 | { |
487 | F32 zoom_amt = gAgent.getAvatarObject()->mHUDCurZoom; | 490 | F32 zoom_amt = gAgent.mHUDCurZoom; |
488 | F32 inv_zoom_amt = 1.f / zoom_amt; | 491 | F32 inv_zoom_amt = 1.f / zoom_amt; |
489 | // scale text back up to counter-act zoom level | 492 | // scale text back up to counter-act zoom level |
490 | render_pos = pos * zoom_amt; | 493 | render_pos = pos * zoom_amt; |
@@ -502,37 +505,37 @@ void LLManip::renderTickText(const LLVector3& pos, const char* text, const LLCol | |||
502 | glPopMatrix(); | 505 | glPopMatrix(); |
503 | } | 506 | } |
504 | 507 | ||
505 | void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffix, const LLColor4 &color) | 508 | void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string& suffix, const LLColor4 &color) |
506 | { | 509 | { |
507 | LLLocale locale(LLLocale::USER_LOCALE); | 510 | LLLocale locale(LLLocale::USER_LOCALE); |
508 | 511 | ||
509 | const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); | 512 | const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); |
510 | const LLFontGL* small_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); | 513 | const LLFontGL* small_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); |
511 | 514 | ||
512 | char val_string[128]; /*Flawfinder: ignore*/ | 515 | std::string val_string; |
513 | char fraction_string[128]; /*Flawfinder: ignore*/ | 516 | std::string fraction_string; |
514 | F32 val_to_print = llround(value, 0.001f); | 517 | F32 val_to_print = llround(value, 0.001f); |
515 | S32 fractional_portion = llround(fmodf(llabs(val_to_print), 1.f) * 100.f); | 518 | S32 fractional_portion = llround(fmodf(llabs(val_to_print), 1.f) * 100.f); |
516 | if (val_to_print < 0.f) | 519 | if (val_to_print < 0.f) |
517 | { | 520 | { |
518 | if (fractional_portion == 0) | 521 | if (fractional_portion == 0) |
519 | { | 522 | { |
520 | snprintf(val_string, sizeof(val_string), "-%d%s", lltrunc(llabs(val_to_print)), suffix); /* Flawfinder: ignore */ | 523 | val_string = llformat("-%d%s", lltrunc(llabs(val_to_print)), suffix.c_str()); |
521 | } | 524 | } |
522 | else | 525 | else |
523 | { | 526 | { |
524 | snprintf(val_string, sizeof(val_string), "-%d", lltrunc(llabs(val_to_print))); /* Flawfinder: ignore */ | 527 | val_string = llformat("-%d", lltrunc(llabs(val_to_print))); |
525 | } | 528 | } |
526 | } | 529 | } |
527 | else | 530 | else |
528 | { | 531 | { |
529 | if (fractional_portion == 0) | 532 | if (fractional_portion == 0) |
530 | { | 533 | { |
531 | snprintf(val_string, sizeof(val_string), "%d%s", lltrunc(llabs(val_to_print)), suffix); /* Flawfinder: ignore */ | 534 | val_string = llformat("%d%s", lltrunc(llabs(val_to_print)), suffix.c_str()); |
532 | } | 535 | } |
533 | else | 536 | else |
534 | { | 537 | { |
535 | snprintf(val_string, sizeof(val_string), "%d", lltrunc(val_to_print)); /* Flawfinder: ignore */ | 538 | val_string = llformat("%d", lltrunc(val_to_print)); |
536 | } | 539 | } |
537 | } | 540 | } |
538 | 541 | ||
@@ -542,7 +545,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffi | |||
542 | LLVector3 render_pos = pos; | 545 | LLVector3 render_pos = pos; |
543 | if (hud_selection) | 546 | if (hud_selection) |
544 | { | 547 | { |
545 | F32 zoom_amt = gAgent.getAvatarObject()->mHUDCurZoom; | 548 | F32 zoom_amt = gAgent.mHUDCurZoom; |
546 | F32 inv_zoom_amt = 1.f / zoom_amt; | 549 | F32 inv_zoom_amt = 1.f / zoom_amt; |
547 | // scale text back up to counter-act zoom level | 550 | // scale text back up to counter-act zoom level |
548 | render_pos = pos * zoom_amt; | 551 | render_pos = pos * zoom_amt; |
@@ -554,7 +557,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffi | |||
554 | 557 | ||
555 | if (fractional_portion != 0) | 558 | if (fractional_portion != 0) |
556 | { | 559 | { |
557 | snprintf(fraction_string, sizeof(fraction_string), "%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix); /* Flawfinder: ignore */ | 560 | fraction_string = llformat("%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix.c_str()); |
558 | 561 | ||
559 | gViewerWindow->setupViewport(1, -1); | 562 | gViewerWindow->setupViewport(1, -1); |
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); | 563 | hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -1.f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection); |