World sections

This commit is contained in:
2026-11-06 23:13:34 -03:00
parent 818ce22dd6
commit 1fa47c027d
21 changed files with 392 additions and 127 deletions
+4 -2
View File
@@ -33,8 +33,10 @@ self.onmessage = (event: MessageEvent<{ port: MessagePort }>) => {
const { x, z } = message;
try {
const raw = (await loaded!).generate(x, z);
send({ type: "chunk", x, z, blocks: raw.blocks, spills: raw.spills, biomes: raw.biomes }, [
raw.blocks.buffer,
const sections = raw.column.sections.map((section) => section.data);
const buffers = sections.flatMap((data) => typeof data === "number" ? [] : [data.buffer]);
send({ type: "chunk", x, z, sections, spills: raw.spills, biomes: raw.column.biomes }, [
...buffers,
raw.spills.buffer,
]);
} catch (e) {