/apps/demos/scenery: more detailed terrain
This commit is contained in:
		@@ -12,7 +12,7 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define TERRAIN_FREQUENCY 0.1f
 | 
			
		||||
#define TERRAIN_FREQUENCY 0.15f
 | 
			
		||||
#define TERRAIN_DISTANCE 32
 | 
			
		||||
#define HALF_TERRAIN_DISTANCE ((float)TERRAIN_DISTANCE / 2)
 | 
			
		||||
#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 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;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user