diff options
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader_material.glsl')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader_material.glsl | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl b/source/blender/gpu/intern/gpu_shader_material.glsl index 16ed38cb47d..0d7e00a541b 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl +++ b/source/blender/gpu/intern/gpu_shader_material.glsl @@ -847,66 +847,66 @@ void mtex_rgb_color(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 i incol.rgb = col.rgb; } -void mtex_value_vars(inout float fact, float facg, out float facm, float flip) +void mtex_value_vars(inout float fact, float facg, out float facm) { - fact *= facg; + fact *= abs(facg); facm = 1.0-fact; - if(flip != 0.0) { + if(facg < 0.0) { float tmp = fact; fact = facm; facm = tmp; } } -void mtex_value_blend(float outcol, float texcol, float fact, float facg, float flip, out float incol) +void mtex_value_blend(float outcol, float texcol, float fact, float facg, out float incol) { float facm; - mtex_value_vars(fact, facg, facm, flip); + mtex_value_vars(fact, facg, facm); incol = fact*texcol + facm*outcol; } -void mtex_value_mul(float outcol, float texcol, float fact, float facg, float flip, out float incol) +void mtex_value_mul(float outcol, float texcol, float fact, float facg, out float incol) { float facm; - mtex_value_vars(fact, facg, facm, flip); + mtex_value_vars(fact, facg, facm); facm = 1.0 - facg; incol = (facm + fact*texcol)*outcol; } -void mtex_value_screen(float outcol, float texcol, float fact, float facg, float flip, out float incol) +void mtex_value_screen(float outcol, float texcol, float fact, float facg, out float incol) { float facm; - mtex_value_vars(fact, facg, facm, flip); + mtex_value_vars(fact, facg, facm); facm = 1.0 - facg; incol = 1.0 - (facm + fact*(1.0 - texcol))*(1.0 - outcol); } -void mtex_value_sub(float outcol, float texcol, float fact, float facg, float flip, out float incol) +void mtex_value_sub(float outcol, float texcol, float fact, float facg, out float incol) { float facm; - mtex_value_vars(fact, facg, facm, flip); + mtex_value_vars(fact, facg, facm); fact = -fact; incol = fact*texcol + outcol; } -void mtex_value_add(float outcol, float texcol, float fact, float facg, float flip, out float incol) +void mtex_value_add(float outcol, float texcol, float fact, float facg, out float incol) { float facm; - mtex_value_vars(fact, facg, facm, flip); + mtex_value_vars(fact, facg, facm); fact = fact; incol = fact*texcol + outcol; } -void mtex_value_div(float outcol, float texcol, float fact, float facg, float flip, out float incol) +void mtex_value_div(float outcol, float texcol, float fact, float facg, out float incol) { float facm; - mtex_value_vars(fact, facg, facm, flip); + mtex_value_vars(fact, facg, facm); if(texcol != 0.0) incol = facm*outcol + fact*outcol/texcol; @@ -914,27 +914,27 @@ void mtex_value_div(float outcol, float texcol, float fact, float facg, float fl incol = 0.0; } -void mtex_value_diff(float outcol, float texcol, float fact, float facg, float flip, out float incol) +void mtex_value_diff(float outcol, float texcol, float fact, float facg, out float incol) { float facm; - mtex_value_vars(fact, facg, facm, flip); + mtex_value_vars(fact, facg, facm); incol = facm*outcol + fact*abs(texcol - outcol); } -void mtex_value_dark(float outcol, float texcol, float fact, float facg, float flip, out float incol) +void mtex_value_dark(float outcol, float texcol, float fact, float facg, out float incol) { float facm; - mtex_value_vars(fact, facg, facm, flip); + mtex_value_vars(fact, facg, facm); float col = fact*texcol; if(col < outcol) incol = col; else incol = outcol; } -void mtex_value_light(float outcol, float texcol, float fact, float facg, float flip, out float incol) +void mtex_value_light(float outcol, float texcol, float fact, float facg, out float incol) { float facm; - mtex_value_vars(fact, facg, facm, flip); + mtex_value_vars(fact, facg, facm); float col = fact*texcol; if(col > outcol) incol = col; else incol = outcol; |