edgeGlowAccumColorFor

The fold step for one color space: adds one color's spots to the running state.

edgeGlowAccumColorFor(mode: number): TgpuFn<(st: WgslStruct<{ rgb: Vec3f; w: F32; ba: F32; ac: Vec3f; aa: F32; }>, color: Vec4f, sectors: Vec2f) => WgslStruct<{ rgb: Vec3f; w: F32; ba: F32; ac: Vec3f; aa: F32; }>>

Import effects from shaders/std and use effects.edgeGlow.edgeGlowAccumColorFor.

mode is the compile-time value of a colorSpace prop (see transformColorSpace); where colors overlap they mix in that space. The returned GPU function takes the state, a color and the pair from orbitSpotsAccum, and returns the new state. Call it once per color, then close with edgeGlowCompose.

Parameters

NameTypeNotes
modenumber

Example

const accumColor = edgeGlowAccumColorFor(propValues.colorSpace as number)
state = call(accumColor, 'edgeGlowAccumColor', [state, uniforms.colorA, sectors])

Tip. OKLCh keeps overlapping lights vivid; linear RGB muddies them.

See also

  • edgeGlowAccumZero — The empty state to start folding colors into.
  • orbitSpotsAccum — The spots of one color orbiting the band, as coverage at this pixel.
  • edgeGlowCompose — The final color from the folded state, over a transparent background.

Used by

LightEdge