/apps/demos/scenery: more detailed terrain
This commit is contained in:
parent
82d4f21a4b
commit
80c77424e2
@ -12,7 +12,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
#define TERRAIN_FREQUENCY 0.1f
|
#define TERRAIN_FREQUENCY 0.15f
|
||||||
#define TERRAIN_DISTANCE 32
|
#define TERRAIN_DISTANCE 32
|
||||||
#define HALF_TERRAIN_DISTANCE ((float)TERRAIN_DISTANCE / 2)
|
#define HALF_TERRAIN_DISTANCE ((float)TERRAIN_DISTANCE / 2)
|
||||||
#define PLAYER_HEIGHT 0.6f
|
#define PLAYER_HEIGHT 0.6f
|
||||||
@ -135,6 +135,7 @@ static void generate_terrain(SceneIngame *scn) {
|
|||||||
float y = floorf(scn->pos.z - HALF_TERRAIN_DISTANCE + (float)ly);
|
float y = floorf(scn->pos.z - HALF_TERRAIN_DISTANCE + (float)ly);
|
||||||
|
|
||||||
float height = stb_perlin_noise3((float)x * TERRAIN_FREQUENCY, (float)y * TERRAIN_FREQUENCY, 0, 0, 0, 0) * 3 - 1;
|
float height = stb_perlin_noise3((float)x * TERRAIN_FREQUENCY, (float)y * TERRAIN_FREQUENCY, 0, 0, 0, 0) * 3 - 1;
|
||||||
|
height += stb_perlin_noise3((float)x * TERRAIN_FREQUENCY / 10, (float)y * TERRAIN_FREQUENCY / 10, 0, 0, 0, 0) * 10 - 1;
|
||||||
|
|
||||||
heightmap[lx][ly] = height;
|
heightmap[lx][ly] = height;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user