[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35844] trunk/blender/source/blender/ blenkernel: particles & vector-font: floats were being implicitly promoted to

Campbell Barton ideasman42 at gmail.com
Mon Mar 28 13:21:40 CEST 2011


Revision: 35844
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35844
Author:   campbellbarton
Date:     2011-03-28 11:21:39 +0000 (Mon, 28 Mar 2011)
Log Message:
-----------
particles & vector-font: floats were being implicitly promoted to
doubles, adjust to use floats.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_curve.h
    trunk/blender/source/blender/blenkernel/intern/font.c
    trunk/blender/source/blender/blenkernel/intern/particle.c
    trunk/blender/source/blender/blenkernel/intern/particle_system.c

Modified: trunk/blender/source/blender/blenkernel/BKE_curve.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_curve.h	2011-03-28 11:04:38 UTC (rev 35843)
+++ trunk/blender/source/blender/blenkernel/BKE_curve.h	2011-03-28 11:21:39 UTC (rev 35844)
@@ -51,7 +51,7 @@
 #define SEGMENTSV(nu)	    ( ((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv-1 )
 
 #define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1)
-#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1!=0.0 || (cu)->ext2!=0.0) ? 1:0)
+#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1!=0.0f || (cu)->ext2!=0.0f) ? 1:0)
 
 
 void unlink_curve( struct Curve *cu);

Modified: trunk/blender/source/blender/blenkernel/intern/font.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/font.c	2011-03-28 11:04:38 UTC (rev 35843)
+++ trunk/blender/source/blender/blenkernel/intern/font.c	2011-03-28 11:21:39 UTC (rev 35844)
@@ -490,19 +490,19 @@
 	nu2->bp[0].vec[0] = x1;
 	nu2->bp[0].vec[1] = y1;	
 	nu2->bp[0].vec[2] = 0;
-	nu2->bp[0].vec[3] = 1.0;
+	nu2->bp[0].vec[3] = 1.0f;
 	nu2->bp[1].vec[0] = x2;
 	nu2->bp[1].vec[1] = y1;
 	nu2->bp[1].vec[2] = 0;	
-	nu2->bp[1].vec[3] = 1.0;	
+	nu2->bp[1].vec[3] = 1.0f;
 	nu2->bp[2].vec[0] = x2;
 	nu2->bp[2].vec[1] = y2;	
 	nu2->bp[2].vec[2] = 0;
-	nu2->bp[2].vec[3] = 1.0; 
+	nu2->bp[2].vec[3] = 1.0f;
 	nu2->bp[3].vec[0] = x1;
 	nu2->bp[3].vec[1] = y2;
 	nu2->bp[3].vec[2] = 0;	
-	nu2->bp[3].vec[3] = 1.0;	
+	nu2->bp[3].vec[3] = 1.0f;
 	
 	BLI_addtail(&(cu->nurb), nu2);	
 
@@ -574,7 +574,7 @@
 			memcpy(bezt2, bezt1, i * sizeof(struct BezTriple));
 			nu2->bezt = bezt2;
 			
