Skip to content

@modoki/engine / index / IParticleBackend

Interface: IParticleBackend

The Three.js particle backend contract. The CPU/TSL backend implements this today; a GPU-compute backend implements the same contract for 100k+ counts. Adds the THREE render object to the renderer-agnostic IParticleBackendCore.

Extends

  • IParticleBackendCore

Particles

create()

create(def): ParticleHandle

Instantiate an effect; returns a handle owning the backend's render object.

Parameters

def

ParticleEffectDef

Returns

ParticleHandle

Inherited from

IParticleBackendCore.create


dispose()

dispose(handle): void

Release GPU/CPU resources for this handle.

Parameters

handle

ParticleHandle

Returns

void

Inherited from

IParticleBackendCore.dispose


getObject3D()

getObject3D(handle): Object3D<Object3DEventMap>

The renderable to add to the THREE scene for this handle.

Parameters

handle

ParticleHandle

Returns

Object3D<Object3DEventMap>


pause()

pause(handle): void

Parameters

handle

ParticleHandle

Returns

void

Inherited from

IParticleBackendCore.pause


play()

play(handle): void

Parameters

handle

ParticleHandle

Returns

void

Inherited from

IParticleBackendCore.play


restart()

restart(handle): void

Parameters

handle

ParticleHandle

Returns

void

Inherited from

IParticleBackendCore.restart


seek()

seek(handle, seconds): void

Jump to seconds into the effect (recompute via stepped simulation).

Parameters

handle

ParticleHandle

seconds

number

Returns

void

Inherited from

IParticleBackendCore.seek


setDef()

setDef(handle, def): void

Hot-swap the effect definition (editor live edits) without losing the handle.

Parameters

handle

ParticleHandle

def

ParticleEffectDef

Returns

void

Inherited from

IParticleBackendCore.setDef


setSpeedScale()?

optional setSpeedScale(handle, scale): void

Runtime multiplier on each new particle's launch speed (1 = authored). Lengthens/shortens the plume and trails over ~one particle lifetime — e.g. an engine flame throttling up on acceleration. Optional: a backend may treat it as a no-op.

Parameters

handle

ParticleHandle

scale

number

Returns

void

Inherited from

IParticleBackendCore.setSpeedScale


setTransform()

setTransform(handle, matrix): void

Set the emitter's world matrix (position/rotation/scale of the emitter origin). Column-major (THREE.Matrix4); the 2D backend reads translation/rotation/scale off it.

Parameters

handle

ParticleHandle

matrix

Matrix4

Returns

void

Inherited from

IParticleBackendCore.setTransform


update()

update(handle, dt): void

Advance simulation by dt seconds (the backend tracks its own elapsed time).

Parameters

handle

ParticleHandle

dt

number

Returns

void

Inherited from

IParticleBackendCore.update

Built with Modoki.