Fix T61163: Single sided images show when viewed from side

This commit is contained in:
Campbell Barton 2019-02-05 10:29:19 +11:00
parent 40f2afcf1d
commit 2c84c23a07
Notes: blender-bot 2023-02-14 07:47:59 +01:00
Referenced by issue #61163, Bug when adding Background Images
1 changed files with 3 additions and 2 deletions

View File

@ -2608,15 +2608,16 @@ 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 | OB_EMPTY_IMAGE_HIDE_FRONT)) != 0) {
const float eps = 1e-5f;
/* 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) {
if (dot < eps) {
return false;
}
}
if (visibility_flag & OB_EMPTY_IMAGE_HIDE_FRONT) {
if (dot > 0.0f) {
if (dot > -eps) {
return false;
}
}