refactor: init_world

This commit is contained in:
2026-05-02 21:19:02 +08:00
parent 11af0d9f01
commit 7a7b3d57ac
14 changed files with 365 additions and 159 deletions

View File

@@ -15,4 +15,27 @@ void BiomeBuilder::build_bottom() {
}
}
}
void BiomeBuilder::fill_water() {
ChunkGenerator& chunk_generator = get_chunk_generator();
Chunk& chunk = chunk_generator.chunk();
auto& m_blocks = chunk.blocks();
auto& neighbor = chunk_generator.neighbor_biome();
auto& heightmap = chunk.heightmap();
for (int i = 0; i < 8; i++) {
if (neighbor[i] == BiomeType::RIVER) {
for (int x = 0; x < SIZE_X; x++) {
for (int z = 0; z < SIZE_Z; z++) {
if (heightmap[x][z] >= SEA_LEVEL) {
continue;
}
int height = heightmap[x][z];
for (int y = height; y < SEA_LEVEL; y++) {
m_blocks[Chunk::get_index(x, y, z)] = 7;
}
}
}
return;
}
}
}
} // namespace Cubed