Render textured aerial maps and support legacy recovery links

This commit is contained in:
2026-10-05 18:11:12 +05:00
parent dcc3779262
commit 2cbaf45340
12 changed files with 226 additions and 35 deletions

19
renderer/map-view.mjs Normal file
View File

@@ -0,0 +1,19 @@
// Keep one world block square in the image, including rectangular exports.
// Eight pixels per block preserves the vanilla textures in typical 128-block
// exports; large worlds are capped to a manageable image size.
export function mapDimensions(bounds) {
const spanX = bounds.maxX - bounds.minX;
const spanZ = bounds.maxZ - bounds.minZ;
if (
!Number.isInteger(spanX) ||
!Number.isInteger(spanZ) ||
spanX < 1 ||
spanZ < 1
)
throw new Error("Surface map bounds must have a positive integer size");
const scale = Math.min(8, 2048 / Math.max(spanX, spanZ));
return {
width: Math.max(1, Math.round(spanX * scale)),
height: Math.max(1, Math.round(spanZ * scale)),
};
}