diff options
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 56843899ff6..498658765b6 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2672,9 +2672,18 @@ bool BKE_object_empty_image_is_visible_in_view3d(const Object *ob, const RegionV { char visibility_flag = ob->empty_image_visibility_flag; - if ((visibility_flag & OB_EMPTY_IMAGE_HIDE_BACK) != 0) { - if (dot_v3v3((float *)&ob->obmat[2], (float *)&rv3d->viewinv[2]) < 0.0f) { - return false; + if ((visibility_flag & (OB_EMPTY_IMAGE_HIDE_BACK | OB_EMPTY_IMAGE_HIDE_FRONT)) != 0) { + /* TODO: this isn't correct with perspective projection. */ + const float dot = dot_v3v3((float *)&ob->obmat[2], (float *)&rv3d->viewinv[2]); + if (visibility_flag & OB_EMPTY_IMAGE_HIDE_BACK) { + if (dot < 0.0f) { + return false; + } + } + if (visibility_flag & OB_EMPTY_IMAGE_HIDE_FRONT) { + if (dot > 0.0f) { + return false; + } } } |