commit 51cb45e0c1451241661d155aef1d67808d7978b6
parent 07db56292477e9c36e3cb73ea30745bf48209ed0
Author: William Casarin <jb55@jb55.com>
Date: Sun, 21 Jul 2019 17:00:32 -0700
terrain: don't free verts
will need this for collision
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/terrain.c b/src/terrain.c
@@ -125,7 +125,7 @@ void create_terrain(struct terrain *terrain, float scale, int seed) {
terrain->fn = offset_fn;
- // 100 random samples from our noise function
+ // n random samples from our noise function
for (i = 0; i < (u32)terrain->n_samples; i++) {
int n = i*3;
double x, y;
@@ -237,9 +237,14 @@ void create_terrain(struct terrain *terrain, float scale, int seed) {
delaunay2d_release(del);
tri_delaunay2d_release(tri);
+ assert(del_verts);
+
free(points);
free(verts);
- free(del_verts);
+ // needed for collision
+ /* free(del_verts); */
+
+ // we might need norms in memory eventually as well ?
free(del_norms);
free(del_indices);
diff --git a/src/terrain.h b/src/terrain.h
@@ -23,6 +23,7 @@ struct perlin_settings {
struct terrain {
entity_id entity_id;
+ float *verts;
struct perlin_settings settings;
struct point *samples;
double (*fn)(struct terrain *, double, double);