diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-27 15:23:10 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-27 15:24:49 +0300 |
commit | 0901a72b6b36b0bc0d2b0783a949e66dcb17a91c (patch) | |
tree | 942cba14c0efb8a7f50779db310b42ef2a802903 /source | |
parent | c5db0272d4befa4ee8c7da8dec8932e379a7275f (diff) |
Cleanup: use consistent clipping plane sign convention
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 9 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_hide.c | 1 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_mask.c | 1 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_utils.c | 1 |
4 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 0eca4489309..eac18c79891 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -2171,12 +2171,13 @@ static PlaneAABBIsect test_planes_aabb(const float bb_min[3], const float bb_max[3], const float (*planes)[4]) { - float vmin[3], vmax[3]; PlaneAABBIsect ret = ISECT_INSIDE; for (int i = 0; i < 4; i++) { + float vmin[3], vmax[3]; + for (int axis = 0; axis < 3; axis++) { - if (planes[i][axis] > 0) { + if (planes[i][axis] < 0) { vmin[axis] = bb_min[axis]; vmax[axis] = bb_max[axis]; } @@ -2186,10 +2187,10 @@ static PlaneAABBIsect test_planes_aabb(const float bb_min[3], } } - if (dot_v3v3(planes[i], vmin) + planes[i][3] > 0) { + if (dot_v3v3(planes[i], vmin) + planes[i][3] < 0) { return ISECT_OUTSIDE; } - else if (dot_v3v3(planes[i], vmax) + planes[i][3] >= 0) { + else if (dot_v3v3(planes[i], vmax) + planes[i][3] <= 0) { ret = ISECT_INTERSECT; } } diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index cfb42407fb7..3463ceb7341 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -309,7 +309,6 @@ static void clip_planes_from_rect(bContext *C, view3d_operator_needs_opengl(C); ED_view3d_viewcontext_init(C, &vc, depsgraph); ED_view3d_clipping_calc(&bb, clip_planes, vc.ar, vc.obact, rect); - negate_m4(clip_planes); } /* If mode is inside, get all PBVH nodes that lie at least partially diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index 0757ae128ec..3a8ea3c296c 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -297,7 +297,6 @@ bool ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti * /* transform the clip planes in object space */ ED_view3d_clipping_calc(&bb, clip_planes, vc->ar, vc->obact, rect); - negate_m4(clip_planes); BKE_sculpt_update_object_for_edit(depsgraph, ob, false, true); pbvh = ob->sculpt->pbvh; diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 6cf80ebf241..a014fe7fdff 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -144,7 +144,6 @@ void paint_calc_redraw_planes(float planes[4][4], rect.ymax += 2; ED_view3d_clipping_calc(&bb, planes, ar, ob, &rect); - negate_m4(planes); } float paint_calc_object_space_radius(ViewContext *vc, const float center[3], float pixel_radius) |