summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-09-30 18:28:00 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-10-02 19:25:11 +0300
commit83a4d86ecf741b5d97c6fd6cbc10d57eb4619699 (patch)
tree7f37beaaf1fd8815a0a7fabc492bffd6fa9fa944 /indra/llrender
parent3bbcc4b16575ac684074d1a5a9f1fc33f8fa5286 (diff)
viewer#2762 Restore LLFontVertexBuffer for HUD
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llfontgl.cpp2
-rw-r--r--indra/llrender/llfontvertexbuffer.cpp11
-rw-r--r--indra/llrender/llvertexbuffer.cpp24
-rw-r--r--indra/llrender/llvertexbuffer.h1
4 files changed, 35 insertions, 3 deletions
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index a012d57b5a..97be43cf86 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -404,7 +404,6 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
{
// recursively render ellipses at end of string
// we've already reserved enough room
- gGL.pushUIMatrix();
static LLWString elipses_wstr(utf8string_to_wstring(std::string("...")));
render(elipses_wstr,
0,
@@ -417,7 +416,6 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
right_x,
false,
use_color);
- gGL.popUIMatrix();
}
gGL.popUIMatrix();
diff --git a/indra/llrender/llfontvertexbuffer.cpp b/indra/llrender/llfontvertexbuffer.cpp
index f5d6b03cd6..963aab7121 100644
--- a/indra/llrender/llfontvertexbuffer.cpp
+++ b/indra/llrender/llfontvertexbuffer.cpp
@@ -209,6 +209,17 @@ void LLFontVertexBuffer::renderBuffers()
gGL.flush(); // deliberately empty pending verts
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
gGL.pushUIMatrix();
+
+ gGL.loadUIIdentity();
+
+ // Depth translation, so that floating text appears 'in-world'
+ // and is correctly occluded.
+ gGL.translatef(0.f, 0.f, LLFontGL::sCurDepth);
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+
+ // Note: ellipses should technically be covered by push/load/translate of their own
+ // but it's more complexity, values do not change, skipping doesn't appear to break
+ // anything, so we can skip that until it proves to cause issues.
for (LLVertexBufferData& buffer : mBufferList)
{
buffer.draw();
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 6f4828397a..12ae36f4bb 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -604,7 +604,7 @@ public:
static LLVBOPool* sVBOPool = nullptr;
-void LLVertexBufferData::draw()
+void LLVertexBufferData::drawWithMatrix()
{
if (!mVB)
{
@@ -642,6 +642,28 @@ void LLVertexBufferData::draw()
gGL.popMatrix();
}
+void LLVertexBufferData::draw()
+{
+ if (!mVB)
+ {
+ llassert(false);
+ // Not supposed to happen, check buffer generation
+ return;
+ }
+
+ if (mTexName)
+ {
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTexName);
+ }
+ else
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+
+ mVB->setBuffer();
+ mVB->drawArrays(mMode, 0, mCount);
+}
+
//============================================================================
//static
diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h
index d4c6fbaf18..375ad76fb8 100644
--- a/indra/llrender/llvertexbuffer.h
+++ b/indra/llrender/llvertexbuffer.h
@@ -77,6 +77,7 @@ public:
, mModelView(projection)
, mTexture0(texture0)
{}
+ void drawWithMatrix();
void draw();
LLPointer<LLVertexBuffer> mVB;
U8 mMode;