Skip to content

Class: InstanceResolver<T> ​

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

Resolves one instance part of a DrawBatchKind.Instance batch into everything a renderer needs before it recurses into the sub-animation.

This lives here rather than in each renderer for the reason MaskComposition does: WHETHER an instance part contributes, WHERE its sub-animation lands, WHICH frame it is at and WHAT mask context it inherits do not depend on how the sub-animation is then drawn. Only the drawing differs — ssplayer-pixi clips against a coverage bitmap and ssplayer-webgl against the GPU stencil — and that stays in the renderers.

Allocation-free in steady state: the returned record is reused across calls, so a caller that recurses (and thereby lets the sub-animation resolve its own instance parts through the same resolver) must read what it needs into locals BEFORE recursing. child and composed are per-child storage and survive; the primitives do not.

Type Parameters ​

T ​

T extends InternalPlayerBase<T>

Constructors ​

Constructor ​

new InstanceResolver<T>(): InstanceResolver<T>

Returns ​

InstanceResolver<T>

Methods ​

resolve() ​

resolve(player, frameData, drawOrder, rank, parentMatrix, parentAlpha): ResolvedInstance<T> | null

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

Resolve the instance part at rank of player's draw order, or return null when it contributes nothing this frame — the rank is not an instance part, its slot is not playing (child.visible), or the part is fully transparent.

parentMatrix places the owner context (null at the root) and parentAlpha is the opacity accumulated down the instance ancestry. The mask context handed down needs nothing from the owner: it is the instance part's own flags, one level deep (see MaskComposition).

Parameters ​

player ​

T

frameData ​

FrameData

drawOrder ​

Uint16Array

rank ​

number

parentMatrix ​

Float32Array<ArrayBufferLike> | null

parentAlpha ​

number

Returns ​

ResolvedInstance<T> | null