scenery: make render distance come from a define
This commit is contained in:
parent
d794ca862f
commit
4be27816c2
@ -60,11 +60,14 @@ static void ingame_tick(State *state) {
|
|||||||
input_mouse_captured(scn->mouse_captured);
|
input_mouse_captured(scn->mouse_captured);
|
||||||
|
|
||||||
#define TERRAIN_FREQUENCY 0.1f
|
#define TERRAIN_FREQUENCY 0.1f
|
||||||
|
#define TERRAIN_DISTANCE 64
|
||||||
|
|
||||||
for (int ly = 128; ly--;) {
|
float const half_terrain_distance = (float)TERRAIN_DISTANCE / 2;
|
||||||
for (int lx = 128; lx--;) {
|
|
||||||
float x = SDL_truncf(scn->pos.x + 64 - (float)lx);
|
for (int ly = TERRAIN_DISTANCE; ly--;) {
|
||||||
float y = SDL_truncf(scn->pos.z + 64 - (float)ly);
|
for (int lx = TERRAIN_DISTANCE; lx--;) {
|
||||||
|
float x = SDL_truncf(scn->pos.x + half_terrain_distance - (float)lx);
|
||||||
|
float y = SDL_truncf(scn->pos.z + half_terrain_distance - (float)ly);
|
||||||
|
|
||||||
float d0 = stb_perlin_noise3((float)x * TERRAIN_FREQUENCY, (float)y * TERRAIN_FREQUENCY, 0, 0, 0, 0) * 3 - 6;
|
float d0 = stb_perlin_noise3((float)x * TERRAIN_FREQUENCY, (float)y * TERRAIN_FREQUENCY, 0, 0, 0, 0) * 3 - 6;
|
||||||
float d1 = stb_perlin_noise3((float)(x + 1) * TERRAIN_FREQUENCY, (float)y * TERRAIN_FREQUENCY, 0, 0, 0, 0) * 3 - 6;
|
float d1 = stb_perlin_noise3((float)(x + 1) * TERRAIN_FREQUENCY, (float)y * TERRAIN_FREQUENCY, 0, 0, 0, 0) * 3 - 6;
|
||||||
|
Loading…
Reference in New Issue
Block a user