Remove branching

This commit is contained in:
Georg Hagen
2025-01-04 11:42:09 +01:00
parent 450f1170b4
commit 994ae12b80

View File

@@ -145,7 +145,6 @@ namespace OpenVulkano::Scene
m_geometry.Init(len * 4, len * 6);
AtlasMetadata* meta;
std::map<uint32_t, GlyphInfo>* 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())