diff --git a/preview/index.html b/preview/index.html index 3584e5e251..ed76b913f5 100644 --- a/preview/index.html +++ b/preview/index.html @@ -107,6 +107,7 @@ p.draw = function () { p.clear(); + p.rotateY(p.millis() * 0.001); p.push(); //p.clip(() => p.rect(-50, -50, 200, 200)); /*p.orbitControl(); diff --git a/src/webgpu/p5.RendererWebGPU.js b/src/webgpu/p5.RendererWebGPU.js index 8ed51bd96a..4ef6f1934a 100644 --- a/src/webgpu/p5.RendererWebGPU.js +++ b/src/webgpu/p5.RendererWebGPU.js @@ -1013,6 +1013,7 @@ function rendererWebGPU(p5, fn) { this.states.setValue('activeImageLight', null); this._pInst.setCamera(this.finalCamera); this._pInst.resetShader(); + this._pInst.resetMatrix(); this._pInst.imageMode(this._pInst.CENTER); this._pInst.image(this.mainFramebuffer, 0, 0); this._pInst.pop(); diff --git a/test/unit/visual/cases/webgpu.js b/test/unit/visual/cases/webgpu.js index 45c793a322..41ff0f9326 100644 --- a/test/unit/visual/cases/webgpu.js +++ b/test/unit/visual/cases/webgpu.js @@ -844,4 +844,14 @@ visualSuite("WebGPU", function () { ); } }); + + visualSuite('transformation', function() { + visualTest('outside of push() and pop()', async function (p5, screenshot) { + await p5.createCanvas(50, 50, p5.WEBGPU); + p5.background(200); + p5.rotateY(p5.PI * 0.1); + p5.box(30); + await screenshot(); + }); + }); }); diff --git a/test/unit/visual/screenshots/WebGPU/transformation/outside of push() and pop()/000.png b/test/unit/visual/screenshots/WebGPU/transformation/outside of push() and pop()/000.png new file mode 100644 index 0000000000..831a6032bc Binary files /dev/null and b/test/unit/visual/screenshots/WebGPU/transformation/outside of push() and pop()/000.png differ diff --git a/test/unit/visual/screenshots/WebGPU/transformation/outside of push() and pop()/metadata.json b/test/unit/visual/screenshots/WebGPU/transformation/outside of push() and pop()/metadata.json new file mode 100644 index 0000000000..2d4bfe30da --- /dev/null +++ b/test/unit/visual/screenshots/WebGPU/transformation/outside of push() and pop()/metadata.json @@ -0,0 +1,3 @@ +{ + "numScreenshots": 1 +} \ No newline at end of file