[Bf-blender-cvs] [0901a72b6b3] master: Cleanup: use consistent clipping plane sign convention

Brecht Van Lommel noreply at git.blender.org
Fri Sep 27 14:32:34 CEST 2019


Commit: 0901a72b6b36b0bc0d2b0783a949e66dcb17a91c
Author: Brecht Van Lommel
Date:   Fri Sep 27 14:23:10 2019 +0200
Branches: master
https://developer.blender.org/rB0901a72b6b36b0bc0d2b0783a949e66dcb17a91c

Cleanup: use consistent clipping plane sign convention

===================================================================

M	source/blender/blenkernel/intern/pbvh.c
M	source/blender/editors/sculpt_paint/paint_hide.c
M	source/blender/editors/sculpt_paint/paint_mask.c
M	source/blender/editors/sculpt_paint/paint_utils.c

===================================================================

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)



More information about the Bf-blender-cvs mailing list