Fix T65406 Edit Mode: Edge selection is below wireframe overlay
[blender.git] / source / blender / draw / modes / shaders / overlay_face_wireframe_vert.glsl
1
2 uniform float wireStepParam;
3
4 in vec3 pos;
5 in vec3 nor;
6 in float wd; /* wiredata */
7
8 float get_edge_sharpness(float wd)
9 {
10 #ifndef USE_SCULPT
11   return ((wd == 0.0) ? -1.5 : wd) + wireStepParam;
12 #else
13   return 1.0;
14 #endif
15 }
16
17 /* Geometry shader version */
18 #if defined(SELECT_EDGES) || defined(USE_GEOM)
19 out float facing_g;
20 out float edgeSharpness_g;
21
22 #else /* USE_GEOM */
23 out float facing;
24 flat out float edgeSharpness;
25 #  define facing_g facing
26 #  define edgeSharpness_g edgeSharpness
27
28 #endif /* SELECT_EDGES */
29
30 void main()
31 {
32   mat4 projmat = ProjectionMatrix;
33
34   vec4 wpos = ModelMatrix * vec4(pos, 1.0);
35   gl_Position = projmat * (ViewMatrix * wpos);
36
37   vec3 wnor = normalize(normal_object_to_world(nor));
38   facing_g = dot(wnor, ViewMatrixInverse[2].xyz);
39   edgeSharpness_g = get_edge_sharpness(wd);
40
41 #ifdef USE_WORLD_CLIP_PLANES
42   world_clip_planes_calc_clip_distance(wpos.xyz);
43 #endif
44 }