World shape for dimension
This commit is contained in:
+5
-3
@@ -4,7 +4,8 @@
|
||||
// blocks with a "tint" are drawn in their biome's grass or foliage color, blended across biome edges, or a fixed one. water is its biome's water color
|
||||
import { assert, assertEquals } from "@std/assert";
|
||||
import { BlockRegistry, EverythingRegistry } from "@/common/everything_registry.ts";
|
||||
import { CHUNK_AREA, CHUNK_HEIGHT, CHUNK_SIZE } from "@/common/constants.ts";
|
||||
import { CHUNK_AREA, CHUNK_SIZE } from "@/common/constants.ts";
|
||||
import { DEFAULT_SHAPE } from "@/common/world_shape.ts";
|
||||
import { generate_raw_chunk } from "@/common/generation.ts";
|
||||
import { get_biome } from "@/common/worldgen/biomes.ts";
|
||||
import { type LayerMesh, TERRAIN_VERTEX_BYTES } from "@/client/workers/chunk_messages.ts";
|
||||
@@ -22,6 +23,7 @@ async function mesh_block(id: string, x: number, middle: Colors, west: Colors |
|
||||
const worker = new Worker(new URL("../client/workers/chunk_worker.ts", import.meta.url).href, { type: "module" });
|
||||
worker.postMessage({
|
||||
type: "init",
|
||||
shape: DEFAULT_SHAPE,
|
||||
blocks_registry: JSON.parse(JSON.stringify(blocks)),
|
||||
models: {},
|
||||
textures_info: { "cubi:missing": { x: 0, y: 0, width: 16, height: 16 } },
|
||||
@@ -29,9 +31,9 @@ async function mesh_block(id: string, x: number, middle: Colors, west: Colors |
|
||||
visuals: [],
|
||||
});
|
||||
|
||||
const chunk = new Uint32Array(CHUNK_AREA * CHUNK_HEIGHT);
|
||||
const chunk = new Uint32Array(DEFAULT_SHAPE.volume);
|
||||
chunk[10 * CHUNK_AREA + 8 * CHUNK_SIZE + x] = block_ids[id];
|
||||
const empty = () => new Uint32Array(CHUNK_AREA * CHUNK_HEIGHT);
|
||||
const empty = () => new Uint32Array(DEFAULT_SHAPE.volume);
|
||||
const chunks = [empty(), empty(), empty(), empty(), chunk, empty(), empty(), empty(), empty()];
|
||||
const colors = chunks.map(() => null as Uint32Array | null);
|
||||
const biome_colors = ({ grass, foliage, water = 0 }: Colors) => {
|
||||
|
||||
Reference in New Issue
Block a user