rename main sdf class for convenient synonym names
This commit is contained in:
@@ -21,7 +21,7 @@ namespace OpenVulkano::Scene
|
||||
SdfFontAtlasGeneratorConfig SdfFontAtlasGeneratorConfig::msdfDefaultConfig = { 32, 1.0, 3 };
|
||||
|
||||
template<int Channels>
|
||||
void SdfFontAtlasGenerator<Channels>::GenerateAtlas(const std::string& fontFile, const std::set<uint32_t>& charset,
|
||||
void SdfFontAtlasGeneratorGeneric<Channels>::GenerateAtlas(const std::string& fontFile, const std::set<uint32_t>& charset,
|
||||
const std::optional<std::string>& pngOutput)
|
||||
{
|
||||
FreetypeHandle* ft;
|
||||
@@ -32,14 +32,14 @@ namespace OpenVulkano::Scene
|
||||
Generate(ft, font, s, pngOutput);
|
||||
}
|
||||
|
||||
template<int Channels> SdfFontAtlasGenerator<Channels>::SdfFontAtlasGenerator() : FontAtlasGeneratorBase(Channels)
|
||||
template<int Channels> SdfFontAtlasGeneratorGeneric<Channels>::SdfFontAtlasGeneratorGeneric() : FontAtlasGeneratorBase(Channels)
|
||||
{
|
||||
if constexpr (Channels == 1) m_config = SdfFontAtlasGeneratorConfig::sdfDefaultConfig;
|
||||
else m_config = SdfFontAtlasGeneratorConfig::msdfDefaultConfig;
|
||||
}
|
||||
|
||||
template<int Channels>
|
||||
void SdfFontAtlasGenerator<Channels>::GenerateAtlas(const Array<char>& fontData, const std::set<uint32_t>& charset,
|
||||
void SdfFontAtlasGeneratorGeneric<Channels>::GenerateAtlas(const Array<char>& fontData, const std::set<uint32_t>& charset,
|
||||
const std::optional<std::string>& pngOutput)
|
||||
{
|
||||
FreetypeHandle* ft;
|
||||
@@ -51,7 +51,7 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
|
||||
template<int Channels>
|
||||
void SdfFontAtlasGenerator<Channels>::GenerateAtlas(const std::string& fontFile, const Charset& charset,
|
||||
void SdfFontAtlasGeneratorGeneric<Channels>::GenerateAtlas(const std::string& fontFile, const Charset& charset,
|
||||
const std::optional<std::string>& 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<int Channels>
|
||||
void SdfFontAtlasGenerator<Channels>::GenerateAtlas(const msdfgen::byte* fontData, int length,
|
||||
void SdfFontAtlasGeneratorGeneric<Channels>::GenerateAtlas(const msdfgen::byte* fontData, int length,
|
||||
const Charset& charset,
|
||||
const std::optional<std::string>& pngOutput)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
|
||||
template<int Channels>
|
||||
void SdfFontAtlasGenerator<Channels>::InitFreetypeFromFile(FreetypeHandle*& ft, FontHandle*& font,
|
||||
void SdfFontAtlasGeneratorGeneric<Channels>::InitFreetypeFromFile(FreetypeHandle*& ft, FontHandle*& font,
|
||||
const std::string& fontFile)
|
||||
{
|
||||
ft = initializeFreetype();
|
||||
@@ -88,7 +88,7 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
|
||||
template<int Channels>
|
||||
void SdfFontAtlasGenerator<Channels>::InitFreetypeFromBuffer(FreetypeHandle*& ft, FontHandle*& font,
|
||||
void SdfFontAtlasGeneratorGeneric<Channels>::InitFreetypeFromBuffer(FreetypeHandle*& ft, FontHandle*& font,
|
||||
const msdfgen::byte* fontData, int length)
|
||||
{
|
||||
ft = initializeFreetype();
|
||||
@@ -103,7 +103,7 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
|
||||
template<int Channels>
|
||||
void SdfFontAtlasGenerator<Channels>::Generate(FreetypeHandle* ft, FontHandle* font, const Charset& chset,
|
||||
void SdfFontAtlasGeneratorGeneric<Channels>::Generate(FreetypeHandle* ft, FontHandle* font, const Charset& chset,
|
||||
const std::optional<std::string>& 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
|
||||
@@ -30,7 +30,7 @@ namespace OpenVulkano::Scene
|
||||
};
|
||||
|
||||
template<int Channels>
|
||||
class SdfFontAtlasGenerator final : public FontAtlasGeneratorBase
|
||||
class SdfFontAtlasGeneratorGeneric final : public FontAtlasGeneratorBase
|
||||
{
|
||||
private:
|
||||
using SdfGenerator = msdf_atlas::ImmediateAtlasGenerator<float, 1, msdf_atlas::sdfGenerator,
|
||||
@@ -41,7 +41,7 @@ namespace OpenVulkano::Scene
|
||||
using Generator = std::conditional<Channels == 1, SdfGenerator, MsdfGenerator>::type;
|
||||
using Config = SdfFontAtlasGeneratorConfig;
|
||||
static constexpr int channelsCount = (Channels == 1 ? 1 : 4);
|
||||
SdfFontAtlasGenerator();
|
||||
SdfFontAtlasGeneratorGeneric();
|
||||
void GenerateAtlas(const std::string& fontFile, const std::set<uint32_t>& charset,
|
||||
const std::optional<std::string>& pngOutput = std::nullopt) override;
|
||||
void GenerateAtlas(const Array<char>& fontData, const std::set<uint32_t>& 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
|
||||
|
||||
Reference in New Issue
Block a user