p5 2.2.3 → 2.3.0-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.
- package/dist/accessibility/color_namer.js +9 -11
- package/dist/accessibility/describe.js +0 -1
- package/dist/accessibility/gridOutput.js +0 -1
- package/dist/accessibility/index.js +9 -10
- package/dist/accessibility/outputs.js +0 -1
- package/dist/accessibility/textOutput.js +0 -1
- package/dist/app.js +11 -10
- package/dist/app.node.js +122 -0
- package/dist/color/color_conversion.js +9 -11
- package/dist/color/creating_reading.js +1 -1
- package/dist/color/index.js +2 -2
- package/dist/color/p5.Color.js +1 -1
- package/dist/color/setting.js +25 -12
- package/dist/{constants-BdTiYOQI.js → constants-0wkVUfqa.js} +2 -2
- package/dist/core/States.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +28 -29
- package/dist/core/filterShaders.js +1 -1
- package/dist/core/friendly_errors/fes_core.js +9 -8
- package/dist/core/friendly_errors/file_errors.js +1 -2
- package/dist/core/friendly_errors/index.js +1 -1
- package/dist/core/friendly_errors/param_validator.js +737 -640
- package/dist/core/friendly_errors/sketch_verifier.js +1 -1
- package/dist/core/friendly_errors/stacktrace.js +0 -1
- package/dist/core/helpers.js +3 -4
- package/dist/core/init.js +24 -21
- package/dist/core/internationalization.js +1 -1
- package/dist/core/legacy.js +9 -11
- package/dist/core/main.js +9 -10
- package/dist/core/p5.Graphics.js +5 -5
- package/dist/core/p5.Renderer.js +3 -3
- package/dist/core/p5.Renderer2D.js +9 -10
- package/dist/core/p5.Renderer3D.js +5 -5
- package/dist/core/rendering.js +5 -5
- package/dist/core/structure.js +0 -1
- package/dist/core/transform.js +7 -16
- package/dist/{creating_reading-C7hu6sg1.js → creating_reading-DLkHH80h.js} +11 -8
- package/dist/data/local_storage.js +0 -1
- package/dist/dom/dom.js +2 -3
- package/dist/dom/index.js +2 -2
- package/dist/dom/p5.Element.js +2 -2
- package/dist/dom/p5.MediaElement.js +2 -2
- package/dist/events/acceleration.js +5 -3
- package/dist/events/keyboard.js +0 -1
- package/dist/events/pointer.js +0 -2
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +19 -12
- package/dist/image/image.js +5 -5
- package/dist/image/index.js +5 -5
- package/dist/image/loading_displaying.js +5 -5
- package/dist/image/p5.Image.js +3 -3
- package/dist/image/pixels.js +0 -1
- package/dist/io/files.js +5 -5
- package/dist/io/index.js +5 -5
- package/dist/io/p5.Table.js +0 -1
- package/dist/io/p5.TableRow.js +0 -1
- package/dist/io/p5.XML.js +0 -1
- package/dist/{ir_builders-Cd6rU9Vm.js → ir_builders-C2ebb6Lu.js} +234 -1
- package/dist/{main-H_nu4eDs.js → main-D2kqeMXM.js} +107 -136
- package/dist/math/Matrices/Matrix.js +1 -1
- package/dist/math/Matrices/MatrixNumjs.js +1 -1
- package/dist/math/calculation.js +0 -1
- package/dist/math/index.js +3 -1
- package/dist/math/math.js +3 -17
- package/dist/math/noise.js +0 -1
- package/dist/math/p5.Matrix.js +1 -2
- package/dist/math/p5.Vector.js +237 -279
- package/dist/math/patch-vector.js +75 -0
- package/dist/math/random.js +0 -1
- package/dist/math/trigonometry.js +3 -4
- package/dist/{p5.Renderer-BmD2P6Wv.js → p5.Renderer-CQI8PO1F.js} +31 -24
- package/dist/{rendering-CC8JNTwG.js → rendering-ltTIxpF2.js} +732 -44
- package/dist/shape/2d_primitives.js +1 -4
- package/dist/shape/attributes.js +43 -8
- package/dist/shape/curves.js +0 -1
- package/dist/shape/custom_shapes.js +260 -5
- package/dist/shape/index.js +2 -2
- package/dist/shape/vertex.js +0 -2
- package/dist/strands/ir_builders.js +1 -1
- package/dist/strands/ir_types.js +5 -1
- package/dist/strands/p5.strands.js +286 -31
- package/dist/strands/strands_api.js +179 -8
- package/dist/strands/strands_codegen.js +26 -8
- package/dist/strands/strands_conditionals.js +1 -1
- package/dist/strands/strands_for.js +1 -1
- package/dist/strands/strands_node.js +1 -1
- package/dist/strands/strands_ternary.js +56 -0
- package/dist/strands/strands_transpiler.js +416 -251
- package/dist/strands_glslBackend-i-ReKgZo.js +423 -0
- package/dist/type/index.js +3 -3
- package/dist/type/lib/Typr.js +1 -1
- package/dist/type/p5.Font.js +3 -3
- package/dist/type/textCore.js +31 -24
- package/dist/utilities/conversion.js +0 -1
- package/dist/utilities/time_date.js +0 -1
- package/dist/utilities/utility_functions.js +0 -1
- package/dist/webgl/3d_primitives.js +5 -5
- package/dist/webgl/GeometryBuilder.js +1 -1
- package/dist/webgl/ShapeBuilder.js +26 -1
- package/dist/webgl/enums.js +1 -1
- package/dist/webgl/index.js +8 -9
- package/dist/webgl/interaction.js +8 -4
- package/dist/webgl/light.js +5 -5
- package/dist/webgl/loading.js +60 -21
- package/dist/webgl/material.js +5 -5
- package/dist/webgl/p5.Camera.js +5 -5
- package/dist/webgl/p5.Framebuffer.js +5 -5
- package/dist/webgl/p5.Geometry.js +3 -5
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RendererGL.js +17 -21
- package/dist/webgl/p5.Shader.js +129 -36
- package/dist/webgl/p5.Texture.js +5 -5
- package/dist/webgl/strands_glslBackend.js +5 -386
- package/dist/webgl/text.js +5 -5
- package/dist/webgl/utils.js +5 -5
- package/dist/webgl2Compatibility-DA7DLMuq.js +7 -0
- package/dist/webgpu/index.js +7 -3
- package/dist/webgpu/p5.RendererWebGPU.js +1146 -180
- package/dist/webgpu/shaders/color.js +1 -1
- package/dist/webgpu/shaders/compute.js +32 -0
- package/dist/webgpu/shaders/functions/randomComputeWGSL.js +31 -0
- package/dist/webgpu/shaders/functions/randomVertWGSL.js +30 -0
- package/dist/webgpu/shaders/functions/randomWGSL.js +30 -0
- package/dist/webgpu/shaders/line.js +1 -1
- package/dist/webgpu/shaders/material.js +3 -3
- package/dist/webgpu/strands_wgslBackend.js +137 -15
- package/lib/p5.esm.js +4092 -1950
- package/lib/p5.esm.min.js +1 -1
- package/lib/p5.js +4092 -1950
- package/lib/p5.min.js +1 -1
- package/lib/p5.webgpu.esm.js +1748 -306
- package/lib/p5.webgpu.js +1747 -305
- package/lib/p5.webgpu.min.js +1 -1
- package/package.json +6 -1
- package/types/global.d.ts +4182 -2441
- package/types/p5.d.ts +2776 -1675
- package/dist/noise3DGLSL-Bwrdi4gi.js +0 -9
package/dist/webgl/p5.Shader.js
CHANGED
|
@@ -3,18 +3,38 @@
|
|
|
3
3
|
* @module 3D
|
|
4
4
|
* @submodule Material
|
|
5
5
|
* @for p5
|
|
6
|
-
* @requires core
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
10
9
|
class Shader {
|
|
11
10
|
constructor(renderer, vertSrc, fragSrc, options = {}) {
|
|
12
11
|
this._renderer = renderer;
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
// Detect compute shader: first arg is STRING and second is undefined OR an options object
|
|
14
|
+
if (
|
|
15
|
+
typeof vertSrc === 'string' && (
|
|
16
|
+
fragSrc === undefined || (typeof fragSrc === 'object' && !Array.isArray(fragSrc))
|
|
17
|
+
)
|
|
18
|
+
) {
|
|
19
|
+
// Compute shader
|
|
20
|
+
this.shaderType = 'compute';
|
|
21
|
+
this._computeSrc = vertSrc;
|
|
22
|
+
this._vertSrc = null;
|
|
23
|
+
this._fragSrc = null;
|
|
24
|
+
// If fragSrc is an options object, use it
|
|
25
|
+
if (typeof fragSrc === 'object') {
|
|
26
|
+
options = fragSrc;
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
// Render shader - shaderType will be set later during binding ('fill', 'stroke', etc.)
|
|
30
|
+
this._vertSrc = vertSrc;
|
|
31
|
+
this._fragSrc = fragSrc;
|
|
32
|
+
this._computeSrc = null;
|
|
33
|
+
}
|
|
34
|
+
|
|
15
35
|
this._vertShader = -1;
|
|
16
36
|
this._fragShader = -1;
|
|
17
|
-
this.
|
|
37
|
+
this._compiled = false;
|
|
18
38
|
this._loadedAttributes = false;
|
|
19
39
|
this.attributes = {};
|
|
20
40
|
this._loadedUniforms = false;
|
|
@@ -28,18 +48,25 @@ class Shader {
|
|
|
28
48
|
// Stores uniforms + default values.
|
|
29
49
|
uniforms: options.uniforms || {},
|
|
30
50
|
|
|
51
|
+
// Compute shader storage uniforms + default values
|
|
52
|
+
storageUniforms: options.storageUniforms || {},
|
|
53
|
+
|
|
31
54
|
// Stores custom uniform + helper declarations as a string.
|
|
32
55
|
declarations: options.declarations,
|
|
33
56
|
|
|
34
57
|
// Stores an array of variable names + types passed between the vertex and fragment shader
|
|
35
58
|
varyingVariables: options.varyingVariables || [],
|
|
36
59
|
|
|
60
|
+
// Stores instanceID varying info for forwarding to the fragment shader
|
|
61
|
+
instanceIDVarying: options.instanceIDVarying || null,
|
|
62
|
+
|
|
37
63
|
// Stores helper functions to prepend to shaders.
|
|
38
64
|
helpers: options.helpers || {},
|
|
39
65
|
|
|
40
66
|
// Stores the hook implementations
|
|
41
67
|
vertex: options.vertex || {},
|
|
42
68
|
fragment: options.fragment || {},
|
|
69
|
+
compute: options.compute || {},
|
|
43
70
|
|
|
44
71
|
hookAliases: options.hookAliases || {},
|
|
45
72
|
|
|
@@ -48,7 +75,8 @@ class Shader {
|
|
|
48
75
|
// yourShader.modify(...).
|
|
49
76
|
modified: {
|
|
50
77
|
vertex: (options.modified && options.modified.vertex) || {},
|
|
51
|
-
fragment: (options.modified && options.modified.fragment) || {}
|
|
78
|
+
fragment: (options.modified && options.modified.fragment) || {},
|
|
79
|
+
compute: (options.modified && options.modified.compute) || {},
|
|
52
80
|
}
|
|
53
81
|
};
|
|
54
82
|
}
|
|
@@ -80,13 +108,20 @@ class Shader {
|
|
|
80
108
|
}
|
|
81
109
|
|
|
82
110
|
vertSrc() {
|
|
111
|
+
if (this.shaderType === 'compute') return null;
|
|
83
112
|
return this.shaderSrc(this._vertSrc, 'vertex');
|
|
84
113
|
}
|
|
85
114
|
|
|
86
115
|
fragSrc() {
|
|
116
|
+
if (this.shaderType === 'compute') return null;
|
|
87
117
|
return this.shaderSrc(this._fragSrc, 'fragment');
|
|
88
118
|
}
|
|
89
119
|
|
|
120
|
+
computeSrc() {
|
|
121
|
+
if (this.shaderType !== 'compute') return null;
|
|
122
|
+
return this.shaderSrc(this._computeSrc, 'compute');
|
|
123
|
+
}
|
|
124
|
+
|
|
90
125
|
/**
|
|
91
126
|
* Logs the hooks available in this shader, and their current implementation.
|
|
92
127
|
*
|
|
@@ -136,29 +171,40 @@ class Shader {
|
|
|
136
171
|
* color.a = components.opacity;
|
|
137
172
|
* return color;
|
|
138
173
|
* }
|
|
139
|
-
* vec4 getFinalColor(vec4 color) { return color; }
|
|
174
|
+
* vec4 getFinalColor(vec4 color, vec2 texCoord) { return color; }
|
|
140
175
|
* void afterFragment() {}
|
|
141
176
|
* ```
|
|
142
177
|
*
|
|
143
178
|
* @beta
|
|
144
179
|
*/
|
|
145
180
|
inspectHooks() {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
(
|
|
150
|
-
key +
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
(
|
|
159
|
-
key +
|
|
160
|
-
|
|
161
|
-
|
|
181
|
+
if (this.shaderType === 'compute') {
|
|
182
|
+
console.log('==== Compute shader hooks: ====');
|
|
183
|
+
for (const key in this.hooks.compute) {
|
|
184
|
+
console.log(
|
|
185
|
+
(this.hooks.modified.compute[key] ? '[MODIFIED] ' : '') +
|
|
186
|
+
key +
|
|
187
|
+
this.hooks.compute[key]
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
console.log('==== Vertex shader hooks: ====');
|
|
192
|
+
for (const key in this.hooks.vertex) {
|
|
193
|
+
console.log(
|
|
194
|
+
(this.hooks.modified.vertex[key] ? '[MODIFIED] ' : '') +
|
|
195
|
+
key +
|
|
196
|
+
this.hooks.vertex[key]
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
console.log('');
|
|
200
|
+
console.log('==== Fragment shader hooks: ====');
|
|
201
|
+
for (const key in this.hooks.fragment) {
|
|
202
|
+
console.log(
|
|
203
|
+
(this.hooks.modified.fragment[key] ? '[MODIFIED] ' : '') +
|
|
204
|
+
key +
|
|
205
|
+
this.hooks.fragment[key]
|
|
206
|
+
);
|
|
207
|
+
}
|
|
162
208
|
}
|
|
163
209
|
console.log('');
|
|
164
210
|
console.log('==== Helper functions: ====');
|
|
@@ -209,15 +255,15 @@ class Shader {
|
|
|
209
255
|
* type of the data, such as `uniformFloat` for a number or `uniformVector2` for a two-component vector.
|
|
210
256
|
* They take in a function that returns the data for the variable. You can then reference these
|
|
211
257
|
* variables in your hooks, and their values will update every time you apply
|
|
212
|
-
* the shader with the result of your function.
|
|
213
|
-
*
|
|
258
|
+
* the shader with the result of your function.
|
|
259
|
+
*
|
|
214
260
|
* Move the mouse over this sketch to increase the moveCounter which will be passed to the shader as a uniform.
|
|
215
261
|
*
|
|
216
262
|
* ```js example
|
|
217
263
|
* let myShader;
|
|
218
264
|
* //count of frames in which mouse has been moved
|
|
219
265
|
* let moveCounter = 0;
|
|
220
|
-
*
|
|
266
|
+
*
|
|
221
267
|
* function setup() {
|
|
222
268
|
* createCanvas(200, 200, WEBGL);
|
|
223
269
|
* myShader = baseMaterialShader().modify(() => {
|
|
@@ -370,28 +416,37 @@ class Shader {
|
|
|
370
416
|
const newHooks = {
|
|
371
417
|
vertex: {},
|
|
372
418
|
fragment: {},
|
|
419
|
+
compute: {},
|
|
373
420
|
helpers: {}
|
|
374
421
|
};
|
|
375
422
|
for (const key in hooks) {
|
|
376
423
|
if (key === 'declarations') continue;
|
|
377
424
|
if (key === 'uniforms') continue;
|
|
425
|
+
if (key === 'storageUniforms') continue;
|
|
378
426
|
if (key === 'varyingVariables') continue;
|
|
427
|
+
if (key === 'instanceIDVarying') continue;
|
|
379
428
|
if (key === 'vertexDeclarations') {
|
|
380
429
|
newHooks.vertex.declarations =
|
|
381
430
|
(newHooks.vertex.declarations || '') + '\n' + hooks[key];
|
|
382
431
|
} else if (key === 'fragmentDeclarations') {
|
|
383
432
|
newHooks.fragment.declarations =
|
|
384
433
|
(newHooks.fragment.declarations || '') + '\n' + hooks[key];
|
|
434
|
+
} else if (key === 'computeDeclarations') {
|
|
435
|
+
newHooks.compute.declarations =
|
|
436
|
+
(newHooks.compute.declarations || '') + '\n' + hooks[key];
|
|
385
437
|
} else if (this.hooks.vertex[key]) {
|
|
386
438
|
newHooks.vertex[key] = hooks[key];
|
|
387
439
|
} else if (this.hooks.fragment[key]) {
|
|
388
440
|
newHooks.fragment[key] = hooks[key];
|
|
441
|
+
} else if (this.hooks.compute[key]) {
|
|
442
|
+
newHooks.compute[key] = hooks[key];
|
|
389
443
|
} else {
|
|
390
444
|
newHooks.helpers[key] = hooks[key];
|
|
391
445
|
}
|
|
392
446
|
}
|
|
393
447
|
const modifiedVertex = Object.assign({}, this.hooks.modified.vertex);
|
|
394
448
|
const modifiedFragment = Object.assign({}, this.hooks.modified.fragment);
|
|
449
|
+
const modifiedCompute = Object.assign({}, this.hooks.modified.compute);
|
|
395
450
|
for (const key in newHooks.vertex || {}) {
|
|
396
451
|
if (key === 'declarations') continue;
|
|
397
452
|
modifiedVertex[key] = true;
|
|
@@ -400,21 +455,37 @@ class Shader {
|
|
|
400
455
|
if (key === 'declarations') continue;
|
|
401
456
|
modifiedFragment[key] = true;
|
|
402
457
|
}
|
|
458
|
+
for (const key in newHooks.compute || {}) {
|
|
459
|
+
if (key === 'declarations') continue;
|
|
460
|
+
modifiedCompute[key] = true;
|
|
461
|
+
}
|
|
403
462
|
|
|
404
|
-
|
|
463
|
+
const args = [this._renderer];
|
|
464
|
+
if (this.shaderType === 'compute') {
|
|
465
|
+
args.push(this._computeSrc);
|
|
466
|
+
} else {
|
|
467
|
+
args.push(this._vertSrc, this._fragSrc);
|
|
468
|
+
}
|
|
469
|
+
args.push({
|
|
405
470
|
declarations:
|
|
406
471
|
(this.hooks.declarations || '') + '\n' + (hooks.declarations || ''),
|
|
407
472
|
uniforms: Object.assign({}, this.hooks.uniforms, hooks.uniforms || {}),
|
|
473
|
+
storageUniforms: Object.assign({}, this.hooks.storageUniforms, hooks.storageUniforms || {}),
|
|
408
474
|
varyingVariables: (hooks.varyingVariables || []).concat(this.hooks.varyingVariables || []),
|
|
475
|
+
instanceIDVarying: hooks.instanceIDVarying || this.hooks.instanceIDVarying || null,
|
|
409
476
|
fragment: Object.assign({}, this.hooks.fragment, newHooks.fragment || {}),
|
|
410
477
|
vertex: Object.assign({}, this.hooks.vertex, newHooks.vertex || {}),
|
|
478
|
+
compute: Object.assign({}, this.hooks.compute, newHooks.compute || {}),
|
|
411
479
|
helpers: Object.assign({}, this.hooks.helpers, newHooks.helpers || {}),
|
|
412
480
|
hookAliases: Object.assign({}, this.hooks.hookAliases, newHooks.hookAliases || {}),
|
|
413
481
|
modified: {
|
|
414
482
|
vertex: modifiedVertex,
|
|
415
|
-
fragment: modifiedFragment
|
|
483
|
+
fragment: modifiedFragment,
|
|
484
|
+
compute: modifiedCompute,
|
|
416
485
|
}
|
|
417
486
|
});
|
|
487
|
+
|
|
488
|
+
return new Shader(...args);
|
|
418
489
|
}
|
|
419
490
|
|
|
420
491
|
/**
|
|
@@ -436,7 +507,9 @@ class Shader {
|
|
|
436
507
|
);
|
|
437
508
|
}
|
|
438
509
|
|
|
439
|
-
this.
|
|
510
|
+
if (this.shaderType !== 'compute') {
|
|
511
|
+
this._loadAttributes();
|
|
512
|
+
}
|
|
440
513
|
this._loadUniforms();
|
|
441
514
|
this._renderer._finalizeShader(this);
|
|
442
515
|
|
|
@@ -464,6 +537,13 @@ class Shader {
|
|
|
464
537
|
this.setUniform(name, value);
|
|
465
538
|
}
|
|
466
539
|
}
|
|
540
|
+
for (const name in this.hooks.storageUniforms) {
|
|
541
|
+
const initializer = this.hooks.storageUniforms[name];
|
|
542
|
+
const value = initializer instanceof Function ? initializer() : initializer;
|
|
543
|
+
if (value !== undefined && value !== null) {
|
|
544
|
+
this.setUniform(name, value);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
467
547
|
}
|
|
468
548
|
|
|
469
549
|
/**
|
|
@@ -639,11 +719,14 @@ class Shader {
|
|
|
639
719
|
* }
|
|
640
720
|
*/
|
|
641
721
|
copyToContext(context) {
|
|
642
|
-
const
|
|
643
|
-
|
|
644
|
-
this.
|
|
645
|
-
|
|
646
|
-
|
|
722
|
+
const args = [context._renderer];
|
|
723
|
+
if (this.shaderType === 'compute') {
|
|
724
|
+
args.push(this._computeSrc);
|
|
725
|
+
} else {
|
|
726
|
+
args.push(this._vertSrc, this._fragSrc);
|
|
727
|
+
}
|
|
728
|
+
args.push(this.hooks);
|
|
729
|
+
const shader = new Shader(...args);
|
|
647
730
|
shader.ensureCompiledOnContext(context._renderer);
|
|
648
731
|
return shader;
|
|
649
732
|
}
|
|
@@ -652,11 +735,11 @@ class Shader {
|
|
|
652
735
|
* @private
|
|
653
736
|
*/
|
|
654
737
|
ensureCompiledOnContext(context) {
|
|
655
|
-
if (this.
|
|
738
|
+
if (this._compiled && this._renderer !== context) {
|
|
656
739
|
throw new Error(
|
|
657
740
|
'The shader being run is attached to a different context. Do you need to copy it to this context first with .copyToContext()?'
|
|
658
741
|
);
|
|
659
|
-
} else if (this.
|
|
742
|
+
} else if (!this._compiled) {
|
|
660
743
|
this._renderer = context?._renderer?.filterRenderer?._renderer || context;
|
|
661
744
|
this.init();
|
|
662
745
|
}
|
|
@@ -809,7 +892,7 @@ class Shader {
|
|
|
809
892
|
* @chainable
|
|
810
893
|
* @param {String} uniformName name of the uniform. Must match the name
|
|
811
894
|
* used in the vertex and fragment shaders.
|
|
812
|
-
* @param {Boolean|Number|Number[]|p5.Image|p5.Graphics|p5.MediaElement|p5.Texture}
|
|
895
|
+
* @param {Boolean|p5.Vector|p5.Color|Number|Number[]|p5.Image|p5.Graphics|p5.MediaElement|p5.Texture|p5.StorageBuffer}
|
|
813
896
|
* data value to assign to the uniform. Must match the uniform’s data type.
|
|
814
897
|
*
|
|
815
898
|
* @example
|
|
@@ -1020,6 +1103,16 @@ class Shader {
|
|
|
1020
1103
|
return;
|
|
1021
1104
|
}
|
|
1022
1105
|
|
|
1106
|
+
// In p5.strands-related code, where some of the code may be in
|
|
1107
|
+
// p5.webgpu.js instead of the main p5.js build, we generally use
|
|
1108
|
+
// duck typing instead of instanceof to avoid accidentally importing
|
|
1109
|
+
// and comparing against a separate copy of p5 classes
|
|
1110
|
+
if (data?.isVector) {
|
|
1111
|
+
data = data.values.length !== data.dimensions ? data.values.slice(0, data.dimensions) : data.values;
|
|
1112
|
+
} else if (data?.isColor) {
|
|
1113
|
+
data = data._getRGBA([1, 1, 1, 1]);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1023
1116
|
if (uniform.isArray) {
|
|
1024
1117
|
if (
|
|
1025
1118
|
uniform._cachedData &&
|
package/dist/webgl/p5.Texture.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import '../constants-
|
|
1
|
+
import '../constants-0wkVUfqa.js';
|
|
2
2
|
import '../dom/p5.Element.js';
|
|
3
|
-
import '../p5.Renderer-
|
|
3
|
+
import '../p5.Renderer-CQI8PO1F.js';
|
|
4
4
|
import '../dom/p5.MediaElement.js';
|
|
5
|
-
export { M as MipmapTexture, T as Texture, t as default } from '../rendering-
|
|
5
|
+
export { M as MipmapTexture, T as Texture, t as default } from '../rendering-ltTIxpF2.js';
|
|
6
6
|
import '../dom/p5.File.js';
|
|
7
7
|
import '../io/p5.XML.js';
|
|
8
|
-
import '../creating_reading-
|
|
8
|
+
import '../creating_reading-DLkHH80h.js';
|
|
9
9
|
import 'colorjs.io/fn';
|
|
10
10
|
import '../color/color_spaces/hsb.js';
|
|
11
11
|
import '../image/filters.js';
|
|
@@ -13,6 +13,7 @@ import '../math/p5.Vector.js';
|
|
|
13
13
|
import '../shape/custom_shapes.js';
|
|
14
14
|
import '../core/States.js';
|
|
15
15
|
import '../io/utilities.js';
|
|
16
|
+
import '../strands/ir_types.js';
|
|
16
17
|
import '../shape/2d_primitives.js';
|
|
17
18
|
import '../core/helpers.js';
|
|
18
19
|
import '../shape/attributes.js';
|
|
@@ -21,7 +22,6 @@ import '../shape/vertex.js';
|
|
|
21
22
|
import '../color/setting.js';
|
|
22
23
|
import 'omggif';
|
|
23
24
|
import '../io/csv.js';
|
|
24
|
-
import 'gifenc';
|
|
25
25
|
import '../image/pixels.js';
|
|
26
26
|
import '../core/transform.js';
|
|
27
27
|
import './GeometryBuilder.js';
|