From 0e21159888cd763481cbdb40f7c8d88483a00cbc Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 4 Jan 2025 00:53:08 +0100 Subject: [PATCH] Use AABB grow instead of custom function --- .../Scene/Prefabs/LabelDrawable.cpp | 19 +------------------ .../Scene/Prefabs/LabelDrawable.hpp | 1 - 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/openVulkanoCpp/Scene/Prefabs/LabelDrawable.cpp b/openVulkanoCpp/Scene/Prefabs/LabelDrawable.cpp index 2a8c8a3..76e1c72 100644 --- a/openVulkanoCpp/Scene/Prefabs/LabelDrawable.cpp +++ b/openVulkanoCpp/Scene/Prefabs/LabelDrawable.cpp @@ -78,7 +78,7 @@ namespace OpenVulkano::Scene double lineHeight = m_atlasData->meta.lineHeight; textDrawable.GenerateText(text, m_position); - RecalculateBbox(textDrawable.GetBoundingBox()); + m_bbox.Grow(textDrawable.GetBoundingBox()); // update position for next text entry m_position.y = m_bbox.GetMin().y - lineHeight; @@ -108,23 +108,6 @@ namespace OpenVulkano::Scene return ray.IntersectAABB(m_bbox); } - void LabelDrawable::RecalculateBbox(const Math::AABB& other) - { - if (m_bbox.IsEmpty()) - { - m_bbox = other; - } - else - { - auto& currentMin = m_bbox.GetMin(); - auto& currentMax = m_bbox.GetMax(); - currentMin.x = std::min(currentMin.x, other.min.x); - currentMin.y = std::min(currentMin.y, other.min.y); - currentMax.x = std::max(currentMax.x, other.max.x); - currentMax.y = std::max(currentMax.y, other.max.y); - } - } - void LabelDrawable::SetupShaders() { SetShader(IsBillboard() ? &BACKGROUND_BILLBOARD_SHADER : &BACKGROUND_SHADER); diff --git a/openVulkanoCpp/Scene/Prefabs/LabelDrawable.hpp b/openVulkanoCpp/Scene/Prefabs/LabelDrawable.hpp index 75f225f..990e434 100644 --- a/openVulkanoCpp/Scene/Prefabs/LabelDrawable.hpp +++ b/openVulkanoCpp/Scene/Prefabs/LabelDrawable.hpp @@ -66,7 +66,6 @@ namespace OpenVulkano::Scene std::optional Intersect(const Ray& ray) const override; private: - void RecalculateBbox(const Math::AABB& other); void SetupShaders(); void SetupBuffers();