Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2018-04-15 13:16:55 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2018-04-15 13:16:55 +0300
commit7e1832c8d546ec13e752b7bd42ce13e3fc10ae86 (patch)
tree0fff9d878db69b288f909ff9a0f8aefe31ab8d80 /source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl
parentc0c8df3f2cf3ab03cec1f660619b0fe2290caf2a (diff)
parent94959dba1b53640e2a36cf9b5ca46aaf49c5c74a (diff)
Merge branch 'blender2.8' into hair_guides
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.glsl35
1 files changed, 35 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
new file mode 100644
index 00000000000..f660cae8d12
--- /dev/null
+++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl
@@ -0,0 +1,35 @@
+uniform vec3 checkerColorAndSize;
+
+noperspective in vec4 finalColor;
+noperspective in float butCo;
+
+out vec4 fragColor;
+
+vec4 do_checkerboard()
+{
+ float size = checkerColorAndSize.z;
+ vec2 phase = mod(gl_FragCoord.xy, size * 2.0);
+
+ if ((phase.x > size && phase.y < size) ||
+ (phase.x < size && phase.y > size))
+ {
+ return vec4(checkerColorAndSize.xxx, 1.0);
+ }
+ else {
+ return vec4(checkerColorAndSize.yyy, 1.0);
+ }
+}
+
+void main()
+{
+ fragColor = finalColor;
+
+ if (butCo > 0.5) {
+ vec4 checker = do_checkerboard();
+ fragColor = mix(checker, fragColor, fragColor.a);
+ }
+
+ if (butCo > 0.0) {
+ fragColor.a = 1.0;
+ }
+} \ No newline at end of file