Commit: 638590078c716c65ed0e9c4a0cbcff60c46a98e2
Author: Clément Foucault
Date:   Mon Jun 11 17:26:41 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB638590078c716c65ed0e9c4a0cbcff60c46a98e2

Outlines: Make outlines in xray mode not occluded.

This is visually too distracting (flickering). Until we have a better
solution, just disable occlusion fading.

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

M       source/blender/draw/modes/object_mode.c

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

diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index 0b90b9276b4..0c8c4664f70 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -864,6 +864,7 @@ static void OBJECT_cache_init(void *vedata)
        DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
        OBJECT_PrivateData *g_data;
        const DRWContextState *draw_ctx = DRW_context_state_get();
+       const bool xray_enabled = ((draw_ctx->v3d->shading.flag & 
V3D_SHADING_XRAY) != 0);
        /* TODO : use dpi setting for enabling the second pass */
        const bool do_outline_expand = false;
 
@@ -880,7 +881,7 @@ static void OBJECT_cache_init(void *vedata)
 
                GPUShader *sh = e_data.outline_prepass_sh;
 
-               if (draw_ctx->v3d->shading.flag & V3D_SHADING_XRAY) {
+               if (xray_enabled) {
                        sh = e_data.outline_prepass_wire_sh;
                }
 
@@ -917,7 +918,8 @@ static void OBJECT_cache_init(void *vedata)
        {
                DRWState state = DRW_STATE_WRITE_COLOR;
                struct Gwn_Batch *quad = DRW_cache_fullscreen_quad_get();
-               static float alphaOcclu = 0.35f;
+               /* Don't occlude the "outline" detection pass if in xray mode 
(too much flickering). */
+               float alphaOcclu = (xray_enabled) ? 1.0f : 0.35f;
                /* Reminder : bool uniforms need to be 4 bytes. */
                static const int bTrue = true;
                static const int bFalse = false;
@@ -929,7 +931,7 @@ static void OBJECT_cache_init(void *vedata)
                DRW_shgroup_uniform_texture_ref(grp, "outlineDepth", 
&e_data.outlines_depth_tx);
                DRW_shgroup_uniform_texture_ref(grp, "sceneDepth", 
&dtxl->depth);
                DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo);
-               DRW_shgroup_uniform_float(grp, "alphaOcclu", &alphaOcclu, 1);
+               DRW_shgroup_uniform_float_copy(grp, "alphaOcclu", alphaOcclu);
                DRW_shgroup_uniform_int(grp, "idOffsets", 
&stl->g_data->id_ofs_active, 3);
                DRW_shgroup_call_add(grp, quad, NULL);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to