viewer#2883 Regenerate font's matrix and depth instead of loading

to fix issues with nametags and window resizes
master
Andrey Kleshchev 2024-09-30 18:28:00 +03:00 committed by Andrey Kleshchev
parent b1fb2fba70
commit 200a196d31
4 changed files with 35 additions and 3 deletions

View File

@ -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();

View File

@ -213,6 +213,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();

View File

@ -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

View File

@ -77,6 +77,7 @@ public:
, mModelView(projection)
, mTexture0(texture0)
{}
void drawWithMatrix();
void draw();
LLPointer<LLVertexBuffer> mVB;
U8 mMode;