diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-06-12 02:37:51 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-06-13 00:16:06 -0600 |
commit | 7acd8ea6673b7a90ed4041408ccf1b024b8a007a (patch) | |
tree | d52199dd7c58e0217bfd1a74e7601d739ad333f5 /libdimension/sky_sphere.c | |
parent | 066261810c2fca192677c5c1c01c91d6ecec65a0 (diff) | |
download | dimension-7acd8ea6673b7a90ed4041408ccf1b024b8a007a.tar.xz |
Vast libdimension API and internals improvements.
Couldn't really do these while I was trying to be POV-Ray compatible,
'cause they would've broken compatibility.
Diffstat (limited to 'libdimension/sky_sphere.c')
-rw-r--r-- | libdimension/sky_sphere.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/libdimension/sky_sphere.c b/libdimension/sky_sphere.c index 0ea5fa3..2279881 100644 --- a/libdimension/sky_sphere.c +++ b/libdimension/sky_sphere.c @@ -30,14 +30,15 @@ dmnsn_new_sky_sphere(void) { dmnsn_sky_sphere *sky_sphere = dmnsn_malloc(sizeof(dmnsn_sky_sphere)); sky_sphere->pigments = dmnsn_new_array(sizeof(dmnsn_pigment *)); - sky_sphere->trans = dmnsn_identity_matrix(); + sky_sphere->trans = dmnsn_identity_matrix(); + sky_sphere->refcount = 1; return sky_sphere; } void dmnsn_delete_sky_sphere(dmnsn_sky_sphere *sky_sphere) { - if (sky_sphere) { + if (DMNSN_DECREF(sky_sphere)) { DMNSN_ARRAY_FOREACH (dmnsn_pigment **, pigment, sky_sphere->pigments) { dmnsn_delete_pigment(*pigment); } @@ -61,11 +62,8 @@ dmnsn_sky_sphere_color(const dmnsn_sky_sphere *sky_sphere, dmnsn_vector d) dmnsn_color color = dmnsn_clear; DMNSN_ARRAY_FOREACH (const dmnsn_pigment **, pigment, sky_sphere->pigments) { - dmnsn_pigment_fn *pigment_fn = (*pigment)->pigment_fn; - if (pigment_fn) { - dmnsn_color sky = pigment_fn(*pigment, d); - color = dmnsn_apply_filter(color, sky); - } + dmnsn_color sky = dmnsn_evaluate_pigment(*pigment, d); + color = dmnsn_apply_filter(color, sky); } return color; |