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:
authorClément Foucault <foucault.clem@gmail.com>2019-06-24 13:42:04 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-06-26 13:03:59 +0300
commite47ce1f2d6d7df814bd6498ae7b881989510395f (patch)
treee7350615fc161f76fc6452644eeccf90571788a5 /source/blender/draw/engines
parentbf1b00212ac1129eb72d8dc2cb741eb04fcf6dcf (diff)
Fix T65755 "In Front" (X-Ray) doesn't work with wire objects
We fix by separating the drawing of wire xray objects. These wire objects gets drawn before normal wires and set the stencil to 0x0 just like the solid counterparts. Also a prepass is done to "dig" through non-xray solid.
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r--source/blender/draw/engines/workbench/workbench_deferred.c12
-rw-r--r--source/blender/draw/engines/workbench/workbench_forward.c2
2 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index f2f211d1db9..49b84b41744 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -1268,14 +1268,14 @@ void workbench_deferred_draw_scene(WORKBENCH_Data *vedata)
DRW_draw_pass(psl->composite_pass);
}
+ /* In order to not draw on top of ghost objects, we clear the stencil
+ * to 0xFF and the ghost object to 0x00 and only draw overlays on top if
+ * stencil is not 0. */
+ GPU_framebuffer_bind(dfbl->depth_only_fb);
+ GPU_framebuffer_clear_stencil(dfbl->depth_only_fb, 0xFF);
+
/* TODO(fclem): only enable when needed (when there is overlays). */
if (GHOST_ENABLED(psl)) {
- /* In order to not draw on top of ghost objects, we clear the stencil
- * to 0xFF and the ghost object to 0x00 and only draw overlays on top if
- * stencil is not 0. */
- GPU_framebuffer_bind(dfbl->depth_only_fb);
- GPU_framebuffer_clear_stencil(dfbl->depth_only_fb, 0xFF);
-
DRWState state = DRW_STATE_DEPTH_EQUAL | DRW_STATE_WRITE_STENCIL | DRW_STATE_STENCIL_ALWAYS;
DRW_pass_state_set(psl->ghost_prepass_pass, state);
DRW_pass_state_set(psl->ghost_prepass_hair_pass, state);
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index eccf2b1a0f0..612a3901ca0 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -674,7 +674,7 @@ void workbench_forward_draw_background(WORKBENCH_Data *UNUSED(vedata))
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
DRW_stats_group_start("Clear depth");
GPU_framebuffer_bind(dfbl->default_fb);
- GPU_framebuffer_clear_depth(dfbl->default_fb, clear_depth);
+ GPU_framebuffer_clear_depth_stencil(dfbl->default_fb, clear_depth, 0xFF);
DRW_stats_group_end();
}