p5 2.2.2 → 2.2.3-rc.1

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 (98) hide show
  1. package/dist/accessibility/color_namer.js +5 -5
  2. package/dist/accessibility/index.js +5 -5
  3. package/dist/app.js +5 -5
  4. package/dist/color/color_conversion.js +5 -5
  5. package/dist/color/index.js +1 -1
  6. package/dist/color/setting.js +1 -1
  7. package/dist/{constants-BxjhKpTv.js → constants-BUwWryrh.js} +1 -1
  8. package/dist/core/constants.js +1 -1
  9. package/dist/core/environment.js +7 -3
  10. package/dist/core/filterShaders.js +1 -1
  11. package/dist/core/friendly_errors/fes_core.js +1 -1
  12. package/dist/core/friendly_errors/file_errors.js +1 -1
  13. package/dist/core/friendly_errors/index.js +1 -1
  14. package/dist/core/friendly_errors/param_validator.js +2063 -2014
  15. package/dist/core/friendly_errors/sketch_verifier.js +1 -1
  16. package/dist/core/helpers.js +1 -1
  17. package/dist/core/init.js +5 -5
  18. package/dist/core/internationalization.js +1 -1
  19. package/dist/core/legacy.js +5 -5
  20. package/dist/core/main.js +5 -5
  21. package/dist/core/p5.Graphics.js +3 -3
  22. package/dist/core/p5.Renderer.js +2 -2
  23. package/dist/core/p5.Renderer2D.js +5 -5
  24. package/dist/core/p5.Renderer3D.js +3 -3
  25. package/dist/core/rendering.js +3 -3
  26. package/dist/dom/dom.js +1 -1
  27. package/dist/dom/index.js +1 -1
  28. package/dist/dom/p5.Element.js +1 -1
  29. package/dist/dom/p5.MediaElement.js +11 -4
  30. package/dist/events/pointer.js +4 -0
  31. package/dist/image/const.js +1 -1
  32. package/dist/image/filterRenderer2D.js +4 -4
  33. package/dist/image/image.js +3 -3
  34. package/dist/image/index.js +3 -3
  35. package/dist/image/loading_displaying.js +3 -3
  36. package/dist/image/p5.Image.js +2 -2
  37. package/dist/io/files.js +3 -3
  38. package/dist/io/index.js +3 -3
  39. package/dist/{ir_builders-w12-GSxu.js → ir_builders-Cd6rU9Vm.js} +48 -14
  40. package/dist/{main-DDs4QOnh.js → main-DFpoFdvM.js} +126 -36
  41. package/dist/math/Matrices/Matrix.js +1 -1
  42. package/dist/math/Matrices/MatrixNumjs.js +1 -1
  43. package/dist/math/index.js +1 -1
  44. package/dist/math/p5.Matrix.js +1 -1
  45. package/dist/math/p5.Vector.js +1 -1
  46. package/dist/math/trigonometry.js +1 -1
  47. package/dist/{p5.Renderer-BSGddFv7.js → p5.Renderer-D-EuAodU.js} +9 -2
  48. package/dist/{rendering-C9g7uSQ5.js → rendering-DE9-Hl7Y.js} +103 -78
  49. package/dist/shape/2d_primitives.js +1 -1
  50. package/dist/shape/attributes.js +1 -1
  51. package/dist/shape/custom_shapes.js +1 -1
  52. package/dist/shape/index.js +1 -1
  53. package/dist/strands/ir_builders.js +1 -1
  54. package/dist/strands/ir_dag.js +32 -2
  55. package/dist/strands/ir_types.js +18 -11
  56. package/dist/strands/p5.strands.js +24 -35
  57. package/dist/strands/strands_api.js +86 -41
  58. package/dist/strands/strands_codegen.js +0 -12
  59. package/dist/strands/strands_conditionals.js +1 -1
  60. package/dist/strands/strands_for.js +1 -1
  61. package/dist/strands/strands_node.js +1 -1
  62. package/dist/strands/strands_phi_utils.js +27 -9
  63. package/dist/strands/strands_transpiler.js +1237 -831
  64. package/dist/type/index.js +2 -2
  65. package/dist/type/p5.Font.js +7 -5
  66. package/dist/type/textCore.js +2 -2
  67. package/dist/webgl/3d_primitives.js +3 -3
  68. package/dist/webgl/GeometryBuilder.js +1 -1
  69. package/dist/webgl/ShapeBuilder.js +1 -1
  70. package/dist/webgl/enums.js +1 -1
  71. package/dist/webgl/index.js +4 -4
  72. package/dist/webgl/interaction.js +1 -1
  73. package/dist/webgl/light.js +3 -3
  74. package/dist/webgl/loading.js +41 -35
  75. package/dist/webgl/material.js +3 -3
  76. package/dist/webgl/p5.Camera.js +3 -3
  77. package/dist/webgl/p5.Framebuffer.js +3 -3
  78. package/dist/webgl/p5.Geometry.js +1 -1
  79. package/dist/webgl/p5.Quat.js +1 -1
  80. package/dist/webgl/p5.RendererGL.js +4 -4
  81. package/dist/webgl/p5.Shader.js +14 -6
  82. package/dist/webgl/p5.Texture.js +3 -3
  83. package/dist/webgl/strands_glslBackend.js +1 -1
  84. package/dist/webgl/text.js +3 -3
  85. package/dist/webgl/utils.js +3 -3
  86. package/dist/webgpu/index.js +2 -2
  87. package/dist/webgpu/p5.RendererWebGPU.js +2 -2
  88. package/dist/webgpu/strands_wgslBackend.js +13 -4
  89. package/lib/p5.esm.js +3670 -2951
  90. package/lib/p5.esm.min.js +1 -1
  91. package/lib/p5.js +3670 -2951
  92. package/lib/p5.min.js +1 -1
  93. package/lib/p5.webgpu.esm.js +43 -21
  94. package/lib/p5.webgpu.js +43 -21
  95. package/lib/p5.webgpu.min.js +1 -1
  96. package/package.json +1 -1
  97. package/types/global.d.ts +1283 -1301
  98. package/types/p5.d.ts +655 -657
