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

@ -6,7 +6,7 @@
#define CHUNK_RADIUS_H 4 // 8
#define CHUNK_RADIUS_V 4 // 4
#define TEXT_GAP_H 1 / 3.0
#define TEXT_GAP_H 1 / 6.0
#define TEXT_GAP_V 1 / 6.0
#define CHUNK_DIAMETER_H (CHUNK_RADIUS_H * 2 + 1)

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++;
}
}

View file

@ -3,10 +3,5 @@
#define V_NOISE_H
#include "cubes.h"
#include <math.h>
double noise_interpolate(double a0, double a1, double w);
int noise_hash(int a, int b);
struct v2f noise_perlin_grad(int x, int y, int seed);
double noise_perlin_dot(double ix, double iy, double x, double y, int seed);
double noise_perlin(double x, double y, double s, int seed);
struct chunk noise_chunk(struct chunk chunk, int x, int y, int z);
#endif

BIN
test.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Before After
Before After