Optimize dirty shadow bounds update for particles and foliage
This commit is contained in:
@@ -909,7 +909,7 @@ void Foliage::RebuildClusters()
|
||||
_box = BoundingBox(_transform.Translation, _transform.Translation);
|
||||
_sphere = BoundingSphere(_transform.Translation, 0.0f);
|
||||
if (_sceneRenderingKey != -1)
|
||||
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey);
|
||||
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey, ISceneRenderingListener::Bounds);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@ void ParticleEffect::UpdateBounds()
|
||||
_box = bounds;
|
||||
BoundingSphere::FromBox(bounds, _sphere);
|
||||
if (_sceneRenderingKey != -1)
|
||||
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey);
|
||||
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey, ISceneRenderingListener::Bounds);
|
||||
}
|
||||
|
||||
void ParticleEffect::Sync()
|
||||
|
||||
@@ -404,8 +404,17 @@ public:
|
||||
// Dirty static objects to redraw when changed (eg. material modification)
|
||||
if (a->HasStaticFlag(StaticFlags::Shadow))
|
||||
{
|
||||
DirtyStaticBounds(prevBounds);
|
||||
DirtyStaticBounds(a->GetSphere());
|
||||
// TODO: skip actors that don't cast shadows (eg. particles)
|
||||
BoundingSphere bounds = a->GetSphere();
|
||||
if (bounds != prevBounds)
|
||||
{
|
||||
// Avoid dirtying twice when bounds are close to each other
|
||||
if (BoundingSphere::NearEqual(bounds, prevBounds, METERS_TO_UNITS_SCALE))
|
||||
BoundingSphere::Merge(bounds, prevBounds, bounds);
|
||||
else
|
||||
DirtyStaticBounds(prevBounds);
|
||||
}
|
||||
DirtyStaticBounds(bounds);
|
||||
}
|
||||
else if (flags & StaticFlags)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user