Client side chunk sections
This commit is contained in:
@@ -5,6 +5,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 { SectionData } from "@/common/section.ts";
|
||||
import type { SortType } from "./translucent_sort.ts";
|
||||
|
||||
// messages between the main thread and the chunk workers
|
||||
@@ -47,8 +48,9 @@ export type ToChunkWorker =
|
||||
chunk_x: number;
|
||||
chunk_z: number;
|
||||
version: number;
|
||||
// copies of the blocks of the 3x3 chunks around it, going +x then +z from -x -z, for lighting
|
||||
chunks: (Uint32Array | null)[];
|
||||
// the blocks of the 3x3 chunks around it, going +x then +z from -x -z, for lighting. each one's sections from the
|
||||
// bottom of the world up, null for a chunk that isn't loaded
|
||||
chunks: (SectionData[] | null)[];
|
||||
// the same chunks' biome colors (see Chunk.biome_colors in client_level.ts), blended across their edges
|
||||
biome_colors: (Uint32Array | null)[];
|
||||
// where the camera is, to sort the translucent quads
|
||||
@@ -64,6 +66,10 @@ export type ToChunkWorker =
|
||||
camera: number[];
|
||||
};
|
||||
|
||||
// a section's light, a byte per block indexed like its blocks (see section_index): block light << 4 | sky light, like
|
||||
// sodium's packed light data. one number when it's the same everywhere, like the open sky above the ground
|
||||
export type SectionLight = number | Uint8Array<ArrayBuffer>;
|
||||
|
||||
// 4 vertices per quad, TERRAIN_VERTEX_BYTES each
|
||||
export interface LayerMesh {
|
||||
vertices: Uint8Array<ArrayBuffer>;
|
||||
@@ -92,10 +98,10 @@ export type FromChunkWorker =
|
||||
planes: [Float32Array, Float32Array, Float32Array];
|
||||
};
|
||||
camera: number[];
|
||||
// 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
|
||||
// the chunk's light by section, from the bottom of the world up, see SectionLight. entities are lit from it
|
||||
light: SectionLight[];
|
||||
// the blocks in it with visuals, as pairs of the block's index in the chunk (y from the bottom of the world, then
|
||||
// z, then x) and its value
|
||||
visuals: Uint32Array<ArrayBuffer>;
|
||||
}
|
||||
| {
|
||||
|
||||
Reference in New Issue
Block a user