diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index ec2142a..bb76aec 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -329,10 +329,11 @@ function drawTileAt(lng, perp, dx, dz, centerTileX, centerTileY) { // corridor's long axis (flight direction +Z) appears as a vertical // strip on canvas, matching the way depth maps on screen. // UNPACK_FLIP_Y_WEBGL=true inverts V: canvas top -> texture V=1 (top). - // To put lng=+12 (corridor front in N flight) at screen TOP we put it - // at canvas top (small canvasY). Same inversion for perp so world - // east (dx>0, perp<0) ends up at canvas right (large canvasX). - var canvasX = (-perp + halfPerp + 0.5) * GROUND_TILE_SIZE; + // For lng axis (Y): invert canvasY so lng=+12 (corridor front in + // N flight) lands at small canvasY (= screen top after flip). + // For perp axis (X): keep the natural sign so world east (dx>0) + // ends up at canvasX > halfPerp area (right side of canvas). + var canvasX = (perp + halfPerp + 0.5) * GROUND_TILE_SIZE; var canvasY = (-lng + halfLong + 0.5) * GROUND_TILE_SIZE; if (canvasX < 0 || canvasX >= groundCanvas.width || canvasY < 0 || canvasY >= groundCanvas.height) { return Promise.resolve(false);