blob: 15362d020e428a706c166621890528d0d662dc07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/*
* Vertex Shader for dashed lines with 2D coordinates,
* with uniform multi-colors or uniform single-color, and unary thickness.
*
* Dashed is performed in screen space.
*/
uniform mat4 ModelViewProjectionMatrix;
uniform vec4 color;
uniform vec2 viewport_size;
in vec2 pos;
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()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
stipple_start = stipple_pos = viewport_size * 0.5 * (gl_Position.xy / gl_Position.w);
color_vert = color;
}
|