diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-09 14:48:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-09 14:48:24 +0400 |
commit | 385e5eb92edab8d8a50941c457dee971185c7af3 (patch) | |
tree | eeb740ced34ccbee41fa8266e53a6e336e18a713 /source/blender/modifiers | |
parent | a2ed2b36f3ba2abfb2f473dfde2a9e20d01ad96d (diff) |
code cleanup: color/bw conversion - use BLI color function.
change modifier to use the average of the RGB since perceptual conversion isn't really needed for modifiers.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_util.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 2d8656e127b..aff6bf548e6 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -77,14 +77,15 @@ void get_texture_value(Tex *texture, float *tex_co, TexResult *texres) result_type = multitex_ext_safe(texture, tex_co, texres); /* if the texture gave an RGB value, we assume it didn't give a valid - * intensity, so calculate one (formula from do_material_tex). + * intensity, since this is in the context of modifiers don't use perceptual color conversion. * if the texture didn't give an RGB value, copy the intensity across */ - if (result_type & TEX_RGB) - texres->tin = (0.35f * texres->tr + 0.45f * texres->tg - + 0.2f * texres->tb); - else - texres->tr = texres->tg = texres->tb = texres->tin; + if (result_type & TEX_RGB) { + texres->tin= (1.0f / 3.0f) * (texres->tr + texres->tg + texres->tb); + } + else { + copy_v3_fl(&texres->tr, texres->tin); + } } void get_texture_coords(MappingInfoModifierData *dmd, Object *ob, |