Add Particles support for Large Worlds

This commit is contained in:
Wojtek Figat
2022-07-03 18:09:04 +02:00
parent 039bf8253a
commit cb92e3c54c
6 changed files with 18 additions and 25 deletions

View File

@@ -14,8 +14,8 @@ ParticleEffect::ParticleEffect(const SpawnParams& params)
, _lastUpdateFrame(0)
, _lastMinDstSqr(MAX_Real)
{
_world = Matrix::Identity;
UpdateBounds();
_box = BoundingBox(_transform.Translation);
BoundingSphere::FromBox(_box, _sphere);
ParticleSystem.Changed.Bind<ParticleEffect, &ParticleEffect::OnParticleSystemModified>(this);
ParticleSystem.Loaded.Bind<ParticleEffect, &ParticleEffect::OnParticleSystemLoaded>(this);
@@ -295,7 +295,7 @@ void ParticleEffect::UpdateBounds()
if (emitter->SimulationSpace == ParticlesSimulationSpace::Local)
{
BoundingBox::Transform(emitterBounds, _world, emitterBounds);
BoundingBox::Transform(emitterBounds, _transform, emitterBounds);
}
BoundingBox::Merge(emitterBounds, bounds, bounds);
@@ -737,6 +737,5 @@ void ParticleEffect::OnTransformChanged()
// Base
Actor::OnTransformChanged();
_transform.GetWorld(_world);
UpdateBounds();
}