More text cleanup

This commit is contained in:
Georg Hagen
2025-03-02 19:39:34 +01:00
parent fdea7ce0ba
commit c2c19b6383
4 changed files with 10 additions and 24 deletions

View File

@@ -18,7 +18,6 @@
#include "Base/EngineConfiguration.hpp"
#include "Controller/FreeCamCameraController.hpp"
#include "Scene/Text/SdfFontAtlasGenerator.hpp"
#include <filesystem>
#ifdef _WIN32
#undef TRANSPARENT
@@ -47,7 +46,7 @@ namespace OpenVulkano
auto& resourceLoader = ResourceLoader::GetInstance();
auto sdfMetadataInfo = resourceLoader.GetResource("sdf_atlas_packed.png");
TextDrawable textDrawable(sdfMetadataInfo);
TextDrawable textDrawable(std::make_shared<FontAtlas>(sdfMetadataInfo));
const std::vector<std::string> texts = { "_!?{}.#@", "1", "XYZ", "12345" };
const int N = texts.size();
m_nodesPool.resize(N);

View File

@@ -20,7 +20,6 @@
#include "Controller/FreeCamCameraController.hpp"
#include "Scene/Text/SdfFontAtlasGenerator.hpp"
#include "Scene/Text/BitmapFontAtlasGenerator.hpp"
#include "Scene/Text/FontAtlasFactory.hpp"
#include <filesystem>
#ifdef _WIN32
@@ -90,30 +89,30 @@ namespace OpenVulkano
{
t = new TextDrawable(m_atlasGenerator.GetAtlas(), texts[j].second);
}
else
else if (i == 1)
{
t = new TextDrawable(m_msdfAtlasGenerator.GetAtlas(), texts[j].second);
}
#else
if (i == 0)
{
t = new TextDrawable(sdfMetadataInfo, texts[j].second);
t = new TextDrawable(std::make_shared<FontAtlas>(sdfMetadataInfo), texts[j].second);
}
else if (i == 1)
{
TextConfig cfg = texts[j].second;
cfg.minimalSpacingBetweenMultipleLines = false;
t = new TextDrawable(msdfMetadataInfo, cfg);
t = new TextDrawable(std::make_shared<FontAtlas>(msdfMetadataInfo), cfg);
}
else if (i == 2)
{
// bitmap
t = new TextDrawable(bitmapMetadataInfo, texts[j].second);
t = new TextDrawable(std::make_shared<FontAtlas>(bitmapMetadataInfo), texts[j].second);
}
else if (i == 3)
{
// bitmap subpixel rendering
t = new TextDrawable(bitmapSubpixelRenderingMetadataInfo, texts[j].second);
t = new TextDrawable(std::make_shared<FontAtlas>(bitmapSubpixelRenderingMetadataInfo), texts[j].second);
}
// OR use separate texture + metadata file
//auto metadataInfo = resourceLoader.GetResource("atlas_metadata");