Skip to content

Class: SSRuntimeManager ​

Defined in: src/SSRuntimeManager.ts:226

Constructors ​

Constructor ​

new SSRuntimeManager(): SSRuntimeManager

Defined in: src/SSRuntimeManager.ts:290

Returns ​

SSRuntimeManager

Properties ​

context ​

context: SSRuntimeContext

Defined in: src/SSRuntimeManager.ts:227


onFrameData ​

onFrameData: ((frameData) => boolean) | null = null

Defined in: src/SSRuntimeManager.ts:1114

Called with every frame getFrameData hands out, before it is handed out: the player builds the draw plans of the effect parts that frame draws. Returns whether it built any, which can grow WASM memory.

Methods ​

bindResource() ​

bindResource(resource): void

Defined in: src/SSRuntimeManager.ts:298

Parameters ​

resource ​

SSABResource

Returns ​

void


capturePassedEvents() ​

capturePassedEvents(): readonly SSPassedEvent[]

Defined in: src/SSRuntimeManager.ts:460

The events the last update reported. Take them before any listener runs: setting up an animation clears them in the runtime, and its source handles then name the new animation.

Each one remembers the animation whose source fired it, not the one set up: once a crossfade on track 0 hands the track to another animation, or an overlay is let fire, the index belongs to that animation's table, and reading it from the set-up one reports a different event or none.

Returns ​

readonly SSPassedEvent[]


crossfade() ​

crossfade(track, animationName, durationMs): void

Defined in: src/SSRuntimeManager.ts:425

Fade track to animationName over durationMs. On track 0 the incoming animation becomes the main one from this call on, so the per-animation reads (getCurrentAnimationData, prepareFrame's guard) follow it here rather than when the fade completes.

Nothing else setupAnimation caches needs redoing: the parts table, and with it the mask flags and the effect parts, belongs to the pack.

Parameters ​

track ​

number

animationName ​

string

durationMs ​

number

Returns ​

void


destroy() ​

destroy(): void

Defined in: src/SSRuntimeManager.ts:1160

Returns ​

void


getAnimationDataByName() ​

getAnimationDataByName(animationName, out?): AnimationData | null

Defined in: src/SSRuntimeManager.ts:580

SSAB AnimationData for the animation named animationName in the bound pack, set up or not, re-derived from the borrowed buffer like getCurrentAnimationData. null before a resource is bound or for a name the pack does not have.

Parameters ​

animationName ​

string

out? ​

AnimationData

Returns ​

AnimationData | null


getCellmapNames() ​

getCellmapNames(): string[]

Defined in: src/SSRuntimeManager.ts:610

Cell-map names in the bound SSAB (table order, no .ssce extension) — the cell-override target namespace. Empty before a resource is bound.

Returns ​

string[]


getCellNames() ​

getCellNames(cellmapName): string[]

Defined in: src/SSRuntimeManager.ts:624

Cell names inside cellmapName in the bound SSAB (empty if that map isn't in this SSAB). Pair with getCellmapNames to discover the valid targets of a cell override.

Parameters ​

cellmapName ​

string

Returns ​

string[]


getCurrentAnimationData() ​

getCurrentAnimationData(out?): AnimationData | null

Defined in: src/SSRuntimeManager.ts:564

SSAB AnimationData for the currently set-up animation, re-derived from the (borrowed) SSAB buffer on each call so the view stays valid across WASM memory growth. null before setup or if the name didn't resolve. Event polling reads its per-frame events table via events(eventIndex). Pass out to reuse a scratch object and avoid allocation.

Parameters ​

out? ​

AnimationData

Returns ​

AnimationData | null


getEffectParts() ​

getEffectParts(): object[]

Defined in: src/SSRuntimeManager.ts:491

Returns ​

object[]


getEventsOf() ​

getEventsOf(event): EventsPerFrame | null

Defined in: src/SSRuntimeManager.ts:481

The per-frame events entry a captured event names, or null once a listener has bound another pack or destroyed the player. Read it before calling the next listener and ask again after: a listener can grow WASM memory, which detaches this view.

Parameters ​

event ​

SSPassedEvent

Returns ​

EventsPerFrame | null


getFrameData() ​

getFrameData(frame): FrameData | null

Defined in: src/SSRuntimeManager.ts:1121

The runtime's frame data for frame, as a zero-copy FlatBuffer view over WASM memory. The returned object is a per-manager scratch re-pointed on every call: don't retain it, and don't hold two at once.

Parameters ​

frame ​

number

Returns ​

FrameData | null


getInstanceParts() ​

getInstanceParts(): object[]

Defined in: src/SSRuntimeManager.ts:495

Returns ​

object[]


getLastFrameData() ​

getLastFrameData(): FrameData | null

Defined in: src/SSRuntimeManager.ts:1148

The frame data the last evaluation built (prepareFrame, which every draw and InternalPlayerBase.evaluateDrawFrame go through), read without evaluating anything. Null before the first evaluation. A view over WASM memory with a scratch of its own: don't retain it.

Returns ​

FrameData | null


getLocalUVs() ​

getLocalUVs(): Float32Array

Defined in: src/SSRuntimeManager.ts:725

Returns ​

Float32Array


getLocalVertices() ​

getLocalVertices(): Float32Array

Defined in: src/SSRuntimeManager.ts:721

Returns ​

Float32Array


getMeshIndexOffsets() ​

getMeshIndexOffsets(): Int32Array

Defined in: src/SSRuntimeManager.ts:749

Returns ​

Int32Array


getMeshIndices() ​

getMeshIndices(): Int32Array

Defined in: src/SSRuntimeManager.ts:741

Returns ​

Int32Array


getMeshUVs() ​

getMeshUVs(): Float32Array

Defined in: src/SSRuntimeManager.ts:737

Returns ​

Float32Array


getMeshVertexOffsets() ​

getMeshVertexOffsets(): Uint32Array

Defined in: src/SSRuntimeManager.ts:745

Returns ​

Uint32Array


getMeshVerticesX() ​

getMeshVerticesX(): Float32Array

Defined in: src/SSRuntimeManager.ts:729

Returns ​

Float32Array


getMeshVerticesY() ​

getMeshVerticesY(): Float32Array

Defined in: src/SSRuntimeManager.ts:733

Returns ​

Float32Array


getPartIndexFromName() ​

getPartIndexFromName(partName): number

Defined in: src/SSRuntimeManager.ts:667

Retrieves the index of a part based on its name.

Parameters ​

partName ​

string

Returns ​

number


getPartMaskFlags() ​

getPartMaskFlags(): Uint8Array<ArrayBufferLike> | null

Defined in: src/SSRuntimeManager.ts:545

Static per-part mask flags for the current animation (one byte per part index, parallel to the SSAB parts table), or null before setup. Bits: 0x01 visibleInsideMask, 0x02 maskWrite, 0x04 maskInfluence, 0x08 drawAsMask. The renderer reads visibleInsideMask to decide a masked part's clip polarity (show inside vs. outside the mask region); the runtime already encodes per-part mask participation in the draw batches (DrawBatchKind.Mask for contributors, flags & 0x01 for masked content), so this is only needed for the polarity bit.

Returns ​

Uint8Array<ArrayBufferLike> | null


getPartName() ​

getPartName(partIndex): string | null

Defined in: src/SSRuntimeManager.ts:659

Cached name of the part at partIndex (SSAB parts-table order), or null if out of range / before an animation is set up.

Parameters ​

partIndex ​

number

Returns ​

string | null


getPartNames() ​

getPartNames(): string[]

Defined in: src/SSRuntimeManager.ts:680

Part names in part-index order, empty before an animation is set up.

A part authored without a name reads as the empty string rather than being skipped, so the list stays index-aligned with the parts table and with the partIndex every event carries.

Returns ​

string[]


getPartsCount() ​

getPartsCount(): number

Defined in: src/SSRuntimeManager.ts:688

Returns the total number of parts in the current animation.

Returns ​

number


getPartSkinnedFlag() ​

getPartSkinnedFlag(index): boolean

Defined in: src/SSRuntimeManager.ts:697

Whether the part at index is a skinned (bone-bound) mesh, from the per-animation cache. Out-of-range or before setup reads as false. See InternalPlayerBase.isPartSkinnedMesh for the contract.

Parameters ​

index ​

number

Returns ​

boolean


getReplaceableTextureNames() ​

getReplaceableTextureNames(): string[]

Defined in: src/SSRuntimeManager.ts:646

Names that InternalPlayerBase.setCellmapTexture can replace at runtime, in table order: every cell-map name (no .ssce extension, e.g. common) followed by every external-texture file name (e.g. common.png). Both are valid replacement targets because DrawBatch.texture_hash is keyed from both namespaces — a cell-map's own name normally, and the texture file name on frames a TextureChange (TCHG) applies. Empty before a resource is bound.

Unlike getCellmapNames (cell-override targets — cell-map names only), this is the texture-replacement discovery list; the two differ whenever the SSAB carries any TCHG targets.

Returns ​

string[]


getShapeVertexBoxCoords() ​

getShapeVertexBoxCoords(): Float32Array

Defined in: src/SSRuntimeManager.ts:757

Returns ​

Float32Array


getShapeVertexCounts() ​

getShapeVertexCounts(): Int32Array

Defined in: src/SSRuntimeManager.ts:753

Returns ​

Int32Array


getShapeVertices() ​

getShapeVertices(): Float32Array

Defined in: src/SSRuntimeManager.ts:761

Returns ​

Float32Array


getSounds() ​

getSounds(): SoundAsset[]

Defined in: src/SSRuntimeManager.ts:597

Get all referenced sound assets (name and path) for the currently loaded SSAB.

Returns ​

SoundAsset[]


getWorldMatrices() ​

getWorldMatrices(): Float32Array

Defined in: src/SSRuntimeManager.ts:717

Returns ​

Float32Array


getWorldMatrix2D() ​

getWorldMatrix2D(partIndex, out?): Float32Array

Defined in: src/SSRuntimeManager.ts:709

Extract the 2D affine of a part's world matrix as [m00, m01, m10, m11, tx, ty] (copied out of WASM memory, so safe to retain). Used to place an instance-part child under its parent. Pass out to avoid allocation.

Parameters ​

partIndex ​

number

out? ​

Float32Array<ArrayBufferLike>

Returns ​

Float32Array


hasMaskWriterParts() ​

hasMaskWriterParts(): boolean

Defined in: src/SSRuntimeManager.ts:553

Whether any part of the bound pack can write a mask: mask_write, draw_as_mask or a mask part. False until an animation is set up.

Returns ​

boolean


invalidateFrame() ​

invalidateFrame(): void

Defined in: src/SSRuntimeManager.ts:1105

Have the next prepareFrame evaluate even the frame it evaluated last. For a change made to the runtime other than through context, which notes its own writes.

Returns ​

void


prepareFrame() ​

prepareFrame(frame): number

Defined in: src/SSRuntimeManager.ts:1075

Evaluates frame: builds its frame data and leaves the per-part buffers (world matrices and the rest) on it. Returns the frame data's byte length, or 0 before an animation is set up or when the runtime rejects the frame. Allocates nothing — getFrameData is this plus a view over the bytes, and the effect draw plans of the parts the frame draws.

Parameters ​

frame ​

number

Returns ​

number


setCoordinateSystem() ​

setCoordinateSystem(system): void

Defined in: src/SSRuntimeManager.ts:1064

Parameters ​

system ​

WebCoordinateSystem

Returns ​

void


setTrackAnimation() ​

setTrackAnimation(track, animationName): void

Defined in: src/SSRuntimeManager.ts:431

Put animationName on track. On track 0 it becomes the main animation, as in crossfade.

Parameters ​

track ​

number

animationName ​

string

Returns ​

void


setupAnimation() ​

setupAnimation(animationName): void

Defined in: src/SSRuntimeManager.ts:307

Parameters ​

animationName ​

string

Returns ​

void


update() ​

update(deltaMs): number

Defined in: src/SSRuntimeManager.ts:518

Parameters ​

deltaMs ​

number

Returns ​

number


extractAnimationNames() ​

static extractAnimationNames(ssabBuffer): string[]

Defined in: src/SSRuntimeManager.ts:919

Parse the SSAB buffer and list its animation names in table order. Engine-agnostic introspection for host UIs (e.g. an animation picker), so consumers don't have to re-implement the FlatBuffer walk.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

string[]


extractCellMapNames() ​

static extractCellMapNames(ssabBuffer): string[]

Defined in: src/SSRuntimeManager.ts:957

Parse the SSAB buffer and list its cell-map names in table order (without the .ssce extension, as the runtime stores them). These are the names a cell override takes — see extractCellNames for the cells inside one.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

string[]


extractCellNames() ​

static extractCellNames(ssabBuffer, cellmapName): string[]

Defined in: src/SSRuntimeManager.ts:1006

Parse the SSAB buffer and list the cell names in the named cell map (empty if that map isn't in this SSAB). Together with extractCellMapNames this is enough to discover every valid target of a cell override.

Parameters ​

ssabBuffer ​

Uint8Array

cellmapName ​

string

Returns ​

string[]


extractEmbeddedTextures() ​

static extractEmbeddedTextures(ssabBuffer): object[]

Defined in: src/SSRuntimeManager.ts:830

Parse the SSAB buffer and collect the textures whose raw image bytes are embedded directly in the file (the converter's --embedded mode) instead of shipping as sibling files.

Embedded assets are keyed by the FILE-name hash (fnv1a(image_path) == CellMap.imagePathHash() for a cell-map, fnv1a(name) == nameHash() for an external texture); this joins them back to both tables and returns them under the render-time keys, matching extractTexturePaths. Returns an empty array for external-file (non-embedded) SSABs.

The returned bytes are views over ssabBuffer — the caller must consume them (e.g. decode into a texture) before that buffer is detached/freed.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

object[]


extractInstancePackRefs() ​

static extractInstancePackRefs(ssabBuffer): object[]

Defined in: src/SSRuntimeManager.ts:892

Parse the SSAB buffer and collect the unique animation packs referenced by PartType::Instance parts (the referenced animation may live in an external pack that the host must load before setup).

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

object[]


extractPackInfo() ​

static extractPackInfo(ssabBuffer): object

Defined in: src/SSRuntimeManager.ts:879

Read a pack's own name and name-hash from its SSAB buffer.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

object

hash ​

hash: number

name ​

name: string | null


extractParts() ​

static extractParts(ssabBuffer): object[]

Defined in: src/SSRuntimeManager.ts:938

Parse the SSAB buffer and list its parts in table order, each with its type. The names are what the part overrides take; the type is what decides which override applies (colour: normal parts; cell: normal and mask parts), so a host UI can offer only the parts a given override can change.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

object[]


extractReplaceableTextureNames() ​

static extractReplaceableTextureNames(ssabBuffer): string[]

Defined in: src/SSRuntimeManager.ts:977

Parse the SSAB buffer and list every name a runtime texture replacement can target: cell-map names (table order, no .ssce extension) followed by external-texture file names (the TCHG targets, e.g. common.png). This is the union of the two hash namespaces extractTexturePaths loads, by name; deduplicated by string so a name appearing in both tables lists once.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

string[]


extractSounds() ​

static extractSounds(ssabBuffer): SoundAsset[]

Defined in: src/SSRuntimeManager.ts:1033

Parse the SSAB buffer and list all referenced sound assets (name and path). Useful for preloading audio files via the Web Audio API.

A sound the .ssab embeds also carries its bytes, as a view over ssabBuffer — consume or copy it before that buffer is detached or freed.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

SoundAsset[]


extractTexturePaths() ​

static extractTexturePaths(ssabBuffer): object[]

Defined in: src/SSRuntimeManager.ts:775

Parse the SSAB buffer and extract the image paths and their name hashes.

Two tables feed this, because DrawBatch.texture_hash is drawn from two namespaces: a cell-map's own name hash for an ordinary part, and a texture FILE-name hash for a part whose drawing applies a texture change (TCHG). The latter live in external_textures, so a player that reads only cellmaps leaves those batches without a texture and drops the part. Both go into one hash-keyed list, exactly as the runtime looks them up.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

object[]