[Bf-blender-cvs] [c760c0d] master: Cleanup: use mul_v3_mat3_m4v3

Campbell Barton noreply at git.blender.org
Mon Apr 27 17:19:22 CEST 2015


Commit: c760c0dbb3b768c54e0ac81ec318cac94503b81b
Author: Campbell Barton
Date:   Mon Apr 27 23:23:04 2015 +1000
Branches: master
https://developer.blender.org/rBc760c0dbb3b768c54e0ac81ec318cac94503b81b

Cleanup: use mul_v3_mat3_m4v3

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

M	source/blender/blenkernel/intern/object.c
M	source/blender/editors/mesh/editmesh_extrude.c
M	source/blender/editors/mesh/editmesh_knife.c
M	source/blender/editors/object/object_transform.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/transform/transform_snap.c
M	source/blender/render/intern/source/convertblender.c
M	source/blender/render/intern/source/shadeinput.c

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

diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index f14f726..6f373ef 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1769,8 +1769,7 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *gob)
 		mul_m4_m4m4(ob->obmat, gob->obmat, target->obmat);
 		if (gob->dup_group) { /* should always be true */
 			float tvec[3];
-			copy_v3_v3(tvec, gob->dup_group->dupli_ofs);
-			mul_mat3_m4_v3(ob->obmat, tvec);
+			mul_v3_mat3_m4v3(tvec, ob->obmat, gob->dup_group->dupli_ofs);
 			sub_v3_v3(ob->obmat[3], tvec);
 		}
 		BKE_object_apply_mat4(ob, ob->obmat, false, true);
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c
index 5c7efcc..e8f9a76 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -574,8 +574,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
 			mul_mat3_m4_v3(vc.obedit->imat, nor); /* local space */
 
 			/* correct the normal to be aligned on the view plane */
-			copy_v3_v3(view_vec, vc.rv3d->viewinv[2]);
-			mul_mat3_m4_v3(vc.obedit->imat, view_vec);
+			mul_v3_mat3_m4v3(view_vec, vc.obedit->imat, vc.rv3d->viewinv[2]);
 			cross_v3_v3v3(cross, nor, view_vec);
 			cross_v3_v3v3(nor, view_vec, cross);
 			normalize_v3(nor);
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 4f88390..cfd0d3f 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -2876,8 +2876,7 @@ static void knife_recalc_projmat(KnifeTool_OpData *kcd)
 	ED_view3d_ob_project_mat_get(kcd->ar->regiondata, kcd->ob, kcd->projmat);
 	invert_m4_m4(kcd->projmat_inv, kcd->projmat);
 
