more complex generation

This commit is contained in:
onezplpl 2024-07-17 20:17:49 -04:00
parent b6b3483a39
commit fb639f96c3
No known key found for this signature in database
GPG key ID: 7EC026A136F9EEC3
4 changed files with 7 additions and 9 deletions

View file

@ -61,12 +61,15 @@ struct chunk noise_chunk(struct chunk chunk, int x, int y, int z) {
int z3 = z2 + z * CHUNK_LENGTH;
double hp = noise_perlin(x3, z3, 128.0, default_seed);
hp = ((hp > 0.0) ? -1.0 : 1.0) * (pow(fabs(hp), 0.7));
hp *= 32.0;
int h = hp + 32;
hp *= 128.0;
int h = hp + 64;
for (int y2 = 0; y2 < CHUNK_LENGTH; y2++) {
int y3 = y2 + y * CHUNK_LENGTH;
chunk.blocks[c] = (y3 < h) ? (((int)((hp + 64.0) * 2.98) % 3) + 1) : 0;
chunk.blocks[c] = 0;
if (y3 < h) chunk.blocks[c] = 4;
if (y3 < h - 1) chunk.blocks[c] = 5;
if (y3 < h - 2) chunk.blocks[c] = 6;
c++;
}
}