diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-09-16 19:25:28 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-09-16 19:25:28 +0400 |
commit | e5d0dcb8d8ecc4782f1a7df890ee2c8ff5ca94c1 (patch) | |
tree | 411e4651950d0c84198e5a8a7fb5471c70843bce /source/blender/blenkernel/intern/constraint.c | |
parent | fc7de2353763c65db3c04c29dcc33289bb86966d (diff) |
Few cleanup in matrix mathutils (make mul_m3_m3m4 and mul_m4_m3m4 consistant with other similar funcs, mainly copy-safe [i.e. you can use the same matrix as operand and result, saves lines in some already over-complicated code!]).
Diffstat (limited to 'source/blender/blenkernel/intern/constraint.c')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 6b9e0921c3b..2db4c466443 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1030,7 +1030,6 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar if (VALID_CONS_TARGET(ct)) { float size[3], vec[3]; float totmat[3][3]; - float tmat[4][4]; /* Get size property, since ob->size is only the object's own relative size, not its global one */ mat4_to_size(size, cob->matrix); @@ -1053,9 +1052,8 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar vectomat(vec, ct->matrix[2], (short)data->reserved1, (short)data->reserved2, data->flags, totmat); - - copy_m4_m4(tmat, cob->matrix); - mul_m4_m3m4(cob->matrix, totmat, tmat); + + mul_m4_m3m4(cob->matrix, totmat, cob->matrix); } } @@ -2281,7 +2279,6 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t float totmat[3][3]; float tmpmat[3][3]; float invmat[3][3]; - float tmat[4][4]; float mdet; /* Vector object -> target */ @@ -2509,8 +2506,6 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t totmat[1][0] = tmpmat[1][0]; totmat[1][1] = tmpmat[1][1]; totmat[1][2] = tmpmat[1][2]; totmat[2][0] = tmpmat[2][0]; totmat[2][1] = tmpmat[2][1]; totmat[2][2] = tmpmat[2][2]; - copy_m4_m4(tmat, cob->matrix); - mdet = determinant_m3(totmat[0][0], totmat[0][1], totmat[0][2], totmat[1][0], totmat[1][1], totmat[1][2], totmat[2][0], totmat[2][1], totmat[2][2]); @@ -2519,7 +2514,7 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t } /* apply out transformaton to the object */ - mul_m4_m3m4(cob->matrix, totmat, tmat); + mul_m4_m3m4(cob->matrix, totmat, cob->matrix); } } @@ -2717,7 +2712,6 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t if (VALID_CONS_TARGET(ct)) { float size[3], scale[3], vec[3], xx[3], zz[3], orth[3]; float totmat[3][3]; - float tmat[4][4]; float dist; /* store scaling before destroying obmat */ @@ -2815,9 +2809,8 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t normalize_v3_v3(totmat[2], zz); break; } /* switch (data->plane) */ - - copy_m4_m4(tmat, cob->matrix); - mul_m4_m3m4(cob->matrix, totmat, tmat); + + mul_m4_m3m4(cob->matrix, totmat, cob->matrix); } } |