diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2019-03-30 10:21:09 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2019-03-30 10:22:43 +0300 |
commit | de0dab66ff896992251763d6e799cc682ff03543 (patch) | |
tree | d82d1d49dd9ef26b6541677b29b92dc939307003 | |
parent | 024d02256e652c944ff259b1ed4327b1b160e335 (diff) |
Fix T63086: Navigation problem with Background/Reference Images
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
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 13 |
1 files changed, 11 insertions, 2 deletions
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); |