Skip to content

Class: EffectBatchPlanner<T> ​

Defined in: packages/ssplayer-core/dist/index.d.ts:5643

Gathers a DrawBatchKind.Effect batch's particle commands in draw order and says where the mergeable runs are (dynamic batching).

Particle geometry is simulated in the WASM runtime and returned as an EffectDrawPlan per effect part, one command per (cell-map, blend) emitter group. Which commands there are, which of them draw, and which neighbours may be merged into one draw call is the same question whichever renderer asks it — only where the vertices are written and how the draw is issued differ. The per-vertex math is already shared, in GeometryBuilder.buildEffectCommand.

Only consecutive commands merge, so draw order — and with it blend compositing — comes out exactly as the runtime laid it down. The Brain gives every effect part a batch of its own, so a renderer gathers the effect batches that follow one another into one list (collect with append), and commands merge across parts too.

Allocation-free in steady state: items is a pooled array reused across frames, valid until the next collect that does not append.

Type Parameters ​

T ​

T extends InternalPlayerBase<T>

Constructors ​

Constructor ​

new EffectBatchPlanner<T>(): EffectBatchPlanner<T>

Returns ​

EffectBatchPlanner<T>

Properties ​

count ​

count: number

Defined in: packages/ssplayer-core/dist/index.d.ts:5647

How many entries collect filled.


items ​

readonly items: EffectDrawItem[]

Defined in: packages/ssplayer-core/dist/index.d.ts:5645

The gathered commands. Only the first count entries are live.

Methods ​

collect() ​

collect(player, frameData, drawOrder, startRank, count, append?): number

Defined in: packages/ssplayer-core/dist/index.d.ts:5657

Gather every drawable particle command of the batch at startRank, in draw order. Skips a fully transparent effect part and one whose slot is not playing (getEffectDrawPlan returns null), and drops empty commands. With append, the commands go after the ones already gathered instead of replacing them. Returns count.

Parameters ​

player ​

T

frameData ​

FrameData

drawOrder ​

Uint16Array

startRank ​

number

count ​

number

append? ​

boolean

Returns ​

number


quadsIn() ​

quadsIn(g, h): number

Defined in: packages/ssplayer-core/dist/index.d.ts:5664

Total quads over [g, h), which sizes the run's vertex and index buffers.

Parameters ​

g ​

number

h ​

number

Returns ​

number


runEnd() ​

runEnd(g): number

Defined in: packages/ssplayer-core/dist/index.d.ts:5662

End (exclusive) of the run of commands starting at g that share its cell-map and blend — the span one draw call can cover.

Parameters ​

g ​

number

Returns ​

number