Interface: IParticleRenderer
Many textured quads drawn as one drawable — a particle system. The framework simulates (Particles/ParticleSimulation.ts); the backend only draws what it's handed each frame.
SetParticleData's data holds PARTICLE_STRIDE floats per particle, in draw order and the node's y-up space: x, y, rotation (radians, counter-clockwise), width, height (px; negative = flipped), alpha, frame. colors holds 0xRRGGBB per particle. Width is the particle's size; the height is scaled by the frame's aspect, so a square size keeps the image's shape. frame indexes the texture's tilesX × tilesY grid, row by row from the top-left. The bounds are the particles' extent in node space (filters / materials size themselves to it).
Methods
CreateParticles()
ts
CreateParticles(): number;Returns
number
DestroyParticles()
ts
DestroyParticles(handle): void;Parameters
| Parameter | Type |
|---|---|
handle | number |
Returns
void
SetParticleBlendMode()
ts
SetParticleBlendMode(handle, mode): void;Parameters
| Parameter | Type |
|---|---|
handle | number |
mode | ParticleBlendMode |
Returns
void
SetParticleData()
ts
SetParticleData(
handle,
data,
colors,
count,
minX,
minY,
maxX,
maxY
): void;Parameters
| Parameter | Type |
|---|---|
handle | number |
data | Float32Array |
colors | Uint32Array |
count | number |
minX | number |
minY | number |
maxX | number |
maxY | number |
Returns
void
SetParticleTexture()
ts
SetParticleTexture(
handle,
assetId,
tilesX,
tilesY
): void;Empty asset id = a white square.
Parameters
| Parameter | Type |
|---|---|
handle | number |
assetId | string |
tilesX | number |
tilesY | number |
Returns
void
SetParticleTrails()
ts
SetParticleTrails(
handle,
vertices,
colors,
vertexCount,
indices,
indexCount,
minX,
minY,
maxX,
maxY
): void;Parameters
| Parameter | Type |
|---|---|
handle | number |
vertices | Float32Array |
colors | Uint32Array |
vertexCount | number |
indices | Uint32Array |
indexCount | number |
minX | number |
minY | number |
maxX | number |
maxY | number |
Returns
void
SetParticleTrailTexture()
ts
SetParticleTrailTexture(handle, assetId): void;Trails, drawn under the particles: a triangle list in node space — TRAIL_VERTEX_STRIDE floats per vertex (x, y, u along, v across), an RGBA colour per vertex (bytes r, g, b, a, straight alpha) and the indices. Index entries past indexCount are zero. The arrays are reused frame to frame (same objects until they grow). A backend without a way to draw them may ignore both calls.
Parameters
| Parameter | Type |
|---|---|
handle | number |
assetId | string |
Returns
void