From a68821424f9826718e32606f9830c84b74737032 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 19 Sep 2011 15:54:34 -0400 Subject: Make dmnsn_color_mul() scale dmnsn_color::trans too. --- libdimension/color.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libdimension') 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; -- cgit v1.2.3