code refactoring
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
#include "Base/EngineConfiguration.hpp"
|
||||
#include "Controller/FreeCamCameraController.hpp"
|
||||
#include "Image/ImageLoaderPng.hpp"
|
||||
#include "Scene/FontAtlasGenerator.hpp"
|
||||
#include "Scene/SdfFontAtlasGenerator.hpp"
|
||||
#include "Scene/IFontAtlasGenerator.hpp"
|
||||
#include "Scene/BitmapFontAtlasGenerator.hpp"
|
||||
#include <filesystem>
|
||||
@@ -39,8 +39,8 @@ namespace OpenVulkano
|
||||
using namespace Math;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
//#define CREATE_NEW_ATLAS 1
|
||||
#define CREATE_BITMAP_ATLAS 0
|
||||
constexpr int CREATE_BITMAP_ATLAS = 0;
|
||||
constexpr int CREATE_NEW_ATLAS = 0;
|
||||
|
||||
class TextExampleAppImpl final : public TextExampleApp
|
||||
{
|
||||
@@ -71,14 +71,15 @@ namespace OpenVulkano
|
||||
m_nodesPool.resize(N * 3);
|
||||
m_drawablesPool.resize(N * 3);
|
||||
|
||||
#if CREATE_BITMAP_ATLAS
|
||||
std::set<uint32_t> s = BitmapFontAtlasGenerator::LoadAllGlyphs(fontPath);
|
||||
BitmapFontAtlasGenerator generator;
|
||||
generator.GenerateAtlas(fontPath, s);
|
||||
generator.SaveAtlasMetadataInfo("bitmap_atlas");
|
||||
#endif
|
||||
if constexpr (CREATE_BITMAP_ATLAS)
|
||||
{
|
||||
std::set<uint32_t> s = BitmapFontAtlasGenerator::LoadAllGlyphs(fontPath);
|
||||
BitmapFontAtlasGenerator generator;
|
||||
generator.GenerateAtlas(fontPath, s);
|
||||
generator.SaveAtlasMetadataInfo("bitmap_atlas");
|
||||
}
|
||||
|
||||
#if defined(MSDFGEN_AVAILABLE) && defined(CREATE_NEW_ATLAS)
|
||||
#if defined(MSDFGEN_AVAILABLE) && CREATE_NEW_ATLAS
|
||||
std::set<uint32_t> s = SdfFontAtlasGenerator::LoadAllGlyphs(fontPath);
|
||||
msdf_atlas::Charset charset;
|
||||
for (uint32_t c : s)
|
||||
@@ -99,7 +100,7 @@ namespace OpenVulkano
|
||||
{
|
||||
int textIdx = i % texts.size();
|
||||
TextDrawable* t = nullptr;
|
||||
#if defined(MSDFGEN_AVAILABLE) && defined(CREATE_NEW_ATLAS)
|
||||
#if defined(MSDFGEN_AVAILABLE) && CREATE_NEW_ATLAS
|
||||
if (i < texts.size())
|
||||
{
|
||||
t = new TextDrawable(m_atlasGenerator.GetAtlasData(), texts[textIdx].second);
|
||||
@@ -180,7 +181,7 @@ namespace OpenVulkano
|
||||
PerspectiveCamera m_cam;
|
||||
OpenVulkano::FreeCamCameraController m_camController;
|
||||
#ifdef MSDFGEN_AVAILABLE
|
||||
SdfFontAtlasGenerator m_atlasGenerator;
|
||||
SdfFontAtlasGeneratorT m_atlasGenerator;
|
||||
MsdfFontAtlasGenerator m_msdfAtlasGenerator;
|
||||
#endif
|
||||
std::vector<SimpleDrawable*> m_drawablesPool;
|
||||
|
||||
Reference in New Issue
Block a user