summaryrefslogtreecommitdiffstats
path: root/libdimension/light.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-05-30 23:24:36 -0600
committerTavian Barnes <tavianator@gmail.com>2011-05-30 23:43:03 -0600
commit141732e737eb7e9a1677fc3b5aa9ebcd66de3aca (patch)
tree196dabb31b85b92951e48462a425a58328350319 /libdimension/light.c
parent54585ba35adc6afc46201b746401c5a8a66ab6fa (diff)
downloaddimension-141732e737eb7e9a1677fc3b5aa9ebcd66de3aca.tar.xz
Make lights more generic to support directional lights.
Diffstat (limited to 'libdimension/light.c')
-rw-r--r--libdimension/light.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libdimension/light.c b/libdimension/light.c
index e1a060c..1103727 100644
--- a/libdimension/light.c
+++ b/libdimension/light.c
@@ -31,9 +31,12 @@ dmnsn_light *
dmnsn_new_light(void)
{
dmnsn_light *light = dmnsn_malloc(sizeof(dmnsn_light));
- light->light_fn = NULL;
- light->free_fn = NULL;
- light->ptr = NULL;
+ light->direction_fn = NULL;
+ light->illumination_fn = NULL;
+ light->shadow_fn = NULL;
+ light->free_fn = NULL;
+ light->ptr = NULL;
+ light->refcount = 0;
return light;
}
@@ -41,7 +44,7 @@ dmnsn_new_light(void)
void
dmnsn_delete_light(dmnsn_light *light)
{
- if (light) {
+ if (light && DMNSN_DECREF(light)) {
if (light->free_fn) {
light->free_fn(light->ptr);
}