Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-27 17:49:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-03-27 17:49:53 +0400
commit9997c3c8951fb253fa5e37b624b81005202ceb6d (patch)
tree5eaa8171f5d0cca14126dfa1107abb2fa6ec36b1 /source/blender/modifiers
parent3cb6f52eec3beae54adcec64e1213995dfac0423 (diff)
modifiers: floats were being implicitly promoted to doubles, adjust to use floats.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_build.c2
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c16
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c4
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c4
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c2
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c2
-rw-r--r--source/blender/modifiers/intern/MOD_particlesystem.c2
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c2
-rw-r--r--source/blender/modifiers/intern/MOD_simpledeform.c10
-rw-r--r--source/blender/modifiers/intern/MOD_smooth.c4
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c2
-rw-r--r--source/blender/modifiers/intern/MOD_wave.c12
12 files changed, 30 insertions, 32 deletions
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index 0d04476c618..1cf67ac8cae 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -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;
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 91d89aaa5d1..5cb352ef482 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -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];
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index 1de95b67cad..09e29d9ed8e 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -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 */
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 4dbe781ca13..082c199b16f 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -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));
}
}
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index fa9976b1ad6..ba73f3fa0d1 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -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)
{
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index 4b6e4bd0241..46d53e0db15 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -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;
}
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index 7e94a76598b..533bfd203b5 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -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 */
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 076c09cc51a..17e350482f0 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -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;
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index fc13eafa866..2e6d9350148 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -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
diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c
index 8aca9ec82c3..5f76fad14b1 100644
--- a/source/blender/modifiers/intern/MOD_smooth.c
+++ b/source/blender/modifiers/intern/MOD_smooth.c
@@ -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];
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index abe87458038..b054a5b0a6e 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -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) {
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index b4e94157e9a..6d547867ed8 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -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)