From de0dab66ff896992251763d6e799cc682ff03543 Mon Sep 17 00:00:00 2001 From: Sebastian Parborg Date: Sat, 30 Mar 2019 08:21:09 +0100 Subject: Fix T63086: Navigation problem with Background/Reference Images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The issue was the manipulated depth for images would be used when doing distance depth checks. Now we will use the actual depth of the image object when doing such tests. Reviewed By: Clément Foucault Differential Revision: http://developer.blender.org/D4616 --- source/blender/draw/modes/object_mode.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'source/blender/draw') diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index bce68623536..3cb3d28a29c 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -945,12 +945,21 @@ static void DRW_shgroup_empty_image( float image_aspect[2]; image_calc_aspect(ob->data, size, image_aspect); + char depth_mode; + if (DRW_state_is_depth()) { + /* Use the actual depth if we are doing depth tests to determine the distance to the object */ + depth_mode = OB_EMPTY_IMAGE_DEPTH_DEFAULT; + } + else { + depth_mode = ob->empty_image_depth; + } + { DRWShadingGroup *grp = DRW_shgroup_create(sh_data->object_empty_image_wire, sgl->non_meshes); /* TODO(fclem) implement DRW_shgroup_uniform_vec2_copy */ DRW_shgroup_uniform_float_copy(grp, "aspectX", image_aspect[0]); DRW_shgroup_uniform_float_copy(grp, "aspectY", image_aspect[1]); - DRW_shgroup_uniform_int_copy(grp, "depthMode", ob->empty_image_depth); + DRW_shgroup_uniform_int_copy(grp, "depthMode", depth_mode); DRW_shgroup_uniform_float(grp, "size", &ob->empty_drawsize, 1); DRW_shgroup_uniform_vec2(grp, "offset", ob->ima_ofs, 1); DRW_shgroup_uniform_vec3(grp, "color", color, 1); @@ -969,7 +978,7 @@ static void DRW_shgroup_empty_image( (use_alpha_blend) ? sgl->image_empties : sgl->non_meshes); DRW_shgroup_uniform_float_copy(grp, "aspectX", image_aspect[0]); DRW_shgroup_uniform_float_copy(grp, "aspectY", image_aspect[1]); - DRW_shgroup_uniform_int_copy(grp, "depthMode", ob->empty_image_depth); + DRW_shgroup_uniform_int_copy(grp, "depthMode", depth_mode); DRW_shgroup_uniform_float(grp, "size", &ob->empty_drawsize, 1); DRW_shgroup_uniform_vec2(grp, "offset", ob->ima_ofs, 1); DRW_shgroup_uniform_texture(grp, "image", tex); -- cgit v1.2.3