diff options
author | Jeroen Bakker <jeroen@blender.org> | 2020-03-23 12:17:36 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-03-23 16:03:39 +0300 |
commit | 0b116a84c9380166337722f5d5b3e255e19951b8 (patch) | |
tree | f4a84f34d625a20d27838d6308a1b103caafe597 /source/blender/draw/engines/overlay | |
parent | 6a5bd812b569d5fe1f09bd5610ce9d0c119f1a21 (diff) |
Fix T74923: Weight Painting Overlay Invisible for In Front Objects
For In Front Objects we need to use the in front depth buffer.
This patch will use the in front depth buffer and also makes sure that
it is filled with the center pixel depth.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D7216
Diffstat (limited to 'source/blender/draw/engines/overlay')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_engine.c | 1 | ||||
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_paint.c | 14 | ||||
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_private.h | 4 |
3 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c index 9b900a53d8d..9788d38478c 100644 --- a/source/blender/draw/engines/overlay/overlay_engine.c +++ b/source/blender/draw/engines/overlay/overlay_engine.c @@ -98,6 +98,7 @@ static void OVERLAY_engine_init(void *vedata) OVERLAY_image_init(vedata); OVERLAY_outline_init(vedata); OVERLAY_wireframe_init(vedata); + OVERLAY_paint_init(vedata); } static void OVERLAY_cache_init(void *vedata) diff --git a/source/blender/draw/engines/overlay/overlay_paint.c b/source/blender/draw/engines/overlay/overlay_paint.c index e88a69b695e..bb0b124f2ae 100644 --- a/source/blender/draw/engines/overlay/overlay_paint.c +++ b/source/blender/draw/engines/overlay/overlay_paint.c @@ -28,6 +28,15 @@ #include "overlay_private.h" +void OVERLAY_paint_init(OVERLAY_Data *vedata) +{ + OVERLAY_StorageList *stl = vedata->stl; + OVERLAY_PrivateData *pd = stl->pd; + const DRWContextState *draw_ctx = DRW_context_state_get(); + + pd->painting.in_front = draw_ctx->obact && (draw_ctx->obact->dtx & OB_DRAWXRAY); +} + void OVERLAY_paint_cache_init(OVERLAY_Data *vedata) { const DRWContextState *draw_ctx = DRW_context_state_get(); @@ -194,12 +203,15 @@ void OVERLAY_paint_weight_cache_populate(OVERLAY_Data *vedata, Object *ob) void OVERLAY_paint_draw(OVERLAY_Data *vedata) { + OVERLAY_StorageList *stl = vedata->stl; + OVERLAY_PrivateData *pd = stl->pd; + OVERLAY_PassList *psl = vedata->psl; DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get(); if (DRW_state_is_fbo()) { /* Pain overlay needs final color because of multiply blend mode. */ - GPU_framebuffer_bind(dfbl->default_fb); + GPU_framebuffer_bind(pd->painting.in_front ? dfbl->in_front_fb : dfbl->default_fb); } if (psl->paint_color_ps) { diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h index de35d4f760e..47c52c885b2 100644 --- a/source/blender/draw/engines/overlay/overlay_private.h +++ b/source/blender/draw/engines/overlay/overlay_private.h @@ -317,6 +317,9 @@ typedef struct OVERLAY_PrivateData { bool do_pose_fade_geom; } armature; struct { + bool in_front; + } painting; + struct { DRWCallBuffer *handle[2]; } mball; } OVERLAY_PrivateData; /* Transient data */ @@ -524,6 +527,7 @@ void OVERLAY_outline_cache_populate(OVERLAY_Data *vedata, bool init_dupli); void OVERLAY_outline_draw(OVERLAY_Data *vedata); +void OVERLAY_paint_init(OVERLAY_Data *vedata); void OVERLAY_paint_cache_init(OVERLAY_Data *vedata); void OVERLAY_paint_texture_cache_populate(OVERLAY_Data *vedata, Object *ob); void OVERLAY_paint_vertex_cache_populate(OVERLAY_Data *vedata, Object *ob); |