p5 2.1.2 → 2.2.0-rc.2
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.
- package/dist/accessibility/color_namer.js +18 -5
- package/dist/accessibility/gridOutput.js +1 -1
- package/dist/accessibility/index.js +18 -5
- package/dist/accessibility/textOutput.js +1 -1
- package/dist/app.js +22 -14
- package/dist/color/color_conversion.js +18 -5
- package/dist/color/index.js +1 -1
- package/dist/color/setting.js +1 -1
- package/dist/{constants-Bt1VTUeD.js → constants-D2K8cOhy.js} +18 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +1 -1
- package/dist/core/filterShaders.js +186 -0
- package/dist/core/friendly_errors/fes_core.js +1 -1
- package/dist/core/friendly_errors/file_errors.js +1 -1
- package/dist/core/friendly_errors/index.js +1 -1
- package/dist/core/friendly_errors/param_validator.js +3 -5
- package/dist/core/friendly_errors/sketch_verifier.js +1 -1
- package/dist/core/helpers.js +1 -1
- package/dist/core/init.js +18 -5
- package/dist/core/internationalization.js +1 -1
- package/dist/core/legacy.js +18 -5
- package/dist/core/main.js +19 -6
- package/dist/core/p5.Graphics.js +8 -4
- package/dist/core/p5.Renderer.js +2 -2
- package/dist/core/p5.Renderer2D.js +18 -5
- package/dist/core/p5.Renderer3D.js +44 -0
- package/dist/core/rendering.js +8 -4
- package/dist/core/structure.js +2 -0
- package/dist/dom/dom.js +1 -1
- package/dist/dom/index.js +1 -1
- package/dist/dom/p5.Element.js +1 -1
- package/dist/dom/p5.MediaElement.js +1 -1
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +225 -62
- package/dist/image/image.js +8 -4
- package/dist/image/index.js +8 -4
- package/dist/image/loading_displaying.js +8 -4
- package/dist/image/p5.Image.js +2 -2
- package/dist/image/pixels.js +1 -1
- package/dist/io/files.js +8 -4
- package/dist/io/index.js +8 -4
- package/dist/{ir_builders-Cn4s8QTL.js → ir_builders-ChBqXfTD.js} +1 -1
- package/dist/{main-IPkchNDB.js → main-CD4LM0Lf.js} +114 -3
- package/dist/math/Matrices/Matrix.js +1 -1
- package/dist/math/Matrices/MatrixNumjs.js +1 -1
- package/dist/math/index.js +1 -1
- package/dist/math/p5.Matrix.js +1 -1
- package/dist/math/p5.Vector.js +1 -1
- package/dist/math/trigonometry.js +1 -1
- package/dist/noise3DGLSL-ew4WIWsn.js +9 -0
- package/dist/{p5.Renderer-C-tu2oim.js → p5.Renderer-BTkvGcQp.js} +24 -1
- package/dist/{rendering-COLWmJqb.js → rendering-DNmvln5l.js} +1549 -4244
- package/dist/shape/2d_primitives.js +1 -1
- package/dist/shape/attributes.js +1 -1
- package/dist/shape/custom_shapes.js +52 -47
- package/dist/shape/index.js +1 -1
- package/dist/strands/ir_builders.js +1 -1
- package/dist/strands/ir_types.js +7 -32
- package/dist/strands/p5.strands.js +37 -23
- package/dist/strands/strands_api.js +51 -13
- package/dist/strands/strands_builtins.js +1 -5
- package/dist/strands/strands_codegen.js +24 -11
- package/dist/strands/strands_conditionals.js +4 -1
- package/dist/strands/strands_for.js +15 -4
- package/dist/strands/strands_node.js +1 -1
- package/dist/strands/strands_phi_utils.js +4 -1
- package/dist/strands/strands_transpiler.js +16 -8
- package/dist/type/index.js +2 -2
- package/dist/type/p5.Font.js +2 -2
- package/dist/type/textCore.js +5 -227
- package/dist/webgl/3d_primitives.js +8 -4
- package/dist/webgl/GeometryBufferCache.js +12 -54
- package/dist/webgl/GeometryBuilder.js +1 -1
- package/dist/webgl/ShapeBuilder.js +1 -1
- package/dist/webgl/enums.js +28 -0
- package/dist/webgl/index.js +28 -33
- package/dist/webgl/interaction.js +1 -1
- package/dist/webgl/light.js +8 -4
- package/dist/webgl/loading.js +8 -4
- package/dist/webgl/material.js +8 -4
- package/dist/webgl/p5.Camera.js +8 -4
- package/dist/webgl/p5.Framebuffer.js +14 -10
- package/dist/webgl/p5.Geometry.js +15 -6
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RenderBuffer.js +6 -44
- package/dist/webgl/p5.RendererGL.js +2092 -22
- package/dist/webgl/p5.Shader.js +1218 -40
- package/dist/webgl/p5.Texture.js +8 -4
- package/dist/webgl/shaderHookUtils.js +80 -0
- package/dist/{strands → webgl}/strands_glslBackend.js +27 -5
- package/dist/webgl/text.js +14 -29
- package/dist/webgl/utils.js +44 -0
- package/dist/webgpu/index.js +23 -0
- package/dist/webgpu/p5.RendererWebGPU.js +2604 -0
- package/dist/webgpu/shaders/color.js +114 -0
- package/dist/webgpu/shaders/filters/base.js +73 -0
- package/dist/webgpu/shaders/font.js +285 -0
- package/dist/webgpu/shaders/functions/noise3DWGSL.js +109 -0
- package/dist/webgpu/shaders/imageLight.js +228 -0
- package/dist/webgpu/shaders/line.js +358 -0
- package/dist/webgpu/shaders/material.js +421 -0
- package/dist/webgpu/strands_wgslBackend.js +504 -0
- package/lib/p5.esm.js +28635 -27694
- package/lib/p5.esm.min.js +1 -1
- package/lib/p5.js +28635 -27694
- package/lib/p5.min.js +1 -1
- package/lib/p5.webgpu.esm.js +7030 -0
- package/lib/p5.webgpu.js +7035 -0
- package/lib/p5.webgpu.min.js +1 -0
- package/package.json +5 -1
- package/types/global.d.ts +61 -26
- package/types/p5.d.ts +34 -13
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import color_conversion from '../color/color_conversion.js';
|
|
2
|
-
import '../main-
|
|
3
|
-
import '../constants-
|
|
2
|
+
import '../main-CD4LM0Lf.js';
|
|
3
|
+
import '../constants-D2K8cOhy.js';
|
|
4
4
|
import '../core/transform.js';
|
|
5
5
|
import '../core/structure.js';
|
|
6
6
|
import '../core/environment.js';
|
|
7
|
-
import '../rendering-
|
|
7
|
+
import '../rendering-DNmvln5l.js';
|
|
8
8
|
import '../creating_reading-p2iQtNm5.js';
|
|
9
9
|
import 'colorjs.io/fn';
|
|
10
10
|
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-
|
|
14
|
+
import '../p5.Renderer-BTkvGcQp.js';
|
|
15
15
|
import '../image/filters.js';
|
|
16
16
|
import '../math/p5.Vector.js';
|
|
17
17
|
import '../shape/custom_shapes.js';
|
|
@@ -36,13 +36,26 @@ import '../math/Matrices/MatrixInterface.js';
|
|
|
36
36
|
import '../webgl/p5.Geometry.js';
|
|
37
37
|
import '../webgl/p5.DataArray.js';
|
|
38
38
|
import '../webgl/p5.Quat.js';
|
|
39
|
-
import '../webgl/p5.RenderBuffer.js';
|
|
40
39
|
import '../webgl/ShapeBuilder.js';
|
|
41
40
|
import 'libtess';
|
|
41
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
42
42
|
import '../webgl/GeometryBufferCache.js';
|
|
43
43
|
import '../image/const.js';
|
|
44
|
+
import '../type/textCore.js';
|
|
45
|
+
import '../core/filterShaders.js';
|
|
46
|
+
import '../webgl/enums.js';
|
|
47
|
+
import '../webgl/p5.Shader.js';
|
|
44
48
|
import '../math/trigonometry.js';
|
|
45
49
|
import '../image/filterRenderer2D.js';
|
|
50
|
+
import '../noise3DGLSL-ew4WIWsn.js';
|
|
51
|
+
import '../webgl/strands_glslBackend.js';
|
|
52
|
+
import '../strands/ir_types.js';
|
|
53
|
+
import '../strands/ir_dag.js';
|
|
54
|
+
import '../strands/strands_FES.js';
|
|
55
|
+
import '../ir_builders-ChBqXfTD.js';
|
|
56
|
+
import '../strands/ir_cfg.js';
|
|
57
|
+
import '../strands/strands_builtins.js';
|
|
58
|
+
import '../webgl/shaderHookUtils.js';
|
|
46
59
|
|
|
47
60
|
/**
|
|
48
61
|
* @module Environment
|
|
@@ -10,7 +10,7 @@ function gridOutput(p5, fn){
|
|
|
10
10
|
|
|
11
11
|
//updates gridOutput
|
|
12
12
|
fn._updateGridOutput = function(idT) {
|
|
13
|
-
if (this._renderer && this._renderer
|
|
13
|
+
if (this._renderer && this._renderer.isP3D) {
|
|
14
14
|
if (!this._didOutputGridWebGLMessage) {
|
|
15
15
|
this._didOutputGridWebGLMessage = true;
|
|
16
16
|
console.error('gridOutput() does not yet work in WebGL mode.');
|
|
@@ -4,19 +4,19 @@ import textOutput from './textOutput.js';
|
|
|
4
4
|
import outputs from './outputs.js';
|
|
5
5
|
import colorNamer from './color_namer.js';
|
|
6
6
|
import '../color/color_conversion.js';
|
|
7
|
-
import '../main-
|
|
8
|
-
import '../constants-
|
|
7
|
+
import '../main-CD4LM0Lf.js';
|
|
8
|
+
import '../constants-D2K8cOhy.js';
|
|
9
9
|
import '../core/transform.js';
|
|
10
10
|
import '../core/structure.js';
|
|
11
11
|
import '../core/environment.js';
|
|
12
|
-
import '../rendering-
|
|
12
|
+
import '../rendering-DNmvln5l.js';
|
|
13
13
|
import '../creating_reading-p2iQtNm5.js';
|
|
14
14
|
import 'colorjs.io/fn';
|
|
15
15
|
import '../color/color_spaces/hsb.js';
|
|
16
16
|
import '../dom/p5.Element.js';
|
|
17
17
|
import '../dom/p5.File.js';
|
|
18
18
|
import '../io/p5.XML.js';
|
|
19
|
-
import '../p5.Renderer-
|
|
19
|
+
import '../p5.Renderer-BTkvGcQp.js';
|
|
20
20
|
import '../image/filters.js';
|
|
21
21
|
import '../math/p5.Vector.js';
|
|
22
22
|
import '../shape/custom_shapes.js';
|
|
@@ -41,13 +41,26 @@ import '../math/Matrices/MatrixInterface.js';
|
|
|
41
41
|
import '../webgl/p5.Geometry.js';
|
|
42
42
|
import '../webgl/p5.DataArray.js';
|
|
43
43
|
import '../webgl/p5.Quat.js';
|
|
44
|
-
import '../webgl/p5.RenderBuffer.js';
|
|
45
44
|
import '../webgl/ShapeBuilder.js';
|
|
46
45
|
import 'libtess';
|
|
46
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
47
47
|
import '../webgl/GeometryBufferCache.js';
|
|
48
48
|
import '../image/const.js';
|
|
49
|
+
import '../type/textCore.js';
|
|
50
|
+
import '../core/filterShaders.js';
|
|
51
|
+
import '../webgl/enums.js';
|
|
52
|
+
import '../webgl/p5.Shader.js';
|
|
49
53
|
import '../math/trigonometry.js';
|
|
50
54
|
import '../image/filterRenderer2D.js';
|
|
55
|
+
import '../noise3DGLSL-ew4WIWsn.js';
|
|
56
|
+
import '../webgl/strands_glslBackend.js';
|
|
57
|
+
import '../strands/ir_types.js';
|
|
58
|
+
import '../strands/ir_dag.js';
|
|
59
|
+
import '../strands/strands_FES.js';
|
|
60
|
+
import '../ir_builders-ChBqXfTD.js';
|
|
61
|
+
import '../strands/ir_cfg.js';
|
|
62
|
+
import '../strands/strands_builtins.js';
|
|
63
|
+
import '../webgl/shaderHookUtils.js';
|
|
51
64
|
|
|
52
65
|
function accessibility(p5){
|
|
53
66
|
p5.registerAddon(describe);
|
|
@@ -10,7 +10,7 @@ function textOutput(p5, fn){
|
|
|
10
10
|
|
|
11
11
|
//updates textOutput
|
|
12
12
|
fn._updateTextOutput = function(idT) {
|
|
13
|
-
if (this._renderer && this._renderer
|
|
13
|
+
if (this._renderer && this._renderer.isP3D) {
|
|
14
14
|
if (!this._didOutputTextWebGLMessage) {
|
|
15
15
|
this._didOutputTextWebGLMessage = true;
|
|
16
16
|
console.error('textOutput() does not yet work in WebGL mode.');
|
package/dist/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as p5 } from './main-
|
|
1
|
+
import { p as p5 } from './main-CD4LM0Lf.js';
|
|
2
2
|
import shape from './shape/index.js';
|
|
3
3
|
import accessibility from './accessibility/index.js';
|
|
4
4
|
import color from './color/index.js';
|
|
@@ -12,19 +12,21 @@ import math from './math/index.js';
|
|
|
12
12
|
import utilities from './utilities/index.js';
|
|
13
13
|
import webgl from './webgl/index.js';
|
|
14
14
|
import type from './type/index.js';
|
|
15
|
+
import shader from './webgl/p5.Shader.js';
|
|
16
|
+
import strands from './strands/p5.strands.js';
|
|
15
17
|
import { waitForDocumentReady, waitingForTranslator, _globalInit } from './core/init.js';
|
|
16
|
-
import './constants-
|
|
18
|
+
import './constants-D2K8cOhy.js';
|
|
17
19
|
import './core/transform.js';
|
|
18
20
|
import './core/structure.js';
|
|
19
21
|
import './core/environment.js';
|
|
20
|
-
import './rendering-
|
|
22
|
+
import './rendering-DNmvln5l.js';
|
|
21
23
|
import './creating_reading-p2iQtNm5.js';
|
|
22
24
|
import 'colorjs.io/fn';
|
|
23
25
|
import './color/color_spaces/hsb.js';
|
|
24
26
|
import './dom/p5.Element.js';
|
|
25
27
|
import './dom/p5.File.js';
|
|
26
28
|
import './io/p5.XML.js';
|
|
27
|
-
import './p5.Renderer-
|
|
29
|
+
import './p5.Renderer-BTkvGcQp.js';
|
|
28
30
|
import './image/filters.js';
|
|
29
31
|
import './math/p5.Vector.js';
|
|
30
32
|
import './shape/custom_shapes.js';
|
|
@@ -49,13 +51,25 @@ import './math/Matrices/MatrixInterface.js';
|
|
|
49
51
|
import './webgl/p5.Geometry.js';
|
|
50
52
|
import './webgl/p5.DataArray.js';
|
|
51
53
|
import './webgl/p5.Quat.js';
|
|
52
|
-
import './webgl/p5.RenderBuffer.js';
|
|
53
54
|
import './webgl/ShapeBuilder.js';
|
|
54
55
|
import 'libtess';
|
|
56
|
+
import './webgl/p5.RenderBuffer.js';
|
|
55
57
|
import './webgl/GeometryBufferCache.js';
|
|
56
58
|
import './image/const.js';
|
|
59
|
+
import './type/textCore.js';
|
|
60
|
+
import './core/filterShaders.js';
|
|
61
|
+
import './webgl/enums.js';
|
|
57
62
|
import './math/trigonometry.js';
|
|
58
63
|
import './image/filterRenderer2D.js';
|
|
64
|
+
import './noise3DGLSL-ew4WIWsn.js';
|
|
65
|
+
import './webgl/strands_glslBackend.js';
|
|
66
|
+
import './strands/ir_types.js';
|
|
67
|
+
import './strands/ir_dag.js';
|
|
68
|
+
import './strands/strands_FES.js';
|
|
69
|
+
import './ir_builders-ChBqXfTD.js';
|
|
70
|
+
import './strands/ir_cfg.js';
|
|
71
|
+
import './strands/strands_builtins.js';
|
|
72
|
+
import './webgl/shaderHookUtils.js';
|
|
59
73
|
import './accessibility/describe.js';
|
|
60
74
|
import './accessibility/gridOutput.js';
|
|
61
75
|
import './accessibility/textOutput.js';
|
|
@@ -92,24 +106,16 @@ import './webgl/interaction.js';
|
|
|
92
106
|
import './webgl/loading.js';
|
|
93
107
|
import './webgl/text.js';
|
|
94
108
|
import './type/p5.Font.js';
|
|
95
|
-
import './type/textCore.js';
|
|
96
109
|
import '@japont/unicode-range';
|
|
97
110
|
import './type/unicodeRanges.js';
|
|
98
111
|
import './type/lib/Typr.js';
|
|
99
112
|
import 'pako';
|
|
100
113
|
import '@davepagurek/bezier-path';
|
|
101
|
-
import './
|
|
102
|
-
import './strands/strands_glslBackend.js';
|
|
103
|
-
import './strands/ir_types.js';
|
|
104
|
-
import './strands/ir_dag.js';
|
|
105
|
-
import './strands/strands_FES.js';
|
|
114
|
+
import './webgl/p5.RendererGL.js';
|
|
106
115
|
import './strands/strands_transpiler.js';
|
|
107
116
|
import 'escodegen';
|
|
108
|
-
import './strands/ir_cfg.js';
|
|
109
117
|
import './strands/strands_codegen.js';
|
|
110
118
|
import './strands/strands_api.js';
|
|
111
|
-
import './ir_builders-Cn4s8QTL.js';
|
|
112
|
-
import './strands/strands_builtins.js';
|
|
113
119
|
import './strands/strands_conditionals.js';
|
|
114
120
|
import './strands/strands_phi_utils.js';
|
|
115
121
|
import './strands/strands_for.js';
|
|
@@ -128,6 +134,8 @@ math(p5);
|
|
|
128
134
|
utilities(p5);
|
|
129
135
|
webgl(p5);
|
|
130
136
|
type(p5);
|
|
137
|
+
p5.registerAddon(shader);
|
|
138
|
+
p5.registerAddon(strands);
|
|
131
139
|
Promise.all([waitForDocumentReady(), waitingForTranslator]).then(_globalInit);
|
|
132
140
|
|
|
133
141
|
export { p5 as default };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { p as p5 } from '../main-
|
|
2
|
-
import '../constants-
|
|
1
|
+
import { p as p5 } from '../main-CD4LM0Lf.js';
|
|
2
|
+
import '../constants-D2K8cOhy.js';
|
|
3
3
|
import '../core/transform.js';
|
|
4
4
|
import '../core/structure.js';
|
|
5
5
|
import '../core/environment.js';
|
|
6
|
-
import '../rendering-
|
|
6
|
+
import '../rendering-DNmvln5l.js';
|
|
7
7
|
import '../creating_reading-p2iQtNm5.js';
|
|
8
8
|
import 'colorjs.io/fn';
|
|
9
9
|
import './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-
|
|
13
|
+
import '../p5.Renderer-BTkvGcQp.js';
|
|
14
14
|
import '../image/filters.js';
|
|
15
15
|
import '../math/p5.Vector.js';
|
|
16
16
|
import '../shape/custom_shapes.js';
|
|
@@ -35,13 +35,26 @@ import '../math/Matrices/MatrixInterface.js';
|
|
|
35
35
|
import '../webgl/p5.Geometry.js';
|
|
36
36
|
import '../webgl/p5.DataArray.js';
|
|
37
37
|
import '../webgl/p5.Quat.js';
|
|
38
|
-
import '../webgl/p5.RenderBuffer.js';
|
|
39
38
|
import '../webgl/ShapeBuilder.js';
|
|
40
39
|
import 'libtess';
|
|
40
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
41
41
|
import '../webgl/GeometryBufferCache.js';
|
|
42
42
|
import '../image/const.js';
|
|
43
|
+
import '../type/textCore.js';
|
|
44
|
+
import '../core/filterShaders.js';
|
|
45
|
+
import '../webgl/enums.js';
|
|
46
|
+
import '../webgl/p5.Shader.js';
|
|
43
47
|
import '../math/trigonometry.js';
|
|
44
48
|
import '../image/filterRenderer2D.js';
|
|
49
|
+
import '../noise3DGLSL-ew4WIWsn.js';
|
|
50
|
+
import '../webgl/strands_glslBackend.js';
|
|
51
|
+
import '../strands/ir_types.js';
|
|
52
|
+
import '../strands/ir_dag.js';
|
|
53
|
+
import '../strands/strands_FES.js';
|
|
54
|
+
import '../ir_builders-ChBqXfTD.js';
|
|
55
|
+
import '../strands/ir_cfg.js';
|
|
56
|
+
import '../strands/strands_builtins.js';
|
|
57
|
+
import '../webgl/shaderHookUtils.js';
|
|
45
58
|
|
|
46
59
|
/**
|
|
47
60
|
* @module Color
|
package/dist/color/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { c as creatingReading, a as color$1 } from '../creating_reading-p2iQtNm5
|
|
|
2
2
|
import setting from './setting.js';
|
|
3
3
|
import 'colorjs.io/fn';
|
|
4
4
|
import './color_spaces/hsb.js';
|
|
5
|
-
import '../constants-
|
|
5
|
+
import '../constants-D2K8cOhy.js';
|
|
6
6
|
|
|
7
7
|
function color(p5){
|
|
8
8
|
p5.registerAddon(creatingReading);
|
package/dist/color/setting.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a2 as NORMAL, B as BLEND } from '../constants-D2K8cOhy.js';
|
|
2
2
|
import { R as RGB, b as RGBHDR, H as HSB, d as HSL, e as HWB, L as LAB, f as LCH, O as OKLAB, g as OKLCH } from '../creating_reading-p2iQtNm5.js';
|
|
3
3
|
import 'colorjs.io/fn';
|
|
4
4
|
import './color_spaces/hsb.js';
|
|
@@ -11,7 +11,7 @@ const _PI = Math.PI;
|
|
|
11
11
|
* @property {String} VERSION
|
|
12
12
|
* @final
|
|
13
13
|
*/
|
|
14
|
-
const VERSION = '2.
|
|
14
|
+
const VERSION = '2.2.0-rc.2';
|
|
15
15
|
|
|
16
16
|
// GRAPHICS RENDERER
|
|
17
17
|
/**
|
|
@@ -72,6 +72,13 @@ const WEBGL = 'webgl';
|
|
|
72
72
|
*/
|
|
73
73
|
const WEBGL2 = 'webgl2';
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* A constant used for creating a WebGPU rendering context
|
|
77
|
+
* @property {'webgpu'} WEBGPU
|
|
78
|
+
* @final
|
|
79
|
+
*/
|
|
80
|
+
const WEBGPU = 'webgpu';
|
|
81
|
+
|
|
75
82
|
// ENVIRONMENT
|
|
76
83
|
/**
|
|
77
84
|
* @typedef {'default'} ARROW
|
|
@@ -1141,6 +1148,13 @@ const IMAGE = 'image';
|
|
|
1141
1148
|
|
|
1142
1149
|
// WEBGL TEXTURE WRAP AND FILTERING
|
|
1143
1150
|
// LINEAR already exists above
|
|
1151
|
+
/**
|
|
1152
|
+
* @typedef {'linear_mipmap'} LINEAR_MIPMAP
|
|
1153
|
+
* @property {LINEAR_MIPMAP} LINEAR_MIPMAP
|
|
1154
|
+
* @final
|
|
1155
|
+
* @private
|
|
1156
|
+
*/
|
|
1157
|
+
const LINEAR_MIPMAP = 'linear_mipmap';
|
|
1144
1158
|
/**
|
|
1145
1159
|
* @typedef {'nearest'} NEAREST
|
|
1146
1160
|
* @property {NEAREST} NEAREST
|
|
@@ -1360,6 +1374,7 @@ var constants = /*#__PURE__*/Object.freeze({
|
|
|
1360
1374
|
LEFT_ARROW: LEFT_ARROW,
|
|
1361
1375
|
LIGHTEST: LIGHTEST,
|
|
1362
1376
|
LINEAR: LINEAR,
|
|
1377
|
+
LINEAR_MIPMAP: LINEAR_MIPMAP,
|
|
1363
1378
|
LINES: LINES,
|
|
1364
1379
|
LINE_LOOP: LINE_LOOP,
|
|
1365
1380
|
LINE_STRIP: LINE_STRIP,
|
|
@@ -1421,6 +1436,7 @@ var constants = /*#__PURE__*/Object.freeze({
|
|
|
1421
1436
|
WAIT: WAIT,
|
|
1422
1437
|
WEBGL: WEBGL,
|
|
1423
1438
|
WEBGL2: WEBGL2,
|
|
1439
|
+
WEBGPU: WEBGPU,
|
|
1424
1440
|
WORD: WORD,
|
|
1425
1441
|
_CTX_MIDDLE: _CTX_MIDDLE,
|
|
1426
1442
|
_DEFAULT_FILL: _DEFAULT_FILL,
|
|
@@ -1429,4 +1445,4 @@ var constants = /*#__PURE__*/Object.freeze({
|
|
|
1429
1445
|
_DEFAULT_TEXT_FILL: _DEFAULT_TEXT_FILL
|
|
1430
1446
|
});
|
|
1431
1447
|
|
|
1432
|
-
export {
|
|
1448
|
+
export { QUAD_STRIP as $, ADD as A, BLEND as B, CLAMP as C, DARKEST as D, EXCLUSION as E, FLOAT as F, GRID as G, HALF_FLOAT as H, MITER as I, INCLUDE as J, PATH as K, LIGHTEST as L, MULTIPLY as M, NEAREST as N, EMPTY_PATH as O, P2D as P, OPEN as Q, REPLACE as R, SUBTRACT as S, TRIANGLE_STRIP as T, UNSIGNED_BYTE as U, CLOSE as V, WEBGPU as W, POINTS as X, LINES as Y, QUADS as Z, TRIANGLE_FAN as _, SCREEN as a, ITALIC as a$, EXCLUDE as a0, JOIN as a1, NORMAL as a2, constants as a3, AUTO as a4, RAD_TO_DEG as a5, DEG_TO_RAD as a6, FLAT as a7, SMOOTH as a8, RIGHT as a9, WORD as aA, COVER as aB, CONTAIN as aC, FILL as aD, SIMPLE as aE, FULL as aF, LINEAR_MIPMAP as aG, P2DHDR as aH, QUARTER_PI as aI, TAU as aJ, LINE_STRIP as aK, LINE_LOOP as aL, TESS as aM, ALT as aN, BACKSPACE as aO, CONTROL as aP, DELETE as aQ, DOWN_ARROW as aR, ENTER as aS, ESCAPE as aT, LEFT_ARROW as aU, OPTION as aV, RETURN as aW, RIGHT_ARROW as aX, SHIFT as aY, TAB as aZ, UP_ARROW as a_, WEBGL2 as aa, BLUR as ab, WEBGL as ac, IMAGE as ad, THRESHOLD as ae, POSTERIZE as af, OPAQUE as ag, DILATE as ah, ERODE as ai, INVERT as aj, GRAY as ak, _DEFAULT_FILL as al, _DEFAULT_STROKE as am, DIFFERENCE as an, OVERLAY as ao, HARD_LIGHT as ap, SOFT_LIGHT as aq, DODGE as ar, BURN as as, PIE as at, CHORD as au, LEFT as av, BOTTOM as aw, BASELINE as ax, TOP as ay, VERSION as az, REMOVE as b, BOLD as b0, BOLDITALIC as b1, CHAR as b2, _DEFAULT_TEXT_FILL as b3, _DEFAULT_LEADMULT as b4, _CTX_MIDDLE as b5, QUADRATIC as b6, BEZIER as b7, CURVE as b8, STROKE as b9, IMMEDIATE as ba, LANDSCAPE as bb, PORTRAIT as bc, LABEL as bd, FALLBACK as be, TRIANGLES as c, UNSIGNED_INT as d, MIRROR as e, REPEAT as f, LINEAR as g, TEXTURE as h, AXES as i, ARROW as j, CROSS as k, HAND as l, MOVE as m, TEXT as n, WAIT as o, CORNER as p, TWO_PI as q, HALF_PI as r, PI as s, CORNERS as t, RADIUS as u, CENTER as v, ROUND as w, SQUARE as x, PROJECT as y, BEVEL as z };
|
package/dist/core/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { A as ADD, aN as ALT, j as ARROW, a4 as AUTO, i as AXES, aO as BACKSPACE, ax as BASELINE, z as BEVEL, b7 as BEZIER, B as BLEND, ab as BLUR, b0 as BOLD, b1 as BOLDITALIC, aw as BOTTOM, as as BURN, v as CENTER, b2 as CHAR, au as CHORD, C as CLAMP, V as CLOSE, aC as CONTAIN, aP as CONTROL, p as CORNER, t as CORNERS, aB as COVER, k as CROSS, b8 as CURVE, D as DARKEST, a6 as DEG_TO_RAD, aQ as DELETE, an as DIFFERENCE, ah as DILATE, ar as DODGE, aR as DOWN_ARROW, O as EMPTY_PATH, aS as ENTER, ai as ERODE, aT as ESCAPE, a0 as EXCLUDE, E as EXCLUSION, be as FALLBACK, aD as FILL, a7 as FLAT, F as FLOAT, aF as FULL, ak as GRAY, G as GRID, H as HALF_FLOAT, r as HALF_PI, l as HAND, ap as HARD_LIGHT, ad as IMAGE, ba as IMMEDIATE, J as INCLUDE, aj as INVERT, a$ as ITALIC, a1 as JOIN, bd as LABEL, bb as LANDSCAPE, av as LEFT, aU as LEFT_ARROW, L as LIGHTEST, g as LINEAR, aG as LINEAR_MIPMAP, Y as LINES, aL as LINE_LOOP, aK as LINE_STRIP, e as MIRROR, I as MITER, m as MOVE, M as MULTIPLY, N as NEAREST, a2 as NORMAL, ag as OPAQUE, Q as OPEN, aV as OPTION, ao as OVERLAY, P as P2D, aH as P2DHDR, K as PATH, s as PI, at as PIE, X as POINTS, bc as PORTRAIT, af as POSTERIZE, y as PROJECT, b6 as QUADRATIC, Z as QUADS, $ as QUAD_STRIP, aI as QUARTER_PI, u as RADIUS, a5 as RAD_TO_DEG, b as REMOVE, f as REPEAT, R as REPLACE, aW as RETURN, a9 as RIGHT, aX as RIGHT_ARROW, w as ROUND, a as SCREEN, aY as SHIFT, aE as SIMPLE, a8 as SMOOTH, aq as SOFT_LIGHT, x as SQUARE, b9 as STROKE, S as SUBTRACT, aZ as TAB, aJ as TAU, aM as TESS, n as TEXT, h as TEXTURE, ae as THRESHOLD, ay as TOP, c as TRIANGLES, _ as TRIANGLE_FAN, T as TRIANGLE_STRIP, q as TWO_PI, U as UNSIGNED_BYTE, d as UNSIGNED_INT, a_ as UP_ARROW, az as VERSION, o as WAIT, ac as WEBGL, aa as WEBGL2, W as WEBGPU, aA as WORD, b5 as _CTX_MIDDLE, al as _DEFAULT_FILL, b4 as _DEFAULT_LEADMULT, am as _DEFAULT_STROKE, b3 as _DEFAULT_TEXT_FILL } from '../constants-D2K8cOhy.js';
|
package/dist/core/environment.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { j as ARROW, k as CROSS, l as HAND, m as MOVE, n as TEXT, o as WAIT, P as P2D } from '../constants-D2K8cOhy.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @module Environment
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { ag as OPAQUE, ah as DILATE, ai as ERODE, ab as BLUR, af as POSTERIZE, ae as THRESHOLD, aj as INVERT, ak as GRAY } from '../constants-D2K8cOhy.js';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Creates p5.strands filter shaders for cross-platform compatibility
|
|
5
|
+
*/
|
|
6
|
+
function makeFilterShader(renderer, operation, p5) {
|
|
7
|
+
switch (operation) {
|
|
8
|
+
case GRAY:
|
|
9
|
+
return renderer.baseFilterShader().modify(() => {
|
|
10
|
+
p5.getColor((inputs, canvasContent) => {
|
|
11
|
+
const tex = p5.getTexture(canvasContent, inputs.texCoord);
|
|
12
|
+
// weighted grayscale with luminance values
|
|
13
|
+
const gray = p5.dot(tex.rgb, p5.vec3(0.2126, 0.7152, 0.0722));
|
|
14
|
+
return p5.vec4(gray, gray, gray, tex.a);
|
|
15
|
+
});
|
|
16
|
+
}, { p5 });
|
|
17
|
+
|
|
18
|
+
case INVERT:
|
|
19
|
+
return renderer.baseFilterShader().modify(() => {
|
|
20
|
+
p5.getColor((inputs, canvasContent) => {
|
|
21
|
+
const color = p5.getTexture(canvasContent, inputs.texCoord);
|
|
22
|
+
const invertedColor = p5.vec3(1.0) - color.rgb;
|
|
23
|
+
return p5.vec4(invertedColor, color.a);
|
|
24
|
+
});
|
|
25
|
+
}, { p5 });
|
|
26
|
+
|
|
27
|
+
case THRESHOLD:
|
|
28
|
+
return renderer.baseFilterShader().modify(() => {
|
|
29
|
+
const filterParameter = p5.uniformFloat();
|
|
30
|
+
p5.getColor((inputs, canvasContent) => {
|
|
31
|
+
const color = p5.getTexture(canvasContent, inputs.texCoord);
|
|
32
|
+
// weighted grayscale with luminance values
|
|
33
|
+
const gray = p5.dot(color.rgb, p5.vec3(0.2126, 0.7152, 0.0722));
|
|
34
|
+
const threshold = p5.floor(filterParameter * 255.0) / 255;
|
|
35
|
+
const blackOrWhite = p5.step(threshold, gray);
|
|
36
|
+
return p5.vec4(p5.vec3(blackOrWhite), color.a);
|
|
37
|
+
});
|
|
38
|
+
}, { p5 });
|
|
39
|
+
|
|
40
|
+
case POSTERIZE:
|
|
41
|
+
return renderer.baseFilterShader().modify(() => {
|
|
42
|
+
const filterParameter = p5.uniformFloat();
|
|
43
|
+
const quantize = (color, n) => {
|
|
44
|
+
// restrict values to N options/bins
|
|
45
|
+
// and floor each channel to nearest value
|
|
46
|
+
//
|
|
47
|
+
// eg. when N = 5, values = 0.0, 0.25, 0.50, 0.75, 1.0
|
|
48
|
+
// then quantize (0.1, 0.7, 0.9) -> (0.0, 0.5, 1.0)
|
|
49
|
+
|
|
50
|
+
color = color * n;
|
|
51
|
+
color = p5.floor(color);
|
|
52
|
+
color = color / (n - 1.0);
|
|
53
|
+
return color;
|
|
54
|
+
};
|
|
55
|
+
p5.getColor((inputs, canvasContent) => {
|
|
56
|
+
const color = p5.getTexture(canvasContent, inputs.texCoord);
|
|
57
|
+
const restrictedColor = quantize(color.rgb, filterParameter);
|
|
58
|
+
return p5.vec4(restrictedColor, color.a);
|
|
59
|
+
});
|
|
60
|
+
}, { p5 });
|
|
61
|
+
|
|
62
|
+
case BLUR:
|
|
63
|
+
return renderer.baseFilterShader().modify(() => {
|
|
64
|
+
const radius = p5.uniformFloat();
|
|
65
|
+
const direction = p5.uniformVec2();
|
|
66
|
+
|
|
67
|
+
// This isn't a real Gaussian weight, it's a quadratic weight
|
|
68
|
+
const quadWeight = (x, e) => {
|
|
69
|
+
return p5.pow(e - p5.abs(x), 2.0);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const random = (p) => {
|
|
73
|
+
let p3 = p5.fract(p.xyx * .1031);
|
|
74
|
+
p3 += p5.dot(p3, p3.yzx + 33.33);
|
|
75
|
+
return p5.fract((p3.x + p3.y) * p3.z);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
p5.getColor((inputs, canvasContent) => {
|
|
79
|
+
const uv = inputs.texCoord;
|
|
80
|
+
|
|
81
|
+
// A reasonable maximum number of samples
|
|
82
|
+
const maxSamples = 64.0;
|
|
83
|
+
|
|
84
|
+
let numSamples = p5.floor(radius * 7.0);
|
|
85
|
+
if (p5.mod(numSamples, 2) == 0.0) {
|
|
86
|
+
numSamples++;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let avg = p5.vec4(0.0);
|
|
90
|
+
let total = 0.0;
|
|
91
|
+
|
|
92
|
+
// Calculate the spacing to avoid skewing if numSamples > maxSamples
|
|
93
|
+
let spacing = 1.0;
|
|
94
|
+
if (numSamples > maxSamples) {
|
|
95
|
+
spacing = numSamples / maxSamples;
|
|
96
|
+
numSamples = maxSamples;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const randomOffset = (spacing - 1.0) * p5.mix(-0.5, 0.5, random(uv * inputs.canvasSize));
|
|
100
|
+
for (let i = 0; i < numSamples; i++) {
|
|
101
|
+
const sample = i * spacing - (numSamples - 1.0) * 0.5 * spacing + randomOffset;
|
|
102
|
+
const sampleCoord = uv + p5.vec2(sample, sample) / inputs.canvasSize * direction;
|
|
103
|
+
const weight = quadWeight(sample, (numSamples - 1.0) * 0.5 * spacing);
|
|
104
|
+
|
|
105
|
+
avg += weight * p5.getTexture(canvasContent, sampleCoord);
|
|
106
|
+
total += weight;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return avg / total;
|
|
110
|
+
});
|
|
111
|
+
}, { p5 });
|
|
112
|
+
|
|
113
|
+
case ERODE:
|
|
114
|
+
return renderer.baseFilterShader().modify(() => {
|
|
115
|
+
const luma = (color) => {
|
|
116
|
+
return p5.dot(color.rgb, p5.vec3(0.2126, 0.7152, 0.0722));
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
p5.getColor((inputs, canvasContent) => {
|
|
120
|
+
const uv = inputs.texCoord;
|
|
121
|
+
let minColor = p5.getTexture(canvasContent, uv);
|
|
122
|
+
let minLuma = luma(minColor);
|
|
123
|
+
|
|
124
|
+
for (let x = -1; x <= 1; x++) {
|
|
125
|
+
for (let y = -1; y <= 1; y++) {
|
|
126
|
+
if (x != 0 || y != 0) {
|
|
127
|
+
const offset = p5.vec2(x, y) * inputs.texelSize;
|
|
128
|
+
const neighborColor = p5.getTexture(canvasContent, uv + offset);
|
|
129
|
+
const neighborLuma = luma(neighborColor);
|
|
130
|
+
|
|
131
|
+
if (neighborLuma < minLuma) {
|
|
132
|
+
minLuma = neighborLuma;
|
|
133
|
+
minColor = neighborColor;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return minColor;
|
|
140
|
+
});
|
|
141
|
+
}, { p5 });
|
|
142
|
+
|
|
143
|
+
case DILATE:
|
|
144
|
+
return renderer.baseFilterShader().modify(() => {
|
|
145
|
+
const luma = (color) => {
|
|
146
|
+
return p5.dot(color.rgb, p5.vec3(0.2126, 0.7152, 0.0722));
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
p5.getColor((inputs, canvasContent) => {
|
|
150
|
+
const uv = inputs.texCoord;
|
|
151
|
+
let maxColor = p5.getTexture(canvasContent, uv);
|
|
152
|
+
let maxLuma = luma(maxColor);
|
|
153
|
+
|
|
154
|
+
for (let x = -1; x <= 1; x++) {
|
|
155
|
+
for (let y = -1; y <= 1; y++) {
|
|
156
|
+
if (x != 0 || y != 0) {
|
|
157
|
+
const offset = p5.vec2(x, y) * inputs.texelSize;
|
|
158
|
+
const neighborColor = p5.getTexture(canvasContent, uv + offset);
|
|
159
|
+
const neighborLuma = luma(neighborColor);
|
|
160
|
+
|
|
161
|
+
if (neighborLuma > maxLuma) {
|
|
162
|
+
maxLuma = neighborLuma;
|
|
163
|
+
maxColor = neighborColor;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return maxColor;
|
|
170
|
+
});
|
|
171
|
+
}, { p5 });
|
|
172
|
+
|
|
173
|
+
case OPAQUE:
|
|
174
|
+
return renderer.baseFilterShader().modify(() => {
|
|
175
|
+
p5.getColor((inputs, canvasContent) => {
|
|
176
|
+
const color = p5.getTexture(canvasContent, inputs.texCoord);
|
|
177
|
+
return p5.vec4(color.rgb, 1.0);
|
|
178
|
+
});
|
|
179
|
+
}, { p5 });
|
|
180
|
+
|
|
181
|
+
default:
|
|
182
|
+
throw new Error(`Unknown filter: ${operation}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export { makeFilterShader };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { translator } from '../internationalization.js';
|
|
2
2
|
import strings from './browser_errors.js';
|
|
3
|
-
import {
|
|
3
|
+
import { a3 as constants } from '../../constants-D2K8cOhy.js';
|
|
4
4
|
import 'i18next';
|
|
5
5
|
import 'i18next-browser-languagedetector';
|
|
6
6
|
|
|
@@ -6,7 +6,7 @@ import fileErrors from './file_errors.js';
|
|
|
6
6
|
import '../internationalization.js';
|
|
7
7
|
import 'i18next';
|
|
8
8
|
import 'i18next-browser-languagedetector';
|
|
9
|
-
import '../../constants-
|
|
9
|
+
import '../../constants-D2K8cOhy.js';
|
|
10
10
|
import './browser_errors.js';
|
|
11
11
|
import 'zod/v4';
|
|
12
12
|
import 'acorn';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a3 as constants } from '../../constants-D2K8cOhy.js';
|
|
2
2
|
import { z } from 'zod/v4';
|
|
3
3
|
|
|
4
4
|
var p5$1 = {
|
|
@@ -429,7 +429,7 @@ var p5$1 = {
|
|
|
429
429
|
[
|
|
430
430
|
"Number?",
|
|
431
431
|
"Number?",
|
|
432
|
-
"P2D|WEBGL|P2DHDR?",
|
|
432
|
+
"P2D|WEBGL|P2DHDR|WEBGPU?",
|
|
433
433
|
"HTMLCanvasElement?"
|
|
434
434
|
],
|
|
435
435
|
[
|
|
@@ -1982,8 +1982,6 @@ var p5$1 = {
|
|
|
1982
1982
|
overloads: [
|
|
1983
1983
|
[
|
|
1984
1984
|
"Object"
|
|
1985
|
-
],
|
|
1986
|
-
[
|
|
1987
1985
|
]
|
|
1988
1986
|
]
|
|
1989
1987
|
},
|
|
@@ -5390,7 +5388,7 @@ function validateParams(p5, fn, lifecycles) {
|
|
|
5390
5388
|
if (!p5.disableFriendlyErrors && !p5.disableParameterValidator) {
|
|
5391
5389
|
validate(name, args);
|
|
5392
5390
|
}
|
|
5393
|
-
return target.
|
|
5391
|
+
return target.apply(this, args);
|
|
5394
5392
|
};
|
|
5395
5393
|
}
|
|
5396
5394
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parse } from 'acorn';
|
|
2
2
|
import { simple } from 'acorn-walk';
|
|
3
|
-
import {
|
|
3
|
+
import { a3 as constants } from '../../constants-D2K8cOhy.js';
|
|
4
4
|
|
|
5
5
|
// List of functions to ignore as they either are meant to be re-defined or
|
|
6
6
|
// generate false positive outputs.
|
package/dist/core/helpers.js
CHANGED