Rework some text related functions
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "Controller/FreeCamCameraController.hpp"
|
||||
#include "Scene/Text/SdfFontAtlasGenerator.hpp"
|
||||
#include "Scene/Text/BitmapFontAtlasGenerator.hpp"
|
||||
#include "Scene/Text/FontAtlasFactory.hpp"
|
||||
#include <filesystem>
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -63,18 +64,13 @@ namespace OpenVulkano
|
||||
|
||||
constexpr int atlasesCount = 4;
|
||||
const int textsCount = texts.size();
|
||||
auto& resourceLoader = ResourceLoader::GetInstance();
|
||||
const std::string fontPath = resourceLoader.GetResourcePath("Roboto-Regular.ttf");
|
||||
m_nodesPool.resize(textsCount * atlasesCount);
|
||||
m_drawablesPool.resize(textsCount * atlasesCount);
|
||||
|
||||
if constexpr (CREATE_BITMAP_ATLAS)
|
||||
{
|
||||
// ReSharper disable once CppDFAUnreachableCode
|
||||
std::set<uint32_t> s = BitmapFontAtlasGenerator::LoadAllGlyphs(fontPath);
|
||||
BitmapFontAtlasGenerator generator(FontPixelSizeConfig(), SubpixelLayout::RGB);
|
||||
generator.GenerateAtlas(fontPath, s);
|
||||
generator.GetAtlas()->Save("bitmap_atlas_packed.png");
|
||||
FontAtlasFactory().GetFontAtlas("Roboto-Regular", 14.0f, SubpixelLayout::RGB)->Save("bitmap_atlas_rgb.ovfont");
|
||||
}
|
||||
|
||||
#if defined(MSDFGEN_AVAILABLE) && defined(CREATE_NEW_ATLAS)
|
||||
@@ -83,7 +79,8 @@ namespace OpenVulkano
|
||||
m_msdfAtlasGenerator.GenerateAtlas(fontPath, s);
|
||||
m_atlasGenerator.GetAtlas()->Save("sdf_atlas_packed.png");
|
||||
m_msdfAtlasGenerator.GetAtlas()->Save("msdf_atlas_packed.png");
|
||||
#else
|
||||
#else
|
||||
auto& resourceLoader = ResourceLoader::GetInstance();
|
||||
auto sdfMetadataInfo = resourceLoader.GetResource("sdf_atlas_packed.png");
|
||||
auto msdfMetadataInfo = resourceLoader.GetResource("msdf_atlas_packed.png");
|
||||
auto bitmapMetadataInfo = resourceLoader.GetResource("bitmap_atlas_packed.png");
|
||||
|
||||
Reference in New Issue
Block a user