Renderer · interface

ParticlePoolOptions

A pool of short-lived particles, simulated on the CPU and drawn as instances.

Explained in Hello world.

interface ParticlePoolOptions
import type { ParticlePoolOptions } from '@driftengine/core';

In depth

Deliberately not a new GPU path: InstancedMesh already uploads instance data per frame and already knows how to draw thousands of copies of one mesh in a single call, so a particle system is only the simulation. That keeps the whole thing testable — none of what follows needs a GL context — and keeps WebGL where the standing rule says it lives.

A ring buffer, not a free list. Emission is continuous and the oldest particle is always the right one to reuse, so the bookkeeping a free list exists for is bookkeeping nobody needs; and overrunning it degrades by dropping the oldest, which is invisible, rather than by refusing to emit, which is visible exactly when the effect matters most.

Properties

NameTypeDescription
capacitynumber
lifeSecnumberSeconds a particle lives.
sizeStartnumberSize at birth and at death: metres from the centre to an edge, so the quad is twice as wide.
sizeEndnumber
colorStartVec3Colour at birth and at death.
colorEndVec3
gravitynumberDownward acceleration. Smoke wants a little; grit wants a lot.
dragnumberHow fast motion decays, per second.
risenumberConstant upward push, for anything that behaves like smoke.
alphaStartoptionalnumberOpacity at birth and at death. Omitted means the old behaviour exactly — fully opaque, fading by colour — so no existing pool changes by a bit.
alphaEndoptionalnumber