/* * 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 "UpdateFrequency.hpp" #include "Base/ICloseable.hpp" #include "Math/Math.hpp" #include "DataFormat.hpp" #include "SimpleDrawable.hpp" namespace OpenVulkano::Scene { //using namespace msdfgen; //using namespace msdf_atlas; struct TextConfig { Math::Vector4f textColor = { 1, 1, 1, 0 }; // vec4 to match paddding (multiple of 16) Math::Vector3f borderColor = { 1, 0, 0 }; int outputSize = 256; float threshold = 0.5f; float borderSize = 0.2f; float smoothing = 1.f/16.f; bool applyBorder = false; //bool sdfMultiChannel = false; }; class Text : public SimpleDrawable { public: Text(const TextConfig& cfg) : m_cfg(cfg) {} void Init(const std::string_view fontFile, char8_t symbol, const std::string_view outputFile); void Init(const std::string_view fontFile, std::vector symbols, const std::string_view outputFile); void setConfig(const TextConfig& cfg) { m_cfg = cfg; } TextConfig& GetConfig() { return m_cfg; } private: TextConfig m_cfg; }; }