aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llhudtext.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llhudtext.cpp43
1 files changed, 21 insertions, 22 deletions
diff --git a/linden/indra/newview/llhudtext.cpp b/linden/indra/newview/llhudtext.cpp
index 5dc016e..92caf8e 100644
--- a/linden/indra/newview/llhudtext.cpp
+++ b/linden/indra/newview/llhudtext.cpp
@@ -76,6 +76,7 @@ const F32 LOD_2_SCREEN_COVERAGE = 0.40f;
76std::set<LLPointer<LLHUDText> > LLHUDText::sTextObjects; 76std::set<LLPointer<LLHUDText> > LLHUDText::sTextObjects;
77std::vector<LLPointer<LLHUDText> > LLHUDText::sVisibleTextObjects; 77std::vector<LLPointer<LLHUDText> > LLHUDText::sVisibleTextObjects;
78std::vector<LLPointer<LLHUDText> > LLHUDText::sVisibleHUDTextObjects; 78std::vector<LLPointer<LLHUDText> > LLHUDText::sVisibleHUDTextObjects;
79BOOL LLHUDText::sDisplayText = TRUE ;
79 80
80bool lltextobject_further_away::operator()(const LLPointer<LLHUDText>& lhs, const LLPointer<LLHUDText>& rhs) const 81bool lltextobject_further_away::operator()(const LLPointer<LLHUDText>& lhs, const LLPointer<LLHUDText>& rhs) const
81{ 82{
@@ -120,7 +121,7 @@ LLHUDText::~LLHUDText()
120 121
121void LLHUDText::render() 122void LLHUDText::render()
122{ 123{
123 if (!mOnHUDAttachment) 124 if (!mOnHUDAttachment && sDisplayText)
124 { 125 {
125 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); 126 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
126 renderText(FALSE); 127 renderText(FALSE);
@@ -174,9 +175,7 @@ void LLHUDText::renderText(BOOL for_select)
174 mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f)); 175 mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
175 176
176 // *TODO: cache this image 177 // *TODO: cache this image
177 LLUUID image_id; 178 LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga");
178 image_id.set(gViewerArt.getString("rounded_square.tga"));
179 LLViewerImage* imagep = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
180 179
181 // *TODO: make this a per-text setting 180 // *TODO: make this a per-text setting
182 LLColor4 bg_color = gSavedSettings.getColor4("BackgroundChatColor"); 181 LLColor4 bg_color = gSavedSettings.getColor4("BackgroundChatColor");
@@ -210,10 +209,10 @@ void LLHUDText::renderText(BOOL for_select)
210 } 209 }
211 else 210 else
212 { 211 {
213 gCamera->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); 212 LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
214 } 213 }
215 214
216 LLVector2 border_scale_vec((F32)border_width / (F32)imagep->getWidth(), (F32)border_height / (F32)imagep->getHeight()); 215 LLVector2 border_scale_vec((F32)border_width / (F32)imagep->getTextureWidth(), (F32)border_height / (F32)imagep->getTextureHeight());
217 LLVector3 width_vec = mWidth * x_pixel_vec; 216 LLVector3 width_vec = mWidth * x_pixel_vec;
218 LLVector3 height_vec = mHeight * y_pixel_vec; 217 LLVector3 height_vec = mHeight * y_pixel_vec;
219 LLVector3 scaled_border_width = (F32)llfloor(border_scale * (F32)border_width) * x_pixel_vec; 218 LLVector3 scaled_border_width = (F32)llfloor(border_scale * (F32)border_width) * x_pixel_vec;
@@ -222,7 +221,7 @@ void LLHUDText::renderText(BOOL for_select)
222 mRadius = (width_vec + height_vec).magVec() * 0.5f; 221 mRadius = (width_vec + height_vec).magVec() * 0.5f;
223 222
224 LLCoordGL screen_pos; 223 LLCoordGL screen_pos;
225 gCamera->projectPosAgentToScreen(mPositionAgent, screen_pos, FALSE); 224 LLViewerCamera::getInstance()->projectPosAgentToScreen(mPositionAgent, screen_pos, FALSE);
226 225
227 LLVector2 screen_offset; 226 LLVector2 screen_offset;
228 if (!mUseBubble) 227 if (!mUseBubble)
@@ -245,7 +244,7 @@ void LLHUDText::renderText(BOOL for_select)
245 //} 244 //}
246 //else 245 //else
247 //{ 246 //{
248 // render_position = gCamera->roundToPixel(render_position); 247 // render_position = LLViewerCamera::getInstance()->roundToPixel(render_position);
249 //} 248 //}
250 249
251 if (mUseBubble) 250 if (mUseBubble)
@@ -271,7 +270,7 @@ void LLHUDText::renderText(BOOL for_select)
271 } 270 }
272 else 271 else
273 { 272 {
274 LLViewerImage::bindTexture(imagep); 273 LLViewerImage::bindTexture(imagep->getImage());
275 274
276 gGL.color4fv(bg_color.mV); 275 gGL.color4fv(bg_color.mV);
277 gl_segmented_rect_3d_tex(border_scale_vec, scaled_border_width, scaled_border_height, width_vec, height_vec); 276 gl_segmented_rect_3d_tex(border_scale_vec, scaled_border_width, scaled_border_height, width_vec, height_vec);
@@ -615,25 +614,25 @@ void LLHUDText::updateVisibility()
615 } 614 }
616 615
617 // push text towards camera by radius of object, but not past camera 616 // push text towards camera by radius of object, but not past camera
618 LLVector3 vec_from_camera = mPositionAgent - gCamera->getOrigin(); 617 LLVector3 vec_from_camera = mPositionAgent - LLViewerCamera::getInstance()->getOrigin();
619 LLVector3 dir_from_camera = vec_from_camera; 618 LLVector3 dir_from_camera = vec_from_camera;
620 dir_from_camera.normVec(); 619 dir_from_camera.normVec();
621 620
622 if (dir_from_camera * gCamera->getAtAxis() <= 0.f) 621 if (dir_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= 0.f)
623 { 622 {
624 mPositionAgent -= projected_vec(vec_from_camera, gCamera->getAtAxis()) * 1.f; 623 mPositionAgent -= projected_vec(vec_from_camera, LLViewerCamera::getInstance()->getAtAxis()) * 1.f;
625 mPositionAgent += gCamera->getAtAxis() * (gCamera->getNear() + 0.1f); 624 mPositionAgent += LLViewerCamera::getInstance()->getAtAxis() * (LLViewerCamera::getInstance()->getNear() + 0.1f);
626 } 625 }
627 else if (vec_from_camera * gCamera->getAtAxis() <= gCamera->getNear() + 0.1f + mSourceObject->getVObjRadius()) 626 else if (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= LLViewerCamera::getInstance()->getNear() + 0.1f + mSourceObject->getVObjRadius())
628 { 627 {
629 mPositionAgent = gCamera->getOrigin() + vec_from_camera * ((gCamera->getNear() + 0.1f) / (vec_from_camera * gCamera->getAtAxis())); 628 mPositionAgent = LLViewerCamera::getInstance()->getOrigin() + vec_from_camera * ((LLViewerCamera::getInstance()->getNear() + 0.1f) / (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis()));
630 } 629 }
631 else 630 else
632 { 631 {
633 mPositionAgent -= dir_from_camera * mSourceObject->getVObjRadius(); 632 mPositionAgent -= dir_from_camera * mSourceObject->getVObjRadius();
634 } 633 }
635 634
636 mLastDistance = (mPositionAgent - gCamera->getOrigin()).magVec(); 635 mLastDistance = (mPositionAgent - LLViewerCamera::getInstance()->getOrigin()).magVec();
637 636
638 if (mLOD >= 3 || !mTextSegments.size() || (mDoFade && (mLastDistance > mFadeDistance + mFadeRange))) 637 if (mLOD >= 3 || !mTextSegments.size() || (mDoFade && (mLastDistance > mFadeDistance + mFadeRange)))
639 { 638 {
@@ -644,14 +643,14 @@ void LLHUDText::updateVisibility()
644 LLVector3 x_pixel_vec; 643 LLVector3 x_pixel_vec;
645 LLVector3 y_pixel_vec; 644 LLVector3 y_pixel_vec;
646 645
647 gCamera->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); 646 LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
648 647
649 LLVector3 render_position = mPositionAgent + 648 LLVector3 render_position = mPositionAgent +
650 (x_pixel_vec * mPositionOffset.mV[VX]) + 649 (x_pixel_vec * mPositionOffset.mV[VX]) +
651 (y_pixel_vec * mPositionOffset.mV[VY]); 650 (y_pixel_vec * mPositionOffset.mV[VY]);
652 651
653 mOffscreen = FALSE; 652 mOffscreen = FALSE;
654 if (!gCamera->sphereInFrustum(render_position, mRadius)) 653 if (!LLViewerCamera::getInstance()->sphereInFrustum(render_position, mRadius))
655 { 654 {
656 if (!mVisibleOffScreen) 655 if (!mVisibleOffScreen)
657 { 656 {
@@ -674,9 +673,9 @@ LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset)
674 LLVector2 screen_pos_vec; 673 LLVector2 screen_pos_vec;
675 LLVector3 x_pixel_vec; 674 LLVector3 x_pixel_vec;
676 LLVector3 y_pixel_vec; 675 LLVector3 y_pixel_vec;
677 gCamera->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); 676 LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
678 LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec); 677 LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec);
679 if (!gCamera->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen) 678 if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen)
680 { 679 {
681 // bubble off-screen, so find a spot for it along screen edge 680 // bubble off-screen, so find a spot for it along screen edge
682 LLVector2 window_center(gViewerWindow->getWindowDisplayWidth() * 0.5f, gViewerWindow->getWindowDisplayHeight() * 0.5f); 681 LLVector2 window_center(gViewerWindow->getWindowDisplayWidth() * 0.5f, gViewerWindow->getWindowDisplayHeight() * 0.5f);
@@ -684,7 +683,7 @@ LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset)
684 screen_pos.mY - window_center.mV[VY]); 683 screen_pos.mY - window_center.mV[VY]);
685 delta_from_center.normVec(); 684 delta_from_center.normVec();
686 685
687 F32 camera_aspect = gCamera->getAspect(); 686 F32 camera_aspect = LLViewerCamera::getInstance()->getAspect();
688 F32 delta_aspect = llabs(delta_from_center.mV[VX] / delta_from_center.mV[VY]); 687 F32 delta_aspect = llabs(delta_from_center.mV[VX] / delta_from_center.mV[VY]);
689 if (camera_aspect / llmax(delta_aspect, 0.001f) > 1.f) 688 if (camera_aspect / llmax(delta_aspect, 0.001f) > 1.f)
690 { 689 {
@@ -834,7 +833,7 @@ void LLHUDText::updateAll()
834 } 833 }
835 } 834 }
836 835
837 LLStat* camera_vel_stat = gCamera->getVelocityStat(); 836 LLStat* camera_vel_stat = LLViewerCamera::getInstance()->getVelocityStat();
838 F32 camera_vel = camera_vel_stat->getCurrent(); 837 F32 camera_vel = camera_vel_stat->getCurrent();
839 if (camera_vel > MAX_STABLE_CAMERA_VELOCITY) 838 if (camera_vel > MAX_STABLE_CAMERA_VELOCITY)
840 { 839 {