summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-09-19 15:54:34 -0400
committerTavian Barnes <tavianator@gmail.com>2011-09-19 15:54:34 -0400
commita68821424f9826718e32606f9830c84b74737032 (patch)
tree0caea98eb4f078b95e53e3eb5208545c782ce8ae
parentd6aa225ca7990fde1eac09e28078e71b73d113ce (diff)
downloaddimension-a68821424f9826718e32606f9830c84b74737032.tar.xz
Make dmnsn_color_mul() scale dmnsn_color::trans too.
-rw-r--r--libdimension/color.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libdimension/color.c b/libdimension/color.c
index c39c524..efa4f4a 100644
--- a/libdimension/color.c
+++ b/libdimension/color.c
@@ -227,6 +227,7 @@ dmnsn_color_mul(double n, dmnsn_color color)
color.R *= n;
color.G *= n;
color.B *= n;
+ color.trans *= n;
return color;
}
@@ -267,7 +268,12 @@ dmnsn_filter_light(dmnsn_color light, dmnsn_color filter)
filter.filter*filter.trans,
dmnsn_color_illuminate(filter, light)
);
- dmnsn_color ret = dmnsn_color_add(transmitted, filtered);
+
+ dmnsn_color ret = dmnsn_new_color(
+ transmitted.R + filtered.R,
+ transmitted.G + filtered.G,
+ transmitted.B + filtered.B
+ );
/* Switch into absolute filter and transmittance space */
double lf = light.filter*light.trans, ff = filter.filter*filter.trans;
@@ -277,7 +283,6 @@ dmnsn_filter_light(dmnsn_color light, dmnsn_color filter)
/* Switch back */
ret.trans = f + t;
- ret.filter = 0.0;
if (ret.trans >= dmnsn_epsilon)
ret.filter = f/ret.trans;