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_3D_line_dashed_uniform_color_vert.glsl')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
index 7c317ecfb8c..aefa47275f5 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
@@ -13,15 +13,21 @@ uniform mat4 ModelMatrix;
#endif
uniform vec4 color;
+uniform vec2 viewport_size;
in vec3 pos;
-out vec4 color_vert;
+flat out vec4 color_vert;
+
+/* We leverage hardware interpolation to compute distance along the line. */
+noperspective out vec2 stipple_pos; /* In screen space */
+flat out vec2 stipple_start; /* In screen space */
void main()
{
vec4 pos_4d = vec4(pos, 1.0);
gl_Position = ModelViewProjectionMatrix * pos_4d;
+ stipple_start = stipple_pos = viewport_size * 0.5 * (gl_Position.xy / gl_Position.w);
color_vert = color;
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);