From 39aa122a0e6d8ff744bec9a245b23d8e9eb2387d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 25 May 2020 19:35:07 +0200 Subject: DRW: Selection: Extend small object selection workaround to all overlays Fix T77015 box select doesnt select cameras when zoomed out, lasso and circle select do work. --- source/blender/draw/engines/overlay/shaders/extra_vert.glsl | 5 +++++ source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'source/blender/draw/engines/overlay') diff --git a/source/blender/draw/engines/overlay/shaders/extra_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl index 035fab1040e..1662e6519c7 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl @@ -221,6 +221,11 @@ void main() /* Convert to screen position [0..sizeVp]. */ edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy; + /* 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); + #ifdef USE_WORLD_CLIP_PLANES world_clip_planes_calc_clip_distance(world_pos); #endif 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 474f3254389..9598f8b2814 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl @@ -17,6 +17,11 @@ void main() vec3 world_pos = point_object_to_world(pos); gl_Position = point_world_to_ndc(world_pos); + /* 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); + stipple_coord = stipple_start = screen_position(gl_Position); #ifdef OBJECT_WIRE -- cgit v1.2.3