@@ -1,10 +1,10 @@
1
1
  import textCore from './textCore.js';
2
2
  import font from './p5.Font.js';
3
- import '../p5.Renderer-BSGddFv7.js';
3
+ import '../p5.Renderer-D-EuAodU.js';
4
4
  import '../creating_reading-C7hu6sg1.js';
5
5
  import 'colorjs.io/fn';
6
6
  import '../color/color_spaces/hsb.js';
7
- import '../constants-BxjhKpTv.js';
7
+ import '../constants-BUwWryrh.js';
8
8
  import '../image/filters.js';
9
9
  import '../math/p5.Vector.js';
10
10
  import '../shape/custom_shapes.js';
@@ -1,11 +1,11 @@
1
1
  import { textCoreConstants } from './textCore.js';
2
- import { v as CENTER, a9 as RIGHT, u as RADIUS } from '../constants-BxjhKpTv.js';
2
+ import { v as CENTER, a9 as RIGHT, u as RADIUS } from '../constants-BUwWryrh.js';
3
3
  import { UnicodeRange } from '@japont/unicode-range';
4
4
  import { unicodeRanges } from './unicodeRanges.js';
5
5
  import { Vector } from '../math/p5.Vector.js';
6
6
  import Typr from './lib/Typr.js';
7
7
  import { createFromCommands } from '@davepagurek/bezier-path';
8
- import '../p5.Renderer-BSGddFv7.js';
8
+ import '../p5.Renderer-D-EuAodU.js';
9
9
  import '../creating_reading-C7hu6sg1.js';
10
10
  import 'colorjs.io/fn';
11
11
  import '../color/color_spaces/hsb.js';
@@ -1553,9 +1553,11 @@ function font(p5, fn) {
1553
1553
  throw err;
1554
1554
  }
1555
1555
  }
1556
- if (success) return success(pfont);
1557
-
1558
- return pfont;
1556
+ const cb = () => {
1557
+ if (success) return success(pfont);
1558
+ return pfont;
1559
+ };
1560
+ return this._internal ? this._internal(cb) : cb();
1559
1561
  };
1560
1562
  }
1561
1563
  // Convert arrays to named objects
@@ -1,8 +1,8 @@
1
- import { R as Renderer } from '../p5.Renderer-BSGddFv7.js';
1
+ import { R as Renderer } from '../p5.Renderer-D-EuAodU.js';
2
2
  import '../creating_reading-C7hu6sg1.js';
3
3
  import 'colorjs.io/fn';
4
4
  import '../color/color_spaces/hsb.js';
5
- import '../constants-BxjhKpTv.js';
5
+ import '../constants-BUwWryrh.js';
6
6
  import '../image/filters.js';
7
7
  import '../math/p5.Vector.js';
8
8
  import '../shape/custom_shapes.js';
@@ -1,5 +1,5 @@
1
- import '../constants-BxjhKpTv.js';
2
- export { p as default } from '../rendering-C9g7uSQ5.js';
1
+ import '../constants-BUwWryrh.js';
2
+ export { p as default } from '../rendering-DE9-Hl7Y.js';
3
3
  import '../math/p5.Vector.js';
