Math: Rework Box and Rect classes

This commit is contained in:
SirLynix
2022-12-18 14:57:14 +01:00
parent 811194bb97
commit 830eee78a8
28 changed files with 242 additions and 642 deletions

View File

@@ -89,8 +89,6 @@ namespace Nz
inline void Sprite::UpdateVertices()
{
Boxf aabb(-1.f, -1.f, -1.f);
VertexStruct_XYZ_Color_UV* vertices = m_vertices.data();
std::array<Vector2f, RectCornerCount> cornerExtent;
@@ -107,15 +105,10 @@ namespace Nz
vertices->position = Vector3f(m_size * cornerExtent[UnderlyingCast(corner)], 0.f) - originShift;
vertices->uv = m_textureCoords.GetCorner(corner);
if (aabb.IsValid())
aabb.ExtendTo(vertices->position);
else
aabb.Set(vertices->position);
vertices++;
}
UpdateAABB(aabb);
UpdateAABB(Rectf(-originShift.x, -originShift.y, m_size.x, m_size.y));
OnElementInvalidated(this);
}
}