[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46656] trunk/blender/source/blender/ blenkernel/intern/particle_system.c: Fix own compile error reported by brecht.

Daniel Genrich daniel.genrich at gmx.net
Tue May 15 14:07:45 CEST 2012


Revision: 46656
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46656
Author:   genscher
Date:     2012-05-15 12:07:44 +0000 (Tue, 15 May 2012)
Log Message:
-----------
Fix own compile error reported by brecht.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/particle_system.c

Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c	2012-05-15 11:35:01 UTC (rev 46655)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2012-05-15 12:07:44 UTC (rev 46656)
@@ -241,10 +241,10 @@
 		}
 	
 		if (psys->particles) {
-			totsaved=MIN2(psys->totpart, totpart);
+			totsaved=MIN2(psys->totpart,totpart);
 			/*save old pars*/
 			if (totsaved) {
-				memcpy(newpars, psys->particles, totsaved*sizeof(ParticleData));
+				memcpy(newpars,psys->particles,totsaved*sizeof(ParticleData));
 
 				if (psys->particles->boid)
 					memcpy(newboids, psys->particles->boid, totsaved*sizeof(BoidParticle));
@@ -418,7 +418,7 @@
 
 	cpa = psys->child;
 	for (i=0; i<child_nbr; i++) {
-		for (p=0; p<psys->totpart; p++, cpa++) {
+		for (p=0; p<psys->totpart; p++,cpa++) {
 			float length=2.0;
 			cpa->parent=p;
 					
@@ -440,7 +440,7 @@
 {
 	ParticleData *pa=NULL;
 	float min[3], max[3], delta[3], d;
-	MVert *mv, *mvert = dm->getVertDataArray(dm, 0);
+	MVert *mv, *mvert = dm->getVertDataArray(dm,0);
 	int totvert=dm->getNumVerts(dm), from=psys->part->from;
 	int i, j, k, p, res=psys->part->grid_res, size[3], axis;
 
@@ -452,13 +452,13 @@
 	mv++;
 
 	for (i=1; i<totvert; i++, mv++) {
-		min[0]=MIN2(min[0], mv->co[0]);
-		min[1]=MIN2(min[1], mv->co[1]);
-		min[2]=MIN2(min[2], mv->co[2]);
+		min[0]=MIN2(min[0],mv->co[0]);
+		min[1]=MIN2(min[1],mv->co[1]);
+		min[2]=MIN2(min[2],mv->co[2]);
 
-		max[0]=MAX2(max[0], mv->co[0]);
-		max[1]=MAX2(max[1], mv->co[1]);
-		max[2]=MAX2(max[2], mv->co[2]);
+		max[0]=MAX2(max[0],mv->co[0]);
+		max[1]=MAX2(max[1],mv->co[1]);
+		max[2]=MAX2(max[2],mv->co[2]);
 	}
 
 	sub_v3_v3v3(delta, max, min);
@@ -473,8 +473,8 @@
 	size[(axis+2)%3] = (int)ceil(delta[(axis+2)%3]/d);
 
 	/* float errors grrr.. */
-	size[(axis+1)%3] = MIN2(size[(axis+1)%3], res);
-	size[(axis+2)%3] = MIN2(size[(axis+2)%3], res);
+	size[(axis+1)%3] = MIN2(size[(axis+1)%3],res);
+	size[(axis+2)%3] = MIN2(size[(axis+2)%3],res);
 
 	size[0] = MAX2(size[0], 1);
 	size[1] = MAX2(size[1], 1);
@@ -485,9 +485,9 @@
 	min[1]+= d < delta[1] ? d/2.f : delta[1]/2.f;
 	min[2]+= d < delta[2] ? d/2.f : delta[2]/2.f;
 
-	for (i=0, p=0, pa=psys->particles; i<res; i++) {
+	for (i=0,p=0,pa=psys->particles; i<res; i++) {
 		for (j=0; j<res; j++) {
-			for (k=0; k<res; k++, p++, pa++) {
+			for (k=0; k<res; k++,p++,pa++) {
 				pa->fuv[0] = min[0] + (float)i*d;
 				pa->fuv[1] = min[1] + (float)j*d;
 				pa->fuv[2] = min[2] + (float)k*d;
@@ -507,8 +507,8 @@
 		min[1] -= d/2.0f;
 		min[2] -= d/2.0f;
 
-		for (i=0, mv=mvert; i<totvert; i++, mv++) {
-			sub_v3_v3v3(vec, mv->co, min);
+		for (i=0,mv=mvert; i<totvert; i++,mv++) {
+			sub_v3_v3v3(vec,mv->co,min);
 			vec[0]/=delta[0];
 			vec[1]/=delta[1];
 			vec[2]/=delta[2];
@@ -517,7 +517,7 @@
 			        (int)(vec[2] * (size[2] - 1)))->flag &= ~PARS_UNEXIST;
 		}
 	}
-	else if (ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
+	else if (ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
 		float co1[3], co2[3];
 
 		MFace *mface= NULL, *mface_array;
@@ -526,7 +526,7 @@
 		int amax= from==PART_FROM_FACE ? 3 : 1;
 
 		totface=dm->getNumTessFaces(dm);
-		mface=mface_array=dm->getTessFaceDataArray(dm, CD_MFACE);
+		mface=mface_array=dm->getTessFaceDataArray(dm,CD_MFACE);
 		
 		for (a=0; a<amax; a++) {
 			if (a==0) { a0mul=res*res; a1mul=res; a2mul=1; }
@@ -545,7 +545,7 @@
 					co1[a] -= 0.001f*d;
 					
 					/* lets intersect the faces */
-					for (i=0; i<totface; i++, mface++) {
+					for (i=0; i<totface; i++,mface++) {
 						copy_v3_v3(v1, mvert[mface->v1].co);
 						copy_v3_v3(v2, mvert[mface->v2].co);
 						copy_v3_v3(v3, mvert[mface->v3].co);
@@ -586,9 +586,9 @@
 	}
 
 	if (psys->part->flag & PART_GRID_HEXAGONAL) {
-		for (i=0, p=0, pa=psys->particles; i<res; i++) {
+		for (i=0,p=0,pa=psys->particles; i<res; i++) {
 			for (j=0; j<res; j++) {
-				for (k=0; k<res; k++, p++, pa++) {
+				for (k=0; k<res; k++,p++,pa++) {
 					if (j%2)
 						pa->fuv[0] += d/2.f;
 
@@ -614,7 +614,7 @@
 
 	if (psys->part->grid_rand > 0.f) {
 		float rfac = d * psys->part->grid_rand;
-		for (p=0, pa=psys->particles; p<psys->totpart; p++, pa++) {
+		for (p=0,pa=psys->particles; p<psys->totpart; p++,pa++) {
 			if (pa->flag & PARS_UNEXIST)
 				continue;
 
@@ -708,10 +708,10 @@
 
 	if (quad) {
 		vert[3][0]= 0.0f; vert[3][1]= 1.0f; vert[3][2]= 0.0f;
-		interp_weights_poly_v3(w, vert, 4, co);
+		interp_weights_poly_v3( w,vert, 4, co);
 	}
 	else {
-		interp_weights_poly_v3(w, vert, 3, co);
+		interp_weights_poly_v3( w,vert, 3, co);
 		w[3]= 0.0f;
 	}
 }
@@ -771,9 +771,9 @@
 			KDTreeNearest ptn[3];
 			int w, maxw;
 
-			psys_particle_on_dm(ctx->dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co1, 0, 0, 0, orco1, 0);
+			psys_particle_on_dm(ctx->dm,from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co1,0,0,0,orco1,0);
 			BKE_mesh_orco_verts_transform((Mesh*)ob->data, &orco1, 1, 1);
-			maxw = BLI_kdtree_find_n_nearest(ctx->tree, 3, orco1, NULL, ptn);
+			maxw = BLI_kdtree_find_n_nearest(ctx->tree,3,orco1,NULL,ptn);
 
 			for (w=0; w<maxw; w++) {
 				pa->verts[w]=ptn->num;
@@ -785,7 +785,7 @@
 		MFace *mface;
 
 		pa->num = i = ctx->index[p];
-		mface = dm->getTessFaceData(dm, i, CD_MFACE);
+		mface = dm->getTessFaceData(dm,i,CD_MFACE);
 		
 		switch (distr) {
 		case PART_DISTR_JIT:
@@ -796,7 +796,7 @@
 					psys_uv_to_w(0.33333f, 0.33333f, mface->v4, pa->fuv);
 			}
 			else {
-				ctx->jitoff[i] = fmod(ctx->jitoff[i], (float)ctx->jitlevel);
+				ctx->jitoff[i] = fmod(ctx->jitoff[i],(float)ctx->jitlevel);
 				psys_uv_to_w(ctx->jit[2*(int)ctx->jitoff[i]], ctx->jit[2*(int)ctx->jitoff[i]+1], mface->v4, pa->fuv);
 				ctx->jitoff[i]++;
 			}
@@ -813,21 +813,21 @@
 		
 		/* experimental */
 		if (from==PART_FROM_VOLUME) {
-			MVert *mvert=dm->getVertDataArray(dm, CD_MVERT);
+			MVert *mvert=dm->getVertDataArray(dm,CD_MVERT);
 
 			tot=dm->getNumTessFaces(dm);
 
-			psys_interpolate_face(mvert, mface, 0, 0, pa->fuv, co1, nor, 0, 0, 0, 0);
+			psys_interpolate_face(mvert,mface,0,0,pa->fuv,co1,nor,0,0,0,0);
 
 			normalize_v3(nor);
-			mul_v3_fl(nor, -100.0);
+			mul_v3_fl(nor,-100.0);
 
-			add_v3_v3v3(co2, co1, nor);
+			add_v3_v3v3(co2,co1,nor);
 
 			min_d=2.0;
 			intersect=0;
 
-			for (i=0, mface=dm->getTessFaceDataArray(dm, CD_MFACE); i<tot; i++, mface++) {
+			for (i=0,mface=dm->getTessFaceDataArray(dm,CD_MFACE); i<tot; i++,mface++) {
 				if (i==pa->num) continue;
 
 				v1=mvert[mface->v1].co;
@@ -889,14 +889,14 @@
 
 		if (ctx->tree) {
 			KDTreeNearest ptn[10];
-			int w, maxw;//, do_seams;
-			float maxd /*, mind, dd */, totw= 0.0f;
+			int w,maxw;//, do_seams;
+			float maxd /*, mind,dd */, totw= 0.0f;
 			int parent[10];
 			float pweight[10];
 
-			psys_particle_on_dm(dm, cfrom, cpa->num, DMCACHE_ISCHILD, cpa->fuv, cpa->foffset, co1, nor1, NULL, NULL, orco1, NULL);
+			psys_particle_on_dm(dm,cfrom,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co1,nor1,NULL,NULL,orco1,NULL);
 			BKE_mesh_orco_verts_transform((Mesh*)ob->data, &orco1, 1, 1);
-			maxw = BLI_kdtree_find_n_nearest(ctx->tree, 4, orco1, NULL, ptn);
+			maxw = BLI_kdtree_find_n_nearest(ctx->tree,4,orco1,NULL,ptn);
 
 			maxd=ptn[maxw-1].dist;
 			/* mind=ptn[0].dist; */ /* UNUSED */
@@ -904,14 +904,14 @@
 			/* the weights here could be done better */
 			for (w=0; w<maxw; w++) {
 				parent[w]=ptn[w].index;
-				pweight[w]=(float)pow(2.0, (double)(-6.0f*ptn[w].dist/maxd));
+				pweight[w]=(float)pow(2.0,(double)(-6.0f*ptn[w].dist/maxd));
 			}
 			for (;w<10; w++) {
 				parent[w]=-1;
 				pweight[w]=0.0f;
 			}
 
-			for (w=0, i=0; w<maxw && i<4; w++) {
+			for (w=0,i=0; w<maxw && i<4; w++) {
 				if (parent[w]>=0) {
 					cpa->pa[i]=parent[w];
 					cpa->w[i]=pweight[w];
@@ -997,7 +997,7 @@
 		int p, totchild = get_psys_tot_child(scene, psys);
 
 		if (psys->child && totchild) {
-			for (p=0, cpa=psys->child; p<totchild; p++, cpa++) {
+			for (p=0,cpa=psys->child; p<totchild; p++,cpa++) {
 				cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]= 0.0;
 				cpa->foffset= 0.0f;
 				cpa->parent=0;
@@ -1033,7 +1033,7 @@
 	int cfrom=0;
 	int totelem=0, totpart, *particle_element=0, children=0, totseam=0;
 	int jitlevel= 1, distr;
-	float *element_weight=NULL, *element_sum=NULL, *jitter_offset=NULL, *vweight=NULL;
+	float *element_weight=NULL,*element_sum=NULL,*jitter_offset=NULL, *vweight=NULL;
 	float cur, maxweight=0.0, tweight, totweight, inv_totweight, co[3], nor[3], orco[3], ornor[3];
 	
 	if (ELEM3(NULL, ob, psys, psys->part))
@@ -1065,7 +1065,7 @@
 			BLI_srandom(31415926 + psys->seed);
 			dm= CDDM_from_mesh((Mesh*)ob->data, ob);
 			DM_ensure_tessface(dm);
-			distribute_grid(dm, psys);
+			distribute_grid(dm,psys);
 			dm->release(dm);
 			return 0;
 		}
@@ -1084,8 +1084,8 @@
 
 		tree=BLI_kdtree_new(totpart);
 
-		for (p=0, pa=psys->particles; p<totpart; p++, pa++) {
-			psys_particle_on_dm(dm, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, orco, ornor);
+		for (p=0,pa=psys->particles; p<totpart; p++,pa++) {
+			psys_particle_on_dm(dm,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,orco,ornor);
 			BKE_mesh_orco_verts_transform((Mesh*)ob->data, &orco, 1, 1);
 			BLI_kdtree_insert(tree, p, orco, ornor);
 		}
@@ -1118,12 +1118,12 @@
 
 			for (p=0; p<totvert; p++) {
 				if (orcodata) {
-					copy_v3_v3(co, orcodata[p]);
+					copy_v3_v3(co,orcodata[p]);
 					BKE_mesh_orco_verts_transform((Mesh*)ob->data, &co, 1, 1);
 				}
 				else
-					copy_v3_v3(co, mv[p].co);
-				BLI_kdtree_insert(tree, p, co, NULL);
+					copy_v3_v3(co,mv[p].co);
+				BLI_kdtree_insert(tree,p,co,NULL);
 			}
 
 			BLI_kdtree_balance(tree);
@@ -1137,7 +1137,7 @@
 		distribute_invalid(scene, psys, children ? PART_FROM_CHILD : 0);
 
 		if (G.debug & G_DEBUG)
-			fprintf(stderr, "Particle distribution error: Nothing to emit from!\n");
+			fprintf(stderr,"Particle distribution error: Nothing to emit from!\n");
 
 		if (dm != finaldm) dm->release(dm);
 
@@ -1160,7 +1160,7 @@
 		orcodata= dm->getVertDataArray(dm, CD_ORCO);
 
 		for (i=0; i<totelem; i++) {
-			MFace *mf=dm->getTessFaceData(dm, i, CD_MFACE);
+			MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
 
 			if (orcodata) {
 				copy_v3_v3(co1, orcodata[mf->v1]);
@@ -1175,14 +1175,14 @@
 				}
 			}
 			else {
-				v1= (MVert*)dm->getVertData(dm, mf->v1, CD_MVERT);
-				v2= (MVert*)dm->getVertData(dm, mf->v2, CD_MVERT);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list