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:
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
new file mode 100644
index 00000000000..85aab7e06ef
--- /dev/null
+++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
@@ -0,0 +1,25 @@
+
+// Draw dashed lines, perforated in screen space.
+// Based on a (3D) version by Mike Erwin.
+
+#if __VERSION__ == 120
+ noperspective varying float distance_along_line;
+ #define fragColor gl_FragColor
+#else
+ noperspective in float distance_along_line;
+ out vec4 fragColor;
+#endif
+
+uniform float dash_width;
+uniform float dash_width_on;
+uniform vec4 color1;
+uniform vec4 color2;
+
+void main()
+{
+ if (mod(distance_along_line, dash_width) <= dash_width_on) {
+ fragColor = color1;
+ } else {
+ fragColor = color2;
+ }
+}