summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-11-09 11:31:28 -0500
committerTavian Barnes <tavianator@gmail.com>2009-11-09 11:32:25 -0500
commit354f43020d956e7f02dcc81feab13e6fa0e98e10 (patch)
treeb3c6484ce799b1807e7f7b179ecfdead00f56aaa /libdimension
parentb79e24ded809056b3cd3a338c042d1a794bdcab3 (diff)
downloaddimension-354f43020d956e7f02dcc81feab13e6fa0e98e10.tar.xz
Make dmnsn_delete_scene() delete the scene's elements too.
Diffstat (limited to 'libdimension')
-rw-r--r--libdimension/scene.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libdimension/scene.c b/libdimension/scene.c
index 6d870fe..65362a5 100644
--- a/libdimension/scene.c
+++ b/libdimension/scene.c
@@ -43,8 +43,25 @@ void
dmnsn_delete_scene(dmnsn_scene *scene)
{
if (scene) {
+ unsigned int i;
+ dmnsn_light *light;
+ dmnsn_object *object;
+
+ for (i = 0; i < dmnsn_array_size(scene->lights); ++i) {
+ dmnsn_array_get(scene->lights, i, &light);
+ dmnsn_delete_light(light);
+ }
+
+ for (i = 0; i < dmnsn_array_size(scene->objects); ++i) {
+ dmnsn_array_get(scene->objects, i, &object);
+ dmnsn_delete_object(object);
+ }
+
dmnsn_delete_array(scene->lights);
dmnsn_delete_array(scene->objects);
+ dmnsn_delete_canvas(scene->canvas);
+ dmnsn_delete_camera(scene->camera);
+ dmnsn_delete_texture(scene->default_texture);
free(scene);
}
}