-	copy_v3_v3(kcd->proj_zaxis, kcd->vc.rv3d->viewinv[2]);
-	mul_mat3_m4_v3(kcd->ob->imat, kcd->proj_zaxis);
+	mul_v3_mat3_m4v3(kcd->proj_zaxis, kcd->ob->imat, kcd->vc.rv3d->viewinv[2]);
 	normalize_v3(kcd->proj_zaxis);
 
 	kcd->is_ortho = ED_view3d_clip_range_get(kcd->vc.v3d, kcd->vc.rv3d,
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 92fe5de..340b662 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -939,8 +939,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 
 				/* convert the offset to parent space */
 				BKE_object_to_mat4(ob, obmat);
-				copy_v3_v3(centn, cent);
-				mul_mat3_m4_v3(obmat, centn); /* omit translation part */
+				mul_v3_mat3_m4v3(centn, obmat, cent); /* omit translation part */
 
 				add_v3_v3(ob->loc, centn);
 
@@ -970,8 +969,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 						ob_other->flag |= OB_DONE;
 						DAG_id_tag_update(&ob_other->id, OB_RECALC_OB | OB_RECALC_DATA);
 
-						copy_v3_v3(centn, cent);
-						mul_mat3_m4_v3(ob_other->obmat, centn); /* omit translation part */
+						mul_v3_mat3_m4v3(centn, ob_other->obmat, cent); /* omit translation part */
 						add_v3_v3(ob_other->loc, centn);
 
 						BKE_object_where_is_calc(scene, ob_other);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 24b814d..5b2ac50 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -8021,9 +8021,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
 			/* don't show smoke before simulation starts, this could be made an option in the future */
 			if (smd->domain->fluid && CFRA >= smd->domain->point_cache[0]->startframe) {
 				/* get view vector */
-				copy_v3_v3(viewnormal, rv3d->viewinv[2]);
 				invert_m4_m4(ob->imat, ob->obmat);
-				mul_mat3_m4_v3(ob->imat, viewnormal);
+				mul_v3_mat3_m4v3(viewnormal, ob->imat, rv3d->viewinv[2]);
 				normalize_v3(viewnormal);
 
 				/* set dynamic boundaries to draw the volume
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index fd189e9..e8a0f35 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1400,11 +1400,8 @@ static bool snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *ar
 
 	invert_m4_m4(imat, obmat);
 
-	copy_v3_v3(ray_start_local, ray_start);
-	copy_v3_v3(ray_normal_local, ray_normal);
-	
-	mul_m4_v3(imat, ray_start_local);
-	mul_mat3_m4_v3(imat, ray_normal_local);
+	mul_v3_m4v3(ray_start_local, imat, ray_start);
+	mul_v3_mat3_m4v3(ray_normal_local, imat, ray_normal);
 
 	if (arm->edbo) {
 		EditBone *eBone;
@@ -1762,11 +1759,8 @@ static bool snapEmpty(short snap_mode, ARegion *ar, Object *ob, float obmat[4][4
 
 	invert_m4_m4(imat, obmat);
 
-	copy_v3_v3(ray_start_local, ray_start);
-	copy_v3_v3(ray_normal_local, ray_normal);
-
-	mul_m4_v3(imat, ray_start_local);
-	mul_mat3_m4_v3(imat, ray_normal_local);
+	mul_v3_m4v3(ray_start_local, imat, ray_start);
+	mul_v3_mat3_m4v3(ray_normal_local, imat, ray_normal);
 
 	switch (snap_mode) {
 		case SCE_SNAP_MODE_VERTEX:
@@ -2111,12 +2105,8 @@ static bool peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[4][4],
 
 		transpose_m3_m4(timat, imat);
 		
-		copy_v3_v3(ray_start_local, ray_start);
-		copy_v3_v3(ray_normal_local, ray_normal);
-		
-		mul_m4_v3(imat, ray_start_local);
-		mul_mat3_m4_v3(imat, ray_normal_local);
-		
+		mul_v3_m4v3(ray_start_local, imat, ray_start);
+		mul_v3_mat3_m4v3(ray_normal_local, imat, ray_normal);
 		
 		/* If number of vert is more than an arbitrary limit, 
 		 * test against boundbox first
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index d36ab46..87c8869 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -1209,8 +1209,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re
 			sd->time = 0.0f;
 			sd->size = hasize;
 
-			copy_v3_v3(vel, state->vel);
-			mul_mat3_m4_v3(re->viewmat, vel);
+			mul_v3_mat3_m4v3(vel, re->viewmat, state->vel);
 			normalize_v3(vel);
 
 			if (part->draw & PART_DRAW_VEL_LENGTH)
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index 9ea7cb6..5a5e67e 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -423,14 +423,11 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
 		}
 
 		if (texco & TEXCO_GLOB) {
-			copy_v3_v3(shi->gl, shi->co);
-			mul_m4_v3(R.viewinv, shi->gl);
+			mul_v3_m4v3(shi->gl, R.viewinv, shi->co);
 			
 			if (shi->osatex) {
-				copy_v3_v3(shi->dxgl, shi->dxco);
-				mul_mat3_m4_v3(R.viewinv, shi->dxgl); 
-				copy_v3_v3(shi->dygl, shi->dyco);
-				mul_mat3_m4_v3(R.viewinv, shi->dygl);
+				mul_v3_mat3_m4v3(shi->dxgl, R.viewinv, shi->dxco);
+				mul_v3_mat3_m4v3(shi->dygl, R.viewinv, shi->dyco);
 			}
 		}




More information about the Bf-blender-cvs mailing list