[Bf-blender-cvs] [dfad332740c] tmp-overlay-engine: Fix Wireframe issue with infront objects

Clément Foucault noreply at git.blender.org
Tue Nov 26 16:06:19 CET 2019


Commit: dfad332740cf02d2755b3af1c7247b6c5bb3fec3
Author: Clément Foucault
Date:   Tue Nov 26 16:36:05 2019 +0100
Branches: tmp-overlay-engine
https://developer.blender.org/rBdfad332740cf02d2755b3af1c7247b6c5bb3fec3

Fix Wireframe issue with infront objects

We were testing against the stencil buffer but the actual stencil was not
the one expected. But with current implementation it is not even required
so we just bypass it.

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

M	source/blender/draw/engines/overlay/overlay_wireframe.c

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

diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.c b/source/blender/draw/engines/overlay/overlay_wireframe.c
index 3fd5d81180f..c3e2c6487b3 100644
--- a/source/blender/draw/engines/overlay/overlay_wireframe.c
+++ b/source/blender/draw/engines/overlay/overlay_wireframe.c
@@ -76,8 +76,7 @@ void OVERLAY_wireframe_cache_init(OVERLAY_Data *vedata)
       stencil_mask = 0xFF;
     }
     else {
-      state |= DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_STENCIL | DRW_STATE_DEPTH_GREATER_EQUAL |
-               DRW_STATE_STENCIL_NEQUAL;
+      state |= DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
       DRW_PASS_CREATE(psl->wireframe_xray_ps, state | pd->clipping_state);
       pass = psl->wireframe_xray_ps;
       stencil_mask = 0x00;
@@ -216,16 +215,6 @@ void OVERLAY_wireframe_in_front_draw(OVERLAY_Data *data)
   OVERLAY_PrivateData *pd = data->stl->pd;
 
   DRW_view_set_active(pd->view_wires);
-
-  /* First lower the depth where there is no xray object (and set the stencil to xray value). */
-  DRW_draw_pass(psl->wireframe_xray_ps);
-
-  /* Then draw the xray wire on top only where the stencil is set. */
-  DRWState state_remove = DRW_STATE_DEPTH_GREATER_EQUAL | DRW_STATE_STENCIL_NEQUAL;
-  DRWState state_add = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL |
-                       DRW_STATE_STENCIL_ALWAYS;
-  DRW_pass_state_remove(psl->wireframe_xray_ps, state_remove);
-  DRW_pass_state_add(psl->wireframe_xray_ps, state_add);
   DRW_draw_pass(psl->wireframe_xray_ps);
 
   DRW_view_set_active(pd->view_default);



More information about the Bf-blender-cvs mailing list