diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-06-28 08:44:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-28 08:46:16 +0300 |
commit | 6f42e69b58ce4b9a2f0370d22b41f1c76bf21f89 (patch) | |
tree | 7c20860e70c7ea09433e860a5485c8044152b3ad /source/blender/editors/gpencil/annotate_paint.c | |
parent | 7efc87dcd2162b9294cb84512b7445fe1565f058 (diff) |
Cleanup: de-duplicate 3D-view depth calculation function
Diffstat (limited to 'source/blender/editors/gpencil/annotate_paint.c')
-rw-r--r-- | source/blender/editors/gpencil/annotate_paint.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index 69b21731284..7b995c545ba 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -1079,17 +1079,6 @@ static void annotation_free_stroke(bGPDframe *gpf, bGPDstroke *gps) BLI_freelinkN(&gpf->strokes, gps); } -/** - * Which which point is in front (result should only be used for comparison). - */ -static float view3d_point_depth(const RegionView3D *rv3d, const float co[3]) -{ - if (rv3d->is_persp) { - return ED_view3d_calc_zfac(rv3d, co, NULL); - } - return -dot_v3v3(rv3d->viewinv[2], co); -} - /* only erase stroke points that are visible (3d view) */ static bool annotation_stroke_eraser_is_occluded(tGPsdata *p, const bGPDspoint *pt, @@ -1102,8 +1091,8 @@ static bool annotation_stroke_eraser_is_occluded(tGPsdata *p, float mval_3d[3]; if (ED_view3d_autodist_simple(p->region, mval_i, mval_3d, 0, NULL)) { - const float depth_mval = view3d_point_depth(rv3d, mval_3d); - const float depth_pt = view3d_point_depth(rv3d, &pt->x); + const float depth_mval = ED_view3d_calc_depth_for_comparison(rv3d, mval_3d); + const float depth_pt = ED_view3d_calc_depth_for_comparison(rv3d, &pt->x); if (depth_pt > depth_mval) { return true; |