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
This commit is contained in:
Sebastian Parborg 2019-03-30 08:21:09 +01:00
parent 024d02256e
commit de0dab66ff
Notes: blender-bot 2023-02-14 11:24:03 +01:00
Referenced by issue #63086, Navigation problem with Background/Reference Images
1 changed files with 11 additions and 2 deletions

View File

@ -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);