diff --git a/openVulkanoCpp/Scene/Prefabs/LabelDrawable.cpp b/openVulkanoCpp/Scene/Prefabs/LabelDrawable.cpp index 794ea73..8e3b806 100644 --- a/openVulkanoCpp/Scene/Prefabs/LabelDrawable.cpp +++ b/openVulkanoCpp/Scene/Prefabs/LabelDrawable.cpp @@ -105,9 +105,9 @@ namespace OpenVulkano::Scene Math::Vector2f padding = m_settings.padding * 2; if (m_settings.hasArrow) padding.y += m_settings.arrowLength; - m_labelData.textSize = Math::Vector2f(m_bbox.GetSize()) + padding * 2; - m_labelData.bboxCenter = { m_bbox.GetCenter() }; - if (m_settings.hasArrow) m_labelData.bboxCenter.y -= m_settings.arrowLength; + m_labelData.textSize = m_bbox.GetSize() + padding; + m_labelData.bboxCenter = m_bbox.GetCenter(); + if (m_settings.hasArrow) m_labelData.bboxCenter.y -= m_settings.arrowLength * 0.5f; } std::optional LabelDrawable::Intersect(const Ray& ray) const diff --git a/openVulkanoCpp/Scene/TextDrawable.cpp b/openVulkanoCpp/Scene/TextDrawable.cpp index 5971385..ae5e2c1 100644 --- a/openVulkanoCpp/Scene/TextDrawable.cpp +++ b/openVulkanoCpp/Scene/TextDrawable.cpp @@ -9,9 +9,7 @@ #include "Shader/Shader.hpp" #include "Scene/IFontAtlasGenerator.hpp" #include "Base/Logger.hpp" -#include "Image/ImageLoader.hpp" #include "DataFormat.hpp" -#include #include namespace OpenVulkano::Scene @@ -97,7 +95,7 @@ namespace OpenVulkano::Scene double cursorX = pos.x; const double lineHeight = m_atlasData->GetLineHeight(); double posY = pos.y; - Math::Vector3f bmin(pos, 0), bmax(pos, 0); + Math::Vector2f bmin(pos), bmax(pos); for (auto begin = text.begin(), end = text.end(); begin != end;) { uint32_t c = utf8::next(begin, end); @@ -131,13 +129,13 @@ namespace OpenVulkano::Scene // when setting for depth comparison operator will be available( <= ) cursorX += info.advance + 0.08; + if (!m_symbolCount) bmin.x = vertices->position[0].x; bmax.x = std::max(bmax.x, vertices->position[1].x); bmax.y = std::max(bmax.y, vertices->position[2].y); bmin.y = std::min(bmin.y, vertices->position[1].y); vertices++; m_symbolCount++; } - bmin.x = vertices->position[0].x; m_bbox.Init(bmin, bmax); if (!GetShader()) SetShader(GetDefaultShader(m_atlasData->GetAtlasType()));