polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

commit 5218d93e95fe12387798b2fa441fe4acf88879bc
parent 6a99ea57109e758cd99a590fc6a3a622e8dcbe86
Author: William Casarin <jb55@jb55.com>
Date:   Wed,  2 May 2018 10:29:17 -0700

fix offset fn

Diffstat:
Msrc/game.c | 2+-
Msrc/terrain.c | 4++--
Msrc/update.c | 8++++----
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/game.c b/src/game.c @@ -27,7 +27,7 @@ void game_init(struct game *game) { struct terrain *terrain = &game->terrain; mat4 *light_dir = game->test_resources.light_dir; - const double size = 5000; + const double size = 10000; const double pdist = 1.7; terrain->settings = (struct perlin_settings){ diff --git a/src/terrain.c b/src/terrain.c @@ -49,8 +49,8 @@ terrain_init(struct terrain *terrain) { double offset_fn(struct terrain* terrain, double x, double y) { struct perlin_settings *perlin = &terrain->settings; - double ox = perlin->ox * (1/perlin->scale); - double oy = perlin->oy * (1/perlin->scale); + double ox = perlin->ox; + double oy = perlin->oy; return old_noisy_boi(terrain, ox+x, oy+y); } diff --git a/src/update.c b/src/update.c @@ -68,13 +68,13 @@ void update_terrain(struct game *game) { if (first) { terrain_init(terrain); - /* ts->ox = rand_0to1() * 1000.0; */ - /* ts->oy = rand_0to1() * 1000.0; */ + tnode->pos[0] = rand_0to1() * 1000.0; + tnode->pos[1] = rand_0to1() * 1000.0; first = 0; } - for (int i = 0; i < 2; ++i) - tnode->pos[i] = max(tnode->pos[i], 0); + ts->ox = tnode->pos[0]; + ts->oy = tnode->pos[1]; double scale = tnode->pos[2] * 0.0015; if (scale == 0) scale = 1.0;