implement multiline text rendering

This commit is contained in:
ohyzha
2024-08-06 10:22:07 +03:00
parent afccf5dee0
commit cb409268a8
7 changed files with 49 additions and 25 deletions

View File

@@ -48,8 +48,8 @@ namespace OpenVulkano::Scene
{
public:
static Shader& GetDefaultShader();
static std::map<uint32_t, GlyphInfo> ReadAtlasMetadataFile(const std::string& atlasMetadataFile);
static std::map<uint32_t, GlyphInfo> ReadAtlasMetadata(const Array<char>& atlasMetadata);
TextDrawable(const std::string& atlasMetadataFile, Texture* atlasTex, const TextConfig& config = TextConfig());
TextDrawable(const Array<char>& atlasMetadata, Texture* atlasTex, const TextConfig& config = TextConfig());
TextDrawable(const std::map<uint32_t, GlyphInfo>& glyphData, Texture* atlasTex, const TextConfig& config = TextConfig());
#ifdef MSDFGEN_AVAILABLE
TextDrawable(FontAtlasGenerator* fontAtlasGenerator, const TextConfig& config = TextConfig());
@@ -62,7 +62,7 @@ namespace OpenVulkano::Scene
#ifdef MSDFGEN_AVAILABLE
void SetFontAtlasGenerator(FontAtlasGenerator* fontAtlasGenerator)
{
if (!fontAtlasGenerator || fontAtlasGenerator->GetAtlasInfo().empty())
if (!fontAtlasGenerator || fontAtlasGenerator->GetGlyphsInfo().empty())
{
Logger::RENDER->error("FontAtlasGenerator is either nullptr or doesn't contain glyphs info");
return;
@@ -76,6 +76,7 @@ namespace OpenVulkano::Scene
Material m_material;
UniformBuffer m_uniBuffer;
std::map<uint32_t, GlyphInfo> m_glyphs;
AtlasMetadata m_meta;
#ifdef MSDFGEN_AVAILABLE
FontAtlasGenerator* m_fontAtlasGenerator = nullptr;
#endif