diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-10-09 12:49:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-10-09 12:49:27 +0300 |
commit | a5b4b0f21c1ae8c96e4fea9abdcfac2fab1cf300 (patch) | |
tree | 0658d8bdfb8ec03652aa04f82ee8a4d243ec6370 /source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl | |
parent | d68f698cf0321477c0734474150eb4bc43c4e85f (diff) | |
parent | abcda06934aba054de8540b66b13c2bbc5f8f515 (diff) |
Merge branch '28' into custom-manipulatorscustom-manipulators
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl index e0b618e0b1a..db4bdf0a9f0 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl @@ -1,5 +1,10 @@ -// Draw dashed lines, perforated in screen space. +/* + * Geometry Shader for dashed lines, with uniform multi-color(s), or any single-color, and unary thickness. + * + * Dashed is performed in screen space. + */ + /* Make to be used with dynamic batching so no Model Matrix needed */ uniform mat4 ModelViewProjectionMatrix; @@ -11,8 +16,11 @@ uniform int num_colors; /* Enabled if > 0, 1 for solid line. */ layout(lines) in; +in vec4 color_vert[]; + layout(line_strip, max_vertices = 2) out; noperspective out float distance_along_line; +noperspective out vec4 color_geom; void main() { @@ -20,12 +28,14 @@ void main() vec4 v2 = gl_in[1].gl_Position; gl_Position = v1; + color_geom = color_vert[0]; distance_along_line = 0.0f; EmitVertex(); gl_Position = v2; + color_geom = color_vert[1]; if ((num_colors == 1) || (dash_factor >= 1.0f)) { - /* Solid line, optimise out distance computation! */ + /* Solid line, optimize out distance computation! */ distance_along_line = 0.0f; } else { |