[Bf-blender-cvs] [9be5a94cf3e] master: Fix part of T69728: drawing glitches with sculpt dynamic mesh preview

Brecht Van Lommel noreply at git.blender.org
Tue Sep 17 14:24:46 CEST 2019


Commit: 9be5a94cf3e1d60f8c73e86c570f545e88eed49a
Author: Brecht Van Lommel
Date:   Tue Sep 17 12:15:21 2019 +0200
Branches: master
https://developer.blender.org/rB9be5a94cf3e1d60f8c73e86c570f545e88eed49a

Fix part of T69728: drawing glitches with sculpt dynamic mesh preview

Depth test must default to off for drawing outside the 3D viewport and
overlays like cursors.

===================================================================

M	source/blender/editors/sculpt_paint/paint_cursor.c

===================================================================

diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 5c83bdf0012..c8c857d721b 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1191,7 +1191,13 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr,
 static void sculpt_geometry_preview_lines_draw(const uint gpuattr, SculptSession *ss)
 {
   immUniformColor4f(1.0f, 1.0f, 1.0f, 0.6f);
-  GPU_depth_test(true);
+
+  /* Cursor normally draws on top, but for this part we need depth tests. */
+  const bool depth_test = GPU_depth_test_enabled();
+  if (!depth_test) {
+    GPU_depth_test(true);
+  }
+
   GPU_line_width(1.0f);
   if (ss->preview_vert_index_count > 0) {
     immBegin(GPU_PRIM_LINES, ss->preview_vert_index_count);
@@ -1200,6 +1206,11 @@ static void sculpt_geometry_preview_lines_draw(const uint gpuattr, SculptSession
     }
     immEnd();
   }
+
+  /* Restore depth test value. */
+  if (!depth_test) {
+    GPU_depth_test(false);
+  }
 }
 
 static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))



More information about the Bf-blender-cvs mailing list