From 63759d3607fa8f1c5369cdced090fc3ce329f6d3 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Sat, 23 Apr 2022 14:39:17 +0300 Subject: [PATCH] Remove affect_selection and has_selection checks from Shaders --- src/Shaders/Desaturate.shader | 9 +-------- src/Shaders/HSV.shader | 11 ++--------- src/Shaders/Invert.shader | 11 ++--------- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/Shaders/Desaturate.shader b/src/Shaders/Desaturate.shader index d7f5e0435..d3306a8ca 100644 --- a/src/Shaders/Desaturate.shader +++ b/src/Shaders/Desaturate.shader @@ -6,8 +6,6 @@ uniform bool blue; uniform bool green; uniform bool alpha; uniform sampler2D selection; -uniform bool affect_selection; -uniform bool has_selection; float stolChannel(float x) { return (x < 0.04045) ? (x / 12.92) : pow((x + 0.055) / 1.055, 2.4); @@ -54,12 +52,7 @@ void fragment() { blue ? lum : lin.b); vec3 stdPrime = linearToStandard(des); - vec3 output; - if(affect_selection && has_selection) { - output = mix(original_color.rgb, stdPrime, selection_color.a); - } else { - output = stdPrime; - } + vec3 output = mix(original_color.rgb, stdPrime, selection_color.a); if (alpha) { COLOR = vec4(output.rgb, ltosChannel(lum)); diff --git a/src/Shaders/HSV.shader b/src/Shaders/HSV.shader index 9e03989ca..a9a2bd1bd 100644 --- a/src/Shaders/HSV.shader +++ b/src/Shaders/HSV.shader @@ -6,8 +6,6 @@ uniform float hue_shift_amount : hint_range(-1, 1); uniform float sat_shift_amount : hint_range(-1, 1); uniform float val_shift_amount : hint_range(-1, 1); uniform sampler2D selection; -uniform bool affect_selection; -uniform bool has_selection; vec3 rgb2hsb(vec3 c){ vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); @@ -61,11 +59,6 @@ void fragment() { col = hsb2rgb(hsb); - vec3 output; - if(affect_selection && has_selection) - output = mix(original_color.rgb, col, selection_color.a); - else - output = col; + vec3 output = mix(original_color.rgb, col, selection_color.a); COLOR = vec4(output.rgb, original_color.a); - -} \ No newline at end of file +} diff --git a/src/Shaders/Invert.shader b/src/Shaders/Invert.shader index 8024450b7..fc214362b 100644 --- a/src/Shaders/Invert.shader +++ b/src/Shaders/Invert.shader @@ -6,8 +6,6 @@ uniform bool blue; uniform bool green; uniform bool alpha; uniform sampler2D selection; -uniform bool affect_selection; -uniform bool has_selection; void fragment() { @@ -24,11 +22,6 @@ void fragment() { if (alpha) col.a = 1f - col.a; - vec4 output; - if(affect_selection && has_selection) - output = mix(original_color.rgba, col, selection_color.a); - else - output = col; - + vec4 output = mix(original_color.rgba, col, selection_color.a); COLOR = output; -} \ No newline at end of file +}