Lighting system

This commit is contained in:
2026-09-25 15:40:09 -03:00
parent 25f8c683bb
commit 4539898c58
12 changed files with 634 additions and 349 deletions
+5 -1
View File
@@ -5,6 +5,9 @@ import type { SortType } from "./translucent_sort.ts";
// messages between the main thread and the chunk workers
// position 3, uv 2, color 4 (directional shade and ambient occlusion, alpha), lightmap coordinates 2
export const TERRAIN_VERTEX_FLOATS = 11;
export type ToChunkWorker =
| {
type: "init";
@@ -23,7 +26,8 @@ export type ToChunkWorker =
chunk_x: number;
chunk_z: number;
version: number;
padded_chunk: Uint32Array;
// copies of the blocks of the 3x3 chunks around it, going +x then +z from -x -z, for lighting
chunks: (Uint32Array | null)[];
// where the camera is, to sort the translucent quads
camera: number[];
}