Refactor OrientedBoundingBox to use Transform for transformation instead of Matrix (for large worlds)

This commit is contained in:
Wojtek Figat
2022-06-16 10:51:59 +02:00
parent 995e5bc6ff
commit 9ba117cde3
16 changed files with 168 additions and 780 deletions

View File

@@ -15,7 +15,7 @@ Decal::Decal(const SpawnParams& params)
{
_world = Matrix::Scaling(_size);
_bounds.Extents = Vector3::Half;
_bounds.Transformation = _world;
_world.Decompose(_bounds.Transformation);
_bounds.GetBoundingBox(_box);
BoundingSphere::FromBox(_box, _sphere);
}
@@ -30,8 +30,8 @@ void Decal::SetSize(const Vector3& value)
Transform t = _transform;
t.Scale *= _size;
t.GetWorld(_world);
_bounds.Extents = Vector3::Half;
_bounds.Transformation = _world;
_bounds.Transformation = t;
_bounds.GetBoundingBox(_box);
BoundingSphere::FromBox(_box, _sphere);
}
@@ -152,7 +152,7 @@ void Decal::OnTransformChanged()
t.GetWorld(_world);
_bounds.Extents = Vector3::Half;
_bounds.Transformation = _world;
_bounds.Transformation = t;
_bounds.GetBoundingBox(_box);
BoundingSphere::FromBox(_box, _sphere);