~ 5% speedup for font-rendering overall
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m55s

This is probably the last speedup for this.
This commit is contained in:
2024-09-11 18:33:29 -04:00
parent 9903fc19c9
commit f6e8875eb9
4 changed files with 12 additions and 40 deletions

View File

@@ -1,9 +1,9 @@
#pragma once
#include <array>
#include <map>
#include <vector>
#include <glad/glad.h>
#include <vector>
#include <array>
#include <unordered_map>
/// TODO: FontCache mechanism works amazing, but makes no fucking sense
@@ -33,7 +33,7 @@ public:
/// Represents a Font object as it exists in the font-cache.
class JGL::CachedFont {
private:
std::map<char, CachedGlyph*> glyphs;
std::unordered_map<char, CachedGlyph*> glyphs;
GLuint texture = 0;
GLsizei texture_width = 0, texture_height = 0;
unsigned int font_size = 0;
@@ -43,7 +43,7 @@ public:
unsigned int getFontSize();
unsigned int getFontIndex();
CachedGlyph* getGlyph(char c);
std::map<char, CachedGlyph*> getGlyphs();
std::unordered_map<char, CachedGlyph*> getGlyphs();
const GLuint* getTexture();
[[nodiscard]] GLsizei getTextureWidth() const;
[[nodiscard]] GLsizei getTextureHeight() const;