diff --git a/openVulkanoCpp/Scene/FontAtlasGeneratorBase.hpp b/openVulkanoCpp/Scene/FontAtlasGeneratorBase.hpp index 5561309..0c4ff78 100644 --- a/openVulkanoCpp/Scene/FontAtlasGeneratorBase.hpp +++ b/openVulkanoCpp/Scene/FontAtlasGeneratorBase.hpp @@ -7,30 +7,31 @@ #pragma once #include "IFontAtlasGenerator.hpp" +#include "AtlasData.hpp" #include "Math/AABB.hpp" #include "Extensions/FreetypeHelper.hpp" #include -#include namespace OpenVulkano::Scene { class FontAtlasGeneratorBase : public IFontAtlasGenerator { + protected: + int m_channelsCount; + std::shared_ptr m_atlasData; + public: - FontAtlasGeneratorBase(int channelsCount) : m_channelsCount(channelsCount) {} + FontAtlasGeneratorBase(const int channelsCount) : m_channelsCount(channelsCount) {} void SaveAtlasMetadataInfo(const std::string& outputFile, bool packIntoSingleFile = true) const override; - std::shared_ptr GetAtlasData() const { return m_atlasData; } - int GetAtlasChannelsCount() const { return m_channelsCount; } - static std::set LoadAllGlyphs(const std::variant>& data); + [[nodiscard]] const std::shared_ptr& GetAtlasData() const override { return m_atlasData; } + [[nodiscard]] int GetAtlasChannelsCount() const { return m_channelsCount; } + [[nodiscard]] static std::set LoadAllGlyphs(const std::variant>& data); protected: void SavePng(std::string output) const; void SetupAtlasData(Math::Vector2ui textureResolution, double lineHeight, FontAtlasType::Type atlasType); void SetGlyphData(GlyphInfo& info, Math::Vector2d bearing, Math::Vector2d size, const Math::AABB& aabb, double advance); - static std::string GetFreetypeErrorDescription(FT_Error error); - static std::pair InitFreetype(const std::variant>& source); - protected: - int m_channelsCount; - std::shared_ptr m_atlasData; + [[nodiscard]] static std::string GetFreetypeErrorDescription(FT_Error error); + [[nodiscard]] static std::pair InitFreetype(const std::variant>& source); }; } \ No newline at end of file diff --git a/openVulkanoCpp/Scene/IFontAtlasGenerator.hpp b/openVulkanoCpp/Scene/IFontAtlasGenerator.hpp index cdb4094..979f723 100644 --- a/openVulkanoCpp/Scene/IFontAtlasGenerator.hpp +++ b/openVulkanoCpp/Scene/IFontAtlasGenerator.hpp @@ -6,24 +6,25 @@ #pragma once -#include "Scene/AtlasData.hpp" +#include #include #include -#include -#include #include #include namespace OpenVulkano::Scene { + struct AtlasData; + class IFontAtlasGenerator { public: + virtual ~IFontAtlasGenerator() = default; virtual void GenerateAtlas(const std::string& fontFile, const std::set& charset, const std::optional& pngOutput = std::nullopt) = 0; virtual void GenerateAtlas(const Array& fontData, const std::set& charset, const std::optional& pngOutput = std::nullopt) = 0; virtual void SaveAtlasMetadataInfo(const std::string& outputFile, bool packIntoSingleFile = true) const = 0; - virtual std::shared_ptr GetAtlasData() const = 0; + virtual const std::shared_ptr& GetAtlasData() const = 0; }; } diff --git a/openVulkanoCpp/Scene/Prefabs/LabelDrawable.hpp b/openVulkanoCpp/Scene/Prefabs/LabelDrawable.hpp index 8bc64bc..3f898bc 100644 --- a/openVulkanoCpp/Scene/Prefabs/LabelDrawable.hpp +++ b/openVulkanoCpp/Scene/Prefabs/LabelDrawable.hpp @@ -7,7 +7,6 @@ #pragma once #include "Scene/Drawable.hpp" -#include "Scene/Texture.hpp" #include "Scene/UniformBuffer.hpp" #include "Scene/BillboardControlBlock.hpp" #include "Math/AABB.hpp" diff --git a/openVulkanoCpp/Shader/text.vert b/openVulkanoCpp/Shader/text.vert index 7d0f209..bc4012c 100644 --- a/openVulkanoCpp/Shader/text.vert +++ b/openVulkanoCpp/Shader/text.vert @@ -20,7 +20,7 @@ layout(set = 1, binding = 0) uniform CameraData } cam; void main() { - gl_Position = cam.viewProjection * node.world * vec4(position[gl_VertexIndex], 1.0, 1.0); + gl_Position = cam.viewProjection * node.world * vec4(position[gl_VertexIndex], 0.0, 1.0); fragTextureCoordinates = textureCoordinates[gl_VertexIndex]; outColor = color; outBgColor = bgColor; diff --git a/openVulkanoCpp/Shader/textBillboard.vert b/openVulkanoCpp/Shader/textBillboard.vert index 0326fce..3bdbfa5 100644 --- a/openVulkanoCpp/Shader/textBillboard.vert +++ b/openVulkanoCpp/Shader/textBillboard.vert @@ -53,7 +53,7 @@ void main() } else { - vec4 billboardPos = vec4(0.5, 0.5, 0.5, 1); + vec4 billboardPos = vec4(0.5, 0.5, 0, 1); vec4 viewPos = cam.view * node.world * billboardPos; float dist = -viewPos.z; gl_Position = cam.projection * (viewPos + vec4(pos.xy * dist * 0.2, 0, 0));