summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/hills.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/examples/hills.c b/examples/hills.c
index c56ab70..a6f36c5 100644
--- a/examples/hills.c
+++ b/examples/hills.c
@@ -22,6 +22,7 @@
#define SIZE 128
#define MARKERS 24
#define BRUSH 3.0f
+#define FOG_END 80.0f
#define COL_SKY 0xFF1B1826u
#define COL_DIM 0xFF9A93B3u
@@ -35,6 +36,7 @@ typedef struct state {
kon_terrain_t *terrain;
kon_material_t grass;
kon_image *ground, *marker;
+ kon_mipmaps_t *mips;
kon_fp_t fp;
int raise, lower;
double time;
@@ -82,6 +84,9 @@ static void draw(kon_program_t *program, kon_framebuffer_t *game, void *user)
kon_clearFramebuffer(game, COL_SKY);
light.direction = KON_VEC3(-0.4f, -1.0f, -0.3f);
light.ambient = 0.45f;
+ light.fogColor = COL_SKY;
+ light.fogStart = 25.0f;
+ light.fogEnd = FOG_END;
kon_drawTerrain(game, &camera, state->terrain, &light);
for (i = 0; i < MARKERS; i++) {
@@ -151,6 +156,8 @@ static int init(kon_program_t *program, void *user)
}
}
state->grass = kon_materialTexture(state->ground);
+ state->mips = kon_createMipmaps(state->ground);
+ state->grass.mips = state->mips;
state->terrain->material = &state->grass;
state->map.columns = SIZE;
@@ -172,7 +179,7 @@ static int init(kon_program_t *program, void *user)
}
kon_fpInit(&state->fp, &state->map, SIZE / 2, SIZE / 2);
- state->fp.farZ = 90.0f;
+ state->fp.farZ = FOG_END;
kon_fpPlace(&state->fp, &state->map, state->terrain);
kon_fpDebug(&state->fp, program->debug);
kon_terrainDebug(state->terrain, program->debug);
@@ -185,6 +192,7 @@ static void shutdown(kon_program_t *program, void *user)
(void)program;
kon_terrainFree(state->terrain);
+ kon_freeMipmaps(state->mips);
kon_freeFramebuffer(state->ground);
kon_freeFramebuffer(state->marker);
}