[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58898] branches/ soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c : Vertex Color transfer through projection: fixing the mloopcol access to be by MLoopCol

Walid Shouman eng.walidshouman at gmail.com
Sun Aug 4 09:16:44 CEST 2013


Revision: 58898
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58898
Author:   walid
Date:     2013-08-04 07:16:43 +0000 (Sun, 04 Aug 2013)
Log Message:
-----------
Vertex Color transfer through projection: fixing the mloopcol access to be by MLoopCol

Modified Paths:
--------------
    branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c

Modified: branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c
===================================================================
--- branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c	2013-08-04 05:37:25 UTC (rev 58897)
+++ branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c	2013-08-04 07:16:43 UTC (rev 58898)
@@ -2324,7 +2324,6 @@
 	BMLoop *l, *l2;						//used for iterating the destination's loops
 //	MLoopUV *luv, *luv_src;
 	BMIter liter, liter2;
-	float weight_accu[4];
 
 	//-----algorithm definitions start
 	BMEditMesh *em_src;						//tree variable
@@ -2458,6 +2457,8 @@
 			mid_poly_v3(f_mid_src, v_co_list_src, v_src_count);	//get the mid point of the source face
 
 			BM_ITER_ELEM (l, &liter, f_dst, BM_LOOPS_OF_FACE) {
+				MLoopCol *lcol = BM_ELEM_CD_GET_VOID_P(l, CD_dst);
+				MLoopCol *lcol_out = MEM_mallocN(sizeof(*lcol_out), "lcol_out bmesh_data_transfer.c");
 
 				zero_v3(tmp_co);
 				// Transform into target space.
@@ -2473,14 +2474,28 @@
 				interp_weights_poly_v3(tmp_weight, v_co_list_src, v_src_count, tmp_co);
 
 				// Interpolating according to the spatially found weights
-				zero_v4(weight_accu);	//this variable is added only for consistency with the other transfer functions
+				lcol_out->a = 0;
+				lcol_out->b = 0;
+				lcol_out->g = 0;
+				lcol_out->r = 0;
+
 				BM_ITER_ELEM_INDEX (l2, &liter2, f_src, BM_LOOPS_OF_FACE, a) {
-					madd_v4_v4fl(weight_accu, BM_ELEM_CD_GET_VOID_P(l2, CD_src), tmp_weight[a]);
+					MLoopCol *lcol2 = BM_ELEM_CD_GET_VOID_P(l2, CD_src);
+
+					//there's no madd_v4_v4fl for char!
+					lcol_out->a += (lcol2->a * tmp_weight[a]);
+					lcol_out->b += (lcol2->b * tmp_weight[a]);
+					lcol_out->g += (lcol2->g * tmp_weight[a]);
+					lcol_out->r += (lcol2->r * tmp_weight[a]);
+
 				}
 
 				//shall we verify the indices!?
-				// copy for each loop directly
-				copy_v4_v4(BM_ELEM_CD_GET_VOID_P(l, CD_dst), weight_accu);
+				//there's no copy_v4_v4 for char!
+				lcol->a = lcol_out->a;
+				lcol->b = lcol_out->b;
+				lcol->g = lcol_out->g;
+				lcol->r = lcol_out->r;
 
 				//end of interpolation
 			}




More information about the Bf-blender-cvs mailing list