4
4
  import './p5.Geometry.js';
5
5
  import '../math/p5.Matrix.js';
@@ -10,7 +10,7 @@ import '../color/color_spaces/hsb.js';
10
10
  import '../dom/p5.Element.js';
11
11
  import '../dom/p5.File.js';
12
12
  import '../io/p5.XML.js';
13
- import '../p5.Renderer-BSGddFv7.js';
13
+ import '../p5.Renderer-D-EuAodU.js';
14
14
  import '../image/filters.js';
15
15
  import '../shape/custom_shapes.js';
16
16
  import '../core/States.js';
@@ -1,4 +1,4 @@
1
- import { T as TRIANGLE_STRIP, $ as QUAD_STRIP, _ as TRIANGLE_FAN, c as TRIANGLES } from '../constants-BxjhKpTv.js';
1
+ import { T as TRIANGLE_STRIP, $ as QUAD_STRIP, _ as TRIANGLE_FAN, c as TRIANGLES } from '../constants-BUwWryrh.js';
2
2
  import '../math/p5.Matrix.js';
3
3
  import { Geometry } from './p5.Geometry.js';
4
4
  import { Matrix } from '../math/Matrices/Matrix.js';
@@ -1,4 +1,4 @@
1
- import { K as PATH, Z as QUADS, $ as QUAD_STRIP, T as TRIANGLE_STRIP, c as TRIANGLES, ad as IMAGE, Y as LINES, _ as TRIANGLE_FAN } from '../constants-BxjhKpTv.js';
1
+ import { K as PATH, Z as QUADS, $ as QUAD_STRIP, T as TRIANGLE_STRIP, c as TRIANGLES, ad as IMAGE, Y as LINES, _ as TRIANGLE_FAN } from '../constants-BUwWryrh.js';
2
2
  import { Geometry } from './p5.Geometry.js';
3
3
  import libtess from 'libtess';
4
4
  import { Vector } from '../math/p5.Vector.js';
@@ -1,4 +1,4 @@
1
- import { a3 as constants } from '../constants-BxjhKpTv.js';
1
+ import { a3 as constants } from '../constants-BUwWryrh.js';
2
2
 
