Renderer · class
BoltPool
Explained in Hello world.
class BoltPoolimport { BoltPool } from '@driftengine/core';Constructor
new
constructor(options: BoltPoolOptions)| Parameter | Type | Description |
|---|---|---|
options | BoltPoolOptions |
Properties
| Name | Type | Description |
|---|---|---|
segmentsreadonly | BoltSegments |
Accessors
| Name | Type | Description |
|---|---|---|
liveget | number | How many arcs are alive. |
Methods
strike
strike(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, seed: number, brightness?: number, /** * Multiplier on the pool's lifetime for this arc alone. * * A volley of arcs that all die on the same frame reads as one object being * switched off, which is the most predictable thing a flash can do. Varying it * per strike is the cheapest way to make a burst decay like several discharges. */ lifeScale?: number): voidStrike an arc between two points.
| Parameter | Type | Description |
|---|---|---|
x0 | number | |
y0 | number | |
z0 | number | |
x1 | number | |
y1 | number | |
z1 | number | |
seed | number | |
brightness? | number | |
/** * Multiplier on the pool's lifetime for this arc alone. * * A volley of arcs that all die on the same frame reads as one object being * switched off | | |
which is the most predictable thing a flash can do. Varying it * per strike is the cheapest way to make a burst decay like several discharges. */ lifeScale?: number | |
More
seed drives the path instead of Math.random, so a caller inside a
deterministic system can pass a tick count and get the same lightning twice.
update
update(dt: number): voidAge every arc, re-strike the ones whose path is due, and rebuild the segment arrays.
| Parameter | Type | Description |
|---|---|---|
dt | number |
More
Compacting as it goes, like the particle pool: live segments are written to the front, so a draw submits exactly the live count and a dead arc costs one loop iteration.
clear
clear(): voidDrop everything, for a respawn or a scene change.