API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classQuadParticles

@codexo/exojs-particles / particles / stable

The default render mode: one textured, rotated, tinted quad per particle, drawn as a single instanced triangle-list. build fills the shared 40-byte per-instance layout described by instanceAttributes. UVs are baked per-particle so the system can carry an atlas of frames - `system.frames` declares the rectangles and each particle's `textureIndex` selects one, resolved to UVs once per particle per frame; no per-instance shader-side indexing needed. GPU-eligible: the system's compute pipeline emits exactly that layout into its instance buffer, so a system running on the GPU path can bind that buffer directly and skip build entirely.

7
props
5
methods
0
events
Import
import { QuadParticles } from '@codexo/exojs-particles'

The default render mode: one textured, rotated, tinted quad per particle, drawn as a single instanced triangle-list.

build fills the shared 40-byte per-instance layout described by instanceAttributes. UVs are baked per-particle so the system can carry an atlas of frames - `system.frames` declares the rectangles and each particle's `textureIndex` selects one, resolved to UVs once per particle per frame; no per-instance shader-side indexing needed.

GPU-eligible: the system's compute pipeline emits exactly that layout into its instance buffer, so a system running on the GPU path can bind that buffer directly and skip build entirely.

Constructors1
new(): QuadParticles
Methods5
_ensureCapacity(byteLength: number): void
Grow the scratch buffer to hold at least byteLength. Grow-only: a shrinking particle count reuses the larger buffer rather than reallocating, matching the renderers' existing buffer policy.
_onBufferGrown(data: ArrayBuffer): void
Re-create typed-array views after _ensureCapacity reallocates.
_setCount(count: number): void
Record the element count produced by a build.
Fill the scratch buffer from the system's live particles. particles is the simulation's own channel storage, handed in rather than read off the system: a render mode is the one consumer that legitimately works in bulk, and it runs at the point in the frame where those values are the ones being drawn.
destroy(): void
Optional cleanup, called from ParticleSystem.destroy.
Properties7
The quad's four corners are derived in the shader - from gl_VertexID on WebGL2 and from vertex_index on WebGPU - so this mode declares no per-vertex geometry and its layout carries the indices that address those four corner slots.
gpuEligible: true
Whether this mode can run while the system is in GPU compute mode. Mirrors UpdateModule.wgsl(): a mode that cannot forces the whole system onto the CPU path, silently and observably via ParticleSystem.gpuMode. A GPU-eligible mode's layout must match what the compute pipeline emits into gpuState.instanceBuffer - the shared 40-byte per-instance layout (instanceAttributes). QuadParticles and MeshParticles both declare exactly that layout and differ only in the shape they expand it into, which is why both are eligible without the compute shader knowing either.
instanced: true
Draw model. true issues an instanced draw, false a plain draw over the built vertex buffer. Declared here because a layout carries topology but has no instancing concept.
Fixed per-vertex geometry this mode instances, or null when it derives its vertices in the shader from the vertex index - which is what QuadParticles and RibbonParticles do. When set, it supplies the topology, index list and index count for the draw in place of dataLayout's, and the executors bind its vertexData as a second vertex buffer stepping per vertex beside the per-instance one. Only meaningful on an instanced mode: without instancing both buffers would step per vertex and no draw is expressible. Attribute names must not collide with dataLayout's, since both sets bind into the same shader. Mutating the geometry is picked up on the next draw through its version, so invalidate() after an in-place edit is enough to reach the GPU.
count: number
Element count of the draw call this mode's last build produced. Draw-model relative: instance count when instanced, vertex count otherwise. Do not assume one meaning.
data: ArrayBuffer
The buffer the renderer uploads. Valid until the next build.
Source