namespace Sandbox.Clutter;
///
/// Infinite/streaming clutter mode
///
public sealed partial class ClutterComponent
{
///
/// Returns true if in infinite streaming mode.
///
[Hide]
public bool Infinite => Mode == ClutterMode.Infinite;
///
/// Gets the current clutter settings for the grid system.
///
internal ClutterSettings GetCurrentSettings()
{
if ( Clutter == null )
return default;
return new ClutterSettings( Seed, Clutter );
}
///
/// Clears all infinite mode tiles for this component.
///
public void ClearInfinite()
{
var gridSystem = Scene.GetSystem();
gridSystem?.ClearComponent( this );
}
///
/// Invalidates the tile at the given world position, causing it to regenerate.
///
public void InvalidateTileAt( Vector3 worldPosition )
{
if ( Mode != ClutterMode.Infinite ) return;
var gridSystem = Scene.GetSystem();
gridSystem.InvalidateTileAt( this, worldPosition );
}
///
/// Invalidates all tiles within the given bounds, causing them to regenerate.
///
public void InvalidateTilesInBounds( BBox bounds )
{
if ( Mode != ClutterMode.Infinite ) return;
var gridSystem = Scene.GetSystem();
gridSystem.InvalidateTilesInBounds( this, bounds );
}
}