From 0dd0532775eb351c844a6d55233da5fcd3b4d22b Mon Sep 17 00:00:00 2001 From: ohyzha Date: Tue, 31 Dec 2024 12:15:15 +0200 Subject: [PATCH] rename main sdf class for convenient synonym names --- examples/ExampleApps/TextExampleApp.cpp | 4 ++-- .../Scene/SdfFontAtlasGenerator.cpp | 20 +++++++++---------- .../Scene/SdfFontAtlasGenerator.hpp | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/ExampleApps/TextExampleApp.cpp b/examples/ExampleApps/TextExampleApp.cpp index 6348aa5..9ed0549 100644 --- a/examples/ExampleApps/TextExampleApp.cpp +++ b/examples/ExampleApps/TextExampleApp.cpp @@ -80,7 +80,7 @@ namespace OpenVulkano } #if defined(MSDFGEN_AVAILABLE) && CREATE_NEW_ATLAS - std::set s = SdfFontAtlasGeneratorT::LoadAllGlyphs(fontPath); + std::set s = SdfFontAtlasGenerator::LoadAllGlyphs(fontPath); m_atlasGenerator.GenerateAtlas(fontPath, s); m_msdfAtlasGenerator.GenerateAtlas(fontPath, s); m_atlasGenerator.SaveAtlasMetadataInfo("sdf_atlas.png"); @@ -176,7 +176,7 @@ namespace OpenVulkano PerspectiveCamera m_cam; OpenVulkano::FreeCamCameraController m_camController; #ifdef MSDFGEN_AVAILABLE - SdfFontAtlasGeneratorT m_atlasGenerator; + SdfFontAtlasGenerator m_atlasGenerator; MsdfFontAtlasGenerator m_msdfAtlasGenerator; #endif std::vector m_drawablesPool; diff --git a/openVulkanoCpp/Scene/SdfFontAtlasGenerator.cpp b/openVulkanoCpp/Scene/SdfFontAtlasGenerator.cpp index e806b76..4ca0e97 100644 --- a/openVulkanoCpp/Scene/SdfFontAtlasGenerator.cpp +++ b/openVulkanoCpp/Scene/SdfFontAtlasGenerator.cpp @@ -21,7 +21,7 @@ namespace OpenVulkano::Scene SdfFontAtlasGeneratorConfig SdfFontAtlasGeneratorConfig::msdfDefaultConfig = { 32, 1.0, 3 }; template - void SdfFontAtlasGenerator::GenerateAtlas(const std::string& fontFile, const std::set& charset, + void SdfFontAtlasGeneratorGeneric::GenerateAtlas(const std::string& fontFile, const std::set& charset, const std::optional& pngOutput) { FreetypeHandle* ft; @@ -32,14 +32,14 @@ namespace OpenVulkano::Scene Generate(ft, font, s, pngOutput); } - template SdfFontAtlasGenerator::SdfFontAtlasGenerator() : FontAtlasGeneratorBase(Channels) + template SdfFontAtlasGeneratorGeneric::SdfFontAtlasGeneratorGeneric() : FontAtlasGeneratorBase(Channels) { if constexpr (Channels == 1) m_config = SdfFontAtlasGeneratorConfig::sdfDefaultConfig; else m_config = SdfFontAtlasGeneratorConfig::msdfDefaultConfig; } template - void SdfFontAtlasGenerator::GenerateAtlas(const Array& fontData, const std::set& charset, + void SdfFontAtlasGeneratorGeneric::GenerateAtlas(const Array& fontData, const std::set& charset, const std::optional& pngOutput) { FreetypeHandle* ft; @@ -51,7 +51,7 @@ namespace OpenVulkano::Scene } template - void SdfFontAtlasGenerator::GenerateAtlas(const std::string& fontFile, const Charset& charset, + void SdfFontAtlasGeneratorGeneric::GenerateAtlas(const std::string& fontFile, const Charset& charset, const std::optional& pngOutput) { // TODO: dynamic atlas and add only those symbols which are not present yet in current atlas @@ -62,7 +62,7 @@ namespace OpenVulkano::Scene } template - void SdfFontAtlasGenerator::GenerateAtlas(const msdfgen::byte* fontData, int length, + void SdfFontAtlasGeneratorGeneric::GenerateAtlas(const msdfgen::byte* fontData, int length, const Charset& charset, const std::optional& pngOutput) { @@ -73,7 +73,7 @@ namespace OpenVulkano::Scene } template - void SdfFontAtlasGenerator::InitFreetypeFromFile(FreetypeHandle*& ft, FontHandle*& font, + void SdfFontAtlasGeneratorGeneric::InitFreetypeFromFile(FreetypeHandle*& ft, FontHandle*& font, const std::string& fontFile) { ft = initializeFreetype(); @@ -88,7 +88,7 @@ namespace OpenVulkano::Scene } template - void SdfFontAtlasGenerator::InitFreetypeFromBuffer(FreetypeHandle*& ft, FontHandle*& font, + void SdfFontAtlasGeneratorGeneric::InitFreetypeFromBuffer(FreetypeHandle*& ft, FontHandle*& font, const msdfgen::byte* fontData, int length) { ft = initializeFreetype(); @@ -103,7 +103,7 @@ namespace OpenVulkano::Scene } template - void SdfFontAtlasGenerator::Generate(FreetypeHandle* ft, FontHandle* font, const Charset& chset, + void SdfFontAtlasGeneratorGeneric::Generate(FreetypeHandle* ft, FontHandle* font, const Charset& chset, const std::optional& pngOutput) { m_atlasData.reset(new AtlasData); @@ -200,7 +200,7 @@ namespace OpenVulkano::Scene deinitializeFreetype(ft); } - template class SdfFontAtlasGenerator<1>; - template class SdfFontAtlasGenerator<3>; + template class SdfFontAtlasGeneratorGeneric<1>; + template class SdfFontAtlasGeneratorGeneric<3>; } #endif \ No newline at end of file diff --git a/openVulkanoCpp/Scene/SdfFontAtlasGenerator.hpp b/openVulkanoCpp/Scene/SdfFontAtlasGenerator.hpp index d368a48..fdaabb3 100644 --- a/openVulkanoCpp/Scene/SdfFontAtlasGenerator.hpp +++ b/openVulkanoCpp/Scene/SdfFontAtlasGenerator.hpp @@ -30,7 +30,7 @@ namespace OpenVulkano::Scene }; template - class SdfFontAtlasGenerator final : public FontAtlasGeneratorBase + class SdfFontAtlasGeneratorGeneric final : public FontAtlasGeneratorBase { private: using SdfGenerator = msdf_atlas::ImmediateAtlasGenerator::type; using Config = SdfFontAtlasGeneratorConfig; static constexpr int channelsCount = (Channels == 1 ? 1 : 4); - SdfFontAtlasGenerator(); + SdfFontAtlasGeneratorGeneric(); void GenerateAtlas(const std::string& fontFile, const std::set& charset, const std::optional& pngOutput = std::nullopt) override; void GenerateAtlas(const Array& fontData, const std::set& charset, @@ -62,7 +62,7 @@ namespace OpenVulkano::Scene private: Config m_config; }; - using SdfFontAtlasGeneratorT = SdfFontAtlasGenerator<1>; - using MsdfFontAtlasGenerator = SdfFontAtlasGenerator<3>; + using SdfFontAtlasGenerator = SdfFontAtlasGeneratorGeneric<1>; + using MsdfFontAtlasGenerator = SdfFontAtlasGeneratorGeneric<3>; } #endif