OverviewFilesCommitsIssuesDocsReleasesPeers

terrain-lookdev commits / 5e820ec

stitch: --per-tile, because the tile set is INCOMPLETE and GROWS
A stitched block is a SNAPSHOT: it fixes which tiles exist at bake time. The 900 km world is 119x119 = 14,161 tiles of which 841 are generated, there is no solid 119x119 to stitch, and there will not be one for a long time -- so the engine has to load a LIST of tiles and treat the gaps as stubs rather than load one rectangle. --per-tile writes one .hblk per cached tile, each keeping its own 1 px apron and its own world origin. A tile is therefore self-describing and can be added at runtime without touching any other file. Verified on the real cache: 258x258 px, 133,160 B each (32 B header + 258^2 x 2). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
5e820ecf84032e29d0277dc383385308caaa50ad
by plankatron <fleeky@gmail.com> · 2026-09-03T17:19:28.000Z

Changed files (1) +30 -0

stitch_block.py +30 -0
……@@ -137,6 +137,10 @@ def main():
137137 ap.add_argument("--ty", type=int, default=None)
138138 ap.add_argument("--out", default="/tmp/block.hblk")
139139 ap.add_argument("--list", action="store_true")
140 ap.add_argument("--per-tile", metavar="OUTDIR",
141 help="write ONE .hblk per cached tile into OUTDIR")
142 ap.add_argument("--limit", type=int, default=0,
143 help="with --per-tile, stop after N tiles (0 = all)")
140144 a = ap.parse_args()
141145
142146 tiles = cached_tiles()
……@@ -148,6 +152,32 @@ def main():
148152 + (f" e.g. --tx {s[len(s)//2][0]} --ty {s[len(s)//2][1]}" if s else ""))
149153 return
150154
155 if a.per_tile:
156 # ONE TILE PER FILE, because the tile set is INCOMPLETE and GROWS.
157 #
158 # A stitched block is a SNAPSHOT: it fixes which tiles exist at bake
159 # time, and the 900 km world is 14,161 tiles of which 841 are generated.
160 # There is no solid 119x119 to stitch and there will not be one for a
161 # long time, so the engine has to load a LIST of tiles and treat the
162 # gaps as stubs rather than load one rectangle.
163 #
164 # Each file keeps its own 1 px apron and its own world origin, so a tile
165 # is self-describing and can be added at runtime without touching any
166 # other file.
167 os.makedirs(a.per_tile, exist_ok=True)
168 origins = sorted(tiles)
169 if a.limit:
170 origins = origins[:a.limit]
171 n_ok = 0
172 for (tx, ty) in origins:
173 arr, ox, oz = stitch(tx, ty, 1)
174 write_hblk(os.path.join(a.per_tile, f"tile_{tx}_{ty}.hblk"), arr, ox, oz)
175 n_ok += 1
176 print(f"wrote {n_ok} per-tile .hblk to {a.per_tile}")
177 print(f" each {arr.shape[0]}x{arr.shape[0]} px "
178 f"({TILE_PX}+2 apron) = {TILE_PX*MPP/1000:.2f} km of payload")
179 return
180
151181 if a.tx is None or a.ty is None:
152182 s = solid_origins(tiles, a.n)
153183 if not s: