Move FontAtlasType into its own file
This commit is contained in:
42
openVulkanoCpp/Scene/Text/FontAtlasType.hpp
Normal file
42
openVulkanoCpp/Scene/Text/FontAtlasType.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 <magic_enum.hpp>
|
||||
|
||||
namespace OpenVulkano::Scene
|
||||
{
|
||||
class FontAtlasType
|
||||
{
|
||||
public:
|
||||
enum Type : int16_t
|
||||
{
|
||||
SDF = 0,
|
||||
MSDF,
|
||||
BITMAP,
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
static constexpr std::string_view DEFAULT_FG_SHADERS[] = { "Shader/sdfText", "Shader/msdfText", "Shader/text" };
|
||||
|
||||
constexpr FontAtlasType(Type type) : m_type(type) {}
|
||||
|
||||
[[nodiscard]] constexpr Type GetType() const { return m_type; }
|
||||
|
||||
[[nodiscard]] constexpr auto GetName() const { return magic_enum::enum_name(m_type); }
|
||||
|
||||
[[nodiscard]] constexpr const std::string_view& GetDefaultFragmentShader() const
|
||||
{
|
||||
return DEFAULT_FG_SHADERS[static_cast<int>(m_type)];
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr operator Type() const { return m_type; }
|
||||
|
||||
private:
|
||||
Type m_type;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user