Update to FontAtlasFactory for more eficent loading

This commit is contained in:
Georg Hagen
2025-03-02 18:35:36 +01:00
parent ba2570d444
commit ee82919293
5 changed files with 69 additions and 56 deletions

View File

@@ -16,15 +16,16 @@ namespace OpenVulkano::Scene
{
struct FontIdentifier
{
FontIdentifier(const std::string& font_, const std::set<uint32_t>& charset, SubpixelLayout subpixelLayout_,
float ptSize_, FontAtlasType atlasType_);
FontIdentifier(const std::string_view& font, FontAtlasType atlasType) : font(font), atlasType(atlasType) { assert(atlasType.IsSDF()); }
FontIdentifier(const std::string_view& font, FontAtlasType atlasType, SubpixelLayout subpixelLayout, float ptSize)
: font(font), atlasType(atlasType), subpixelLayout(subpixelLayout), ptSize(ptSize) {}
bool operator<(const FontIdentifier& other) const;
std::string font;
uint32_t charsetHash = 0;
FontAtlasType atlasType;
SubpixelLayout subpixelLayout = SubpixelLayout::UNKNOWN;
float ptSize = 0;
FontAtlasType atlasType;
};
static FontAtlasFactory INSTANCE;