diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
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 | 55 |
1 files changed, 27 insertions, 28 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 1e5a75c37b8..11f67172e89 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 @@ -5,14 +5,13 @@ * Dashed is performed in screen space. */ - /* Make to be used with dynamic batching so no Model Matrix needed */ uniform mat4 ModelViewProjectionMatrix; uniform vec2 viewport_size; /* Uniforms from fragment shader, used here to optimize out useless computation in case of solid line. */ -uniform float dash_factor; /* if > 1.0, solid line. */ -uniform int colors_len; /* Enabled if > 0, 1 for solid line. */ +uniform float dash_factor; /* if > 1.0, solid line. */ +uniform int colors_len; /* Enabled if > 0, 1 for solid line. */ layout(lines) in; @@ -24,41 +23,41 @@ noperspective out vec4 color_geom; void main() { - vec4 v1 = gl_in[0].gl_Position; - vec4 v2 = gl_in[1].gl_Position; + vec4 v1 = gl_in[0].gl_Position; + vec4 v2 = gl_in[1].gl_Position; - gl_Position = v1; - color_geom = color_vert[0]; - distance_along_line = 0.0f; + gl_Position = v1; + color_geom = color_vert[0]; + distance_along_line = 0.0f; #ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_set_clip_distance(gl_in[0].gl_ClipDistance); + world_clip_planes_set_clip_distance(gl_in[0].gl_ClipDistance); #endif - EmitVertex(); + EmitVertex(); - gl_Position = v2; - color_geom = color_vert[1]; - if ((colors_len == 1) || (dash_factor >= 1.0f)) { - /* Solid line, optimize out distance computation! */ - distance_along_line = 0.0f; - } - else { - vec2 p1 = (v1.xy / v1.w) * 0.5 + 0.5; // <- device coordinates in [0..1] range. - p1 = p1 * viewport_size; // <- 'virtual' screen coordinates. + gl_Position = v2; + color_geom = color_vert[1]; + if ((colors_len == 1) || (dash_factor >= 1.0f)) { + /* Solid line, optimize out distance computation! */ + distance_along_line = 0.0f; + } + else { + vec2 p1 = (v1.xy / v1.w) * 0.5 + 0.5; // <- device coordinates in [0..1] range. + p1 = p1 * viewport_size; // <- 'virtual' screen coordinates. - vec2 p2 = (v2.xy / v2.w) * 0.5 + 0.5; // <- device coordinates in [0..1] range. - p2 = p2 * viewport_size; // <- 'virtual' screen coordinates. + vec2 p2 = (v2.xy / v2.w) * 0.5 + 0.5; // <- device coordinates in [0..1] range. + p2 = p2 * viewport_size; // <- 'virtual' screen coordinates. - distance_along_line = distance(p1, p2); - } + distance_along_line = distance(p1, p2); + } #ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_set_clip_distance(gl_in[1].gl_ClipDistance); + world_clip_planes_set_clip_distance(gl_in[1].gl_ClipDistance); #endif - EmitVertex(); + EmitVertex(); - EndPrimitive(); + EndPrimitive(); - /* Note: we could also use similar approach as diag_stripes_frag, but this would give us dashed 'anchored' - * to the screen, and not to one end of the line... */ + /* Note: we could also use similar approach as diag_stripes_frag, but this would give us dashed 'anchored' + * to the screen, and not to one end of the line... */ } |