diff --git a/package-lock.json b/package-lock.json index b77b8a2fbf..aabc1d3d9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -655,9 +655,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -675,9 +672,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -695,9 +689,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -715,9 +706,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -735,9 +723,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -755,9 +740,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -775,9 +757,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -795,9 +774,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1002,9 +978,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1022,9 +995,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1042,9 +1012,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1062,9 +1029,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1082,9 +1046,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1102,9 +1063,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1122,9 +1080,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1142,9 +1097,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1336,9 +1288,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1356,9 +1305,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1376,9 +1322,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1396,9 +1339,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1416,9 +1356,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1436,9 +1373,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -4002,9 +3936,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -4026,9 +3957,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -4050,9 +3978,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -4074,9 +3999,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ diff --git a/src/strands/strands_transpiler.js b/src/strands/strands_transpiler.js index 630efcba1f..f3367620a9 100644 --- a/src/strands/strands_transpiler.js +++ b/src/strands/strands_transpiler.js @@ -218,7 +218,7 @@ function buildPropertyPath(memberExpr) { const propName = current.property.name || current.property.value; if (isSwizzle(propName)) { current = current.object; - break; + continue; } parts.unshift(propName); current = current.object; diff --git a/src/webgl/3d_primitives.js b/src/webgl/3d_primitives.js index 6ed2ed98d2..5c6c270745 100644 --- a/src/webgl/3d_primitives.js +++ b/src/webgl/3d_primitives.js @@ -2733,6 +2733,8 @@ function primitives3D(p5, fn) { rect: wrap(this.rect, this), quad: wrap(this.quad, this), ellipse: wrap(this.ellipse, this), + circle: wrap(this.circle, this), + square: wrap(this.square, this), arc: wrap(this.arc, this), model: wrap(r.model), line: wrap(this.line, this), diff --git a/test/unit/visual/cases/webgl.js b/test/unit/visual/cases/webgl.js index 76896c3a56..e8b64c40bc 100644 --- a/test/unit/visual/cases/webgl.js +++ b/test/unit/visual/cases/webgl.js @@ -1465,6 +1465,38 @@ visualSuite('WebGL', function () { p5.instances(count).spline(-5, 5, 0, -2, -5, 0, 2, 5, 0, 5, -5, 0); screenshot(); }); + + visualTest( + 'conditional swizzle assignment inside of branching', + (p5, screenshot) => { + p5.createCanvas(50, 50, p5.WEBGL); + const shader = p5.baseMaterialShader().modify( + () => { + p5.worldInputs.begin(); + // For the first instance, bump the circle vertices out to +/- 15 + // to turn it into a square. The second instance remains a circle + if (p5.instanceIndex < 1) { + p5.worldInputs.position.x = p5.sign(p5.worldInputs.position.x) * 15; + p5.worldInputs.position.y = p5.sign(p5.worldInputs.position.y) * 15; + } + // Spread the instances out horizontally to be side by side + p5.worldInputs.position += [ + (p5.instanceIndex - 0.5) * 30, + 0, + 0 + ]; + p5.worldInputs.end(); + }, + { p5 } + ); + p5.background(200); + p5.noStroke(); + p5.fill(255, 0, 0); + p5.shader(shader); + p5.instances(2).circle(0, 0, 20); + screenshot(); + } + ); }); visualSuite('p5.strands', () => { diff --git a/test/unit/visual/cases/webgpu.js b/test/unit/visual/cases/webgpu.js index d81d51ca7a..dd7ba1b742 100644 --- a/test/unit/visual/cases/webgpu.js +++ b/test/unit/visual/cases/webgpu.js @@ -533,6 +533,38 @@ visualSuite('WebGPU', function () { await screenshot(); } ); + + visualTest( + 'conditional swizzle assignment inside of branching', + async function (p5, screenshot) { + await p5.createCanvas(50, 50, p5.WEBGPU); + const shader = p5.baseMaterialShader().modify( + () => { + p5.worldInputs.begin(); + // For the first instance, bump the circle vertices out to +/- 15 + // to turn it into a square. The second instance remains a circle + if (p5.instanceIndex < 1) { + p5.worldInputs.position.x = p5.sign(p5.worldInputs.position.x) * 15; + p5.worldInputs.position.y = p5.sign(p5.worldInputs.position.y) * 15; + } + // Spread the instances out horizontally to be side by side + p5.worldInputs.position += [ + (p5.instanceIndex - 0.5) * 30, + 0, + 0 + ]; + p5.worldInputs.end(); + }, + { p5 } + ); + p5.background(200); + p5.noStroke(); + p5.fill(255, 0, 0); + p5.shader(shader); + p5.instances(2).circle(0, 0, 20); + await screenshot(); + } + ); }); visualTest( diff --git a/test/unit/visual/screenshots/WebGL/instanced randering/conditional swizzle assignment inside of branching/000.png b/test/unit/visual/screenshots/WebGL/instanced randering/conditional swizzle assignment inside of branching/000.png new file mode 100644 index 0000000000..d6b2e63d6d Binary files /dev/null and b/test/unit/visual/screenshots/WebGL/instanced randering/conditional swizzle assignment inside of branching/000.png differ diff --git a/test/unit/visual/screenshots/WebGL/instanced randering/conditional swizzle assignment inside of branching/metadata.json b/test/unit/visual/screenshots/WebGL/instanced randering/conditional swizzle assignment inside of branching/metadata.json new file mode 100644 index 0000000000..2d4bfe30da --- /dev/null +++ b/test/unit/visual/screenshots/WebGL/instanced randering/conditional swizzle assignment inside of branching/metadata.json @@ -0,0 +1,3 @@ +{ + "numScreenshots": 1 +} \ No newline at end of file diff --git a/test/unit/visual/screenshots/WebGPU/Shaders/conditional swizzle assignment inside of branching/000.png b/test/unit/visual/screenshots/WebGPU/Shaders/conditional swizzle assignment inside of branching/000.png new file mode 100644 index 0000000000..29ec642e98 Binary files /dev/null and b/test/unit/visual/screenshots/WebGPU/Shaders/conditional swizzle assignment inside of branching/000.png differ diff --git a/test/unit/visual/screenshots/WebGPU/Shaders/conditional swizzle assignment inside of branching/metadata.json b/test/unit/visual/screenshots/WebGPU/Shaders/conditional swizzle assignment inside of branching/metadata.json new file mode 100644 index 0000000000..2d4bfe30da --- /dev/null +++ b/test/unit/visual/screenshots/WebGPU/Shaders/conditional swizzle assignment inside of branching/metadata.json @@ -0,0 +1,3 @@ +{ + "numScreenshots": 1 +} \ No newline at end of file