API reference

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

I

interfaceWgslContribution

@codexo/exojs-particles / particles / stable

What an UpdateModule contributes to the system's composite compute shader. `body` runs once per particle in the inner main function, with these locals in scope: - `idx: u32` - the particle slot index (already gated on `< sim.liveCount` and skip-on-dead via `timing[idx].y < 0.0`). - `dt: f32` - frame delta in seconds (mirrors `sim.dt`). - **Packed SoA bindings** (see body of doc) - channels are packed into `vec2<f32>`-typed storage buffers to fit within WebGPU's default 8-buffer limit. Access x/y components for the per-axis values: - `positions[idx].x` / `.y` (was posX/posY) - `velocities[idx].x` / `.y` (was velX/velY) - `scales[idx].x` / `.y` (was scaleX/scaleY) - `rotInfo[idx].x` / `.y` (rotation, rotationSpeed) - `timing[idx].x` / `.y` (elapsed, lifetime - y is set to -1 when expired) - `color[idx]` - packed RGBA u32, single channel (no .x/.y) - `sim: SimUniforms` - `{ dt: f32, liveCount: u32 }`. - `modules.u_${key}: ${Key}Uniforms` - your module's uniform struct (if declared). - `u_${key}_${textureName}` and `u_${key}_${textureName}_sampler` - texture bindings (if any). The body should not declare new functions or top-level statements; it runs inline in the main function. Use comments and parentheses generously - composition concatenates several module bodies and any syntax mistake surfaces only at pipeline-creation time.

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

What an UpdateModule contributes to the system's composite compute shader. `body` runs once per particle in the inner main function, with these locals in scope:

- `idx: u32` - the particle slot index (already gated on `< sim.liveCount` and skip-on-dead via `timing[idx].y < 0.0`). - `dt: f32` - frame delta in seconds (mirrors `sim.dt`). - **Packed SoA bindings** (see body of doc) - channels are packed into `vec2<f32>`-typed storage buffers to fit within WebGPU's default 8-buffer limit. Access x/y components for the per-axis values: - `positions[idx].x` / `.y` (was posX/posY) - `velocities[idx].x` / `.y` (was velX/velY) - `scales[idx].x` / `.y` (was scaleX/scaleY) - `rotInfo[idx].x` / `.y` (rotation, rotationSpeed) - `timing[idx].x` / `.y` (elapsed, lifetime - y is set to -1 when expired) - `color[idx]` - packed RGBA u32, single channel (no .x/.y) - `sim: SimUniforms` - `{ dt: f32, liveCount: u32 }`. - `modules.u_${key}: ${Key}Uniforms` - your module's uniform struct (if declared). - `u_${key}_${textureName}` and `u_${key}_${textureName}_sampler` - texture bindings (if any).

The body should not declare new functions or top-level statements; it runs inline in the main function. Use comments and parentheses generously - composition concatenates several module bodies and any syntax mistake surfaces only at pipeline-creation time.

Properties5
body: string
key: string
Unique key per module *class* (e.g. 'ApplyForce'). Two ApplyForce instances on one system aren't supported - combine into one.
prelude?: string
Optional WGSL declarations (functions, constants) emitted at module scope before main(). Use this for noise/hash helpers or any supporting function the body calls. Multiple modules can declare preludes; they're concatenated in registration order. Naming collisions across modules are the author's problem - prefix helpers with the module key (e.g. myModule_hash) to avoid clashes.
Source