diff --git a/apps/scenery/scenes/ingame.c b/apps/scenery/scenes/ingame.c index 2d3ca37..2e49be6 100644 --- a/apps/scenery/scenes/ingame.c +++ b/apps/scenery/scenes/ingame.c @@ -56,8 +56,11 @@ static void ingame_tick(State *state) { #define TERRAIN_FREQUENCY 0.1f - for (int y = 64; y--;) { - for (int x = 64; x--;) { + for (int ly = 64; ly--;) { + for (int lx = 64; lx--;) { + float x = SDL_truncf(scn->cam.pos.x + 32 - lx); + float y = SDL_truncf(scn->cam.pos.z + 32 - ly); + 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 d2 = stb_perlin_noise3((float)(x + 1) * TERRAIN_FREQUENCY, (float)(y - 1) * TERRAIN_FREQUENCY, 0, 0, 0, 0) * 3 - 6;