3D biomes

This commit is contained in:
2026-11-07 12:13:43 -03:00
parent b726ce9695
commit 22191d260c
53 changed files with 874 additions and 316 deletions
+3 -21
View File
@@ -4,15 +4,13 @@
// the client meshes a section at a time, and a block changing only meshes again the sections it can change the look
// or the light of, see ClientLevel's #block_changed
import { assertEquals } from "@std/assert";
import { ClientLevel } from "@/client/level/client_level.ts";
import { AssetManager } from "@/client/assets.ts";
import { Camera } from "@/client/camera.ts";
import type { ToChunkWorker } from "@/client/workers/chunk_messages.ts";
import { type BlockRegistry, EverythingRegistry } from "@/common/everything_registry.ts";
import { EverythingRegistry } from "@/common/everything_registry.ts";
import { CHUNK_AREA } from "@/common/constants.ts";
import { ChunkColumn } from "@/common/section.ts";
import { DEFAULT_SHAPE } from "@/common/world_shape.ts";
import { test_game } from "./helpers.ts";
import { client_level } from "./client_level.ts";
const GROUND_TOP = 63;
const ROOF = 200;
@@ -21,23 +19,7 @@ const ROOF = 200;
// its chunk workers is kept in requests instead of being sent
async function meshed_level() {
await test_game("mods");
AssetManager.instance.assets["cubi:textures"] = { width: 16, height: 16 };
AssetManager.instance.assets["cubi:textures_info"] = {};
const requests: Extract<ToChunkWorker, { type: "mesh" }>[] = [];
const real = globalThis.Worker;
globalThis.Worker = class {
postMessage(message: ToChunkWorker) {
if (message.type === "mesh") requests.push(message);
}
terminate() {}
} as unknown as typeof Worker;
const blocks = EverythingRegistry.get_registry<BlockRegistry>("blocks");
let level: ClientLevel;
try {
level = new ClientLevel(Array.from(blocks, (block) => block?.id), DEFAULT_SHAPE, 2);
} finally {
globalThis.Worker = real;
}
const { level, requests } = client_level(DEFAULT_SHAPE);
const stone = EverythingRegistry.get_id("blocks", "bworld:stone")!;
for (let x = -2; x <= 2; x++) {