From 994ae12b80d5cb1e51305bcec77217c2992e00f7 Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 4 Jan 2025 11:42:09 +0100 Subject: [PATCH] Remove branching --- openVulkanoCpp/Scene/TextDrawable.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/openVulkanoCpp/Scene/TextDrawable.cpp b/openVulkanoCpp/Scene/TextDrawable.cpp index bb6fd43..5c8446e 100644 --- a/openVulkanoCpp/Scene/TextDrawable.cpp +++ b/openVulkanoCpp/Scene/TextDrawable.cpp @@ -145,7 +145,6 @@ namespace OpenVulkano::Scene m_geometry.Init(len * 4, len * 6); AtlasMetadata* meta; std::map* symbols; - m_material.texture = &m_atlasData->texture; symbols = &m_atlasData->glyphs; meta = &m_atlasData->meta; @@ -156,7 +155,6 @@ namespace OpenVulkano::Scene double posY = pos.y; int i = 0; Math::Vector3f bmin(pos), bmax(pos); - bool firstGlyph = true; while (begin != end) { uint32_t c = utf8::next(begin, end); @@ -204,16 +202,13 @@ namespace OpenVulkano::Scene // TODO: change to lower value(or ideally remove completely) to avoid overlapping and make less space between symbols // when setting for depth comparison operator will be available( <= ) cursorX += info.advance + 0.08; - if (firstGlyph) - { - bmin.x = m_geometry.vertices[vIdx].position.x; - firstGlyph = false; - } + bmax.x = std::max(bmax.x, m_geometry.vertices[vIdx + 1].position.x); bmax.y = std::max(bmax.y, m_geometry.vertices[vIdx + 2].position.y); bmin.y = std::min(bmin.y, m_geometry.vertices[vIdx + 1].position.y); ++i; } + bmin.x = m_geometry.vertices[0].position.x; m_bbox.Init(bmin, bmax); if (!GetShader())