modifiers: floats were being implicitly promoted to doubles, adjust to use floats.
This commit is contained in:
@@ -114,7 +114,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
} 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;
|
||||
|
||||
@@ -427,9 +427,9 @@ static void cuboid_do(
|
||||
}
|
||||
|
||||
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 @@ static void cuboid_do(
|
||||
|
||||
/* 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 @@ static void cuboid_do(
|
||||
}
|
||||
|
||||
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 @@ static void cuboid_do(
|
||||
coord = 2;
|
||||
}
|
||||
|
||||
if (fabs(tmp_co[coord]) < FLT_EPSILON)
|
||||
if (fabsf(tmp_co[coord]) < FLT_EPSILON)
|
||||
continue;
|
||||
|
||||
fbb = apex[coord] / tmp_co[coord];
|
||||
|
||||
@@ -1052,7 +1052,7 @@ static void tag_and_count_extra_edges(SmoothMesh *mesh, float split_angle,
|
||||
/* 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 @@ static void split_sharp_edges(SmoothMesh *mesh, float split_angle, int flags)
|
||||
/* 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 */
|
||||
|
||||
@@ -136,8 +136,8 @@ static float hook_falloff(float *co_1, float *co_2, const float falloff_squared,
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@ static void deformVertsEM(ModifierData *md, Object *ob,
|
||||
dm->release(dm);
|
||||
}
|
||||
|
||||
#define MESHDEFORM_MIN_INFLUENCE 0.00001
|
||||
#define MESHDEFORM_MIN_INFLUENCE 0.00001f
|
||||
|
||||
void modifier_mdef_compact_influences(ModifierData *md)
|
||||
{
|
||||
|
||||
@@ -236,7 +236,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
||||
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 */
|
||||
|
||||
@@ -272,7 +272,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
|
||||
/* 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;
|
||||
|
||||
@@ -89,11 +89,11 @@ static void simpleDeform_stretch(const float factor, const float dcut[3], float
|
||||
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 @@ static void simpleDeform_bend(const float factor, const float dcut[3], float *co
|
||||
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 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
|
||||
//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
|
||||
|
||||
|
||||
@@ -142,9 +142,7 @@ static void smoothModifier_do(
|
||||
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];
|
||||
|
||||
@@ -194,7 +194,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
|
||||
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) {
|
||||
|
||||
@@ -286,7 +286,7 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
|
||||
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 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
|
||||
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 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
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 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user