From 999410be624057f6c5bdebd0284934d9d97db879 Mon Sep 17 00:00:00 2001 From: catdbg Date: Fri, 6 Mar 2026 10:50:09 -0800 Subject: [PATCH] Revert "Batch font drawing to fix debug overlay FPS" This reverts commit 7dcecdbd4d6037194e75d9fe3130845dd8690928. --- Minecraft.Client/Font.cpp | 52 +++++---------------------------------- Minecraft.Client/Font.h | 1 - 2 files changed, 6 insertions(+), 47 deletions(-) diff --git a/Minecraft.Client/Font.cpp b/Minecraft.Client/Font.cpp index ce2275f69..51b50ca19 100644 --- a/Minecraft.Client/Font.cpp +++ b/Minecraft.Client/Font.cpp @@ -146,44 +146,6 @@ void Font::renderStyleLine(float x0, float y0, float x1, float y1) t->end(); } -void Font::addCharacterQuad(wchar_t c) -{ - float xOff = c % m_cols * m_charWidth; - float yOff = c / m_cols * m_charWidth; - float width = charWidths[c] - .01f; - float height = m_charHeight - .01f; - float fontWidth = m_cols * m_charWidth; - float fontHeight = m_rows * m_charHeight; - const float shear = m_italic ? (height * 0.25f) : 0.0f; - float x0 = xPos, x1 = xPos + width + shear; - float y0 = yPos, y1 = yPos + height; - - Tesselator *t = Tesselator::getInstance(); - t->tex(xOff / fontWidth, (yOff + 7.99f) / fontHeight); - t->vertex(x0, y1, 0.0f); - t->tex((xOff + width) / fontWidth, (yOff + 7.99f) / fontHeight); - t->vertex(x1, y1, 0.0f); - t->tex((xOff + width) / fontWidth, yOff / fontHeight); - t->vertex(x1, y0, 0.0f); - t->tex(xOff / fontWidth, yOff / fontHeight); - t->vertex(x0, y0, 0.0f); - - if (m_bold) - { - float dx = 1.0f; - t->tex(xOff / fontWidth, (yOff + 7.99f) / fontHeight); - t->vertex(x0 + dx, y1, 0.0f); - t->tex((xOff + width) / fontWidth, (yOff + 7.99f) / fontHeight); - t->vertex(x1 + dx, y1, 0.0f); - t->tex((xOff + width) / fontWidth, yOff / fontHeight); - t->vertex(x1 + dx, y0, 0.0f); - t->tex(xOff / fontWidth, yOff / fontHeight); - t->vertex(x0 + dx, y0, 0.0f); - } - - xPos += static_cast(charWidths[c]); -} - void Font::renderCharacter(wchar_t c) { float xOff = c % m_cols * m_charWidth; @@ -293,13 +255,11 @@ void Font::draw(const wstring &str, bool dropShadow) { // Bind the texture textures->bindTexture(m_textureLocation); + bool noise = false; m_bold = m_italic = m_underline = m_strikethrough = false; wstring cleanStr = sanitize(str); - Tesselator *t = Tesselator::getInstance(); - t->begin(); - for (int i = 0; i < static_cast(cleanStr.length()); ++i) { // Map character @@ -310,10 +270,8 @@ void Font::draw(const wstring &str, bool dropShadow) wchar_t ca = cleanStr[i+1]; if (!isSectionFormatCode(ca)) { - t->end(); renderCharacter(167); renderCharacter(ca); - t->begin(); i += 1; continue; } @@ -336,10 +294,14 @@ void Font::draw(const wstring &str, bool dropShadow) { noise = false; if (colorN < 0 || colorN > 15) colorN = 15; + if (dropShadow) colorN += 16; + int color = colors[colorN]; glColor3f((color >> 16) / 255.0F, ((color >> 8) & 255) / 255.0F, (color & 255) / 255.0F); } + + i += 1; continue; } @@ -355,10 +317,8 @@ void Font::draw(const wstring &str, bool dropShadow) c = newc; } - addCharacterQuad(c); + renderCharacter(c); } - - t->end(); } void Font::draw(const wstring& str, int x, int y, int color, bool dropShadow) diff --git a/Minecraft.Client/Font.h b/Minecraft.Client/Font.h index a5d117ca0..3d25880de 100644 --- a/Minecraft.Client/Font.h +++ b/Minecraft.Client/Font.h @@ -47,7 +47,6 @@ public: private: void renderCharacter(wchar_t c); // 4J added - void addCharacterQuad(wchar_t c); void renderStyleLine(float x0, float y0, float x1, float y1); // solid line for underline/strikethrough public: