API

Interface VatHandle

Runtime VAT playback handle for one mesh (the analogue of BJS BakedVertexAnimationManager + the per-mesh settings). Advance update() each frame; set the active clip with play().

interface VatHandle {
    clips: Record<string, VatClip>;
    mesh: Mesh;
    play(clip: string, opts?: { fps?: number; offset?: number }): void;
    setInstances(params: Float32Array): void;
    setInstancesBlend(params: Float32Array): void;
    update(dtSeconds: number): void;
}
Index
clips: Record<string, VatClip>

Baked clip row map.

mesh: Mesh

The mesh this drives (its mesh.vat is set).

  • Select the clip to play (by name) or set explicit playback params.

    Parameters

    • clip: string
    • Optionalopts: { fps?: number; offset?: number }

    Returns void

  • Enable/refresh PER-INSTANCE VAT: upload one vec4 (fromRow, toRow, timeOffset, fps) per thin-instance, so every instance plays its own clip + phase from the one shared baked texture (all instances in a single draw call). params.length must be 4 * instanceCount. Call this BEFORE registerScene the first time — it sets mesh.vat.instanceTexture; a VAT mesh that is thin-instanced then takes the per-instance vertex path. Later calls re-upload in place. Use clips to look up each clip's fromRow/toRow/fps when building params. (Internally expanded to the dual-clip layout, blend 0.)

    Parameters

    • params: Float32Array

    Returns void

  • PER-INSTANCE DUAL-CLIP VAT: like setInstances, but each instance carries TWO clips that are blended, so gait cross-fades stay smooth. params.length must be 8 * instanceCount — two vec4s per instance: A = (fromRowA, toRowA, timeOffset, fpsA), B = (fromRowB, toRowB, blendWeight, fpsB), where blendWeight in [0,1] lerps A→B and B reuses A's timeOffset. Same per-instance VAT path as setInstances.

    Parameters

    • params: Float32Array

    Returns void