Files
OpenVulkano/openVulkanoCpp/Scene/AtlasData.hpp
2025-01-10 18:31:34 +01:00

46 lines
1003 B
C++

/*
* 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 "Base/Wrapper.hpp"
#include "Math/Math.hpp"
#include "Image/Image.hpp"
#include "Scene/Texture.hpp"
#include "Scene/Text/FontAtlasType.hpp"
#include <string_view>
#include <map>
#include <magic_enum.hpp>
namespace OpenVulkano::Scene
{
struct GlyphInfo
{
//GlyphGeometry geometry;
//GlyphBox glyphBox;
Math::Vector2f_SIMD pos[4] = {};
Math::Vector2f_SIMD uv[4] = {};
double advance = 0;
};
struct AtlasMetadata
{
// vertical difference between baselines
double lineHeight = 0;
FontAtlasType atlasType = FontAtlasType::UNKNOWN;
};
struct AtlasData
{
std::map<uint32_t, GlyphInfo> glyphs;
AtlasMetadata meta;
Unique<Image::Image> img;
Texture texture;
operator bool() const { return !glyphs.empty() && texture.textureBuffer; }
};
}