summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-09-24 22:20:35 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-09-25 09:37:59 +0300
commita2e9a0caf32003253766efe528329fdd11f28b0b (patch)
tree285f31ccf2b20a0a5bd518a5c522f5c5de68d0b9 /indra
parent86446c7b55c4265b3dd90919e4d1cd4a4d30ea6a (diff)
viewer-private#291 Object floating text does not update without moving camera
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llhudtext.cpp16
-rw-r--r--indra/newview/llhudtext.h4
2 files changed, 18 insertions, 2 deletions
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 92f09c34a0..818474a0cb 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -185,6 +185,15 @@ void LLHUDText::renderText()
LLVector3 render_position = mPositionAgent
+ (x_pixel_vec * screen_offset.mV[VX])
+ (y_pixel_vec * screen_offset.mV[VY]);
+ bool reset_buffers = false;
+ const F32 treshold = 0.000001f;
+ if (abs(mLastRenderPosition.mV[VX] - render_position.mV[VX]) > treshold
+ || abs(mLastRenderPosition.mV[VY] - render_position.mV[VY]) > treshold
+ || abs(mLastRenderPosition.mV[VZ] - render_position.mV[VZ]) > treshold)
+ {
+ reset_buffers = true;
+ mLastRenderPosition = render_position;
+ }
F32 y_offset = (F32)mOffsetY;
@@ -208,6 +217,11 @@ void LLHUDText::renderText()
for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin() + start_segment;
segment_iter != mTextSegments.end(); ++segment_iter )
{
+ if (reset_buffers)
+ {
+ segment_iter->mFontBufferText.reset();
+ }
+
const LLFontGL* fontp = segment_iter->mFont;
y_offset -= fontp->getLineHeight() - 1; // correction factor to match legacy font metrics
@@ -231,7 +245,7 @@ void LLHUDText::renderText()
}
text_color.mV[VALPHA] *= alpha_factor;
- hud_render_text(segment_iter->getText(), render_position, &mFontBuffer, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment);
+ hud_render_text(segment_iter->getText(), render_position, &segment_iter->mFontBufferText, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment);
}
}
/// Reset the default color to white. The renderer expects this to be the default.
diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h
index 224677736c..4c850e2d91 100644
--- a/indra/newview/llhudtext.h
+++ b/indra/newview/llhudtext.h
@@ -67,6 +67,8 @@ protected:
LLColor4 mColor;
LLFontGL::StyleFlags mStyle;
const LLFontGL* mFont;
+ LLFontVertexBuffer mFontBuffer;
+ LLFontVertexBuffer mFontBufferText;
private:
LLWString mText;
std::map<const LLFontGL*, F32> mFontWidthMap;
@@ -152,6 +154,7 @@ private:
const LLFontGL* mBoldFontp;
LLRectf mSoftScreenRect;
LLVector3 mPositionAgent;
+ LLVector3 mLastRenderPosition;
LLVector2 mPositionOffset;
LLVector2 mTargetPositionOffset;
F32 mMass;
@@ -162,7 +165,6 @@ private:
ETextAlignment mTextAlignment;
EVertAlignment mVertAlignment;
bool mHidden;
- LLFontVertexBuffer mFontBuffer;
static bool sDisplayText ;
static std::set<LLPointer<LLHUDText> > sTextObjects;