[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35817] trunk/blender/source/blender/ modifiers/intern: modifiers: floats were being implicitly promoted to doubles, adjust to use floats.
Campbell Barton
ideasman42 at gmail.com
Sun Mar 27 15:49:53 CEST 2011
Revision: 35817
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35817
Author: campbellbarton
Date: 2011-03-27 13:49:53 +0000 (Sun, 27 Mar 2011)
Log Message:
-----------
modifiers: floats were being implicitly promoted to doubles, adjust to use floats.
Modified Paths:
--------------
trunk/blender/source/blender/modifiers/intern/MOD_build.c
trunk/blender/source/blender/modifiers/intern/MOD_cast.c
trunk/blender/source/blender/modifiers/intern/MOD_edgesplit.c
trunk/blender/source/blender/modifiers/intern/MOD_hook.c
trunk/blender/source/blender/modifiers/intern/MOD_meshdeform.c
trunk/blender/source/blender/modifiers/intern/MOD_particleinstance.c
trunk/blender/source/blender/modifiers/intern/MOD_particlesystem.c
trunk/blender/source/blender/modifiers/intern/MOD_screw.c
trunk/blender/source/blender/modifiers/intern/MOD_simpledeform.c
trunk/blender/source/blender/modifiers/intern/MOD_smooth.c
trunk/blender/source/blender/modifiers/intern/MOD_uvproject.c
trunk/blender/source/blender/modifiers/intern/MOD_wave.c
Modified: trunk/blender/source/blender/modifiers/intern/MOD_build.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_build.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_build.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -114,7 +114,7 @@
} else {
frac = BKE_curframe(md->scene) - bmd->start / bmd->length;
}
- CLAMP(frac, 0.0, 1.0);
+ CLAMP(frac, 0.0f, 1.0f);
numFaces = dm->getNumFaces(dm) * frac;
numEdges = dm->getNumEdges(dm) * frac;
Modified: trunk/blender/source/blender/modifiers/intern/MOD_cast.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_cast.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_cast.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -427,9 +427,9 @@
}
if (has_radius) {
- if (fabs(tmp_co[0]) > cmd->radius ||
- fabs(tmp_co[1]) > cmd->radius ||
- fabs(tmp_co[2]) > cmd->radius) continue;
+ if (fabsf(tmp_co[0]) > cmd->radius ||
+ fabsf(tmp_co[1]) > cmd->radius ||
+ fabsf(tmp_co[2]) > cmd->radius) continue;
}
for (j = 0; j < dvert[i].totweight; ++j) {
@@ -479,7 +479,7 @@
/* ok, now we know which coordinate of the vertex to use */
- if (fabs(tmp_co[coord]) < FLT_EPSILON) /* avoid division by zero */
+ if (fabsf(tmp_co[coord]) < FLT_EPSILON) /* avoid division by zero */
continue;
/* finally, this is the factor we wanted, to project the vertex
@@ -523,9 +523,9 @@
}
if (has_radius) {
- if (fabs(tmp_co[0]) > cmd->radius ||
- fabs(tmp_co[1]) > cmd->radius ||
- fabs(tmp_co[2]) > cmd->radius) continue;
+ if (fabsf(tmp_co[0]) > cmd->radius ||
+ fabsf(tmp_co[1]) > cmd->radius ||
+ fabsf(tmp_co[2]) > cmd->radius) continue;
}
octant = 0;
@@ -550,7 +550,7 @@
coord = 2;
}
- if (fabs(tmp_co[coord]) < FLT_EPSILON)
+ if (fabsf(tmp_co[coord]) < FLT_EPSILON)
continue;
fbb = apex[coord] / tmp_co[coord];
Modified: trunk/blender/source/blender/modifiers/intern/MOD_edgesplit.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_edgesplit.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_edgesplit.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -1052,7 +1052,7 @@
/* if normal1 dot normal2 < threshold, angle is greater, so split */
/* FIXME not sure if this always works */
/* 0.00001 added for floating-point rounding */
- float threshold = cos((split_angle + 0.00001) * M_PI / 180.0);
+ float threshold = cos((split_angle + 0.00001f) * (float)M_PI / 180.0f);
int i;
*extra_edges = 0;
@@ -1113,7 +1113,7 @@
/* if normal1 dot normal2 < threshold, angle is greater, so split */
/* FIXME not sure if this always works */
/* 0.00001 added for floating-point rounding */
- mesh->threshold = cos((split_angle + 0.00001) * M_PI / 180.0);
+ mesh->threshold = cosf((split_angle + 0.00001f) * (float)M_PI / 180.0f);
mesh->flags = flags;
/* loop through edges, splitting sharp ones */
Modified: trunk/blender/source/blender/modifiers/intern/MOD_hook.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_hook.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_hook.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -136,8 +136,8 @@
if(len_squared > falloff_squared) {
return 0.0f;
}
- else if(len_squared > 0.0) {
- return fac * (1.0 - (len_squared / falloff_squared));
+ else if(len_squared > 0.0f) {
+ return fac * (1.0f - (len_squared / falloff_squared));
}
}
Modified: trunk/blender/source/blender/modifiers/intern/MOD_meshdeform.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_meshdeform.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_meshdeform.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -377,7 +377,7 @@
dm->release(dm);
}
-#define MESHDEFORM_MIN_INFLUENCE 0.00001
+#define MESHDEFORM_MIN_INFLUENCE 0.00001f
void modifier_mdef_compact_influences(ModifierData *md)
{
Modified: trunk/blender/source/blender/modifiers/intern/MOD_particleinstance.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_particleinstance.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_particleinstance.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -236,7 +236,7 @@
normalize_v3(state.vel);
/* TODO: incremental rotations somehow */
- if(state.vel[axis] < -0.9999 || state.vel[axis] > 0.9999) {
+ if(state.vel[axis] < -0.9999f || state.vel[axis] > 0.9999f) {
state.rot[0] = 1;
state.rot[1] = state.rot[2] = state.rot[3] = 0.0f;
}
Modified: trunk/blender/source/blender/modifiers/intern/MOD_particlesystem.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_particlesystem.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_particlesystem.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -101,7 +101,7 @@
dataMask |= CD_MASK_MTFACE;
}
- if(psmd->psys->part->tanfac!=0.0)
+ if(psmd->psys->part->tanfac != 0.0f)
dataMask |= CD_MASK_MTFACE;
/* ask for vertexgroups if we need them */
Modified: trunk/blender/source/blender/modifiers/intern/MOD_screw.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_screw.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_screw.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -272,7 +272,7 @@
/* will the screw be closed?
* Note! smaller then FLT_EPSILON*100 gives problems with float precision so its never closed. */
- if (fabs(screw_ofs) <= (FLT_EPSILON*100) && fabs(fabs(angle) - (M_PI * 2)) <= (FLT_EPSILON*100)) {
+ if (fabsf(screw_ofs) <= (FLT_EPSILON*100.0f) && fabsf(fabsf(angle) - ((float)M_PI * 2.0f)) <= (FLT_EPSILON*100.0f)) {
close= 1;
step_tot--;
if(step_tot < 2) step_tot= 2;
Modified: trunk/blender/source/blender/modifiers/intern/MOD_simpledeform.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_simpledeform.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_simpledeform.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -89,11 +89,11 @@
float x = co[0], y = co[1], z = co[2];
float scale;
- scale = (z*z*factor-factor + 1.0);
+ scale = (z*z*factor-factor + 1.0f);
co[0] = x*scale;
co[1] = y*scale;
- co[2] = z*(1.0+factor);
+ co[2] = z*(1.0f+factor);
if(dcut)
@@ -134,7 +134,7 @@
sint = sin(theta);
cost = cos(theta);
- if(fabs(factor) > 1e-7f)
+ if(fabsf(factor) > 1e-7f)
{
co[0] = -(y-1.0f/factor)*sint;
co[1] = (y-1.0f/factor)*cost + 1.0f/factor;
@@ -168,8 +168,8 @@
//Safe-check
if(smd->origin == ob) smd->origin = NULL; //No self references
- if(smd->limit[0] < 0.0) smd->limit[0] = 0.0f;
- if(smd->limit[0] > 1.0) smd->limit[0] = 1.0f;
+ if(smd->limit[0] < 0.0f) smd->limit[0] = 0.0f;
+ if(smd->limit[0] > 1.0f) smd->limit[0] = 1.0f;
smd->limit[0] = MIN2(smd->limit[0], smd->limit[1]); //Upper limit >= than lower limit
Modified: trunk/blender/source/blender/modifiers/intern/MOD_smooth.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_smooth.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_smooth.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -142,9 +142,7 @@
v1 = vertexCos[idx1];
v2 = vertexCos[idx2];
- fvec[0] = (v1[0] + v2[0]) / 2.0;
- fvec[1] = (v1[1] + v2[1]) / 2.0;
- fvec[2] = (v1[2] + v2[2]) / 2.0;
+ mid_v3_v3v3(fvec, v1, v2);
v1 = &ftmp[idx1*3];
v2 = &ftmp[idx2*3];
Modified: trunk/blender/source/blender/modifiers/intern/MOD_uvproject.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_uvproject.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_uvproject.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -194,7 +194,7 @@
free_uci= 1;
}
else {
- float scale= (cam->type == CAM_PERSP) ? cam->clipsta * 32.0 / cam->lens : cam->ortho_scale;
+ float scale= (cam->type == CAM_PERSP) ? cam->clipsta * 32.0f / cam->lens : cam->ortho_scale;
float xmax, xmin, ymax, ymin;
if(aspect > 1.0f) {
Modified: trunk/blender/source/blender/modifiers/intern/MOD_wave.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_wave.c 2011-03-27 09:46:20 UTC (rev 35816)
+++ trunk/blender/source/blender/modifiers/intern/MOD_wave.c 2011-03-27 13:49:53 UTC (rev 35817)
@@ -286,7 +286,7 @@
if(wmd->damp == 0) wmd->damp = 10.0f;
- if(wmd->lifetime != 0.0) {
+ if(wmd->lifetime != 0.0f) {
float x = ctime - wmd->timeoffs;
if(x > wmd->lifetime) {
@@ -294,7 +294,7 @@
if(lifefac > wmd->damp) lifefac = 0.0;
else lifefac =
- (float)(wmd->height * (1.0 - sqrt(lifefac / wmd->damp)));
+ (float)(wmd->height * (1.0f - sqrtf(lifefac / wmd->damp)));
}
}
@@ -304,9 +304,9 @@
wavemod_get_texture_coords(wmd, ob, dm, vertexCos, tex_co, numVerts);
}
- if(lifefac != 0.0) {
+ if(lifefac != 0.0f) {
/* avoid divide by zero checks within the loop */
- float falloff_inv= wmd->falloff ? 1.0f / wmd->falloff : 1.0;
+ float falloff_inv= wmd->falloff ? 1.0f / wmd->falloff : 1.0f;
int i;
for(i = 0; i < numVerts; i++) {
@@ -364,14 +364,14 @@
amplit -= (ctime - wmd->timeoffs) * wmd->speed;
if(wmd->flag & MOD_WAVE_CYCL) {
- amplit = (float)fmod(amplit - wmd->width, 2.0 * wmd->width)
+ amplit = (float)fmodf(amplit - wmd->width, 2.0f * wmd->width)
+ wmd->width;
}
/* GAUSSIAN */
if(amplit > -wmd->width && amplit < wmd->width) {
amplit = amplit * wmd->narrow;
- amplit = (float)(1.0 / exp(amplit * amplit) - minfac);
+ amplit = (float)(1.0f / expf(amplit * amplit) - minfac);
/*apply texture*/
if(wmd->texture)
More information about the Bf-blender-cvs
mailing list