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>2014-05-29 18:26:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-05-29 18:26:32 +0400
commitb2cad79500bb1af92153928479ca7d7144463e00 (patch)
treee34b336625b2795a371eab7dcc0fc67588f74699
parent0780f5915b29ab7102bf1cb8bddd54774161d0d3 (diff)
Math lib: add negate_m3, negate_m4
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h3
-rw-r--r--source/blender/blenlib/intern/math_matrix.c19
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c2
5 files changed, 25 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 8ce78e5be63..d149ad73b04 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -111,6 +111,9 @@ void mul_m3_fl(float R[3][3], float f);
void mul_m4_fl(float R[4][4], float f);
void mul_mat3_m4_fl(float R[4][4], float f);
+void negate_m3(float R[4][4]);
+void negate_m4(float R[4][4]);
+
bool invert_m3_ex(float m[3][3], const float epsilon);
bool invert_m3_m3_ex(float m1[3][3], float m2[3][3], const float epsilon);
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index f375a5c01ed..7fc30e3112b 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -519,7 +519,6 @@ void mul_transposed_mat3_m4_v3(float mat[4][4], float vec[3])
vec[2] = x * mat[2][0] + y * mat[2][1] + mat[2][2] * vec[2];
}
-
void mul_m3_fl(float m[3][3], float f)
{
int i, j;
@@ -547,6 +546,24 @@ void mul_mat3_m4_fl(float m[4][4], float f)
m[i][j] *= f;
}
+void negate_m3(float m[4][4])
+{
+ int i, j;
+
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 3; j++)
+ m[i][j] *= -1.0f;
+}
+
+void negate_m4(float m[4][4])
+{
+ int i, j;
+
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++)
+ m[i][j] *= -1.0f;
+}
+
void mul_m3_v3_double(float mat[3][3], double vec[3])
{
double x, y;
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index 3d860145f59..bc37a88d7f0 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -329,7 +329,7 @@ static void clip_planes_from_rect(bContext *C,
view3d_set_viewcontext(C, &vc);
view3d_get_transformation(vc.ar, vc.rv3d, vc.obact, &mats);
ED_view3d_clipping_calc(&bb, clip_planes, &mats, rect);
- mul_m4_fl(clip_planes, -1.0f);
+ 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 a5f0fcd3b53..9363542ba05 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -208,7 +208,7 @@ int do_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, rcti *rect, b
/* transform the clip planes in object space */
view3d_get_transformation(vc->ar, vc->rv3d, vc->obact, &mats);
ED_view3d_clipping_calc(&bb, clip_planes, &mats, rect);
- mul_m4_fl(clip_planes, -1.0f);
+ negate_m4(clip_planes);
BKE_sculpt_update_mesh_elements(scene, sd, ob, false, true);
pbvh = ob->sculpt->pbvh;
@@ -355,7 +355,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
mask_lasso_px_cb, &data);
ED_view3d_clipping_calc(&bb, clip_planes, &mats, &data.rect);
- mul_m4_fl(clip_planes, -1.0f);
+ negate_m4(clip_planes);
BKE_sculpt_update_mesh_elements(scene, sd, 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 642c1dd9529..25308f6595e 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -146,7 +146,7 @@ void paint_calc_redraw_planes(float planes[4][4],
rect.ymax += 2;
ED_view3d_clipping_calc(&bb, planes, &mats, &rect);
- mul_m4_fl(planes, -1.0f);
+ negate_m4(planes);
}
float paint_calc_object_space_radius(ViewContext *vc, const float center[3],