Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-06-28 08:44:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-06-28 08:46:16 +0300
commit6f42e69b58ce4b9a2f0370d22b41f1c76bf21f89 (patch)
tree7c20860e70c7ea09433e860a5485c8044152b3ad /source/blender/editors/gpencil/gpencil_paint.c
parent7efc87dcd2162b9294cb84512b7445fe1565f058 (diff)
Cleanup: de-duplicate 3D-view depth calculation function
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_paint.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c15
1 files changed, 2 insertions, 13 deletions
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;