@wonderyard/vivarium 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,13 +71,24 @@ export declare const mainCompute: import('typegpu').TgpuComputeFn<{
71
71
  * @param options.canvas - The HTML canvas element. Its `width` and `height` define the grid dimensions.
72
72
  * @param options.automaton - The compiled automaton produced by {@link VivariumBlueprint.create | vivarium().create()}.
73
73
  * @param options.initialGrid - An optional 2d array of element indices to use instead of random initialization. Alternatively, you can pass a flat (1d) array with one index per cell, row-major order.
74
- * @returns An object with an `evolve` function that advances the simulation by one step, a `readGrid` function that reads the current grid state, a `writeCell` function that updates a single cell by flat index, a `writeCellAt` function that updates a single cell by grid coordinates, a `writeGrid` function that overwrites the entire grid, a `setAutomaton` function to update the automaton, and the underlying `tgpuRoot`.
74
+ * @returns An object with:
75
+ * - `update` — advances the simulation by one step (synchronous, GPU only).
76
+ * - `draw` — reads the latest GPU state and renders it to the canvas (async).
77
+ * - `evolve` — convenience shorthand for `update()` + `await draw()`.
78
+ * - `readGrid` — reads the current grid state.
79
+ * - `writeCell` — updates a single cell by flat index.
80
+ * - `writeCellAt` — updates a single cell by grid coordinates.
81
+ * - `writeGrid` — overwrites the entire grid.
82
+ * - `setAutomaton` — replaces the automaton rules.
83
+ * - `tgpuRoot` — the underlying TypeGPU root.
75
84
  */
76
85
  export declare const setup: ({ canvas, automaton, initialGrid, }: {
77
86
  canvas: HTMLCanvasElement;
78
87
  automaton: Automaton;
79
88
  initialGrid?: number[] | number[][];
80
89
  }) => {
90
+ update: () => void;
91
+ draw: () => Promise<void>;
81
92
  evolve: () => Promise<void>;
82
93
  readGrid: () => Promise<number[]>;
83
94
  writeCell: (index: number, elementIndex: number) => void;