Use AABB grow instead of custom function

This commit is contained in:
Georg Hagen
2025-01-04 00:53:08 +01:00
parent 61fa1546a0
commit 0e21159888
2 changed files with 1 additions and 19 deletions

View File

@@ -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);

View File

@@ -66,7 +66,6 @@ namespace OpenVulkano::Scene
std::optional<RayHit> Intersect(const Ray& ray) const override;
private:
void RecalculateBbox(const Math::AABB& other);
void SetupShaders();
void SetupBuffers();