From cf3bffc2a686dc8162d3b42121841b2f90c5c646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 13 Jul 2026 19:04:59 +0200 Subject: [PATCH] Fix TilemapGPULayer rendering at double its position A TilemapGPULayer placed at (x, y) was rendered at (2x, 2y). The layer's position is already baked into the transform via applyITRS(x, y, ...), but setQuad() was then called with the absolute x/y again, applying the offset twice. Build the quad from local (0, 0)-(width, height) coordinates instead. The existing GPU tilemap examples only place layers at (0, 0), so the doubling (2*0 = 0) was never visible. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../submitter/SubmitterTilemapGPULayer.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/renderer/webgl/renderNodes/submitter/SubmitterTilemapGPULayer.js b/src/renderer/webgl/renderNodes/submitter/SubmitterTilemapGPULayer.js index da6be803e9..cb57233289 100644 --- a/src/renderer/webgl/renderNodes/submitter/SubmitterTilemapGPULayer.js +++ b/src/renderer/webgl/renderNodes/submitter/SubmitterTilemapGPULayer.js @@ -515,11 +515,16 @@ var SubmitterTilemapGPULayer = new Class({ calcMatrix.multiply(spriteMatrix); // Compute output quad. + // The layer's x/y position is already baked into `spriteMatrix` (via + // `applyITRS`) and thus into `calcMatrix`, so the quad must be built + // from local coordinates (0, 0)-(width, height). Passing the absolute + // x/y here would apply the position twice, offsetting the layer by + // (x, y) (i.e. rendering a layer placed at (x, y) at (2x, 2y)). calcMatrix.setQuad( - x, - y, - x + width, - y + height, + 0, + 0, + width, + height, quad );