Renderer · class
BoltBatch
One draw call for a pool of electrical arcs.
Explained in Hello world.
class BoltBatchimport { BoltBatch } from '@driftengine/core';In depth
Four vertices per segment rather than instancing, because a segment's two endpoints are its geometry — there is no repeated base shape to instance, and an instanced version would upload the same two positions per vertex anyway.
Additive and depth-tested without writing depth, like every other emissive effect here: an arc adds light to what is behind it and must not occlude whatever is drawn next.
Constructor
new
constructor(gl: WebGL2RenderingContext, capacity: number, label: string)| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext | |
capacity | number | |
label | string |
Properties
| Name | Type | Description |
|---|---|---|
programreadonly | WebGLProgram | |
uniformsreadonly | Record<string, WebGLUniformLocation> |
Methods
upload
upload(gl: WebGL2RenderingContext, data: BoltSegments): numberSend this frame's arcs, expanding each segment to its four vertices.
| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext | |
data | BoltSegments |
More
The expansion is segmentQuads.ts's because it is a fact about how the geometry is drawn
rather than about GL — the pool is deliberately GL-free and testable, and the WebGPU batch
needs exactly the same four vertices.
drawTo
drawTo(gl: WebGL2RenderingContext, segmentCount: number): void| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext | |
segmentCount | number |
dispose
dispose(gl: WebGL2RenderingContext): void| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext |