diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-10-20 17:01:07 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-10-20 17:01:07 +0400 |
commit | ce741bc223940654a13b3d6b723fc42328c3b832 (patch) | |
tree | 726e3c6908dceaca95696dff73f2fc79cb742e14 /source/blender/modifiers | |
parent | e9d5e9813c5cce45f14bb25bb82f2e88f5688351 (diff) |
Code cleanup: de-duplicate implementation of get_texture_value
Expect to be no functional changes :)
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_displace.c | 2 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_util.c | 24 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_util.h | 1 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_warp.c | 2 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_wave.c | 3 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvg_util.c | 2 |
6 files changed, 5 insertions, 29 deletions
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 25254c7a30e..61f5495bee8 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -219,7 +219,7 @@ static void displaceModifier_do( if (dmd->texture) { texres.nor = NULL; - get_texture_value(dmd->modifier.scene, dmd->texture, tex_co[i], &texres, false); + BKE_texture_get_value(dmd->modifier.scene, dmd->texture, tex_co[i], &texres, false); delta = texres.tin - dmd->midlevel; } else { diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 230931a1a33..e9fabcd1fd0 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -70,30 +70,6 @@ void modifier_init_texture(Scene *scene, Tex *tex) BKE_image_user_frame_calc(&tex->iuser, scene->r.cfra, 0); } -void get_texture_value(Scene *scene, Tex *texture, float *tex_co, TexResult *texres, bool use_color_management) -{ - int result_type; - bool do_color_manage = false; - - if (use_color_management) { - do_color_manage = BKE_scene_check_color_management_enabled(scene); - } - - /* no node textures for now */ - result_type = multitex_ext_safe(texture, tex_co, texres, NULL, do_color_manage); - - /* if the texture gave an RGB value, we assume it didn't give a valid - * 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 = (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, DerivedMesh *dm, float (*co)[3], float (*texco)[3], diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index 25632eb5b80..b4dcdc1721a 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -41,7 +41,6 @@ struct Tex; struct TexResult; void modifier_init_texture(struct Scene *scene, struct Tex *texture); -void get_texture_value(struct Scene *scene, struct Tex *texture, float *tex_co, struct TexResult *texres, bool do_color_manage); void get_texture_coords(struct MappingInfoModifierData *dmd, struct Object *ob, struct DerivedMesh *dm, float (*co)[3], float (*texco)[3], int numVerts); void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]); diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 4fac201377a..83b05ae708a 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -282,7 +282,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, if (tex_co) { TexResult texres; texres.nor = NULL; - get_texture_value(wmd->modifier.scene, wmd->texture, tex_co[i], &texres, false); + BKE_texture_get_value(wmd->modifier.scene, wmd->texture, tex_co[i], &texres, false); fac *= texres.tin; } diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 43dc1ba4eb9..168907e293c 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -48,6 +48,7 @@ #include "BKE_library.h" #include "BKE_object.h" #include "BKE_scene.h" +#include "BKE_texture.h" #include "depsgraph_private.h" @@ -306,7 +307,7 @@ static void waveModifier_do(WaveModifierData *md, if (wmd->texture) { TexResult texres; texres.nor = NULL; - get_texture_value(wmd->modifier.scene, wmd->texture, tex_co[i], &texres, false); + BKE_texture_get_value(wmd->modifier.scene, wmd->texture, tex_co[i], &texres, false); amplit *= texres.tin; } diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index e2267addd53..5c3b87bd92c 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -164,7 +164,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne do_color_manage = tex_use_channel != MOD_WVG_MASK_TEX_USE_INT; texres.nor = NULL; - get_texture_value(scene, texture, tex_co[idx], &texres, do_color_manage); + BKE_texture_get_value(scene, texture, tex_co[idx], &texres, do_color_manage); /* Get the good channel value... */ switch (tex_use_channel) { case MOD_WVG_MASK_TEX_USE_INT: |