-			if (shear != 0.0) {
+			if (shear != 0.0f) {
 				bezt2 = nu2->bezt;
 				
 				for (i= nu2->pntsu; i > 0; i--) {
@@ -584,7 +584,7 @@
 					bezt2++;
 				}
 			}
-			if(rot!=0.0) {
+			if(rot != 0.0f) {
 				bezt2= nu2->bezt;
 				for (i=nu2->pntsu; i > 0; i--) {
 					fp= bezt2->vec[0];
@@ -709,8 +709,8 @@
 	// Count the wchar_t string length
 	slen = wcslen(mem);
 
-	if (cu->ulheight == 0.0) 
-		cu->ulheight = 0.05;
+	if (cu->ulheight == 0.0f)
+		cu->ulheight = 0.05f;
 	
 	if (cu->strinfo==NULL)	/* old file */
 		cu->strinfo = MEM_callocN((slen+4) * sizeof(CharInfo), "strinfo compat");
@@ -815,7 +815,7 @@
 		twidth = char_width(cu, che, info);
 
 		// Calculate positions
-		if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w + cu->xof*cu->fsize) {
+		if((tb->w != 0.0f) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w + cu->xof*cu->fsize) {
 	//		fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]);
 			for (j=i; j && (mem[j] != '\n') && (mem[j] != '\r') && (chartransdata[j].dobreak==0); j--) {
 				if (mem[j]==' ' || mem[j]=='-') {
@@ -855,7 +855,7 @@
 			linedata3[lnr]= tb->w/cu->fsize;
 			linedata4[lnr]= wsnr;
 			
-			if ( (tb->h != 0.0) &&
+			if ( (tb->h != 0.0f) &&
 				 ((-(yof-(tb->y/cu->fsize))) > ((tb->h/cu->fsize)-(linedist*cu->fsize)) - cu->yof) &&
 				 (cu->totbox > (curbox+1)) ) {
 				maxlen= 0;
@@ -886,7 +886,7 @@
 			ct->charnr= cnr++;
 
 			tabfac= (xof-cu->xof+0.01f);
-			tabfac= (float)(2.0*ceil(tabfac/2.0));
+			tabfac= 2.0f*ceilf(tabfac/2.0f);
 			xof= cu->xof+tabfac;
 		}
 		else {
@@ -900,7 +900,7 @@
 
 			if (cu->selboxes && (i>=selstart) && (i<=selend)) {
 				sb = &(cu->selboxes[i-selstart]);
-				sb->y = yof*cu->fsize-linedist*cu->fsize*0.1;
+				sb->y = yof*cu->fsize-linedist*cu->fsize*0.1f;
 				sb->h = linedist*cu->fsize;
 				sb->w = xof*cu->fsize;
 			}
@@ -909,12 +909,12 @@
 				wsfac = cu->wordspace; 
 				wsnr++;
 			} 
-			else wsfac = 1.0;
+			else wsfac = 1.0f;
 			
 			// Set the width of the character
 			twidth = char_width(cu, che, info);
 
-			xof += (twidth*wsfac*(1.0+(info->kern/40.0)) ) + xtrax;
+			xof += (twidth*wsfac*(1.0f+(info->kern/40.0f)) ) + xtrax;
 			
 			if (sb) 
 				sb->w = (xof*cu->fsize) - sb->w;
@@ -951,7 +951,7 @@
 				ct++;
 			}
 		} else if((cu->spacemode==CU_FLUSH) &&
-				  (cu->tb[0].w != 0.0)) {
+				  (cu->tb[0].w != 0.0f)) {
 			for(i=0;i<lnr;i++)
 				if(linedata2[i]>1)
 					linedata[i]= (linedata3[i]-linedata[i])/(linedata2[i]-1);
@@ -964,7 +964,7 @@
 				ct++;
 			}
 		} 
-		else if((cu->spacemode==CU_JUSTIFY) && (cu->tb[0].w != 0.0)) {
+		else if((cu->spacemode==CU_JUSTIFY) && (cu->tb[0].w != 0.0f)) {
 			float curofs= 0.0f;
 			for (i=0; i<=slen; i++) {
 				for (j=i; (mem[j]) && (mem[j]!='\n') && 
@@ -1015,9 +1015,9 @@
 			
 			/* length correction */
 			distfac= sizefac*cucu->path->totdist/(maxx-minx);
-			timeofs= 0.0;
+			timeofs= 0.0f;
 			
-			if(distfac > 1.0) {
+			if(distfac > 1.0f) {
 				/* path longer than text: spacemode involves */
 				distfac= 1.0f/distfac;
 				
@@ -1051,7 +1051,7 @@
 				dtime= distfac*0.5f*twidth;
 
 				ctime= timeofs + distfac*( ct->xof - minx);
-				CLAMP(ctime, 0.0, 1.0);
+				CLAMP(ctime, 0.0f, 1.0f);
 
 				/* calc the right loc AND the right rot separately */
 				/* vec, tvec need 4 items */
@@ -1173,17 +1173,17 @@
 					if ( (i<(slen-1)) && (mem[i+1] != '\n') && (mem[i+1] != '\r') &&
 						 ((mem[i+1] != ' ') || (custrinfo[i+1].flag & CU_CHINFO_UNDERLINE)) && ((custrinfo[i+1].flag & CU_CHINFO_WRAP)==0)
 						 ) {
-						uloverlap = xtrax + 0.1;
+						uloverlap = xtrax + 0.1f;
 					}
 					// Find the character, the characters has to be in the memory already 
 					// since character checking has been done earlier already.
 					che= find_vfont_char(vfd, cha);
 
 					twidth = char_width(cu, che, info);
-					ulwidth = cu->fsize * ((twidth* (1.0+(info->kern/40.0)))+uloverlap);
-					build_underline(cu, ct->xof*cu->fsize, ct->yof*cu->fsize + (cu->ulpos-0.05)*cu->fsize, 
+					ulwidth = cu->fsize * ((twidth* (1.0f+(info->kern/40.0f)))+uloverlap);
+					build_underline(cu, ct->xof*cu->fsize, ct->yof*cu->fsize + (cu->ulpos-0.05f)*cu->fsize,
 									ct->xof*cu->fsize + ulwidth, 
-									ct->yof*cu->fsize + (cu->ulpos-0.05)*cu->fsize - cu->ulheight*cu->fsize, 
+									ct->yof*cu->fsize + (cu->ulpos-0.05f)*cu->fsize - cu->ulheight*cu->fsize,
 									i, info->mat_nr);
 				}
 				ct++;

Modified: trunk/blender/source/blender/blenkernel/intern/particle.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle.c	2011-03-28 11:04:38 UTC (rev 35843)
+++ trunk/blender/source/blender/blenkernel/intern/particle.c	2011-03-28 11:21:39 UTC (rev 35844)
@@ -660,7 +660,7 @@
 	}
 
 	/* screen space radius */
-	radius= sqrt(area/M_PI);
+	radius= sqrt(area/(float)M_PI);
 
 	/* make smaller using fallof once over screen edge */
 	*viewport= 1.0f;
@@ -869,7 +869,7 @@
 
 	powrate= log(0.5f)/log(part->simplify_rate*0.5f);
 	if(part->simplify_flag & PART_SIMPLIFY_VIEWPORT)
-		vprate= pow(1.0 - part->simplify_viewport, 5.0);
+		vprate= pow(1.0f - part->simplify_viewport, 5.0);
 	else
 		vprate= 1.0;
 
@@ -1990,25 +1990,25 @@
 		inp_y=dot_v3v3(y_vec, vec_one);
 		inp_z=dot_v3v3(z_vec, vec_one);
 
-		if(inp_y>0.5){
+		if(inp_y > 0.5f){
 			copy_v3_v3(state_co, y_vec);
 
 			mul_v3_fl(y_vec, amplitude*(float)cos(t));
 			mul_v3_fl(z_vec, amplitude/2.f*(float)sin(2.f*t));
 		}
-		else if(inp_z>0.0){
-			mul_v3_v3fl(state_co, z_vec, (float)sin(M_PI/3.f));
+		else if(inp_z > 0.0f){
+			mul_v3_v3fl(state_co, z_vec, (float)sin((float)M_PI/3.f));
 			VECADDFAC(state_co,state_co,y_vec,-0.5f);
 
-			mul_v3_fl(y_vec, -amplitude * (float)cos(t + M_PI/3.f));
-			mul_v3_fl(z_vec, amplitude/2.f * (float)cos(2.f*t + M_PI/6.f));
+			mul_v3_fl(y_vec, -amplitude * (float)cos(t + (float)M_PI/3.f));
+			mul_v3_fl(z_vec, amplitude/2.f * (float)cos(2.f*t + (float)M_PI/6.f));
 		}
 		else{
-			mul_v3_v3fl(state_co, z_vec, -(float)sin(M_PI/3.f));
+			mul_v3_v3fl(state_co, z_vec, -(float)sin((float)M_PI/3.f));
 			madd_v3_v3fl(state_co, y_vec, -0.5f);
 
-			mul_v3_fl(y_vec, amplitude * (float)-sin(t + M_PI/6.f));
-			mul_v3_fl(z_vec, amplitude/2.f * (float)-sin(2.f*t + M_PI/3.f));
+			mul_v3_fl(y_vec, amplitude * (float)-sin(t + (float)M_PI/6.f));
+			mul_v3_fl(z_vec, amplitude/2.f * (float)-sin(2.f*t + (float)M_PI/3.f));
 		}
 
 		mul_v3_fl(state_co, amplitude);
@@ -2047,15 +2047,15 @@
 {
 	float clump = 0.f;
 
-	if(par && clumpfac!=0.0){
+	if(par && clumpfac!=0.0f){
 		float cpow;
 
-		if(clumppow<0.0)
+		if(clumppow < 0.0f)
 			cpow=1.0f+clumppow;
 		else
 			cpow=1.0f+9.0f*clumppow;
 
-		if(clumpfac<0.0) /* clump roots instead of tips */
+		if(clumpfac < 0.0f) /* clump roots instead of tips */
 			clump = -clumpfac*pa_clump*(float)pow(1.0-(double)time,(double)cpow);
 		else
 			clump = clumpfac*pa_clump*(float)pow((double)time,(double)cpow);
@@ -2129,7 +2129,7 @@
 		if(data->strength <= 0.0f)
 			continue;
 
-		guidetime = time / (1.0 - pd->free_end);
+		guidetime = time / (1.0f - pd->free_end);
 
 		if(guidetime>1.0f)
 			continue;
@@ -2152,7 +2152,7 @@
 
 		VECCOPY(vec_to_point, data->vec_to_point);
 
-		if(guidetime != 0.0){
+		if(guidetime != 0.0f) {
 			/* curve direction */
 			cross_v3_v3v3(temp, eff->guide_dir, guidedir);
 			angle = dot_v3v3(eff->guide_dir, guidedir)/(len_v3(eff->guide_dir));
@@ -2167,7 +2167,7 @@
 
 		/* curve taper */
 		if(cu->taperobj)
-			mul_v3_fl(vec_to_point, calc_taper(eff->scene, cu->taperobj, (int)(data->strength*guidetime*100.0), 100));
+			mul_v3_fl(vec_to_point, calc_taper(eff->scene, cu->taperobj, (int)(data->strength*guidetime*100.0f), 100));
 
 		else{ /* curve size*/
 			if(cu->flag & CU_PATH_RADIUS) {
@@ -2191,10 +2191,10 @@
 			totstrength *= weight;
 	}
 
-	if(totstrength != 0.0){
-		if(totstrength > 1.0)
+	if(totstrength != 0.0f){
+		if(totstrength > 1.0f)
 			mul_v3_fl(effect, 1.0f / totstrength);
-		CLAMP(totstrength, 0.0, 1.0);
+		CLAMP(totstrength, 0.0f, 1.0f);
 		//VECADD(effect,effect,pa_zero);
 		interp_v3_v3v3(state->co, state->co, effect, totstrength);
 
@@ -2210,8 +2210,8 @@
 	float rough[3];
 	float rco[3];
 
-	if(thres!=0.0)
-		if((float)fabs((float)(-1.5+loc[0]+loc[1]+loc[2]))<1.5f*thres) return;
+	if(thres != 0.0f)
+		if((float)fabs((float)(-1.5f+loc[0]+loc[1]+loc[2]))<1.5f*thres) return;
 
 	VECCOPY(rco,loc);
 	mul_v3_fl(rco,t);
@@ -2333,7 +2333,7 @@
 	int p, totparent,totchild=sim->psys->totchild;
 	float co[3], orco[3];
 	int from=PART_FROM_FACE;
-	totparent=(int)(totchild*part->parents*0.3);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list