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:
authorJulian Eisel <julian@blender.org>2020-06-05 14:09:31 +0300
committerJulian Eisel <julian@blender.org>2020-06-05 14:09:31 +0300
commit920a58d9b6d667894cf166cbbd25e4c2fbd238ea (patch)
tree7ca5a9da640753b5e070c439ac3bdd14dfad92cf /source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl
parentc94b6209861ca7cc3985b53474feed7d94c0221a (diff)
parenta1d55bdd530390e58c51abe9707b8d3b0ae3e861 (diff)
Merge branch 'master' into wm-drag-drop-rewritewm-drag-drop-rewrite
Diffstat (limited to 'source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl')
-rw-r--r--source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl
index 97183638a71..0fbf9ba8137 100644
--- a/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl
+++ b/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl
@@ -1,7 +1,7 @@
in vec3 pos;
in vec4 color;
-in int colorid; /* if equal 0 (i.e: Not specified) use color attrib and stippling. */
+in int colorid; /* if equal 0 (i.e: Not specified) use color attribute and stippling. */
noperspective out vec2 stipple_coord;
flat out vec2 stipple_start;
@@ -17,6 +17,13 @@ void main()
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
+#ifdef SELECT_EDGES
+ /* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the
+ * wire to at least create one fragment that will pass the occlusion query. */
+ /* TODO(fclem) Limit this workaround to selection. It's not very noticeable but still... */
+ gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0);
+#endif
+
stipple_coord = stipple_start = screen_position(gl_Position);
#ifdef OBJECT_WIRE
@@ -34,6 +41,10 @@ void main()
}
#endif
+#ifdef SELECT_EDGES
+ finalColor.a = 0.0; /* No Stipple */
+#endif
+
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance(world_pos);
#endif