add basic heightmaps generator optimization

This commit is contained in:
MihailRis
2024-08-18 00:08:36 +03:00
parent 8c0a3f4260
commit 8fb0f6a1bb
5 changed files with 74 additions and 12 deletions
+1
View File
@@ -34,6 +34,7 @@ void WorldGenerator::generate(
for (uint x = 0; x < CHUNK_W; x++) {
// generate water
int height = values[z * CHUNK_W + x] * CHUNK_H;
height = std::max(0, height);
for (uint y = height+1; y <= seaLevel; y++) {
voxels[vox_index(x, y, z)].id = baseWater;
}