Tile Z is now hypotenused to 1 rather than stretching to have Z of 1.

This commit is contained in:
2026-07-01 16:27:59 -05:00
parent 874c6258ab
commit 172dc5d37b
15 changed files with 334 additions and 23 deletions
+9 -1
View File
@@ -44,6 +44,7 @@ Usage:
"""
import json
import math
import os
import struct
import sys
@@ -58,6 +59,10 @@ CHUNK_HEIGHT = 16
CHUNK_DEPTH = 4
CHUNK_TILE_COUNT = CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_DEPTH # 1024
# World-space Z distance of one Z-layer/story, in world-float space.
# Must match WORLD_LAYER_HEIGHT in src/dusk/rpg/overworld/worldpos.h.
WORLD_LAYER_HEIGHT = 1.0 / math.sqrt(2)
CHUNK_MESH_COUNT_MAX = 10
CHUNK_MESH_NAME_MAX = 64
@@ -231,7 +236,10 @@ def build_terrain_verts(tiles_bytes):
sw, se, ne, nw = corners
buf += _tile_quad(
u0, u1, v0, v1, fx, fy,
fz + sw, fz + se, fz + ne, fz + nw
(fz + sw) * WORLD_LAYER_HEIGHT,
(fz + se) * WORLD_LAYER_HEIGHT,
(fz + ne) * WORLD_LAYER_HEIGHT,
(fz + nw) * WORLD_LAYER_HEIGHT
)
return bytes(buf)