diff options
-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); |