summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-08-29 18:49:10 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-09-04 10:16:46 +0300
commita638d9610d9f369eca6dff74e8860ca466c253c7 (patch)
treee65ff848bd186e761891b2ca9d95c8026ed96274 /indra/newview
parent2bae8dfb815cf4d04cb4882c2fb889e3fb9666b2 (diff)
viewer#2411 LLFontGL::render optimizations #2
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llhudnametag.cpp19
-rw-r--r--indra/newview/llhudnametag.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp
index 0c56582ea6..19ae35813c 100644
--- a/indra/newview/llhudnametag.cpp
+++ b/indra/newview/llhudnametag.cpp
@@ -290,6 +290,15 @@ void LLHUDNameTag::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;
+ }
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
LLRect screen_rect;
@@ -313,6 +322,11 @@ void LLHUDNameTag::renderText()
for(std::vector<LLHUDTextSegment>::iterator segment_iter = mLabelSegments.begin();
segment_iter != mLabelSegments.end(); ++segment_iter )
{
+ if (reset_buffers)
+ {
+ segment_iter->mFontBufferLabel.reset();
+ }
+
// Label segments use default font
const LLFontGL* fontp = (segment_iter->mStyle == LLFontGL::BOLD) ? mBoldFontp : mFontp;
y_offset -= fontp->getLineHeight();
@@ -350,6 +364,11 @@ void LLHUDNameTag::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();
y_offset -= LINE_PADDING;
diff --git a/indra/newview/llhudnametag.h b/indra/newview/llhudnametag.h
index ee315f47af..b48a606982 100644
--- a/indra/newview/llhudnametag.h
+++ b/indra/newview/llhudnametag.h
@@ -177,6 +177,7 @@ private:
S32 mMaxLines;
S32 mOffsetY;
F32 mRadius;
+ LLVector3 mLastRenderPosition;
std::vector<LLHUDTextSegment> mTextSegments;
std::vector<LLHUDTextSegment> mLabelSegments;
// LLFrameTimer mResizeTimer;