shaderpad 1.0.0-beta.80 → 1.0.0-beta.82

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +648 -0
  2. package/README.md +11 -11
  3. package/dist/chunk-B3EEZDUT.mjs +5 -0
  4. package/dist/chunk-B3EEZDUT.mjs.map +1 -0
  5. package/dist/dev/{chunk-QYD24S7K.mjs → chunk-TTKZ43JC.mjs} +325 -370
  6. package/dist/dev/chunk-TTKZ43JC.mjs.map +1 -0
  7. package/dist/dev/index.js +322 -367
  8. package/dist/dev/index.js.map +1 -1
  9. package/dist/dev/index.mjs +1 -1
  10. package/dist/dev/plugins/pose.js +322 -367
  11. package/dist/dev/plugins/pose.js.map +1 -1
  12. package/dist/dev/plugins/pose.mjs +1 -1
  13. package/dist/dev/plugins/segmenter.js +322 -367
  14. package/dist/dev/plugins/segmenter.js.map +1 -1
  15. package/dist/dev/plugins/segmenter.mjs +1 -1
  16. package/dist/dev/react.js +354 -383
  17. package/dist/dev/react.js.map +1 -1
  18. package/dist/dev/react.mjs +31 -15
  19. package/dist/dev/react.mjs.map +1 -1
  20. package/dist/dev/web-component.js +339 -378
  21. package/dist/dev/web-component.js.map +1 -1
  22. package/dist/dev/web-component.mjs +16 -10
  23. package/dist/dev/web-component.mjs.map +1 -1
  24. package/dist/index.d.mts +36 -32
  25. package/dist/index.d.ts +36 -32
  26. package/dist/index.js +3 -8
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +1 -1
  29. package/dist/plugins/pose.js +32 -37
  30. package/dist/plugins/pose.js.map +1 -1
  31. package/dist/plugins/pose.mjs +1 -1
  32. package/dist/plugins/segmenter.js +10 -15
  33. package/dist/plugins/segmenter.js.map +1 -1
  34. package/dist/plugins/segmenter.mjs +1 -1
  35. package/dist/react.d.mts +2 -2
  36. package/dist/react.d.ts +2 -2
  37. package/dist/react.js +3 -8
  38. package/dist/react.js.map +1 -1
  39. package/dist/react.mjs +1 -1
  40. package/dist/react.mjs.map +1 -1
  41. package/dist/web-component.d.mts +5 -4
  42. package/dist/web-component.d.ts +5 -4
  43. package/dist/web-component.js +5 -10
  44. package/dist/web-component.js.map +1 -1
  45. package/dist/web-component.mjs +2 -2
  46. package/dist/web-component.mjs.map +1 -1
  47. package/package.json +3 -2
  48. package/dist/chunk-PZ4UVAHU.mjs +0 -10
  49. package/dist/chunk-PZ4UVAHU.mjs.map +0 -1
  50. package/dist/dev/chunk-QYD24S7K.mjs.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,648 @@
