World shape for dimension

This commit is contained in:
2026-11-06 22:49:43 -03:00
parent 7458a2d42a
commit 818ce22dd6
60 changed files with 749 additions and 349 deletions
+5 -2
View File
@@ -4,6 +4,7 @@
import type { BlockRegistry } from "@/common/everything_registry.ts";
import type { SpriteRegion } from "@/common/constants.ts";
import type { ModelJson } from "@/common/block_models.ts";
import type { WorldShapeJson } from "@/common/world_shape.ts";
import type { SortType } from "./translucent_sort.ts";
// messages between the main thread and the chunk workers
@@ -38,6 +39,8 @@ export type ToChunkWorker =
// the numeric ids of blocks with visuals, and whether each visual replaces the block's model, see
// ctx.render.register_visual
visuals: [number, boolean][];
// the dimension's height and sky light. the chunks meshed hold all of its height
shape: WorldShapeJson;
}
| {
type: "mesh";
@@ -75,7 +78,7 @@ export type FromChunkWorker =
chunk_x: number;
chunk_z: number;
version: number;
// the lowest and highest y of the chunk's quads, for frustum culling
// the lowest and highest y of the chunk's quads in the world, for frustum culling
min_y: number;
max_y: number;
solid: LayerMesh;
@@ -89,7 +92,7 @@ export type FromChunkWorker =
planes: [Float32Array, Float32Array, Float32Array];
};
camera: number[];
// the chunk's light, one byte per block indexed like its blocks: block light << 4 | sky light, like sodium's
// the chunk's light, one byte per block indexed like its blocks (from the bottom of the world): block light << 4 | sky light, like sodium's
// packed light data. entities are lit from it
light: Uint8Array<ArrayBuffer>;
// the blocks in it with visuals, as pairs of the block's index in the chunk (like light's) and its value