diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-14 21:14:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-14 21:14:23 +0400 |
commit | 0d5595befb71303926d03e40dc5791e55f7f7ad9 (patch) | |
tree | d4c3f976df9ea92c546d35ed99215e4710a3db51 /source/blender/render | |
parent | 6e72a7c1138169eb23ff3628e5e0a27349e7015a (diff) |
add utility function to BLI_math_color - rgb_to_luma, rgb_to_luma_byte, also use rgb_to_grayscale in more places.
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/source/shadeoutput.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 9cb30c2ba1a..e2cfd25c40b 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -900,7 +900,7 @@ static void ramp_diffuse_result(float *diff, ShadeInput *shi) if(ma->ramp_col) { if(ma->rampin_col==MA_RAMP_IN_RESULT) { - float fac= 0.3f*diff[0] + 0.58f*diff[1] + 0.12f*diff[2]; + float fac = rgb_to_grayscale(diff); do_colorband(ma->ramp_col, fac, col); /* blending method */ @@ -932,6 +932,7 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa /* input */ switch(ma->rampin_col) { case MA_RAMP_IN_ENERGY: + /* should use 'rgb_to_grayscale' but we only have a vector version */ fac= 0.3f*r + 0.58f*g + 0.12f*b; break; case MA_RAMP_IN_SHADER: @@ -974,7 +975,7 @@ static void ramp_spec_result(float spec_col[3], ShadeInput *shi) if(ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) { float col[4]; - float fac= 0.3f*spec_col[0] + 0.58f*spec_col[1] + 0.12f*spec_col[2]; + float fac = rgb_to_grayscale(spec_col); do_colorband(ma->ramp_spec, fac, col); |