summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2019-05-19 00:51:56 -0700
committerVito Caputo <vcaputo@pengaru.com>2019-05-19 00:57:31 -0700
commita21f1febe29fbc2c7e00ff97913c04c247bfb95b (patch)
treeb2866d3601f0a0716a264d0c00daea539c8df7ff /src
parentfecb84825c461de3455eef71cc72fc38d871d8e8 (diff)
libs/ray: fix off by one error in prepared objects
Missed the sentinel, oops
Diffstat (limited to 'src')
-rw-r--r--src/libs/ray/ray_render.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libs/ray/ray_render.c b/src/libs/ray/ray_render.c
index 32c45dc..e551d8c 100644
--- a/src/libs/ray/ray_render.c
+++ b/src/libs/ray/ray_render.c
@@ -228,7 +228,7 @@ ray_render_t * ray_render_new(const ray_scene_t *scene, const ray_camera_t *came
for (i = 0, object = scene->objects; object->type; object++)
i++;
- render = malloc(sizeof(ray_render_t) + i * sizeof(ray_render_object_t));
+ render = malloc(sizeof(ray_render_t) + (i + 1) * sizeof(ray_render_object_t));
if (!render)
return NULL;
@@ -241,6 +241,8 @@ ray_render_t * ray_render_new(const ray_scene_t *scene, const ray_camera_t *came
for (i = 0, object = scene->objects; object->type; object++)
render->objects[i++] = ray_render_object_prepare(object, camera);
+ render->objects[i].type = RAY_OBJECT_TYPE_SENTINEL;
+
return render;
}
© All Rights Reserved