Skip to content

geometry#setWasmColors

Summary

geometry#setWasmColors attaches a borrowed WebAssembly view of per-vertex colors. Each record contains four f32 values in linear RGBA order. Use it when a Wasm producer changes a geometry's vertex colors over time.

Syntax

Geometry.setWasmColors(source: WasmMemoryView<Float32Array> | null, options?: GeometryWasmAttributeOptions): void
geometry.setWasmColors(colors, { keepCPUData: true });

Parameters

Name Type Required Description
source WasmMemoryView<Float32Array> | null Yes Borrowed float view with four values for each active vertex. Pass null to detach it and release its managed GPU buffer.
options GeometryWasmAttributeOptions No Capacity and refresh settings. The active count comes from the geometry or its attached Wasm position source unless you supply vertexCount. Set keepCPUData: true to keep a snapshot.

Notes

Attaching the view refreshes the vertex source state. After producer changes, call refreshWasmVertices and let the renderer upload the pending data. The producer owns the Wasm allocation and must keep it valid while attached.

See Also