1
+ # shaderpad
2
+
3
+ ## 1.0.0-beta.82
4
+
5
+ ### Patch Changes
6
+
7
+ - Reduce size
8
+
9
+ ## 1.0.0-beta.81
10
+
11
+ ### Minor Changes
12
+
13
+ - Improve timing / lifecycle behavior
14
+
15
+ Pause `u_time` on `pause()`, so that `step()` and `play()` resume from the same timestamp after a pause.
16
+
17
+ Also renamed:
18
+ - `resetFrame()` => `rewind()`
19
+ - `beforeDraw` => `preDraw`
20
+ - `afterDraw` => `postDraw`
21
+ - `beforeStep` => `preStep`
22
+ - `afterStep` => `postStep`
23
+
24
+ ## 1.0.0-beta.80
25
+
26
+ ### Minor Changes
27
+
28
+ - Add configurable `wasmBaseUrl` option for MediaPipe plugins
29
+
30
+ ## 1.0.0-beta.79
31
+
32
+ ### Patch Changes
33
+
34
+ - Add package READMEs
35
+
36
+ ## 1.0.0-beta.78
37
+
38
+ ### Minor Changes
39
+
40
+ - Add `<shader-pad>` web component
41
+
42
+ ## 1.0.0-beta.77
43
+
44
+ ### Minor Changes
45
+
46
+ - Add default export to shaderpad/react
47
+
48
+ ## 1.0.0-beta.76
49
+
50
+ ### Minor Changes
51
+
52
+ - Add `shaderpad/react` export
53
+
54
+ ## 1.0.0-beta.75
55
+
56
+ ### Minor Changes
57
+
58
+ - Improve face plugin performance and simplify templates
59
+
60
+ ## 1.0.0-beta.74
61
+
62
+ ### Minor Changes
63
+
64
+ - API improvements for public release
65
+
66
+ ## 1.0.0-beta.73
67
+
68
+ ### Minor Changes
69
+
70
+ - Expand `create-shaderpad` starters and support modular GLSL includes
71
+
72
+ ## 1.0.0-beta.72
73
+
74
+ ### Minor Changes
75
+
76
+ - Simplify history writes and shared MediaPipe plugins
77
+
78
+ ## 1.0.0-beta.71
79
+
80
+ ### Minor Changes
81
+
82
+ - Publish development build
83
+
84
+ ## 1.0.0-beta.70
85
+
86
+ ### Minor Changes
87
+
88
+ - Update error shortlinks and enable texture historyWriteIndex
89
+
90
+ ## 1.0.0-beta.69
91
+
92
+ ### Minor Changes
93
+
94
+ - Improve runtime error handling
95
+
96
+ ## 1.0.0-beta.68
97
+
98
+ ### Minor Changes
99
+
100
+ - Autosize: replace `ignorePixelRatio` with `scale`
101
+
102
+ ## 1.0.0-beta.67
103
+
104
+ ### Patch Changes
105
+
106
+ - Fix eyebrow fill region
107
+
108
+ ## 1.0.0-beta.66
109
+
110
+ ### Minor Changes
111
+
112
+ - Improve eye/mouth geometry
113
+ - Reduces triangle count in face mesh by filling eyes/mouth
114
+ - Improves eye and inner-mouth masks by triangulating between contour curves instead of fan-filling across the opening
115
+
116
+ In practice, you’ll notice a better inner mouth shape with a
117
+ closed-mouth smile.
118
+
119
+ ## 1.0.0-beta.65
120
+
121
+ ### Patch Changes
122
+
123
+ - Fill eyes/mouth in face tessellation
124
+
125
+ ## 1.0.0-beta.64
126
+
127
+ ### Patch Changes
128
+
129
+ - Refactor face mask rendering to use overlap-safe scratch composition
130
+
131
+ ## 1.0.0-beta.63
132
+
133
+ ### Minor Changes
134
+
135
+ - Rename "outer mouth" to "mouth"
136
+
137
+ ## 1.0.0-beta.62
138
+
139
+ ### Minor Changes
140
+
141
+ - Misc fixes and improvements
142
+
143
+ ## 1.0.0-beta.61
144
+
145
+ ### Patch Changes
146
+
147
+ - Fix UNPACK_ALIGNMENT for non-RGBA formats
148
+
149
+ ## 1.0.0-beta.60
150
+
151
+ ### Patch Changes
152
+
153
+ - Release v60
154
+
155
+ ## 1.0.0-beta.59
156
+
157
+ ### Minor Changes
158
+
159
+ - Allow uint uniforms
160
+
161
+ ## 1.0.0-beta.58
162
+
163
+ ### Patch Changes
164
+
165
+ - Add a synchronous handleResize() during autosize init
166
+
167
+ ## 1.0.0-beta.57
168
+
169
+ ### Minor Changes
170
+
171
+ - Fix autosize target sizing
172
+
173
+ ## 1.0.0-beta.56
174
+
175
+ ### Patch Changes
176
+
177
+ - Improve ShaderPad chaining
178
+
179
+ ## 1.0.0-beta.55
180
+
181
+ ### Minor Changes
182
+
183
+ - Add preventShare option to save plugin
184
+
185
+ ## 1.0.0-beta.54
186
+
187
+ ### Patch Changes
188
+
189
+ - Fix formatString defaults and improve play/pause ergonomics
190
+
191
+ ## 1.0.0-beta.53
192
+
193
+ ### Minor Changes
194
+
195
+ - Improve integer format compatibility, perf, add cursorTarget option
196
+
197
+ ## 1.0.0-beta.52
198
+
199
+ ### Minor Changes
200
+
201
+ - Enable model choice for segmenter plugin
202
+
203
+ ## 1.0.0-beta.51
204
+
205
+ ### Patch Changes
206
+
207
+ - Bind framebuffer in step
208
+
209
+ ## 1.0.0-beta.50
210
+
211
+ ### Minor Changes
212
+
213
+ - Improve plugin history consistency and performance
214
+
215
+ ## 1.0.0-beta.49
216
+
217
+ ### Minor Changes
218
+
219
+ - Remove time as first arg for public step method
220
+
221
+ This version also fixes high-precision float formats, and handles a race condition between init and destroy in MediaPipe plugins.
222
+
223
+ ## 1.0.0-beta.48
224
+
225
+ ### Minor Changes
226
+
227
+ - Improve inX checks and add public clear method
228
+
229
+ ## 1.0.0-beta.47
230
+
231
+ ### Patch Changes
232
+
233
+ - Add precision qualifiers to mask uniforms
234
+
235
+ ## 1.0.0-beta.46
236
+
237
+ ### Minor Changes
238
+
239
+ - Enable headless ShaderPads
240
+
241
+ This version also migrates some canvas-specific code out of the core package into `plugins/autosize` and `util/createFullscreenCanvas`.
242
+
243
+ ## 1.0.0-beta.45
244
+
245
+ ### Patch Changes
246
+
247
+ - Improve destroy()
248
+
249
+ ## 1.0.0-beta.44
250
+
251
+ ### Minor Changes
252
+
253
+ - Swap play() arg order
254
+
255
+ ## 1.0.0-beta.43
256
+
257
+ ### Patch Changes
258
+
259
+ - Improve mobile save/dismiss behaviour
260
+
261
+ ## 1.0.0-beta.42
262
+
263
+ ### Minor Changes
264
+
265
+ - Allow ShaderPad texture sources, improve MediaPipe perf, add MediaPipe history
266
+
267
+ ## 1.0.0-beta.41
268
+
269
+ ### Minor Changes
270
+
271
+ - Overhaul hook system and MediaPipe init order
272
+
273
+ ## 1.0.0-beta.40
274
+
275
+ ### Patch Changes
276
+
277
+ - Improve save / dismiss behaviour on mobile
278
+
279
+ ## 1.0.0-beta.39
280
+
281
+ ### Patch Changes
282
+
283
+ - Bugfix: allocate storage for intermediate texture
284
+
285
+ ## 1.0.0-beta.38
286
+
287
+ ### Minor Changes
288
+
289
+ - Allow high-precision history
290
+
291
+ Also:
292
+ - Allow texture options to be passed during ShaderPad creation
293
+ - Add onReady callbacks to MediaPipe plugins
294
+ - Add an afterStep lifecycle method
295
+ - Add option to skip history writes
296
+ - Various bugfixes and performance improvements
297
+
298
+ ## 1.0.0-beta.37
299
+
300
+ ### Minor Changes
301
+
302
+ - Generate face mask with GL TRIANGLEs
303
+
304
+ ## 1.0.0-beta.36
305
+
306
+ ### Minor Changes
307
+
308
+ - Re-address antialiasing in face plugin
309
+
310
+ ## 1.0.0-beta.35
311
+
312
+ ### Patch Changes
313
+
314
+ - Fix bug in face plugin
315
+
316
+ ## 1.0.0-beta.34
317
+
318
+ ### Minor Changes
319
+
320
+ - Limit antialiasing on mask textures
321
+
322
+ ## 1.0.0-beta.33
323
+
324
+ ### Minor Changes
325
+
326
+ - Expand texture input types and improve MediaPipe plugins
327
+
328
+ ## 1.0.0-beta.32
329
+
330
+ ### Minor Changes
331
+
332
+ - Add segmenter plugin
333
+
334
+ ## 1.0.0-beta.31
335
+
336
+ ### Minor Changes
337
+
338
+ - Add onResults callbacks to MediaPipe plugins
339
+
340
+ ## 1.0.0-beta.30
341
+
342
+ ### Minor Changes
343
+
344
+ - Rewrite plugins to transfer landmark data as textures
345
+
346
+ Rewrite MediaPipe plugins (pose, face, hands) to transfer landmark data as textures instead of uniform arrays. Landmarks are now accessed via `texelFetch()` on `u_poseLandmarksTex`, `u_faceLandmarksTex`, and `u_handLandmarksTex` textures. The `poseLandmark()`, `faceLandmark()`, and `handLandmark()` functions now return `vec4` (x, y, z, visibility) instead of `vec2`. Function names updated: `getBody()` → `inBody()`, `getFace()` → `inFace()`, etc.
347
+
348
+ As part of this change, typed arrays (e.g., `Float32Array`) are now valid texture sources when provided with width and height.
349
+
350
+ Also:
351
+ - Updated examples for the new API
352
+ - Added debug option to reduce logging in production
353
+
354
+ ## 1.0.0-beta.29
355
+
356
+ ### Minor Changes
357
+
358
+ - Expose individual face landmarks in face plugin
359
+
360
+ ## 1.0.0-beta.28
361
+
362
+ ### Minor Changes
363
+
364
+ - Add share text as optional second argument to save()
365
+
366
+ ## 1.0.0-beta.27
367
+
368
+ ### Minor Changes
369
+
370
+ - Add u_mouth to face plugin
371
+
372
+ ## 1.0.0-beta.26
373
+
374
+ ### Minor Changes
375
+
376
+ - Improve MediaPipe media handling
377
+
378
+ ## 1.0.0-beta.25
379
+
380
+ ### Minor Changes
381
+
382
+ - Improve pose segmentation
383
+
384
+ ## 1.0.0-beta.24
385
+
386
+ ### Patch Changes
387
+
388
+ - Fix fitCover/fitContain function name swap
389
+
390
+ ## 1.0.0-beta.23
391
+
392
+ ### Patch Changes
393
+
394
+ - Include u_resolution definition in helpers plugin
395
+
396
+ ## 1.0.0-beta.22
397
+
398
+ ### Minor Changes
399
+
400
+ - Add fitContain and fitCover helper functions
401
+
402
+ ## 1.0.0-beta.21
403
+
404
+ ### Minor Changes
405
+
406
+ - Export all plugins as default exports
407
+
408
+ Also resolve deprecation warning for non-DOM textures
409
+
410
+ ## 1.0.0-beta.20
411
+
412
+ ### Minor Changes
413
+
414
+ - Add draw() method
415
+
416
+ ## 1.0.0-beta.19
417
+
418
+ ### Minor Changes
419
+
420
+ - Add hands and pose plugins
421
+
422
+ ### Minor Changes
423
+ - Add MediaPipe hands plugin
424
+
425
+ The `hands` plugin uses [MediaPipe Hand Landmarker](https://ai.google.dev/edge/mediapipe/solutions/vision/hand_landmarker) to detect and track hand landmarks in video or image textures. Each hand contributes 22 landmarks (21 standard landmarks plus hand center).
426
+
427
+ - Add MediaPipe pose plugin
428
+
429
+ The `pose` plugin uses [MediaPipe Pose Landmarker](https://ai.google.dev/edge/mediapipe/solutions/vision/pose_landmarker) to detect and track body pose landmarks. Each pose contributes 33 landmarks, and the plugin provides both landmark data and a mask texture showing the skeleton and body segmentation.
430
+
431
+ - Add documentation site
432
+
433
+ Added a new documentation site that showcases ShaderPad with a live shader example. The site is automatically deployed to GitHub Pages via a new GitHub Actions workflow.
434
+
435
+ - Add new example shaders
436
+
437
+ Added several new example shaders demonstrating the new plugins and various shader techniques:
438
+ - `hands.ts`: Hand tracking example
439
+ - `pose.ts`: Pose tracking example
440
+ - `god-rays.ts`: God rays effect example
441
+ - `fragmentum.ts`: Complex procedural shader example
442
+
443
+ ### Patch Changes
444
+ - Update package.json exports to include new plugins (hands, pose)
445
+ - Remove plugins/index.ts in favor of individual plugin exports (optimizes bundle size)
446
+ - Update README with comprehensive documentation for all MediaPipe plugins
447
+ - Add project logo
448
+
449
+ ## 1.0.0-beta.18
450
+
451
+ ### Minor Changes
452
+
453
+ - Add per-texture history
454
+
455
+ The history plugin now supports history tracking for individual textures, in addition to framebuffer history. When initializing a texture with `initializeTexture()`, you can now specify a historyDepth parameter to maintain a buffer of prior frames for that specific texture:
456
+
457
+ ```ts
458
+ // Store the last 30 webcam frames
459
+ // shader.initializeTexture('u_webcam', videoElement, 30);
460
+ ```
461
+
462
+ Added two new examples demonstrating per-texture history:
463
+ - history-webcam-channels
464
+ - history-webcam-grid
465
+
466
+ ## 1.0.0-beta.17
467
+
468
+ ### Minor Changes
469
+
470
+ - Add plugin system
471
+
472
+ Finally in beta! This version adds a new plugin system, and migrates history
473
+ and save functionality out of the main class into standalone plugins. This
474
+ reduces bundle size for the most common usecases, and ensures flexibility going
475
+ forward.
476
+
477
+ This commit also reorganizes the examples directory; now all demos can be
478
+ played without needing to edit any files.
479
+
480
+ Other significant changes:
481
+ - The `play` callback now runs after the next loop is requested, so
482
+ `shader.pause()` can be called from within the `play` callback.
483
+ - The constructor no-longer accepts a `history` option. That has moved to the
484
+ history plugin’s configuration.
485
+ - The constructor now accepts a `plugins` option.
486
+
487
+ ## 1.0.0-alpha.16
488
+
489
+ ### Minor Changes
490
+
491
+ - Prevent double play
492
+
493
+ ## 1.0.0-alpha.15
494
+
495
+ ### Patch Changes
496
+
497
+ - Improve iOS recognition on save
498
+
499
+ ## 1.0.0-alpha.14
500
+
501
+ ### Patch Changes
502
+
503
+ - Improve mobile save experience
504
+
505
+ ## 1.0.0-alpha.13
506
+
507
+ ### Minor Changes
508
+
509
+ - Improve save experience on mobile
510
+
511
+ ## 1.0.0-alpha.12
512
+
513
+ ### Minor Changes
514
+
515
+ - Improve resize behaviour
516
+
517
+ ## 1.0.0-alpha.11
518
+
519
+ ### Patch Changes
520
+
521
+ - Remove wheel position from u_cursor
522
+
523
+ ## 1.0.0-alpha.10
524
+
525
+ ### Minor Changes
526
+
527
+ - Add reset() and onResize
528
+
529
+ ## 1.0.0-alpha.9
530
+
531
+ ### Patch Changes
532
+
533
+ - Make initial history frames transparent
534
+
535
+ ## 1.0.0-alpha.8
536
+
537
+ ### Minor Changes
538
+
539
+ - Allow `initializeTexture` and `history` to exist in the same shader
540
+
541
+ ## 1.0.0-alpha.7
542
+
543
+ ### Minor Changes
544
+
545
+ - - **WebGL 2.0 upgrade** 🚀
546
+
547
+ ShaderPad now uses WebGL 2.0 and GLSL 3.00 ES. All shaders now use the `#version 300 es` directive with updated syntax:
548
+ - `attribute` → `in`
549
+ - `varying` → `out` (vertex) / `in` (fragment)
550
+ - `gl_FragColor` → custom `out` variables
551
+ - `texture2D` → `texture`
552
+
553
+ This is a breaking change - existing shaders will need to be updated to use the new syntax.
554
+
555
+ - **Frame history buffers**
556
+
557
+ Added support for frame history buffers, enabling shaders to reference prior frames. The `u_history` uniform provides access to previous frames as a `sampler2DArray`.
558
+
559
+ ```typescript
560
+ // 2-frame history (eg. for cellular automata)
561
+ const shader = new ShaderPad(fragmentShaderSrc, { history: 2 });
562
+ ```
563
+
564
+ - **Options object constructor**
565
+
566
+ The constructor now accepts an options object instead of just a canvas element:
567
+
568
+ ```typescript
569
+ // Old API
570
+ const shader = new ShaderPad(fragmentShaderSrc, canvas);
571
+
572
+ // New API
573
+ const shader = new ShaderPad(fragmentShaderSrc, { canvas });
574
+ ```
575
+
576
+ - **Resize throttling**
577
+
578
+ Added throttled resize handling to improve performance during window resizing.
579
+
580
+ - **Minor bugfixes around click handling**
581
+
582
+ ## 1.0.0-alpha.6
583
+
584
+ ### Minor Changes
585
+
586
+ - Update uniform names to use conventional u\_ prefix
587
+
588
+ ### Patch Changes
589
+
590
+ - b9bf4b1: npx changeset version
591
+
592
+ ## 1.0.0-alpha.5
593
+
594
+ ### Minor Changes
595
+
596
+ - Enhanced mouse interaction uniforms
597
+
598
+ Updated the mouse interaction uniforms to provide comprehensive input tracking:
599
+ - `u_cursor` is now a `vec4` with cursor position (x, y) and scroll position (z, w)
600
+ - `u_click` is now a `vec3` with click position (x, y) and left click state (z)
601
+
602
+ This allows shaders to respond to cursor movement, scrolling, and mouse clicks.
603
+
604
+ - Callbacks passed to `play` now receive `time` in seconds, not milliseconds.
605
+
606
+ This improves consistency with the `u_time` uniform.
607
+
608
+ ## 1.0.0-alpha.4
609
+
610
+ ### Minor Changes
611
+
612
+ - Add step method and frame counter
613
+
614
+ This release adds a `shaderPad.step` method, which enables finer-grained control over animation loops. The `shaderPad.play` callback now receives a `frame` parameter, which is the current frame number.
615
+
616
+ ## 1.0.0-alpha.3
617
+
618
+ ### Minor Changes
619
+
620
+ - Add texture and destroy methods
621
+
622
+ This release adds `shaderPad.initializeTexture` and `shaderPad.updateTextures` methods, which roughly map to how `initializeUniform` and `updateUniform` works. It also adds a `shaderPad.destroy` method, which runs some general cleanup.
623
+
624
+ This release also fixes a bug where a passed-in canvas would resize indefinitely on a retina display.
625
+
626
+ ## 1.0.0-alpha.2
627
+
628
+ ### Patch Changes
629
+
630
+ - Remove log from save()
631
+
632
+ ## 1.0.0-alpha.1
633
+
634
+ ### Minor Changes
635
+
636
+ - Add save() method
637
+
638
+ This method saves the current frame to a PNG file. The filename is optional; if not provided, it will be "export.png".
639
+
640
+ ## 1.0.0-alpha.0
641
+
642
+ ### Major Changes
643
+
644
+ - Initial alpha release 🎉
645
+
646
+ I’ve started using this on a few projects, and I’m pretty confident that the API will retain this general shape. I want to try adopting ShaderPad into a few more projects before officially moving this out of alpha.
647
+
648
+ Always open to suggestions!
package/README.md CHANGED
@@ -240,7 +240,7 @@ shader.updateTextures({
240
240
 
241
241
  ### Lifecycle methods
242
242
 
243
- #### `play(onBeforeStep?)`
243
+ #### `play(onPreStep?)`
244
244
 
245
245
  Start the render loop.
246
246
 
@@ -257,7 +257,7 @@ shader.play((_time, frame) => {
257
257
 
258
258
  **Parameters:**
259
259
 
260
- - `onBeforeStep?`: `(time: number, frame: number) => StepOptions | void` - Called before each frame
260
+ - `onPreStep?`: `(time: number, frame: number) => StepOptions | void` - Called before each frame
261
261
 
262
262
  #### `step(options?)`
263
263
 
@@ -297,12 +297,12 @@ interface StepOptions {
297
297
  - `skipClear?: boolean` - If `true`, the canvas is not cleared before rendering. Useful for accumulating effects or multi-pass rendering.
298
298
  - `skipHistory?: boolean` - If `true`, history buffers are not updated. Useful when you want to render without affecting the history state.
299
299
 
300
- #### `pause()`, `reset()`, `destroy()`
300
+ #### `pause()`, `rewind()`, `reset()`, `destroy()`
301
301
 
302
302
  ```typescript
303
- shader.pause(); // Pause the render loop.
304
- shader.reset(); // Reset frame counter, clock, and clear history buffers.
305
- shader.resetFrame(); // Reset frame counter and clock only.
303
+ shader.pause(); // Pause the render loop and preserve playback time/frame.
304
+ shader.rewind(); // Reset frame counter and clock.
305
+ shader.reset(); // Rewind and clear output/history buffers.
306
306
  shader.destroy(); // Clean up resources.
307
307
  ```
308
308
 
@@ -352,10 +352,10 @@ Remove a previously registered callback.
352
352
  | `pause` | none | Fired when the render loop is paused |
353
353
  | `reset` | none | Fired when the shader is reset |
354
354
  | `destroy` | none | Fired when the shader is destroyed |
355
- | `beforeStep` | `(time: number, frame: number, options?: StepOptions)` | Fired before each render step |
356
- | `afterStep` | `(time: number, frame: number, options?: StepOptions)` | Fired after each render step |
357
- | `beforeDraw` | `(options?: StepOptions)` | Fired before each draw call |
358
- | `afterDraw` | `(options?: StepOptions)` | Fired after each draw call |
355
+ | `preStep` | `(time: number, frame: number, options?: StepOptions)` | Fired before each render step |
356
+ | `postStep` | `(time: number, frame: number, options?: StepOptions)` | Fired after each render step |
357
+ | `preDraw` | `(options?: StepOptions)` | Fired before each draw call |
358
+ | `postDraw` | `(options?: StepOptions)` | Fired after each draw call |
359
359
  | `initializeTexture` | `(name, source, options?)` | Fired after a texture is initialized |
360
360
  | `initializeUniform` | `(name, type, value, options?)` | Fired after a uniform is initialized |
361
361
  | `updateTextures` | `(updates)` | Fired after textures are updated |
@@ -371,7 +371,7 @@ inject GLSL, listen to lifecycle events with `shader.on(...)`, emit its own name
371
371
  textures with `updateTexture(...)`. If a plugin needs the backing canvas or raw WebGL access, use `shader.canvas` and
372
372
  `shader.gl`.
373
373
 
374
- The most useful lifecycle hooks are usually `_init` for setup, `beforeStep` / `beforeDraw` for per-frame work, and
374
+ The most useful lifecycle hooks are usually `_init` for setup, `preStep` / `preDraw` for per-frame work, and
375
375
  `destroy` for cleanup. Plugin order is stable: plugins install in `plugins[]` order, handlers run in registration
376
376
  order, and GLSL injections preserve plugin order. If a plugin touches shared GL state directly, it should restore that
377
377
  state before returning.