Water tint

This commit is contained in:
2026-10-07 11:29:58 -03:00
parent b830196829
commit 40d5a4f5af
8 changed files with 84 additions and 29 deletions
+4 -3
View File
@@ -1,7 +1,7 @@
import { block_value, chunk_key, default_block_value } from "$/common/utils.ts";
import { AIR_ID } from "$/common/protocol.ts";
import { decode_level_chunk } from "$/common/chunk_streaming.ts";
import { foliage_color, grass_color } from "$/common/worldgen/biome_colors.ts";
import { foliage_color, grass_color, water_color } from "$/common/worldgen/biome_colors.ts";
import {
block_light_emission,
block_light_opacity,
@@ -45,7 +45,7 @@ export interface Chunk {
max_y: number;
// only for translucent meshes that have to be sorted again as the camera moves
translucent_sort?: TranslucentSort;
// each column's biome grass color, x then z, then each column's foliage color
// each column's biome grass color, x then z, then each column's foliage color, then water color
biome_colors: Uint32Array;
// from its last mesh, see get_light. undefined until it's been meshed
light?: Uint8Array;
@@ -171,10 +171,11 @@ export class ClientLevel {
if (!this.#in_storage_range(x, z)) {
return;
}
const biome_colors = new Uint32Array(CHUNK_AREA * 2);
const biome_colors = new Uint32Array(CHUNK_AREA * 3);
biomes.forEach((biome, column) => {
biome_colors[column] = grass_color(biome);
biome_colors[CHUNK_AREA + column] = foliage_color(biome);
biome_colors[CHUNK_AREA * 2 + column] = water_color(biome);
});
const chunk = this.get_chunk(x, z);