From 6f42e69b58ce4b9a2f0370d22b41f1c76bf21f89 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 28 Jun 2021 15:44:16 +1000 Subject: Cleanup: de-duplicate 3D-view depth calculation function --- source/blender/editors/gpencil/gpencil_paint.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'source/blender/editors/gpencil/gpencil_paint.c') diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index d0c0933c5be..409d10996d0 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1319,17 +1319,6 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p) /* --- 'Eraser' for 'Paint' Tool ------ */ -/** - * 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 */ static bool gpencil_stroke_eraser_is_occluded( tGPsdata *p, bGPDlayer *gpl, bGPDspoint *pt, const int x, const int y) @@ -1359,10 +1348,10 @@ static bool gpencil_stroke_eraser_is_occluded( BKE_gpencil_layer_transform_matrix_get(p->depsgraph, obact, gpl, diff_mat); 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_mval = ED_view3d_calc_depth_for_comparison(rv3d, mval_3d); mul_v3_m4v3(fpt, diff_mat, &pt->x); - const float depth_pt = view3d_point_depth(rv3d, fpt); + const float depth_pt = ED_view3d_calc_depth_for_comparison(rv3d, fpt); /* Checked occlusion flag. */ pt->flag |= GP_SPOINT_TEMP_TAG; -- cgit v1.2.3