diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-04-28 03:51:27 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-04-28 17:54:57 +0300 |
commit | 9b0ea92be75c67567e05a091d0593b87564e0ad1 (patch) | |
tree | 7e350eb0097468d4d0c424ee11abf7ac1a43996d /source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl | |
parent | c06bfe9d09c33cebdffd2c840252d4863fd8ca33 (diff) |
UI: Number slider uniform filling
Now we always fill the slider with a vertical boundary. A bit hard to explain,
but very easy to see the difference.
I split the widget in three parts and used fragment shader discard to remove the
undesired bits. That means all the widget program is doing a bit extra
calculation.
Reviewers: fclem
Subscribers: billreynish
Differential Revision: https://developer.blender.org/D3186
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl index 286a5373554..a356014d025 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl @@ -2,6 +2,7 @@ uniform vec3 checkerColorAndSize; noperspective in vec4 finalColor; noperspective in float butCo; +flat in float discardFac; out vec4 fragColor; @@ -22,6 +23,10 @@ vec4 do_checkerboard() void main() { + if (min(1.0, -butCo) > discardFac) { + discard; + } + fragColor = finalColor; if (butCo > 0.5) { |