Fix shader rotation: align with JS corridor constants (90 deg)

When I changed GROUND_TRAVEL_COS/SIN to (0, 1) (90 deg, +Z
direction) in JS, the shader still used the old (0.82, 0.57)
rotation (35 deg). The corridor was built along +Z but UVs were
computed as if the canvas were rotated 35 deg — meaning the
corridor was effectively at 35 deg from where tiles were loaded.
Tiles ended up diagonally to the flight path.
This commit is contained in:
Richard Zink committed 2026-10-07 21:12:05 +02:00
1 parent 425dbf4529
commit af5cda467f
1 file changed
+1 -1
+1 -1
View File
@@ -204,7 +204,7 @@ var FRAG_SRC = [
'vec3 hitPoint = ro + rd * tGround;',
// Project hitPoint onto the corridor rotated axes (travel ~35 deg). Then divide by per-axis extent so the corridor maps to UV 0..1. The mosaic canvas is drawn in this rotated frame, so the satellite image comes out oriented correctly.
'vec2 offset = vec2(hitPoint.x, hitPoint.z) - uGroundCenter;',
'vec2 rotated = vec2(offset.x * 0.82 + offset.y * 0.57, -offset.x * 0.57 + offset.y * 0.82);',
'vec2 rotated = vec2(offset.x * 0.0 + offset.y * 1.0, -offset.x * 1.0 + offset.y * 0.0);',
'vec2 gUv = rotated / uGroundSize + 0.5;',
'vec3 groundCol = texture2D(uGround, gUv).rgb;',
'float fogAmount = clamp(tGround / 14.0, 0.0, 1.0);',