diff options
author | Ton Roosendaal <ton@blender.org> | 2008-01-10 14:26:17 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2008-01-10 14:26:17 +0300 |
commit | cd02005fe446eed724745a4073d7df8b4654a1f7 (patch) | |
tree | 7ca092ebea06d9831ef970e1d2cda143454d16ac | |
parent | 8aee3ae449c1d6d74ef17345da14dd2233560662 (diff) |
Adding the colorband Hue, Saturation, Value, Color blending modes
to the Material Texture blending as well.
-rw-r--r-- | source/blender/makesdna/DNA_texture_types.h | 4 | ||||
-rw-r--r-- | source/blender/render/intern/source/texture.c | 26 | ||||
-rw-r--r-- | source/blender/src/buttons_shading.c | 5 |
3 files changed, 32 insertions, 3 deletions
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index 88f37dcfd53..bc2b0521d4f 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -365,6 +365,10 @@ typedef struct TexMapping { #define MTEX_LIGHT 7 #define MTEX_SCREEN 8 #define MTEX_OVERLAY 9 +#define MTEX_BLEND_HUE 10 +#define MTEX_BLEND_SAT 11 +#define MTEX_BLEND_VAL 12 +#define MTEX_BLEND_COLOR 13 /* **************** EnvMap ********************* */ diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 14f28c20f1c..a4182637f02 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -53,6 +53,7 @@ #include "BKE_global.h" #include "BKE_main.h" +#include "BKE_material.h" #include "BKE_library.h" #include "BKE_image.h" @@ -1255,7 +1256,7 @@ void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg in[1]= (fact*tex[1] + facm*out[1]); in[2]= (fact*tex[2] + facm*out[2]); break; - + case MTEX_MUL: fact*= facg; facm= 1.0-facg; @@ -1343,9 +1344,28 @@ void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg col= fact*tex[2]; if(col > out[2]) in[2]= col; else in[2]= out[2]; break; + + case MTEX_BLEND_HUE: + fact*= facg; + VECCOPY(in, out); + ramp_blend(MA_RAMP_HUE, in, in+1, in+2, fact, tex); + break; + case MTEX_BLEND_SAT: + fact*= facg; + VECCOPY(in, out); + ramp_blend(MA_RAMP_SAT, in, in+1, in+2, fact, tex); + break; + case MTEX_BLEND_VAL: + fact*= facg; + VECCOPY(in, out); + ramp_blend(MA_RAMP_VAL, in, in+1, in+2, fact, tex); + break; + case MTEX_BLEND_COLOR: + fact*= facg; + VECCOPY(in, out); + ramp_blend(MA_RAMP_COLOR, in, in+1, in+2, fact, tex); + break; } - - } float texture_value_blend(float tex, float out, float fact, float facg, int blendtype, int flip) diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 26735eaa645..4eef6b29599 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -142,6 +142,11 @@ static char *mapto_blendtype_pup(void) str += sprintf(str, formatstr, "Darken", MTEX_DARK); str += sprintf(str, formatstr, "Lighten", MTEX_LIGHT); + str += sprintf(str, formatstr, "Hue", MTEX_BLEND_HUE); + str += sprintf(str, formatstr, "Saturation", MTEX_BLEND_SAT); + str += sprintf(str, formatstr, "Value", MTEX_BLEND_VAL); + str += sprintf(str, formatstr, "Color", MTEX_BLEND_COLOR); + return string; } |