summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-11-09 11:19:13 -0500
committerTavian Barnes <tavianator@gmail.com>2009-11-09 11:19:13 -0500
commitb79e24ded809056b3cd3a338c042d1a794bdcab3 (patch)
treeb3b2715e7238d32057eab9a19111f4c83ba5e291 /libdimension
parente7c3459f8eba5db5704632f927a4168467521b88 (diff)
downloaddimension-b79e24ded809056b3cd3a338c042d1a794bdcab3.tar.xz
Add lights to scenes.
Diffstat (limited to 'libdimension')
-rw-r--r--libdimension/dimension/scene.h9
-rw-r--r--libdimension/scene.c9
2 files changed, 12 insertions, 6 deletions
diff --git a/libdimension/dimension/scene.h b/libdimension/dimension/scene.h
index 12ad6bd..8c9c705 100644
--- a/libdimension/dimension/scene.h
+++ b/libdimension/dimension/scene.h
@@ -37,15 +37,18 @@ typedef struct {
dmnsn_color background;
dmnsn_texture *default_texture;
- /* Objects */
- dmnsn_array *objects;
-
/* Camera */
dmnsn_camera *camera;
/* Canvas */
dmnsn_canvas *canvas;
+ /* Objects */
+ dmnsn_array *objects;
+
+ /* Lights */
+ dmnsn_array *lights;
+
/* Rendering quality */
dmnsn_quality quality;
} dmnsn_scene;
diff --git a/libdimension/scene.c b/libdimension/scene.c
index 3629c8e..6d870fe 100644
--- a/libdimension/scene.c
+++ b/libdimension/scene.c
@@ -27,10 +27,12 @@ dmnsn_new_scene()
{
dmnsn_scene *scene = malloc(sizeof(dmnsn_scene));
if (scene) {
- scene->camera = NULL;
- scene->canvas = NULL;
scene->default_texture = NULL;
- scene->objects = dmnsn_new_array(sizeof(dmnsn_object*));
+
+ scene->camera = NULL;
+ scene->canvas = NULL;
+ scene->objects = dmnsn_new_array(sizeof(dmnsn_object *));
+ scene->lights = dmnsn_new_array(sizeof(dmnsn_light *));
scene->quality = DMNSN_RENDER_FULL;
}
return scene;
@@ -41,6 +43,7 @@ void
dmnsn_delete_scene(dmnsn_scene *scene)
{
if (scene) {
+ dmnsn_delete_array(scene->lights);
dmnsn_delete_array(scene->objects);
free(scene);
}