Both axes without swap: UNPACK flip for Y only

User clarified:
- x must decrease left to right (east at screen left, high x left)
- y must decrease in flight direction (south at front, low y in flight dir)

With no swap on canvasY (lng+halfLong+0.5 formula) and UNPACK
flip=true, canvas top -> texture top -> screen top. canvas bottom
-> screen bottom.

So:
- lng=+12 (north, ahead in N flight) -> canvasY=6272 (bottom)
  -> screen bottom. User at screen bottom sees north tiles = high y
- south tiles at canvas top -> screen top. User at screen top sees
  south tiles = low y. y decreases in flight direction (looking
  forward = top of screen = low y).

With no swap on canvasX:
- perp=-2 (east, dx=+2) -> canvasX=128 (left)
- After WebGL (no X flip): east at screen left, west at screen right.
  x decreases left to right (east at left, west at right).
This commit is contained in:
Richard Zink committed 2026-10-08 07:41:14 +02:00
1 parent d063e5e864
commit 73920d0ce8
1 file changed
+1 -1
+1 -1
View File
@@ -334,7 +334,7 @@ function drawTileAt(lng, perp, dx, dz, centerTileX, centerTileY) {
// 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;
var canvasY = (lng + halfLong + 0.5) * GROUND_TILE_SIZE;
if (canvasX < 0 || canvasX >= groundCanvas.width || canvasY < 0 || canvasY >= groundCanvas.height) {
return Promise.resolve(false);
}