Renderer · class
ParticleBatch
Explained in Hello world.
class ParticleBatchimport { ParticleBatch } from '@driftengine/core';Constructor
new
constructor(gl: WebGL2RenderingContext, capacity: number, options: ParticleBatchOptions)| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext | |
capacity | number | |
options | ParticleBatchOptions |
Properties
| Name | Type | Description |
|---|---|---|
programreadonly | WebGLProgram | |
uniformsreadonly | Record<string, WebGLUniformLocation> | |
texturereadonly | SurfaceTexture | null | The sprite's own: its image, its flipbook and its fades. See ParticleBatchOptions. |
cellsreadonly | readonly [number, number] | |
blendCellsreadonly | boolean | |
softDepthreadonly | number | |
cameraFadereadonly | number | |
cameraOffsetreadonly | number | |
materialreadonly | ParticleMaterial | Which material compiled this batch's program, so reuse can be checked. |
Methods
upload
upload(gl: WebGL2RenderingContext, given: ParticleInstances, eye: ArrayLike<number>): voidSend this frame's particles.
| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext | |
given | ParticleInstances | |
eye | ArrayLike<number> |
More
Only the live prefix of each array, which is what the pool's compaction exists for: a pool at a tenth of its capacity uploads a tenth of the bytes.
bindMaterial
bindMaterial(gl: WebGL2RenderingContext): voidBind this material's own constants. Called once per draw, before drawTo.
| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext |
drawTo
drawTo(gl: WebGL2RenderingContext, count: number): voidDraw the live particles.
| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext | |
count | number |
More
Depth tested but not written, so a puff is correctly hidden behind the deck and never hides a puff behind it. Culling off, because a blade seen from behind is exactly as valid as one seen from the front.
dispose
dispose(gl: WebGL2RenderingContext): void| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext |