English
Class: MaskTreePlanner<T>
Defined in: packages/ssplayer-core/dist/index.d.ts:5548
One mask set for a whole instance tree. SpriteStudio 7.6 masks as if every draw of the tree went through one stencil, in one sequence: a sub-animation is drawn in its instance part's place. So each writer holds over an open interval of that sequence:
- a pure mask (
PartTypeMask/draw_as_mask), from the start of its own animation to itself — it never leaves the instance it sits in; - a clipping writer (
mask_write), from itself to the end of the tree — one written inside an instance keeps clipping the caller's later parts, at any depth.
This walks the tree depth-first, numbering every draw-order rank of every visible context (a sub-animation right after its instance part), and collects the writers of all of them. A part at sequence number s is covered by the writers whose open < s and s < close (or close < 0). How that is then drawn — a coverage bitmap in ssplayer-pixi, the stencil in ssplayer-webgl — is the renderer's.
A writer's op follows its effective mask_influence: its own AND its instance part's, one level deep, like any target (see MaskComposition).
Output is reusable SoA, valid until the next plan() call. Allocation-free in steady state; a context's sequence array is allocated the first time it is seen or grows.
Type Parameters
T
T extends InternalPlayerBase<T>
Constructors
Constructor
new MaskTreePlanner<
T>(capacity?):MaskTreePlanner<T>
Defined in: packages/ssplayer-core/dist/index.d.ts:5584
capacity is the renderer's budget for the whole tree: a coverage bitmap needs a bit per writer, a stencil only a counter deep enough for the writers overlapping at one pixel. Each context still plans at most MAX_MASK_WRITERS of its own.
Parameters
capacity?
number
Returns
MaskTreePlanner<T>
Properties
capacity
readonlycapacity:number
Defined in: packages/ssplayer-core/dist/index.d.ts:5550
Writers the tree can hold; past it they are dropped and exceeded is set.
close
readonlyclose:Float32Array
Defined in: packages/ssplayer-core/dist/index.d.ts:5558
Interval end on the tree sequence (exclusive); -1 for a clipping writer, which holds to the end of the tree. A sentinel rather than a large number so the replay's comparisons stay exact at shader precisions.
count
count:
number
Defined in: packages/ssplayer-core/dist/index.d.ts:5566
Writers found by the last plan().
exceeded
exceeded:
boolean
Defined in: packages/ssplayer-core/dist/index.d.ts:5568
True when the tree held more writers than there are bits (extras dropped).
isClipping
readonlyisClipping:Uint8Array
Defined in: packages/ssplayer-core/dist/index.d.ts:5562
1 = clipping writer, 0 = pure mask.
meta
readonlymeta:Float32Array
Defined in: packages/ssplayer-core/dist/index.d.ts:5564
Replay metadata (open, close, bit, opInvert) x capacity; bit === index.
open
readonlyopen:Float32Array
Defined in: packages/ssplayer-core/dist/index.d.ts:5552
Interval start on the tree sequence (exclusive).
opInvert
readonlyopInvert:Uint8Array
Defined in: packages/ssplayer-core/dist/index.d.ts:5560
Effective op: 1 = invert (mask_influence 1), 0 = increment.
Methods
plan()
plan(
root,frameData,matrix,visitor):number
Defined in: packages/ssplayer-core/dist/index.d.ts:5597
Number the tree under root and collect its writers. frameData is the root's frame and matrix its placement; instance children are reached through the same resolver the renderers draw them with, so exactly the sub-animations that are drawn are numbered.
Asks the runtime for each visible child's frame, which can grow WASM memory: a caller holding views into it re-derives them afterwards.
A tree with no part that can write a mask is not walked: it returns 0 and numbers nothing.
Parameters
root
T
frameData
matrix
Float32Array<ArrayBufferLike> | null
visitor
Returns
number
seqOf()
seqOf(
player):Float32Array<ArrayBufferLike> |undefined
Defined in: packages/ssplayer-core/dist/index.d.ts:5603
Sequence number of each draw-order rank of player, as numbered by the last plan() that found writers. Undefined for a player that was not part of it.
Parameters
player
T
Returns
Float32Array<ArrayBufferLike> | undefined