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-11-11 16:00:08 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-11 16:00:08 +0400
commit094c9799f9926ae37515a1fe0380403ce3298a77 (patch)
tree780f06d65010a80ae7d3c67000af00db89d11a32 /source/blender/blenkernel
parenteb7bccb39a639683275ed0b80b927cd5eb8264fa (diff)
quiet -Wdouble-promotion warnings
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/boids.c4
-rw-r--r--source/blender/blenkernel/intern/cloth.c10
-rw-r--r--source/blender/blenkernel/intern/collision.c22
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c16
-rw-r--r--source/blender/blenkernel/intern/nla.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c2
-rw-r--r--source/blender/blenkernel/intern/softbody.c10
-rw-r--r--source/blender/blenkernel/intern/tracking.c4
8 files changed, 35 insertions, 35 deletions
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index c9868bd900f..6656d06e72e 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -175,7 +175,7 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
if(len2 > 0.0f && efd.distance - surface < len2) {
len2 = (efd.distance - surface)/len2;
- bbd->wanted_speed *= pow(len2, boids->landing_smoothness);
+ bbd->wanted_speed *= powf(len2, boids->landing_smoothness);
}
}
@@ -242,7 +242,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
mul_v3_fl(bbd->wanted_co, (1.0f - t) * val->personal_space * pa->size);
- bbd->wanted_speed = sqrt(t) * len_v3(pa->prev_state.vel);
+ bbd->wanted_speed = sqrtf(t) * len_v3(pa->prev_state.vel);
bbd->wanted_speed = MAX2(bbd->wanted_speed, val->min_speed);
return 1;
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index ae6a6ec012a..57a9dbcbc0f 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -1093,7 +1093,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
cloth->verts[spring->kl].spring_count++;
spring->type = CLOTH_SPRING_TYPE_STRUCTURAL;
spring->flags = 0;
- spring->stiffness = (cloth->verts[spring->kl].struct_stiff + cloth->verts[spring->ij].struct_stiff) / 2.0;
+ spring->stiffness = (cloth->verts[spring->kl].struct_stiff + cloth->verts[spring->ij].struct_stiff) / 2.0f;
struct_springs++;
BLI_linklist_prepend ( &cloth->springs, spring );
@@ -1110,7 +1110,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
for(i = 0; i < numverts; i++)
{
- cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49 / ((float)cloth->verts[i].spring_count);
+ cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49f / ((float)cloth->verts[i].spring_count);
}
// shear springs
@@ -1132,7 +1132,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
spring->kl = MAX2(mface[i].v3, mface[i].v1);
spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
spring->type = CLOTH_SPRING_TYPE_SHEAR;
- spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0;
+ spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0f;
BLI_linklist_append ( &edgelist[spring->ij], spring );
BLI_linklist_append ( &edgelist[spring->kl], spring );
@@ -1195,7 +1195,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
spring->kl = MAX2(tspring2->ij, index2);
spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
spring->type = CLOTH_SPRING_TYPE_BENDING;
- spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0;
+ spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f;
BLI_edgehash_insert ( edgehash, spring->ij, spring->kl, NULL );
bend_springs++;
@@ -1234,7 +1234,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
spring->kl = tspring->kl;
spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
spring->type = CLOTH_SPRING_TYPE_BENDING;
- spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0;
+ spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f;
bend_springs++;
BLI_linklist_prepend ( &cloth->springs, spring );
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 09030575438..456c0c9fe3b 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -464,7 +464,7 @@ static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3
d = ( a * c - b * b );
- if ( ABS ( d ) < ALMOST_ZERO )
+ if ( ABS ( d ) < (double)ALMOST_ZERO )
{
*w1 = *w2 = *w3 = 1.0 / 3.0;
return;
@@ -554,14 +554,14 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
// Decrease in magnitude of relative tangential velocity due to coulomb friction
// in original formula "magrelVel" should be the "change of relative velocity in normal direction"
- magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( INPR ( vrel_t_pre,vrel_t_pre ) ) );
+ magtangent = MIN2 ( clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf( INPR ( vrel_t_pre,vrel_t_pre ) ) );
// Apply friction impulse.
if ( magtangent > ALMOST_ZERO )
{
normalize_v3( vrel_t_pre );
- impulse = magtangent / ( 1.0 + w1*w1 + w2*w2 + w3*w3 ); // 2.0 *
+ impulse = magtangent / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // 2.0 *
VECADDMUL ( cloth1->verts[collpair->ap1].impulse, vrel_t_pre, w1 * impulse );
VECADDMUL ( cloth1->verts[collpair->ap2].impulse, vrel_t_pre, w2 * impulse );
VECADDMUL ( cloth1->verts[collpair->ap3].impulse, vrel_t_pre, w3 * impulse );
@@ -585,17 +585,17 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
// I_r = -min(dt*kd, m(0,1d/dt - v_n))
spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
- d = clmd->coll_parms->epsilon*8.0/9.0 + epsilon2*8.0/9.0 - collpair->distance;
- if ( ( magrelVel < 0.1*d*spf ) && ( d > ALMOST_ZERO ) )
+ d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance;
+ if ( ( magrelVel < 0.1f*d*spf ) && ( d > ALMOST_ZERO ) )
{
- repulse = MIN2 ( d*1.0/spf, 0.1*d*spf - magrelVel );
+ repulse = MIN2 ( d*1.0f/spf, 0.1f*d*spf - magrelVel );
// stay on the safe side and clamp repulse
if ( impulse > ALMOST_ZERO )
repulse = MIN2 ( repulse, 5.0*impulse );
repulse = MAX2 ( impulse, repulse );
- impulse = repulse / ( 1.0 + w1*w1 + w2*w2 + w3*w3 ); // original 2.0 / 0.25
+ impulse = repulse / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // original 2.0 / 0.25
VECADDMUL ( cloth1->verts[collpair->ap1].impulse, collpair->normal, impulse );
VECADDMUL ( cloth1->verts[collpair->ap2].impulse, collpair->normal, impulse );
VECADDMUL ( cloth1->verts[collpair->ap3].impulse, collpair->normal, impulse );
@@ -1492,8 +1492,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
collmd->current_xnew[collpair->bp2].co,
collmd->current_xnew[collpair->bp3].co, &l, 0))
{
- if (l >= 0.0 && l < sdis) {
- mul_v3_fl(n2, (l-sdis)*cloth->verts[collpair->ap1].mass*dt*clmd->coll_parms->repel_force*0.1);
+ if (l >= 0.0f && l < sdis) {
+ mul_v3_fl(n2, (l-sdis)*cloth->verts[collpair->ap1].mass*dt*clmd->coll_parms->repel_force*0.1f);
add_v3_v3(cloth->verts[collpair->ap1].tv, n2);
add_v3_v3(cloth->verts[collpair->ap2].tv, n2);
@@ -1507,7 +1507,7 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
verts1[collpair->ap1].txold, verts1[collpair->ap2].txold, verts1[collpair->ap3].txold, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, collpair->pa,collpair->pb,collpair->vector );
#else
// just be sure that we don't add anything
- distance = 2.0 * ( epsilon1 + epsilon2 + ALMOST_ZERO );
+ distance = 2.0 * (double)( epsilon1 + epsilon2 + ALMOST_ZERO );
#endif
if ( distance <= ( epsilon1 + epsilon2 + ALMOST_ZERO ) )
@@ -2534,7 +2534,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
}
else
{
- mul_v3_fl( temp, -correction*0.5 );
+ mul_v3_fl( temp, correction * -0.5 );
VECADD ( verts[j].tx, verts[j].tx, temp );
VECSUB ( verts[i].tx, verts[i].tx, temp );
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index df7cd85e6a1..40421c25607 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -677,7 +677,7 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface)
volume = td[0]*td[1]*td[2];
/* determine final grid size by trying to fit average 10.000 points per grid cell */
- dim_factor = pow(volume / ((double)sData->total_points / 10000.f), 1.0f/axis);
+ dim_factor = (float)pow(volume / ((double)sData->total_points / 10000.0), 1.0/(double)axis);
/* define final grid size using dim_factor, use min 3 for active axises */
for (i=0; i<3; i++) {
@@ -3695,7 +3695,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
/* get displace depth */
- disp_intersect = (1.0f - sqrt(disp_intersect / radius)) * radius;
+ disp_intersect = (1.0f - sqrtf(disp_intersect / radius)) * radius;
depth = (radius - disp_intersect) / bData->bNormal[index].normal_scale;
if (depth<0.0f) depth = 0.0f;
}
@@ -3803,7 +3803,7 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po
else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
/* get displace depth */
- float disp_intersect = (1.0f - sqrt((brush->paint_distance-distance) / brush->paint_distance)) * brush->paint_distance;
+ float disp_intersect = (1.0f - sqrtf((brush->paint_distance-distance) / brush->paint_distance)) * brush->paint_distance;
depth = (brush->paint_distance - disp_intersect) / bData->bNormal[index].normal_scale;
if (depth<0.0f) depth = 0.0f;
}
@@ -3863,7 +3863,7 @@ static void dynamicPaint_prepareNeighbourData(DynamicPaintSurface *surface, int
int numOfNeighs = adj_data->n_num[index];
for (i=0; i<numOfNeighs; i++) {
- bData->average_dist += bNeighs[adj_data->n_index[index]+i].dist;
+ bData->average_dist += (double)bNeighs[adj_data->n_index[index]+i].dist;
}
}
bData->average_dist /= adj_data->total_targets;
@@ -3922,18 +3922,18 @@ void surface_determineForceTargetPoints(PaintSurfaceData *sData, int index, floa
/* get drip factor based on force dir in relation to angle between those neighbours */
temp = dot_v3v3(bNeighs[closest_id[0]].dir, force_proj);
CLAMP(temp, -1.0f, 1.0f); /* float precision might cause values > 1.0f that return infinite */
- closest_d[1] = acos(temp)/neigh_diff;
+ closest_d[1] = acosf(temp)/neigh_diff;
closest_d[0] = 1.0f - closest_d[1];
/* and multiply depending on how deeply force intersects surface */
temp = fabs(force_intersect);
CLAMP(temp, 0.0f, 1.0f);
- closest_d[0] *= acos(temp)/1.57079633f;
- closest_d[1] *= acos(temp)/1.57079633f;
+ closest_d[0] *= acosf(temp)/1.57079633f;
+ closest_d[1] *= acosf(temp)/1.57079633f;
}
else {
/* if only single neighbour, still linearize force intersection effect */
- closest_d[0] = 1.0f - acos(closest_d[0])/1.57079633f;
+ closest_d[0] = 1.0f - acosf(closest_d[0])/1.57079633f;
}
}
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index fd5c7912e1f..8a908097862 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -356,7 +356,7 @@ NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker)
{
AUD_SoundInfo info = AUD_getInfo(speaker->sound->playback_handle);
- strip->end = ceil(info.length * FPS);
+ strip->end = (float)ceil((double)info.length * FPS);
}
else
#endif
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index a86e819ae9f..d28fe8b8509 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -638,7 +638,7 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center
w= co[2]*data->winmat[2][3] + data->winmat[3][3];
dx= data->winx*ortho2[0]*data->winmat[0][0];
dy= data->winy*ortho2[1]*data->winmat[1][1];
- w= sqrt(dx*dx + dy*dy)/w;
+ w= sqrtf(dx*dx + dy*dy)/w;
/* w squared because we are working with area */
area= area*w*w;
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 5b02731050e..7f18db63c36 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -2270,7 +2270,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
kd = sb->goalfrict * sb_fric_force_scale(ob) ;
add_v3_v3v3(auxvect,velgoal,bp->vec);
- if (forcetime > 0.0 ) { /* make sure friction does not become rocket motor on time reversal */
+ if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */
bp->force[0]-= kd * (auxvect[0]);
bp->force[1]-= kd * (auxvect[1]);
bp->force[2]-= kd * (auxvect[2]);
@@ -2675,7 +2675,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
kd = sb->goalfrict * sb_fric_force_scale(ob) ;
add_v3_v3v3(auxvect,velgoal,bp->vec);
- if (forcetime > 0.0 ) { /* make sure friction does not become rocket motor on time reversal */
+ if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */
bp->force[0]-= kd * (auxvect[0]);
bp->force[1]-= kd * (auxvect[1]);
bp->force[2]-= kd * (auxvect[2]);
@@ -3149,7 +3149,7 @@ static void apply_spring_memory(Object *ob)
bp2 =&sb->bpoint[bs->v2];
l = len_v3v3(bp1->pos,bp2->pos);
r = bs->len/l;
- if (( r > 1.05f) || (r < 0.95)){
+ if (( r > 1.05f) || (r < 0.95f)){
bs->len = ((100.0f - b) * bs->len + b*l)/100.0f;
}
}
@@ -3952,7 +3952,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
while ( (ABS(timedone) < ABS(dtime)) && (loops < 2000) )
{
/* set goals in time */
- interpolate_exciter(ob,200,(int)(200.0*(timedone/dtime)));
+ interpolate_exciter(ob,200,(int)(200.0f*(timedone/dtime)));
sb->scratch->flag &= ~SBF_DOFUZZY;
/* do predictive euler step */
@@ -3993,7 +3993,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
timedone += forcetime;
newtime=MIN2(forcetimemax,MAX2(newtime,forcetimemin));
//if (newtime > forcetime) printf("up,");
- if (forcetime > 0.0)
+ if (forcetime > 0.0f)
forcetime = MIN2(dtime - timedone,newtime);
else
forcetime = MAX2(dtime - timedone,newtime);
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 38bb615896b..65b27f725bc 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1794,8 +1794,8 @@ static void calculate_stabdata(MovieTracking *tracking, int framenr, float width
*angle*= stab->rotinf;
/* convert to rotation around image center */
- loc[0]-= (x0 + (x-x0)*cos(*angle)-(y-y0)*sin(*angle) - x)*(*scale);
- loc[1]-= (y0 + (x-x0)*sin(*angle)+(y-y0)*cos(*angle) - y)*(*scale);
+ loc[0]-= (x0 + (x-x0)*cosf(*angle)-(y-y0)*sinf(*angle) - x)*(*scale);
+ loc[1]-= (y0 + (x-x0)*sinf(*angle)+(y-y0)*cosf(*angle) - y)*(*scale);
}
}