[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35822] trunk/blender/source/blender/ editors/space_view3d: view3d / object drawing: floats were being implicitly promoted to doubles, adjust to use floats.

Campbell Barton ideasman42 at gmail.com
Sun Mar 27 17:57:27 CEST 2011


Revision: 35822
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35822
Author:   campbellbarton
Date:     2011-03-27 15:57:27 +0000 (Sun, 27 Mar 2011)
Log Message:
-----------
view3d / object drawing: floats were being implicitly promoted to doubles, adjust to use floats.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/drawobject.c
    trunk/blender/source/blender/editors/space_view3d/view3d_buttons.c
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
    trunk/blender/source/blender/editors/space_view3d/view3d_fly.c
    trunk/blender/source/blender/editors/space_view3d/view3d_select.c
    trunk/blender/source/blender/editors/space_view3d/view3d_snap.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c

Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c	2011-03-27 15:54:20 UTC (rev 35821)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c	2011-03-27 15:57:27 UTC (rev 35822)
@@ -153,16 +153,16 @@
 	mul_m4_v4(rv3d->persmatob, vec4);
 	
 	/* clipplanes in window space */
-	if( vec4[3]>BL_NEAR_CLIP ) {	/* is the NEAR clipping cutoff for picking */
+	if( vec4[3] > (float)BL_NEAR_CLIP ) {	/* is the NEAR clipping cutoff for picking */
 		fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
 		
 		if( fx>0 && fx<ar->winx) {
 			
 			fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
 			
-			if(fy>0.0 && fy< (float)ar->winy) {
-				adr[0]= (short)floor(fx); 
-				adr[1]= (short)floor(fy);
+			if(fy > 0.0f && fy < (float)ar->winy) {
+				adr[0]= (short)floorf(fx);
+				adr[1]= (short)floorf(fy);
 			}
 		}
 	}
@@ -181,16 +181,16 @@
 	
 	mul_m4_v4(rv3d->persmatob, vec4);
 	
-	if( vec4[3]>BL_NEAR_CLIP ) {	/* is the NEAR clipping cutoff for picking */
+	if( vec4[3] > (float)BL_NEAR_CLIP ) {	/* is the NEAR clipping cutoff for picking */
 		fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
 		
 		if( fx>-32700 && fx<32700) {
 			
 			fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
 			
-			if(fy>-32700.0 && fy<32700.0) {
-				adr[0]= (short)floor(fx); 
-				adr[1]= (short)floor(fy);
+			if(fy > -32700.0f && fy < 32700.0f) {
+				adr[0]= (short)floorf(fx);
+				adr[1]= (short)floorf(fy);
 			}
 		}
 	}
@@ -325,7 +325,7 @@
 static void draw_xyz_wire(const float c[3], float size, int axis)
 {
 	float v1[3]= {0.f, 0.f, 0.f}, v2[3] = {0.f, 0.f, 0.f};
-	float dim = size * 0.1;
+	float dim = size * 0.1f;
 	float dx[3], dy[3], dz[3];
 
 	dx[0]=dim; dx[1]=0.f; dx[2]=0.f;
@@ -444,9 +444,9 @@
 		/* square pyramid */
 		glBegin(GL_TRIANGLES);
 		
-		v2[0]= size*0.035; v2[1] = size*0.035;
-		v3[0]= size*-0.035; v3[1] = size*0.035;
-		v2[2]= v3[2]= size*0.75;
+		v2[0]= size * 0.035f; v2[1] = size * 0.035f;
+		v3[0]= size * -0.035f; v3[1] = size * 0.035f;
+		v2[2]= v3[2]= size * 0.75f;
 		
 		for (axis=0; axis<4; axis++) {
 			if (axis % 2 == 1) {
@@ -492,18 +492,18 @@
 			glVertex3fv(v1);
 			glVertex3fv(v2);
 				
-			v1[axis]= size*0.85;
-			v1[arrow_axis]= -size*0.08;
+			v1[axis]= size*0.85f;
+			v1[arrow_axis]= -size*0.08f;
 			glVertex3fv(v1);
 			glVertex3fv(v2);
 				
-			v1[arrow_axis]= size*0.08;
+			v1[arrow_axis]= size*0.08f;
 			glVertex3fv(v1);
 			glVertex3fv(v2);
 			
 			glEnd();
 				
-			v2[axis]+= size*0.125;
+			v2[axis]+= size*0.125f;
 			
 			draw_xyz_wire(v2, size, axis);
 			
@@ -824,7 +824,7 @@
 	q[3] = 0 ;
 	normalize_v3(&q[1]);
 
-	angle = saacos(plane[2])/2.0;
+	angle = saacos(plane[2])/2.0f;
 	co = cos(angle);
 	si = sqrt(1-co*co);
 
@@ -881,7 +881,7 @@
 
 		for(a=0; a<33; a++) {
 			angle= a*M_PI*2/(33-1);
-			glVertex3f(z*cos(angle), z*sin(angle), 0);
+			glVertex3f(z*cosf(angle), z*sinf(angle), 0);
 		}
 	}
 
@@ -1001,7 +1001,7 @@
 		short axis;
 		
 		/* setup a 45 degree rotation matrix */
-		vec_rot_to_mat3( mat,imat[2], M_PI/4.0f);
+		vec_rot_to_mat3(mat, imat[2], (float)M_PI/4.0f);
 		
 		/* vectors */
 		mul_v3_v3fl(v1, imat[0], circrad * 1.2f);
@@ -1048,7 +1048,7 @@
 		vvec[1]= x*ob->obmat[1][0] + y*ob->obmat[1][1] + z*ob->obmat[1][2];
 		vvec[2]= x*ob->obmat[2][0] + y*ob->obmat[2][1] + z*ob->obmat[2][2];
 
-		y = cos( M_PI*la->spotsize/360.0 );
+		y = cosf(la->spotsize*(float)(M_PI/360.0));
 		spotvolume(lvec, vvec, y);
 		x = -la->dist;
 		mul_v3_fl(lvec, x);
@@ -1061,7 +1061,7 @@
 			glVertex3fv(lvec);
 		glEnd();
 		
-		z = x*sqrt(1.0 - y*y);
+		z = x*sqrtf(1.0f - y*y);
 		x *= y;
 
 		/* draw the circle/square at the end of the cone */
@@ -1083,7 +1083,7 @@
 				glVertex3fv(tvec);
 			glEnd();
 		}
-		else circ(0.0, 0.0, fabs(z));
+		else circ(0.0, 0.0, fabsf(z));
 		
 		/* draw the circle/square representing spotbl */
 		if(la->type==LA_SPOT) {
@@ -1091,7 +1091,7 @@
 			/* hide line if it is zero size or overlaps with outer border,
 			   previously it adjusted to always to show it but that seems
 			   confusing because it doesn't show the actual blend size */
-			if (spotblcirc != 0 && spotblcirc != fabs(z))
+			if (spotblcirc != 0 && spotblcirc != fabsf(z))
 				circ(0.0, 0.0, spotblcirc);
 		}
 
@@ -1165,9 +1165,9 @@
 	} else if(la->type==LA_AREA) {
 		setlinestyle(3);
 		if(la->area_shape==LA_AREA_SQUARE) 
-			fdrawbox(-la->area_size*0.5, -la->area_size*0.5, la->area_size*0.5, la->area_size*0.5);
+			fdrawbox(-la->area_size*0.5f, -la->area_size*0.5f, la->area_size*0.5f, la->area_size*0.5f);
 		else if(la->area_shape==LA_AREA_RECT) 
-			fdrawbox(-la->area_size*0.5, -la->area_sizey*0.5, la->area_size*0.5, la->area_sizey*0.5);
+			fdrawbox(-la->area_size*0.5f, -la->area_sizey*0.5f, la->area_size*0.5f, la->area_sizey*0.5f);
 
 		glBegin(GL_LINE_STRIP); 
 		glVertex3f(0.0,0.0,-circrad);
@@ -1287,7 +1287,7 @@
 
 		if(is_view) {
 			/* fixed depth, variable size (avoids exceeding clipping range) */
-			depth = -(cam->clipsta + 0.1);
+			depth = -(cam->clipsta + 0.1f);
 			fac = depth / (cam->lens/-16.0f * scaz);
 		}
 		else {
@@ -1342,15 +1342,15 @@
 		else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES);
 		else break;
 
-		vec[0][0]= shx + ((-0.7 * drawsize) * scax);
-		vec[0][1]= shy + ((drawsize * (caspy + 0.1)) * scay);
+		vec[0][0]= shx + ((-0.7f * drawsize) * scax);
+		vec[0][1]= shy + ((drawsize * (caspy + 0.1f)) * scay);
 		glVertex3fv(vec[0]); /* left */
 		
-		vec[0][0]= shx + ((0.7 * drawsize) * scax);
+		vec[0][0]= shx + ((0.7f * drawsize) * scax);
 		glVertex3fv(vec[0]); /* right */
 		
 		vec[0][0]= shx;
-		vec[0][1]= shy + ((1.1 * drawsize * (caspy + 0.7)) * scay);
+		vec[0][1]= shy + ((1.1f * drawsize * (caspy + 0.7f)) * scay);
 		glVertex3fv(vec[0]); /* top */
 	
 		glEnd();
@@ -1939,7 +1939,7 @@
 {
 	EditEdge *eed = EM_get_edge_for_index(index);
 
-	if (eed->h==0 && eed->crease!=0.0) {
+	if (eed->h==0 && eed->crease != 0.0f) {
 		UI_ThemeColorBlend(TH_WIRE, TH_EDGE_CREASE, eed->crease);
 		return 1;
 	} else {
@@ -1957,7 +1957,7 @@
 {
 	EditEdge *eed = EM_get_edge_for_index(index);
 
-	if (eed->h==0 && eed->bweight!=0.0) {
+	if (eed->h==0 && eed->bweight != 0.0f) {
 		UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, eed->bweight);
 		return 1;
 	} else {
@@ -1968,7 +1968,7 @@
 {
 	EditVert *eve = EM_get_vert_for_index(index);
 
-	if (eve->h==0 && eve->bweight!=0.0) {
+	if (eve->h==0 && eve->bweight != 0.0f) {
 		UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_SELECT, eve->bweight);
 		bglVertex3fv(co);
 	}
@@ -2026,8 +2026,8 @@
 					continue;
 				}
 
-				size = (size>2.1?size/2.0:size);
-				fsize = (fsize>2.1?fsize/2.0:fsize);
+				size = (size > 2.1f ? size/2.0f:size);
+				fsize = (fsize > 2.1f ? fsize/2.0f:fsize);
 				col[3] = fcol[3] = 100;
 			} else {
 				col[3] = fcol[3] = 255;
@@ -2162,7 +2162,7 @@
 					bUnit_AsString(val, sizeof(val), len_v3v3(v1, v2)*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE);
 				else
 					sprintf(val, conv_float, len_v3v3(v1, v2));
-				
+
 				view3d_cached_text_draw_add(vmid, val, 0, V3D_CACHE_TEXT_ASCII, col);
 			}
 		}
@@ -2231,29 +2231,29 @@
 				
 			if( (e4->f & e1->f & SELECT) || (do_moving && (efa->v1->f & SELECT)) ) {
 				/* Vec 1 */
-				sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v4, v1, v2)));
+				sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v4, v1, v2)));
 				interp_v3_v3v3(fvec, efa->cent, efa->v1->co, 0.8f);
 				view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
 			}
 			if( (e1->f & e2->f & SELECT) || (do_moving && (efa->v2->f & SELECT)) ) {
 				/* Vec 2 */
-				sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v1, v2, v3)));
+				sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v1, v2, v3)));
 				interp_v3_v3v3(fvec, efa->cent, efa->v2->co, 0.8f);
 				view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
 			}
 			if( (e2->f & e3->f & SELECT) || (do_moving && (efa->v3->f & SELECT)) ) {
 				/* Vec 3 */
 				if(efa->v4) 
-					sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v2, v3, v4)));
+					sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v2, v3, v4)));
 				else
