refactor: use fBM for heightmap generation

This commit is contained in:
2026-05-22 17:16:15 +08:00
parent b824504502
commit 17c7ad989d
14 changed files with 208 additions and 69 deletions

View File

@@ -19,19 +19,19 @@ void MountainBuilder::build_blocks() {
for (int z = 0; z < CHUNK_SIZE; z++) {
int height = static_cast<int>(m_heightmap[x][z]);
for (int y = 5; y < height - 5; y++) {
m_blocks[Chunk::get_index(x, y, z)] = 3;
m_blocks[Chunk::index(x, y, z)] = 3;
}
for (int y = height - 5; y <= height - 1; y++) {
if (y > 110) {
m_blocks[Chunk::get_index(x, y, z)] = 3;
m_blocks[Chunk::index(x, y, z)] = 3;
} else {
m_blocks[Chunk::get_index(x, y, z)] = 2;
m_blocks[Chunk::index(x, y, z)] = 2;
}
}
if (height > 110) {
m_blocks[Chunk::get_index(x, height, z)] = 3;
m_blocks[Chunk::index(x, height, z)] = 3;
} else {
m_blocks[Chunk::get_index(x, height, z)] = 1;
m_blocks[Chunk::index(x, height, z)] = 1;
}
}
}