Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

SkinnedBatch

Copies of one skinned model, drawn together. Place it in the scene once, anywhere, and add each copy, a clone with bones of its own such as SkeletonUtils.clone makes; each part then draws every shown copy at its own pose in one draw, and once more into each shadow map. While a copy is in the batch, the part’s material draws it, not its own, and its meshes’ own visible is the batch’s: hide a copy, or a part of one, by a group that holds it.

  • Group
Type Parameter Default type
Uniforms extends SkinnedBatchUniforms SkinnedBatchUniforms

new SkinnedBatch<Uniforms>(source, options?): SkinnedBatch<Uniforms>

Parameter Type
source Object3D
options SkinnedBatchOptions<Uniforms>

SkinnedBatch<Uniforms>

Group.constructor

onEmpty: (() => void) | undefined

Runs as the last copy leaves.


readonly parts: readonly SkinnedBatchPart[]

A part for each mesh of the model the batch draws.

get copyCount(): number

number

addCopy(root): SkinnedCopy<Uniforms>

Draws root’s meshes in the batch from the next draw on, in place of their own draws: root is a clone of the model the batch was made from, each skinned mesh at the same place in its tree and sharing its geometry. A mesh hidden as it is added keeps drawing itself, hidden.

Parameter Type
root Object3D

SkinnedCopy<Uniforms>


dispose(): void

Frees the draws’ textures and its own materials: the copies keep theirs, and the game keeps what dress gave.

void

Group.dispose


findPart(mesh): SkinnedPart | undefined

The part mesh draws.

Parameter Type
mesh InstancedMesh2

SkinnedPart | undefined


holdWarmUp(): () => void

Draws one instance in each part, with every bone zero so it covers no pixel, until the returned call lets go: a batch with no copy draws nothing, so the first copy’s draw would be each part’s first, and the GPU process builds a draw’s vertex layout then, 19 to 44 ms of Holdfast’s first wave on Chrome’s Direct3D backend. Held under the loading screen, that first draw happens there. Holds count.

() => void


update(): void

Writes each shown copy’s pose, colour and uniforms into its parts’ draws. Each part’s draw runs it once a render, after the frame’s matrices are up to date.

void


updateOnce(frame): void

update, once for each of the renderer’s renders.

Parameter Type
frame number

void