Fix fluid atlas N/S hole placement via paired mirrorY.
FBO sampling flips V vs Framework sprites: mirror each tile draw and the chunk atlas GameObject so sandbank gaps and coasts share the same upright space.
@@ -2,9 +2,10 @@
2
2
* Per-chunk fluid (water / lava) atlas: render procedural shaders at true
3
3
* SPRITE_SIZE_PX, then nearest-upscale the atlas to chunk world size.
4
4
*
5
* Tile placement uses the same Y-down screen space as Framework drawSprite
6
* (no extra FBO Y-flip — that put N/S coasts on the wrong sides).
5
* Tile placement is Y-down (localY). FBO↔sprite V mismatch is corrected by
6
* mirrorY on each tile draw and on the atlas GameObject (holes + coasts).
7
7
*/
8
8
9
import { CHUNK_SIZE, SPRITE_SIZE_PX } from "/shared/protocol/constants.js";
9
10
import { frameworkImageFromCanvas } from "./canvasSprite.js";
10
11
@@ -159,7 +160,9 @@ export function drawFluidAtlasTile (glCtx, {
159
160
h: SPRITE_SIZE_PX,
160
161
rotationDeg: 0,
161
162
mirrorX: false,
162
mirrorY: false,
163
// FBO sampling is V-flipped vs Framework sprites; pre-flip tile content
164
// so a mirrored atlas GameObject shows correct coasts + hole positions.
165
mirrorY: true,
163
166
alpha: 1,
164
167
uvRect: uvRect ?? { u0: 0, v0: 0, u1: 1, v1: 1 },
165
168
shader,
@@ -2,9 +2,10 @@2
* Per-chunk fluid (water / lava) atlas: render procedural shaders at true2
* Per-chunk fluid (water / lava) atlas: render procedural shaders at true3
* SPRITE_SIZE_PX, then nearest-upscale the atlas to chunk world size.3
* SPRITE_SIZE_PX, then nearest-upscale the atlas to chunk world size.4
*4
*5
* Tile placement uses the same Y-down screen space as Framework drawSprite5
* Tile placement is Y-down (localY). FBO↔sprite V mismatch is corrected by6
* (no extra FBO Y-flip — that put N/S coasts on the wrong sides).6
* mirrorY on each tile draw and on the atlas GameObject (holes + coasts).7
*/7
*/8
8
import { CHUNK_SIZE, SPRITE_SIZE_PX } from "/shared/protocol/constants.js";9
import { CHUNK_SIZE, SPRITE_SIZE_PX } from "/shared/protocol/constants.js";9
import { frameworkImageFromCanvas } from "./canvasSprite.js";10
import { frameworkImageFromCanvas } from "./canvasSprite.js";10
11
@@ -159,7 +160,9 @@ export function drawFluidAtlasTile (glCtx, {159
h: SPRITE_SIZE_PX,160
h: SPRITE_SIZE_PX,160
rotationDeg: 0,161
rotationDeg: 0,161
mirrorX: false,162
mirrorX: false,162
mirrorY: false,163
// FBO sampling is V-flipped vs Framework sprites; pre-flip tile content164
// so a mirrored atlas GameObject shows correct coasts + hole positions.165
mirrorY: true,163
alpha: 1,166
alpha: 1,164
uvRect: uvRect ?? { u0: 0, v0: 0, u1: 1, v1: 1 },167
uvRect: uvRect ?? { u0: 0, v0: 0, u1: 1, v1: 1 },165
shader,168
shader,@@ -4446,6 +4446,10 @@ export class WorldView
4446
4446
object.transform.position.x = Math.round(left + chunkPx / 2);
4447
4447
object.transform.position.y = Math.round(top + chunkPx / 2);
4448
4448
object.transform.size = new vector(chunkPx, chunkPx);
4449
// FBO color attachment is V-flipped vs Framework sprite UVs — mirror so
4450
// sandbank holes sit on the correct N/S side (tile draws also mirrorY).
4451
if (object.renderer)
4452
{ object.renderer.mirrorY = true; }
4449
4453
if (kind === "bloom")
4450
4454
{
4451
4455
this.#setLayer(object, this.#depthLayer(top + chunkPx, SORT_BLOCK));
@@ -4446,6 +4446,10 @@ export class WorldView4446
object.transform.position.x = Math.round(left + chunkPx / 2);4446
object.transform.position.x = Math.round(left + chunkPx / 2);4447
object.transform.position.y = Math.round(top + chunkPx / 2);4447
object.transform.position.y = Math.round(top + chunkPx / 2);4448
object.transform.size = new vector(chunkPx, chunkPx);4448
object.transform.size = new vector(chunkPx, chunkPx);4449
// FBO color attachment is V-flipped vs Framework sprite UVs — mirror so4450
// sandbank holes sit on the correct N/S side (tile draws also mirrorY).4451
if (object.renderer)4452
{ object.renderer.mirrorY = true; }4449
if (kind === "bloom")4453
if (kind === "bloom")4450
{4454
{4451
this.#setLayer(object, this.#depthLayer(top + chunkPx, SORT_BLOCK));4455
this.#setLayer(object, this.#depthLayer(top + chunkPx, SORT_BLOCK));