p5 2.2.1 → 2.2.2-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accessibility/color_namer.js +5 -5
- package/dist/accessibility/index.js +5 -5
- package/dist/app.js +5 -5
- package/dist/color/color_conversion.js +5 -5
- package/dist/color/index.js +1 -1
- package/dist/color/setting.js +1 -1
- package/dist/{constants-DQyACdzq.js → constants-D3npMLOW.js} +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +1 -1
- package/dist/core/filterShaders.js +1 -1
- 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 +1 -1
- package/dist/core/friendly_errors/sketch_verifier.js +2 -2
- package/dist/core/helpers.js +1 -1
- package/dist/core/init.js +5 -5
- package/dist/core/internationalization.js +1 -1
- package/dist/core/legacy.js +5 -5
- package/dist/core/main.js +5 -5
- package/dist/core/p5.Graphics.js +3 -3
- package/dist/core/p5.Renderer.js +2 -2
- package/dist/core/p5.Renderer2D.js +5 -5
- package/dist/core/p5.Renderer3D.js +3 -3
- package/dist/core/rendering.js +3 -3
- 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 +4 -4
- package/dist/image/image.js +3 -3
- package/dist/image/index.js +3 -3
- package/dist/image/loading_displaying.js +3 -3
- package/dist/image/p5.Image.js +2 -2
- package/dist/io/files.js +3 -3
- package/dist/io/index.js +3 -3
- package/dist/{ir_builders-DXNgaB9N.js → ir_builders-w12-GSxu.js} +37 -5
- package/dist/{main-DvN69W3f.js → main-C5AeICIY.js} +3 -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/{p5.Renderer-D-5LdCRz.js → p5.Renderer-xpFkUQC6.js} +1 -1
- package/dist/{rendering-h9unX5K0.js → rendering-B8po3Onj.js} +57 -13
- package/dist/shape/2d_primitives.js +1 -1
- package/dist/shape/attributes.js +1 -1
- package/dist/shape/custom_shapes.js +1 -1
- package/dist/shape/index.js +1 -1
- package/dist/strands/ir_builders.js +1 -1
- package/dist/strands/p5.strands.js +1 -1
- package/dist/strands/strands_api.js +49 -18
- package/dist/strands/strands_conditionals.js +1 -1
- package/dist/strands/strands_for.js +2 -2
- package/dist/strands/strands_node.js +1 -1
- package/dist/type/index.js +2 -2
- package/dist/type/p5.Font.js +2 -2
- package/dist/type/textCore.js +2 -2
- package/dist/webgl/3d_primitives.js +3 -3
- package/dist/webgl/GeometryBuilder.js +1 -1
- package/dist/webgl/ShapeBuilder.js +1 -1
- package/dist/webgl/enums.js +1 -1
- package/dist/webgl/index.js +4 -4
- package/dist/webgl/interaction.js +1 -1
- package/dist/webgl/light.js +3 -3
- package/dist/webgl/loading.js +11 -13
- package/dist/webgl/material.js +3 -3
- package/dist/webgl/p5.Camera.js +3 -3
- package/dist/webgl/p5.Framebuffer.js +3 -3
- package/dist/webgl/p5.Geometry.js +1 -1
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RendererGL.js +4 -4
- package/dist/webgl/p5.Texture.js +3 -3
- package/dist/webgl/strands_glslBackend.js +1 -1
- package/dist/webgl/text.js +4 -4
- package/dist/webgl/utils.js +3 -3
- package/dist/webgpu/index.js +2 -2
- package/dist/webgpu/p5.RendererWebGPU.js +13 -4
- package/dist/webgpu/strands_wgslBackend.js +5 -4
- package/lib/p5.esm.js +152 -47
- package/lib/p5.esm.min.js +1 -1
- package/lib/p5.js +152 -47
- package/lib/p5.min.js +1 -1
- package/lib/p5.webgpu.esm.js +51 -9
- package/lib/p5.webgpu.js +51 -9
- package/lib/p5.webgpu.min.js +1 -1
- package/package.json +1 -1
- package/types/global.d.ts +1449 -1379
- package/types/p5.d.ts +727 -692
package/dist/webgl/index.js
CHANGED
|
@@ -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-
|
|
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-B8po3Onj.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-
|
|
11
|
+
import '../constants-D3npMLOW.js';
|
|
12
12
|
import '../creating_reading-ZXzcZEsb.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-
|
|
18
|
+
import '../p5.Renderer-xpFkUQC6.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-
|
|
58
|
+
import '../ir_builders-w12-GSxu.js';
|
|
59
59
|
import '../strands/ir_cfg.js';
|
|
60
60
|
import '../strands/strands_builtins.js';
|
|
61
61
|
import './shaderHookUtils.js';
|
package/dist/webgl/light.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { l as default } from '../rendering-
|
|
1
|
+
export { l as default } from '../rendering-B8po3Onj.js';
|
|
2
2
|
import '../math/p5.Vector.js';
|
|
3
3
|
import '../creating_reading-ZXzcZEsb.js';
|
|
4
|
-
import '../constants-
|
|
4
|
+
import '../constants-D3npMLOW.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-
|
|
10
|
+
import '../p5.Renderer-xpFkUQC6.js';
|
|
11
11
|
import '../image/filters.js';
|
|
12
12
|
import '../shape/custom_shapes.js';
|
|
13
13
|
import '../core/States.js';
|
package/dist/webgl/loading.js
CHANGED
|
@@ -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-
|
|
4
|
-
import '../constants-
|
|
3
|
+
import { a as request } from '../rendering-B8po3Onj.js';
|
|
4
|
+
import '../constants-D3npMLOW.js';
|
|
5
5
|
import './p5.DataArray.js';
|
|
6
6
|
import '../io/utilities.js';
|
|
7
7
|
import '../creating_reading-ZXzcZEsb.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-
|
|
13
|
+
import '../p5.Renderer-xpFkUQC6.js';
|
|
14
14
|
import '../image/filters.js';
|
|
15
15
|
import '../shape/custom_shapes.js';
|
|
16
16
|
import '../core/States.js';
|
|
@@ -634,12 +634,10 @@ function loading(p5, fn){
|
|
|
634
634
|
const vertString = tokens[vertexTokens[tokenInd]];
|
|
635
635
|
let vertParts = vertString.split('/');
|
|
636
636
|
|
|
637
|
-
// TODO: Faces can technically use negative numbers to refer to the
|
|
638
|
-
// previous nth vertex. I haven't seen this used in practice, but
|
|
639
|
-
// it might be good to implement this in the future.
|
|
640
|
-
|
|
641
637
|
for (let i = 0; i < vertParts.length; i++) {
|
|
642
|
-
|
|
638
|
+
let index = parseInt(vertParts[i]);
|
|
639
|
+
if (index > 0) index -= 1; // OBJ uses 1-based indexing
|
|
640
|
+
vertParts[i] = index;
|
|
643
641
|
}
|
|
644
642
|
|
|
645
643
|
if (!usedVerts[vertString]) {
|
|
@@ -648,11 +646,11 @@ function loading(p5, fn){
|
|
|
648
646
|
|
|
649
647
|
if (usedVerts[vertString][currentMaterial] === undefined) {
|
|
650
648
|
const vertIndex = model.vertices.length;
|
|
651
|
-
model.vertices.push(loadedVerts.v
|
|
652
|
-
model.uvs.push(loadedVerts.vt
|
|
653
|
-
loadedVerts.vt
|
|
654
|
-
model.vertexNormals.push(loadedVerts.vn
|
|
655
|
-
loadedVerts.vn
|
|
649
|
+
model.vertices.push(loadedVerts.v.at(vertParts[0]).copy());
|
|
650
|
+
model.uvs.push(loadedVerts.vt.at(vertParts[1]) ?
|
|
651
|
+
loadedVerts.vt.at(vertParts[1]).slice() : [0, 0]);
|
|
652
|
+
model.vertexNormals.push(loadedVerts.vn.at(vertParts[2]) ?
|
|
653
|
+
loadedVerts.vn.at(vertParts[2]).copy() : new Vector());
|
|
656
654
|
|
|
657
655
|
usedVerts[vertString][currentMaterial] = vertIndex;
|
|
658
656
|
face.push(vertIndex);
|
package/dist/webgl/material.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '../constants-
|
|
2
|
-
export { m as default } from '../rendering-
|
|
1
|
+
import '../constants-D3npMLOW.js';
|
|
2
|
+
export { m as default } from '../rendering-B8po3Onj.js';
|
|
3
3
|
import './p5.Shader.js';
|
|
4
4
|
import '../creating_reading-ZXzcZEsb.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-
|
|
10
|
+
import '../p5.Renderer-xpFkUQC6.js';
|
|
11
11
|
import '../image/filters.js';
|
|
12
12
|
import '../math/p5.Vector.js';
|
|
13
13
|
import '../shape/custom_shapes.js';
|
package/dist/webgl/p5.Camera.js
CHANGED
|
@@ -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-
|
|
4
|
+
export { C as Camera, c as default } from '../rendering-B8po3Onj.js';
|
|
5
5
|
import '../math/Matrices/Matrix.js';
|
|
6
|
-
import '../constants-
|
|
6
|
+
import '../constants-D3npMLOW.js';
|
|
7
7
|
import '../math/Matrices/MatrixInterface.js';
|
|
8
8
|
import '../creating_reading-ZXzcZEsb.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-
|
|
14
|
+
import '../p5.Renderer-xpFkUQC6.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-
|
|
1
|
+
import '../constants-D3npMLOW.js';
|
|
2
2
|
import '../creating_reading-ZXzcZEsb.js';
|
|
3
|
-
export { w as Framebuffer, v as FramebufferCamera, F as FramebufferTexture, f as default } from '../rendering-
|
|
3
|
+
export { w as Framebuffer, v as FramebufferCamera, F as FramebufferTexture, f as default } from '../rendering-B8po3Onj.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-
|
|
9
|
+
import '../p5.Renderer-xpFkUQC6.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-
|
|
1
|
+
import { a7 as FLAT, a8 as SMOOTH } from '../constants-D3npMLOW.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';
|
package/dist/webgl/p5.Quat.js
CHANGED
|
@@ -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-
|
|
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-
|
|
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-D3npMLOW.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-B8po3Onj.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-ZXzcZEsb.js';
|
|
6
|
-
import { I as Image } from '../p5.Renderer-
|
|
6
|
+
import { I as Image } from '../p5.Renderer-xpFkUQC6.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-
|
|
50
|
+
import '../ir_builders-w12-GSxu.js';
|
|
51
51
|
import '../strands/ir_cfg.js';
|
|
52
52
|
import '../strands/strands_builtins.js';
|
|
53
53
|
|
package/dist/webgl/p5.Texture.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import '../constants-
|
|
1
|
+
import '../constants-D3npMLOW.js';
|
|
2
2
|
import '../dom/p5.Element.js';
|
|
3
|
-
import '../p5.Renderer-
|
|
3
|
+
import '../p5.Renderer-xpFkUQC6.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-B8po3Onj.js';
|
|
6
6
|
import '../dom/p5.File.js';
|
|
7
7
|
import '../io/p5.XML.js';
|
|
8
8
|
import '../creating_reading-ZXzcZEsb.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-
|
|
4
|
+
import { f as functionCallNode } from '../ir_builders-w12-GSxu.js';
|
|
5
5
|
import '../strands/ir_cfg.js';
|
|
6
6
|
import '../strands/strands_builtins.js';
|
|
7
7
|
|
package/dist/webgl/text.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as TEXTURE, c as TRIANGLES } from '../constants-
|
|
2
|
-
import { R as Renderer3D } from '../rendering-
|
|
1
|
+
import { h as TEXTURE, c as TRIANGLES } from '../constants-D3npMLOW.js';
|
|
2
|
+
import { R as Renderer3D } from '../rendering-B8po3Onj.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-
|
|
12
|
+
import '../p5.Renderer-xpFkUQC6.js';
|
|
13
13
|
import '../image/filters.js';
|
|
14
14
|
import '../shape/custom_shapes.js';
|
|
15
15
|
import '../core/States.js';
|
|
@@ -729,7 +729,7 @@ function text(p5, fn) {
|
|
|
729
729
|
|
|
730
730
|
if (!p5.Font.hasGlyphData(this.states.textFont)) {
|
|
731
731
|
console.log(
|
|
732
|
-
'WEBGL: only Opentype (.otf) and Truetype (.ttf) fonts with glyph data are supported'
|
|
732
|
+
'WEBGL: only Opentype (.otf) and Truetype (.ttf) fonts with glyph data are supported. Make sure to set the font using textFont() before drawing text.'
|
|
733
733
|
);
|
|
734
734
|
return;
|
|
735
735
|
}
|
package/dist/webgl/utils.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import '../constants-
|
|
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-
|
|
1
|
+
import '../constants-D3npMLOW.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-B8po3Onj.js';
|
|
3
3
|
import '../creating_reading-ZXzcZEsb.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-
|
|
9
|
+
import '../p5.Renderer-xpFkUQC6.js';
|
|
10
10
|
import '../image/filters.js';
|
|
11
11
|
import '../math/p5.Vector.js';
|
|
12
12
|
import '../shape/custom_shapes.js';
|
package/dist/webgpu/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import rendererWebGPU from './p5.RendererWebGPU.js';
|
|
2
|
-
import '../constants-
|
|
2
|
+
import '../constants-D3npMLOW.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-
|
|
13
|
+
import '../ir_builders-w12-GSxu.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-
|
|
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-D3npMLOW.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-
|
|
15
|
+
import '../ir_builders-w12-GSxu.js';
|
|
16
16
|
import '../strands/ir_cfg.js';
|
|
17
17
|
import '../strands/strands_builtins.js';
|
|
18
18
|
|
|
@@ -97,6 +97,10 @@ function rendererWebGPU(p5, fn) {
|
|
|
97
97
|
this.finalCamera = new Camera(this);
|
|
98
98
|
this.finalCamera._computeCameraDefaultSettings();
|
|
99
99
|
this.finalCamera._setDefaultCamera();
|
|
100
|
+
|
|
101
|
+
this.depthFormat = 'depth24plus-stencil8';
|
|
102
|
+
this.depthTexture = null;
|
|
103
|
+
this.depthTextureView = null;
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
async setupContext() {
|
|
@@ -137,7 +141,6 @@ function rendererWebGPU(p5, fn) {
|
|
|
137
141
|
});
|
|
138
142
|
|
|
139
143
|
// TODO disablable stencil
|
|
140
|
-
this.depthFormat = 'depth24plus-stencil8';
|
|
141
144
|
this.mainFramebuffer = this.createFramebuffer({ _useCanvasFormat: true });
|
|
142
145
|
this._updateSize();
|
|
143
146
|
this._update();
|
|
@@ -194,6 +197,7 @@ function rendererWebGPU(p5, fn) {
|
|
|
194
197
|
}
|
|
195
198
|
|
|
196
199
|
_updateSize() {
|
|
200
|
+
if (!this.device || !this.depthFormat) return;
|
|
197
201
|
if (this.depthTexture && this.depthTexture.destroy) {
|
|
198
202
|
this.flushDraw();
|
|
199
203
|
const textureToDestroy = this.depthTexture;
|
|
@@ -288,6 +292,7 @@ function rendererWebGPU(p5, fn) {
|
|
|
288
292
|
}
|
|
289
293
|
|
|
290
294
|
clear(...args) {
|
|
295
|
+
if (!this.device || !this.drawingContext) return;
|
|
291
296
|
const _r = args[0] || 0;
|
|
292
297
|
const _g = args[1] || 0;
|
|
293
298
|
const _b = args[2] || 0;
|
|
@@ -354,6 +359,7 @@ function rendererWebGPU(p5, fn) {
|
|
|
354
359
|
* occlude anything subsequently drawn.
|
|
355
360
|
*/
|
|
356
361
|
clearDepth(depth = 1) {
|
|
362
|
+
if (!this.device || !this.depthTextureView) return;
|
|
357
363
|
this._finishActiveRenderPass();
|
|
358
364
|
const commandEncoder = this.device.createCommandEncoder();
|
|
359
365
|
|
|
@@ -1902,7 +1908,7 @@ function rendererWebGPU(p5, fn) {
|
|
|
1902
1908
|
|
|
1903
1909
|
getNextBindingIndex({ vert, frag }, group = 0) {
|
|
1904
1910
|
// Get the highest binding index in the specified group and return the next available
|
|
1905
|
-
const samplerRegex = /@group\((\d+)\)\s*@binding\((\d+)\)\s*var
|
|
1911
|
+
const samplerRegex = /@group\((\d+)\)\s*@binding\((\d+)\)\s*var(?:<uniform>)?\s+(\w+)\s*:\s*(texture_2d<f32>|sampler|uniform|\w+)/g;
|
|
1906
1912
|
let maxBindingIndex = -1;
|
|
1907
1913
|
|
|
1908
1914
|
for (const [src, visibility] of [
|
|
@@ -2252,6 +2258,9 @@ function rendererWebGPU(p5, fn) {
|
|
|
2252
2258
|
// Inject hook uniforms as a separate struct at a new binding
|
|
2253
2259
|
let hookUniformFields = '';
|
|
2254
2260
|
for (const key in shader.hooks.uniforms) {
|
|
2261
|
+
// Skip textures, they don't get added to structs
|
|
2262
|
+
if (key.endsWith(': sampler2D')) continue;
|
|
2263
|
+
|
|
2255
2264
|
// WGSL format: "name: type"
|
|
2256
2265
|
hookUniformFields += ` ${key},\n`;
|
|
2257
2266
|
}
|
|
@@ -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-
|
|
4
|
+
import { v as variableNode, c as createStrandsNode, f as functionCallNode } from '../ir_builders-w12-GSxu.js';
|
|
5
5
|
import '../strands/ir_cfg.js';
|
|
6
6
|
import '../strands/strands_builtins.js';
|
|
7
7
|
|
|
@@ -225,10 +225,11 @@ const wgslBackend = {
|
|
|
225
225
|
return primitiveTypeName;
|
|
226
226
|
},
|
|
227
227
|
generateHookUniformKey(name, typeInfo) {
|
|
228
|
-
// For sampler2D types, we don't add them to the uniform struct
|
|
229
|
-
//
|
|
228
|
+
// For sampler2D types, we don't add them to the uniform struct,
|
|
229
|
+
// but we still need them in the shader's hooks object so that
|
|
230
|
+
// they can be set by users.
|
|
230
231
|
if (typeInfo.baseType === 'sampler2D') {
|
|
231
|
-
return
|
|
232
|
+
return `${name}: sampler2D`; // Signal that this should not be added to uniform struct
|
|
232
233
|
}
|
|
233
234
|
return `${name}: ${this.getTypeName(typeInfo.baseType, typeInfo.dimension)}`;
|
|
234
235
|
},
|