mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 13:01:49 +00:00
add basic heightmaps generator optimization
This commit is contained in:
parent
8c0a3f4260
commit
8fb0f6a1bb
5 changed files with 74 additions and 12 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue