/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #pragma once #include "Math/Math.hpp" #include "Image/Image.hpp" #include "Scene/Texture.hpp" #include #include namespace OpenVulkano::Scene { struct GlyphInfo { //GlyphGeometry geometry; //GlyphBox glyphBox; Math::Vector3f_SIMD xyz[4] = {}; Math::Vector2f_SIMD uv[4] = {}; double advance = 0; }; class FontAtlasType { public: enum Type : int16_t { SDF = 0, MSDF, UNKNOWN }; static constexpr std::string_view DEFAULT_FG_SHADERS[] = { "Shader/text", "Shader/msdfText" }; public: FontAtlasType(Type type) : m_type(type) {} Type GetType() const { return m_type; } const std::string_view& GetDefaultFragmentShader() const { return DEFAULT_FG_SHADERS[static_cast(m_type)]; } private: Type m_type; }; struct AtlasMetadata { // vertical difference between baselines double lineHeight = 0; int16_t atlasType = FontAtlasType::UNKNOWN; }; struct AtlasData { std::map glyphs; AtlasMetadata meta; std::unique_ptr img; Texture texture; }; }