Fail fast on missing terrain assets and recover empty renders

This commit is contained in:
2026-10-04 22:32:11 +05:00
parent 79d0f53a79
commit 763cf8713c
15 changed files with 842 additions and 21 deletions

View File

@@ -225,6 +225,11 @@ export async function buildTerrain(
);
}
const modelMs = performance.now() - started - indexMs;
if (!materials.size || !entries.some(([, entry]) => entry.faces.length)) {
throw new Error(
`No terrain models could be rendered. Minecraft models/textures are missing or failed to load. Run npm run setup. Unsupported examples: ${[...unsupported].slice(0, 8).join(", ")}`,
);
}
await progress(35, "Building cached block faces", true);
const batches = new Map(),
meshList = [],
@@ -299,6 +304,11 @@ export async function buildTerrain(
);
}
window.terrainBounds = snapshot.bounds;
if (!meshList.length || !emittedFaces) {
throw new Error(
"Terrain renderer produced no visible geometry. The export cannot be accepted as a playable map.",
);
}
window.terrainMeshes = meshList;
const totalMs = performance.now() - started;
return {