Interface CsmRefitGate<M>
isDynamic(caster: M): boolean;
markDynamic(caster: M): void;
syncCasters(casters: readonly M[]): void;
update(
lightDirX: number,
lightDirY: number,
lightDirZ: number,
nowMs: number,
cameraChanged: boolean,
force: boolean,
onPromote: (caster: M) => void,
onDemote: (caster: M) => void,
): CsmRefitDecision;
}
Type Parameters
- M extends CsmRefitCaster
Methods
is Dynamic
-
Current classification, for callers that build task membership from a carried gate.
Parameters
- caster: M
Returns boolean
mark Dynamic
-
Force a known caster into the dynamic set (bookkeeping only; the caller owns task membership). The engine's static cache no longer calls it (a re-capped caster, or one requeued for a material change, keeps its class); it is kept for external users of the gate.
Parameters
- caster: M
Returns void
sync Casters
-
Adopt a (possibly re-supplied) caster array. Identity-checked, so calling every frame is O(1) while the array is unchanged. New casters start dynamic; departed casters are forgotten; any membership change forces a refit on the next
update()(a removed static caster's shadow would otherwise linger in the cache). Reordering or re-supplying the same members does not invalidate the cache.Parameters
- casters: readonly M[]
Returns void
update
-
update(
lightDirX: number,
lightDirY: number,
lightDirZ: number,
nowMs: number,
cameraChanged: boolean,
force: boolean,
onPromote: (caster: M) => void,
onDemote: (caster: M) => void,
): CsmRefitDecisionOne walk over the synced casters: computes the static/dynamic version sums, promotes churning static casters (via
onPromote, immediately), counts quiet frames, and decides refit/overlay. Pending demotions are applied (viaonDemote) only inside a refit; they ride refits caused by something else, except that in a world with no other refit cause they may trigger one themselves once overdue by the quiet threshold (seeupdate). No allocation while nothing changes.Parameters
Returns CsmRefitDecision
Per-frame refit/partition gate for the CSM static shadow cache.