Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 0 additions & 78 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/strands/strands_transpiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/webgl/3d_primitives.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
32 changes: 32 additions & 0 deletions test/unit/visual/cases/webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
32 changes: 32 additions & 0 deletions test/unit/visual/cases/webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"numScreenshots": 1
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"numScreenshots": 1
}
Loading