-					sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v2, v3, v1)));
+					sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v2, v3, v1)));
 				interp_v3_v3v3(fvec, efa->cent, efa->v3->co, 0.8f);
 				view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
 			}
 				/* Vec 4 */
 			if(efa->v4) {
 				if( (e3->f & e4->f & SELECT) || (do_moving && (efa->v4->f & SELECT)) ) {
-					sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v3, v4, v1)));
+					sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v3, v4, v1)));
 					interp_v3_v3v3(fvec, efa->cent, efa->v4->co, 0.8f);
 					view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
 				}
@@ -2455,7 +2455,7 @@
 {
 	
 	if(v3d->transp==0) {	// not when we draw the transparent pass
-		glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0);
+		glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f);
 		glDepthMask(0);
 		
 		/* if transparent, we cannot draw the edges for solid select... edges have no material info.
@@ -3184,7 +3184,7 @@
 					drawDispListsolid(lb, ob, 0);
 					GPU_end_object_materials();
 				}
-				if(cu->editnurb && cu->bevobj==NULL && cu->taperobj==NULL && cu->ext1 == 0.0 && cu->ext2 == 0.0) {
+				if(cu->editnurb && cu->bevobj==NULL && cu->taperobj==NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) {
 					cpack(0);
 					draw_index_wire= 0;
 					drawDispListwire(lb);
@@ -3577,7 +3577,7 @@
 			pixsize= view3d_pixel_size(rv3d, ob->obmat[3]);
 			
 			if(part->draw_size==0.0)
-				pixsize*=2.0;
+				pixsize *= 2.0f;
 			else
 				pixsize*=part->draw_size;
 
@@ -3761,8 +3761,8 @@
 
 			drawn = 0;
 			if(part->draw_as == PART_DRAW_REND && part->trail_count > 1) {
-				float length = part->path_end * (1.0 - part->randlength * r_length);
-				int trail_count = part->trail_count * (1.0 - part->randlength * r_length);
+				float length = part->path_end * (1.0f - part->randlength * r_length);
+				int trail_count = part->trail_count * (1.0f - part->randlength * r_length);
 				float ct = ((part->draw & PART_ABS_PATH_TIME) ? cfra : pa_time) - length;
 				float dt = length / (trail_count ? (float)trail_count : 1.0f);
 				int i=0;
@@ -4114,7 +4114,7 @@
 		if(timed) {
 			for(k=0, pcol=pathcol, pkey=path; k<steps; k++, pkey++, pcol+=4){
 				copy_v3_v3(pcol, pkey->col);
-				pcol[3] = 1.0f - fabs((float)CFRA - pkey->time)/(float)pset->fade_frames;

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list