3
3
  function getStrokeDefs(shaderConstant) {
4
4
  const STROKE_CAP_ENUM = {};
@@ -1,4 +1,4 @@
1
- import { r as renderer3D, p as primitives3D, l as light, m as material, c as camera, f as framebuffer, t as texture } from '../rendering-C9g7uSQ5.js';
1
+ import { r as renderer3D, p as primitives3D, l as light, m as material, c as camera, f as framebuffer, t as texture } from '../rendering-DE9-Hl7Y.js';
2
2
  import interaction from './interaction.js';
3
3
  import loading from './loading.js';
4
4
  import text from './text.js';
@@ -8,14 +8,14 @@ import matrix from '../math/p5.Matrix.js';
8
8
  import geometry from './p5.Geometry.js';
9
9
  import dataArray from './p5.DataArray.js';
10
10
  import rendererGL from './p5.RendererGL.js';
11
- import '../constants-BxjhKpTv.js';
11
+ import '../constants-BUwWryrh.js';
12
12
  import '../creating_reading-C7hu6sg1.js';
13
13
  import 'colorjs.io/fn';
14
14
  import '../color/color_spaces/hsb.js';
15
15
  import '../dom/p5.Element.js';
16
16
  import '../dom/p5.File.js';
17
17
  import '../io/p5.XML.js';
18
- import '../p5.Renderer-BSGddFv7.js';
18
+ import '../p5.Renderer-D-EuAodU.js';
19
19
  import '../image/filters.js';
20
20
  import '../math/p5.Vector.js';
21
21
  import '../shape/custom_shapes.js';
@@ -55,7 +55,7 @@ import './strands_glslBackend.js';
55
55
  import '../strands/ir_types.js';
56
56
  import '../strands/ir_dag.js';
57
57
  import '../strands/strands_FES.js';
58
- import '../ir_builders-w12-GSxu.js';
58
+ import '../ir_builders-Cd6rU9Vm.js';
59
59
  import '../strands/ir_cfg.js';
60
60
  import '../strands/strands_builtins.js';
61
61
  import './shaderHookUtils.js';
@@ -1,4 +1,4 @@
1
- import { G as GRID, i as AXES } from '../constants-BxjhKpTv.js';
1
+ import { G as GRID, i as AXES } from '../constants-BUwWryrh.js';
2
2
  import { Vector } from '../math/p5.Vector.js';
3
3
 
4
4
  /**
@@ -1,13 +1,13 @@
1
- export { l as default } from '../rendering-C9g7uSQ5.js';
1
+ export { l as default } from '../rendering-DE9-Hl7Y.js';
2
2
  import '../math/p5.Vector.js';
3
3
  import '../creating_reading-C7hu6sg1.js';
4
- import '../constants-BxjhKpTv.js';
4
+ import '../constants-BUwWryrh.js';
5
5
  import '../dom/p5.Element.js';
6
6
  import '../dom/p5.File.js';
7
7
  import '../io/p5.XML.js';
8
8
  import 'colorjs.io/fn';
9
9
  import '../color/color_spaces/hsb.js';
10
- import '../p5.Renderer-BSGddFv7.js';
10
+ import '../p5.Renderer-D-EuAodU.js';
11
11
  import '../image/filters.js';
12
12
  import '../shape/custom_shapes.js';
13
13
  import '../core/States.js';
@@ -1,7 +1,7 @@
1
1
  import { Geometry } from './p5.Geometry.js';
2
2
  import { Vector } from '../math/p5.Vector.js';
3
- import { a as request } from '../rendering-C9g7uSQ5.js';
4
- import '../constants-BxjhKpTv.js';
3
+ import { a as request } from '../rendering-DE9-Hl7Y.js';
4
+ import '../constants-BUwWryrh.js';
5
5
  import './p5.DataArray.js';
6
6
  import '../io/utilities.js';
7
7
  import '../creating_reading-C7hu6sg1.js';
@@ -10,7 +10,7 @@ import '../color/color_spaces/hsb.js';
10
10
  import '../dom/p5.Element.js';
11
11
  import '../dom/p5.File.js';
12
12
  import '../io/p5.XML.js';
13
- import '../p5.Renderer-BSGddFv7.js';
13
+ import '../p5.Renderer-D-EuAodU.js';
14
14
  import '../image/filters.js';
15
15
  import '../shape/custom_shapes.js';
16
16
  import '../core/States.js';
@@ -460,50 +460,56 @@ function loading(p5, fn){
460
460
  try{
461
461
  if (fileType.match(/\.stl$/i)) {
462
462
  const { data } = await request(path, 'arrayBuffer');
463
- parseSTL(model, data);
463
+ const cb = () => {
464
+ parseSTL(model, data);
464
465
 
465
- if (normalize) {
466
- model.normalize();
467
- }
466
+ if (normalize) {
467
+ model.normalize();
468
+ }
468
469
 
469
- if (flipU) {
470
- model.flipU();
471
- }
470
+ if (flipU) {
471
+ model.flipU();
472
+ }
472
473
 
473
- if (flipV) {
474
- model.flipV();
475
- }
476
- model._makeTriangleEdges();
474
+ if (flipV) {
475
+ model.flipV();
476
+ }
477
+ model._makeTriangleEdges();
477
478
 
478
- if (successCallback) {
479
- return successCallback(model);
480
- } else {
481
- return model;
482
- }
479
+ if (successCallback) {
480
+ return successCallback(model);
481
+ } else {
482
+ return model;
483
+ }
484
+ };
485
+ return this._internal ? this._internal(cb) : cb();
483
486
 
484
487
  } else if (fileType.match(/\.obj$/i)) {
485
488
  const { data } = await request(path, 'text');
486
489
  const lines = data.split('\n');
487
490
 
488
491
  const parsedMaterials = await getMaterials(lines);
489
- parseObj(model, lines, parsedMaterials);
492
+ const cb = () => {
493
+ parseObj(model, lines, parsedMaterials);
490
494
 
491
- if (normalize) {
492
- model.normalize();
493
- }
494
- if (flipU) {
495
- model.flipU();
496
- }
497
- if (flipV) {
498
- model.flipV();
499
- }
500
- model._makeTriangleEdges();
495
+ if (normalize) {
496
+ model.normalize();
497
+ }
498
+ if (flipU) {
499
+ model.flipU();
500
+ }
501
+ if (flipV) {
502
+ model.flipV();
503
+ }
504
+ model._makeTriangleEdges();
501
505
 
502
- if (successCallback) {
503
- return successCallback(model);
504
- } else {
505
- return model;
506
- }
506
+ if (successCallback) {
507
+ return successCallback(model);
508
+ } else {
509
+ return model;
510
+ }
511
+ };
512
+ return this._internal ? this._internal(cb) : cb();
507
513
  }
508
514
  } catch(err) {
509
515
  p5._friendlyFileLoadError(3, path);
@@ -1,5 +1,5 @@
1
- import '../constants-BxjhKpTv.js';
2
- export { m as default } from '../rendering-C9g7uSQ5.js';
1
+ import '../constants-BUwWryrh.js';
2
+ export { m as default } from '../rendering-DE9-Hl7Y.js';
3
3
  import './p5.Shader.js';
4
4
  import '../creating_reading-C7hu6sg1.js';
5
5
  import '../dom/p5.Element.js';
@@ -7,7 +7,7 @@ import '../dom/p5.File.js';
7
7
  import '../io/p5.XML.js';
8
8
  import 'colorjs.io/fn';
9
9
  import '../color/color_spaces/hsb.js';
10
- import '../p5.Renderer-BSGddFv7.js';
10
+ import '../p5.Renderer-D-EuAodU.js';
11
11
  import '../image/filters.js';
12
12
  import '../math/p5.Vector.js';
13
13
  import '../shape/custom_shapes.js';
@@ -1,9 +1,9 @@
1
1
  import '../math/p5.Matrix.js';
2
2
  import '../math/p5.Vector.js';
3
3
  import './p5.Quat.js';
4
- export { C as Camera, c as default } from '../rendering-C9g7uSQ5.js';
4
+ export { C as Camera, c as default } from '../rendering-DE9-Hl7Y.js';
5
5
  import '../math/Matrices/Matrix.js';
6
- import '../constants-BxjhKpTv.js';
6
+ import '../constants-BUwWryrh.js';
7
7
  import '../math/Matrices/MatrixInterface.js';
8
8
  import '../creating_reading-C7hu6sg1.js';
9
9
  import 'colorjs.io/fn';
@@ -11,7 +11,7 @@ import '../color/color_spaces/hsb.js';
11
11
  import '../dom/p5.Element.js';
12
12
  import '../dom/p5.File.js';
13
13
  import '../io/p5.XML.js';
14
- import '../p5.Renderer-BSGddFv7.js';
14
+ import '../p5.Renderer-D-EuAodU.js';
15
15
  import '../image/filters.js';
16
16
  import '../shape/custom_shapes.js';
17
17
  import '../core/States.js';
@@ -1,12 +1,12 @@
1
- import '../constants-BxjhKpTv.js';
1
+ import '../constants-BUwWryrh.js';
2
2
  import '../creating_reading-C7hu6sg1.js';
3
- export { w as Framebuffer, v as FramebufferCamera, F as FramebufferTexture, f as default } from '../rendering-C9g7uSQ5.js';
3
+ export { w as Framebuffer, v as FramebufferCamera, F as FramebufferTexture, f as default } from '../rendering-DE9-Hl7Y.js';
4
4
  import 'colorjs.io/fn';
5
5
  import '../color/color_spaces/hsb.js';
6
6
  import '../dom/p5.Element.js';
7
7
  import '../dom/p5.File.js';
8
8
  import '../io/p5.XML.js';
9
- import '../p5.Renderer-BSGddFv7.js';
9
+ import '../p5.Renderer-D-EuAodU.js';
10
10
  import '../image/filters.js';
11
11
  import '../math/p5.Vector.js';
12
12
  import '../shape/custom_shapes.js';
@@ -1,4 +1,4 @@
1
- import { a7 as FLAT, a8 as SMOOTH } from '../constants-BxjhKpTv.js';
1
+ import { a7 as FLAT, a8 as SMOOTH } from '../constants-BUwWryrh.js';
2
2
  import { DataArray } from './p5.DataArray.js';
3
3
  import { Vector } from '../math/p5.Vector.js';
4
4
  import { downloadFile } from '../io/utilities.js';
@@ -1,5 +1,5 @@
1
1
  import { Vector } from '../math/p5.Vector.js';
2
- import '../constants-BxjhKpTv.js';
2
+ import '../constants-BUwWryrh.js';
3
3
 
4
4
  /**
5
5
  * @module Math
@@ -1,9 +1,9 @@
1
- import { ac as WEBGL, aa as WEBGL2, L as LIGHTEST, D as DARKEST, S as SUBTRACT, R as REPLACE, E as EXCLUSION, a as SCREEN, M as MULTIPLY, b as REMOVE, A as ADD, B as BLEND, c as TRIANGLES, p as CORNER, U as UNSIGNED_BYTE, g as LINEAR, aG as LINEAR_MIPMAP, h as TEXTURE, F as FLOAT, d as UNSIGNED_INT, H as HALF_FLOAT } from '../constants-BxjhKpTv.js';
2
- import { R as Renderer3D, o as readPixelWebGL, q as readPixelsWebGL, M as MipmapTexture, h as getWebGLShaderAttributes, g as getWebGLUniformMetadata, s as setWebGLUniformValue, e as setWebGLTextureParams, j as populateGLSLHooks, u as checkWebGLCapabilities } from '../rendering-C9g7uSQ5.js';
1
+ import { ac as WEBGL, aa as WEBGL2, L as LIGHTEST, D as DARKEST, S as SUBTRACT, R as REPLACE, E as EXCLUSION, a as SCREEN, M as MULTIPLY, b as REMOVE, A as ADD, B as BLEND, c as TRIANGLES, p as CORNER, U as UNSIGNED_BYTE, g as LINEAR, aG as LINEAR_MIPMAP, h as TEXTURE, F as FLOAT, d as UNSIGNED_INT, H as HALF_FLOAT } from '../constants-BUwWryrh.js';
2
+ import { R as Renderer3D, o as readPixelWebGL, q as readPixelsWebGL, M as MipmapTexture, h as getWebGLShaderAttributes, g as getWebGLUniformMetadata, s as setWebGLUniformValue, e as setWebGLTextureParams, j as populateGLSLHooks, u as checkWebGLCapabilities } from '../rendering-DE9-Hl7Y.js';
3
3
  import { getStrokeDefs } from './enums.js';
4
4
  import { Shader } from './p5.Shader.js';
5
5
  import { R as RGB, h as RGBA } from '../creating_reading-C7hu6sg1.js';
6
- import { I as Image } from '../p5.Renderer-BSGddFv7.js';
6
+ import { I as Image } from '../p5.Renderer-D-EuAodU.js';
7
7
  import { glslBackend } from './strands_glslBackend.js';
8
8
  import '../strands/ir_types.js';
9
9
  import { getShaderHookTypes } from './shaderHookUtils.js';
@@ -47,7 +47,7 @@ import '../core/filterShaders.js';
47
47
  import '../math/trigonometry.js';
48
48
  import '../strands/ir_dag.js';
49
49
  import '../strands/strands_FES.js';
50
- import '../ir_builders-w12-GSxu.js';
50
+ import '../ir_builders-Cd6rU9Vm.js';
51
51
  import '../strands/ir_cfg.js';
52
52
  import '../strands/strands_builtins.js';
53
53
 
@@ -206,24 +206,28 @@ class Shader {
206
206
  *
207
207
  * In addition to calling hooks, you can create uniforms, which are special variables
208
208
  * used to pass data from p5.js into the shader. They can be created by calling `uniform` + the
209
- * type of the data, such as `uniformFloat` for a number of `uniformVector2` for a two-component vector.
209
+ * type of the data, such as `uniformFloat` for a number or `uniformVector2` for a two-component vector.
210
210
  * They take in a function that returns the data for the variable. You can then reference these
211
211
  * variables in your hooks, and their values will update every time you apply
212
- * the shader with the result of your function.
212
+ * the shader with the result of your function.
213
+ *
214
+ * Move the mouse over this sketch to increase the moveCounter which will be passed to the shader as a uniform.
213
215
  *
214
216
  * ```js example
215
217
  * let myShader;
216
- *
218
+ * //count of frames in which mouse has been moved
219
+ * let moveCounter = 0;
220
+ *
217
221
  * function setup() {
218
222
  * createCanvas(200, 200, WEBGL);
219
223
  * myShader = baseMaterialShader().modify(() => {
220
- * // Get the current time from p5.js
221
- * let t = uniformFloat(() => millis());
224
+ * // Get the move counter from our sketch
225
+ * let count = uniformFloat(() => moveCounter);
222
226
  *
223
227
  * getPixelInputs((inputs) => {
224
228
  * inputs.color = [
225
229
  * inputs.texCoord,
226
- * sin(t * 0.01) / 2 + 0.5,
230
+ * sin(count/100) / 2 + 0.5,
227
231
  * 1,
228
232
  * ];
229
233
  * return inputs;
@@ -231,6 +235,10 @@ class Shader {
231
235
  * });
232
236
  * }
233
237
  *
238
+ * function mouseDragged(){
239
+ * moveCounter += 1;
240
+ * }
241
+ *
234
242
  * function draw() {
235
243
  * background(255);
236
244
  * noStroke(255);
@@ -1,8 +1,8 @@
1
- import '../constants-BxjhKpTv.js';
1
+ import '../constants-BUwWryrh.js';
2
2
  import '../dom/p5.Element.js';
3
- import '../p5.Renderer-BSGddFv7.js';
3
+ import '../p5.Renderer-D-EuAodU.js';
4
4
  import '../dom/p5.MediaElement.js';
5
- export { M as MipmapTexture, T as Texture, t as default } from '../rendering-C9g7uSQ5.js';
5
+ export { M as MipmapTexture, T as Texture, t as default } from '../rendering-DE9-Hl7Y.js';
6
6
  import '../dom/p5.File.js';
7
7
  import '../io/p5.XML.js';
8
8
  import '../creating_reading-C7hu6sg1.js';
@@ -1,7 +1,7 @@
1
1
  import { NodeTypeToName, NodeType, OpCode, BaseType, OpCodeToSymbol, isStructType, StatementType, DataType, BlockType } from '../strands/ir_types.js';
2
2
  import { getNodeDataFromID, extractNodeTypeInfo } from '../strands/ir_dag.js';
3
3
  import { internalError } from '../strands/strands_FES.js';
4
- import { f as functionCallNode } from '../ir_builders-w12-GSxu.js';
4
+ import { f as functionCallNode } from '../ir_builders-Cd6rU9Vm.js';
5
5
  import '../strands/ir_cfg.js';
6
6
  import '../strands/strands_builtins.js';
7
7
 
@@ -1,5 +1,5 @@
1
- import { h as TEXTURE, c as TRIANGLES } from '../constants-BxjhKpTv.js';
2
- import { R as Renderer3D } from '../rendering-C9g7uSQ5.js';
1
+ import { h as TEXTURE, c as TRIANGLES } from '../constants-BUwWryrh.js';
2
+ import { R as Renderer3D } from '../rendering-DE9-Hl7Y.js';
3
3
  import { Vector } from '../math/p5.Vector.js';
4
4
  import { Geometry } from './p5.Geometry.js';
5
5
  import { Font, arrayCommandsToObjects } from '../type/p5.Font.js';
@@ -9,7 +9,7 @@ import '../color/color_spaces/hsb.js';
9
9
  import '../dom/p5.Element.js';
10
10
  import '../dom/p5.File.js';
11
11
  import '../io/p5.XML.js';
12
- import '../p5.Renderer-BSGddFv7.js';
12
+ import '../p5.Renderer-D-EuAodU.js';
13
13
  import '../image/filters.js';
14
14
  import '../shape/custom_shapes.js';
15
15
  import '../core/States.js';
@@ -1,12 +1,12 @@
1
- import '../constants-BxjhKpTv.js';
2
- export { u as checkWebGLCapabilities, h as getWebGLShaderAttributes, g as getWebGLUniformMetadata, j as populateGLSLHooks, o as readPixelWebGL, q as readPixelsWebGL, e as setWebGLTextureParams, s as setWebGLUniformValue } from '../rendering-C9g7uSQ5.js';
1
+ import '../constants-BUwWryrh.js';
2
+ export { u as checkWebGLCapabilities, h as getWebGLShaderAttributes, g as getWebGLUniformMetadata, j as populateGLSLHooks, o as readPixelWebGL, q as readPixelsWebGL, e as setWebGLTextureParams, s as setWebGLUniformValue } from '../rendering-DE9-Hl7Y.js';
3
3
  import '../creating_reading-C7hu6sg1.js';
4
4
  import 'colorjs.io/fn';
5
5
  import '../color/color_spaces/hsb.js';
6
6
  import '../dom/p5.Element.js';
7
7
  import '../dom/p5.File.js';
8
8
  import '../io/p5.XML.js';
9
- import '../p5.Renderer-BSGddFv7.js';
9
+ import '../p5.Renderer-D-EuAodU.js';
10
10
  import '../image/filters.js';
11
11
  import '../math/p5.Vector.js';
12
12
  import '../shape/custom_shapes.js';
@@ -1,5 +1,5 @@
1
1
  import rendererWebGPU from './p5.RendererWebGPU.js';
2
- import '../constants-BxjhKpTv.js';
2
+ import '../constants-BUwWryrh.js';
3
3
  import '../webgl/enums.js';
4
4
  import '../strands/ir_types.js';
5
5
  import './shaders/color.js';
@@ -10,7 +10,7 @@ import './shaders/blit.js';
10
10
  import './strands_wgslBackend.js';
11
11
  import '../strands/ir_dag.js';
12
12
  import '../strands/strands_FES.js';
13
- import '../ir_builders-w12-GSxu.js';
13
+ import '../ir_builders-Cd6rU9Vm.js';
14
14
  import '../strands/ir_cfg.js';
15
15
  import '../strands/strands_builtins.js';
16
16
  import './shaders/functions/noise3DWGSL.js';
@@ -1,4 +1,4 @@
1
- import { W as WEBGPU, T as TRIANGLE_STRIP, L as LIGHTEST, D as DARKEST, S as SUBTRACT, R as REPLACE, E as EXCLUSION, a as SCREEN, M as MULTIPLY, b as REMOVE, A as ADD, B as BLEND, c as TRIANGLES, U as UNSIGNED_BYTE, F as FLOAT, H as HALF_FLOAT, d as UNSIGNED_INT, e as MIRROR, f as REPEAT, C as CLAMP, g as LINEAR, N as NEAREST } from '../constants-BxjhKpTv.js';
1
+ import { W as WEBGPU, T as TRIANGLE_STRIP, L as LIGHTEST, D as DARKEST, S as SUBTRACT, R as REPLACE, E as EXCLUSION, a as SCREEN, M as MULTIPLY, b as REMOVE, A as ADD, B as BLEND, c as TRIANGLES, U as UNSIGNED_BYTE, F as FLOAT, H as HALF_FLOAT, d as UNSIGNED_INT, e as MIRROR, f as REPEAT, C as CLAMP, g as LINEAR, N as NEAREST } from '../constants-BUwWryrh.js';
2
2
  import { getStrokeDefs } from '../webgl/enums.js';
3
3
  import { DataType } from '../strands/ir_types.js';
4
4
  import { colorVertexShader, colorFragmentShader } from './shaders/color.js';
@@ -12,7 +12,7 @@ import { baseFilterVertexShader, baseFilterFragmentShader } from './shaders/filt
12
12
  import { imageLightVertexShader, imageLightDiffusedFragmentShader, imageLightSpecularFragmentShader } from './shaders/imageLight.js';
13
13
  import '../strands/ir_dag.js';
14
14
  import '../strands/strands_FES.js';
15
- import '../ir_builders-w12-GSxu.js';
15
+ import '../ir_builders-Cd6rU9Vm.js';
16
16
  import '../strands/ir_cfg.js';
17
17
  import '../strands/strands_builtins.js';
18
18
 
@@ -1,7 +1,7 @@
1
1
  import { BaseType, DataType, NodeTypeToName, NodeType, OpCode, OpCodeToSymbol, isStructType, StatementType, BlockType } from '../strands/ir_types.js';
2
2
  import { getNodeDataFromID, extractNodeTypeInfo } from '../strands/ir_dag.js';
3
3
  import { internalError } from '../strands/strands_FES.js';
4
- import { v as variableNode, c as createStrandsNode, f as functionCallNode } from '../ir_builders-w12-GSxu.js';
4
+ import { v as variableNode, c as createStrandsNode, f as functionCallNode } from '../ir_builders-Cd6rU9Vm.js';
5
5
  import '../strands/ir_cfg.js';
6
6
  import '../strands/strands_builtins.js';
7
7
 
@@ -75,10 +75,10 @@ const cfgHandlers = {
75
75
  // Initialize with default value - WGSL requires initialization
76
76
  let defaultValue;
77
77
  if (T.dimension === 1) {
78
- defaultValue = T.baseType === 'float' ? '0.0' : '0';
78
+ defaultValue = this.defaultScalarValue(T.baseType);
79
79
  } else {
80
80
  // For vector types, use constructor with repeated scalar values
81
- const scalarDefault = T.baseType === 'float' ? '0.0' : '0';
81
+ const scalarDefault = this.defaultScalarValue(T.baseType);
82
82
  const components = Array(T.dimension).fill(scalarDefault).join(', ');
83
83
  defaultValue = `${typeName}(${components})`;
84
84
  }
@@ -87,6 +87,15 @@ const cfgHandlers = {
87
87
  }
88
88
  this[BlockType.DEFAULT](blockID, strandsContext, generationContext);
89
89
  },
90
+ defaultScalarValue(baseType) {
91
+ if (baseType === BaseType.FLOAT) {
92
+ return '0.0';
93
+ } else if (baseType === BaseType.BOOL) {
94
+ return 'false';
95
+ } else {
96
+ return '0';
97
+ }
98
+ },
90
99
  [BlockType.IF_COND](blockID, strandsContext, generationContext) {
91
100
  const { dag, cfg } = strandsContext;
92
101
  const conditionID = cfg.blockConditions[blockID];
@@ -466,7 +475,7 @@ const wgslBackend = {
466
475
  if (validInputs.length > 0) {
467
476
  return this.generateExpression(generationContext, dag, validInputs[0]);
468
477
  } else {
469
- throw new Error(`No valid inputs for node`)
478
+ throw new Error('No valid inputs for node');
470
479
  }
471
480
  }
472
481
  case NodeType.ASSIGNMENT: