use negative dot product for clipping, rather then doing it inline.

This commit is contained in:
Campbell Barton
2013-05-08 12:53:43 +00:00
parent 3e4db4969c
commit 67ec36a615
2 changed files with 3 additions and 10 deletions

View File

@@ -3703,18 +3703,13 @@ void VIEW3D_OT_background_image_remove(wmOperatorType *ot)
/* ********************* set clipping operator ****************** */
static void calc_clipping_plane(float clip[6][4], BoundBox *clipbb)
static void calc_clipping_plane(float clip[6][4], const BoundBox *clipbb)
{
int val;
for (val = 0; val < 4; val++) {
normal_tri_v3(clip[val], clipbb->vec[val], clipbb->vec[val == 3 ? 0 : val + 1], clipbb->vec[val + 4]);
/* TODO - this is just '-dot_v3v3(clip[val], clipbb->vec[val])' isnt it? - sould replace */
clip[val][3] = -clip[val][0] * clipbb->vec[val][0] -
clip[val][1] * clipbb->vec[val][1] -
clip[val][2] * clipbb->vec[val][2];
clip[val][3] = -dot_v3v3(clip[val], clipbb->vec[val]);
}
}

View File

@@ -606,9 +606,7 @@ void ED_view3d_clipping_calc(BoundBox *bb, float planes[4][4], bglMats *mats, co
if (flip_sign)
negate_v3(planes[val]);
planes[val][3] = -planes[val][0] * bb->vec[val][0] -
planes[val][1] * bb->vec[val][1] -
planes[val][2] * bb->vec[val][2];
planes[val][3] = -dot_v3v3(planes[val], bb->vec[val]);
}
}