class

FDebrisPool

The per-scene debris budget. Every shard a break spawns is entered here; when the count would pass the budget the OLDEST shard is recycled first, and no shard outlives the lifetime cap whatever its component asked for. Without this a cascade in a room full of crates spawned bodies until the physics step could not keep its budget, and "keep forever" pieces (a lifetime of 0) never left at all.

Module
Destruction
Header
#include "Destruction/DebrisPool.h"
Namespace
Mowo

Type aliases

AliasDescription
using DestroyFn = std::function<void(EntityID)>

Public functions

ReturnsNameDescription
int32_tMaxCountphys.Debris.MaxCount / phys.Debris.MaxLifetime.
floatMaxLifetime
int32_tMaxSpawnPerFramephys.Debris.MaxSpawnPerFrame: shards one update may create across every break.
voidSetSpawnCapOverride
int32_tEffectiveMaxSpawnPerFrame
boolTryReserveSpawn
voidSetBudgetOverrideA test (or a scene that knows better) can pin the budget without touching the cvars; negative restores the cvar.
int32_tEffectiveMaxCount
floatEffectiveMaxLifetime
floatClampLifetime0 means "keep" on the component; under a budget that becomes the cap.
size_tAddEnters a shard, evicting the oldest through destroy when the budget is already full.
voidTick
voidForgetThe entity went away some other way (its own cascade break, a scene unload) — drop it without destroying anything.
boolContains
size_tCount
voidClear

Function details

MaxCount

C++
static int32_t MaxCount()

phys.Debris.MaxCount / phys.Debris.MaxLifetime.

MaxLifetime

C++
static float MaxLifetime()

MaxSpawnPerFrame

C++
static int32_t MaxSpawnPerFrame()

phys.Debris.MaxSpawnPerFrame: shards one update may create across every break. A break past it spawns fewer pieces rather than a hitch; the count restarts at each Tick.

SetSpawnCapOverride

C++
void SetSpawnCapOverride(int32_t maxSpawn)

EffectiveMaxSpawnPerFrame

C++
int32_t EffectiveMaxSpawnPerFrame() const

TryReserveSpawn

C++
bool TryReserveSpawn()

SetBudgetOverride

C++
void SetBudgetOverride(int32_t maxCount, float maxLifetime)

A test (or a scene that knows better) can pin the budget without touching the cvars; negative restores the cvar.

EffectiveMaxCount

C++
int32_t EffectiveMaxCount() const

EffectiveMaxLifetime

C++
float EffectiveMaxLifetime() const

ClampLifetime

C++
float ClampLifetime(float requested) const

0 means "keep" on the component; under a budget that becomes the cap.

Add

C++
size_t Add(EntityID entity, float lifetime, const DestroyFn& destroy)

Enters a shard, evicting the oldest through destroy when the budget is already full. Returns how many were evicted.

Tick

C++
void Tick(float deltaTime, const DestroyFn& destroy)

Forget

C++
void Forget(EntityID entity)

The entity went away some other way (its own cascade break, a scene unload) — drop it without destroying anything.

Contains

C++
bool Contains(EntityID entity) const

Count

C++
size_t Count() const

Clear

C++
void Clear()
Generated from Destruction/DebrisPool.h via destruction.json · Oct 26, 2026Version 1.0.0