diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-02 06:08:33 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-02 06:08:33 +0400 |
commit | 69bd72c3b6aa1fdaab0c1232a6ba1e3e4c9029fa (patch) | |
tree | bba65f8473ee4c3c2b6650f567964955b8611940 /source/blender/blenkernel/intern | |
parent | fb994b3c857bdf3a7313da046580c0fb76e8b620 (diff) |
quiet gcc float -> double promotion warnings.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/boids.c | 26 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fmodifier.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/seqeffects.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 2 |
10 files changed, 34 insertions, 34 deletions
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 286cd3b2499..11ea3384c96 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -233,7 +233,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * t = hit.dist/col.original_ray_length; /* avoid head-on collision */ - if(dot_v3v3(col.pce.nor, pa->prev_state.ave) < -0.99) { + if(dot_v3v3(col.pce.nor, pa->prev_state.ave) < -0.99f) { /* don't know why, but uneven range [0.0,1.0] */ /* works much better than even [-1.0,1.0] */ bbd->wanted_co[0] = BLI_frand(); @@ -439,7 +439,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va mul = dot_v3v3(vec, vec); /* leader is not moving */ - if(mul < 0.01) { + if(mul < 0.01f) { len = len_v3(loc); /* too close to leader */ if(len < 2.0f * val->personal_space * pa->size) { @@ -476,7 +476,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va else { VECCOPY(loc, flbr->oloc); sub_v3_v3v3(vec, flbr->loc, flbr->oloc); - mul_v3_fl(vec, 1.0/bbd->timestep); + mul_v3_fl(vec, 1.0f/bbd->timestep); } /* fac is seconds behind leader */ @@ -499,7 +499,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va mul = dot_v3v3(vec, vec); /* leader is not moving */ - if(mul < 0.01) { + if(mul < 0.01f) { len = len_v3(loc); /* too close to leader */ if(len < 2.0f * val->personal_space * pa->size) { @@ -730,7 +730,7 @@ static void set_boid_values(BoidValues *val, BoidSettings *boids, ParticleData * if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) { val->max_speed = boids->land_max_speed * bpa->data.health/boids->health; val->max_acc = boids->land_max_acc * val->max_speed; - val->max_ave = boids->land_max_ave * M_PI * bpa->data.health/boids->health; + val->max_ave = boids->land_max_ave * (float)M_PI * bpa->data.health/boids->health; val->min_speed = 0.0f; /* no minimum speed on land */ val->personal_space = boids->land_personal_space; val->jump_speed = boids->land_jump_speed * bpa->data.health/boids->health; @@ -738,7 +738,7 @@ static void set_boid_values(BoidValues *val, BoidSettings *boids, ParticleData * else { val->max_speed = boids->air_max_speed * bpa->data.health/boids->health; val->max_acc = boids->air_max_acc * val->max_speed; - val->max_ave = boids->air_max_ave * M_PI * bpa->data.health/boids->health; + val->max_ave = boids->air_max_ave * (float)M_PI * bpa->data.health/boids->health; val->min_speed = boids->air_min_speed * boids->air_max_speed; val->personal_space = boids->air_personal_space; val->jump_speed = 0.0f; /* no jumping in air */ @@ -872,7 +872,7 @@ static void boid_climb(BoidSettings *boids, ParticleData *pa, float *surface_co, VECCOPY(nor, surface_nor); /* gather apparent gravity */ - VECADDFAC(bpa->gravity, bpa->gravity, surface_nor, -1.0); + VECADDFAC(bpa->gravity, bpa->gravity, surface_nor, -1.0f); normalize_v3(bpa->gravity); /* raise boid it's size from surface */ @@ -1010,7 +1010,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) /* decide on jumping & liftoff */ if(bpa->data.mode == eBoidMode_OnLand) { /* fuzziness makes boids capable of misjudgement */ - float mul = 1.0 + state->rule_fuzziness; + float mul = 1.0f + state->rule_fuzziness; if(boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f) { float cvel[3], dir[3]; @@ -1021,7 +1021,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) VECCOPY(cvel, bbd->wanted_co); normalize_v2(cvel); - if(dot_v2v2(cvel, dir) > 0.95 / mul) + if(dot_v2v2(cvel, dir) > 0.95f / mul) bpa->data.mode = eBoidMode_Liftoff; } else if(val.jump_speed > 0.0f) { @@ -1129,7 +1129,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor); /* level = how many particle sizes above ground */ - level = (pa->prev_state.co[2] - ground_co[2])/(2.0f * pa->size) - 0.5; + level = (pa->prev_state.co[2] - ground_co[2])/(2.0f * pa->size) - 0.5f; landing_level = - boids->landing_smoothness * pa->prev_state.vel[2] * pa_mass; @@ -1328,7 +1328,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) boid_climb(boids, pa, ground_co, ground_nor); } /* land boid when really near ground */ - else if(pa->state.co[2] <= ground_co[2] + 1.01 * pa->size * boids->height){ + else if(pa->state.co[2] <= ground_co[2] + 1.01f * pa->size * boids->height){ pa->state.co[2] = ground_co[2] + pa->size * boids->height; pa->state.vel[2] = 0.0f; bpa->data.mode = eBoidMode_OnLand; @@ -1370,7 +1370,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) boid_climb(boids, pa, ground_co, ground_nor); } /* ground is too far away so boid falls */ - else if(pa->state.co[2]-ground_co[2] > 1.1 * pa->size * boids->height) + else if(pa->state.co[2]-ground_co[2] > 1.1f * pa->size * boids->height) bpa->data.mode = eBoidMode_Falling; else { /* constrain to surface */ @@ -1402,7 +1402,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) /* save direction to state.ave unless the boid is falling */ /* (boids can't effect their direction when falling) */ - if(bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1*pa->size) { + if(bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1f*pa->size) { copy_v3_v3(pa->state.ave, pa->state.vel); pa->state.ave[2] *= bbd->part->boids->pitch; normalize_v3(pa->state.ave); diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 9cca5ae4982..ee46bef6038 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -495,7 +495,7 @@ static float wind_func(struct RNG *rng, float strength) float ret; float sign = 0; - sign = ((float)random > 64.0) ? 1.0: -1.0; // dividing by 2 is not giving equal sign distribution + sign = ((float)random > 64.0f) ? 1.0f: -1.0f; // dividing by 2 is not giving equal sign distribution ret = sign*((float)random / force)*strength/128.0f; @@ -517,7 +517,7 @@ static float falloff_func(float fac, int usemin, float mindist, int usemax, floa if(!usemin) mindist = 0.0; - return pow((double)1.0+fac-mindist, (double)-power); + return pow((double)(1.0f+fac-mindist), (double)(-power)); } static float falloff_func_dist(PartDeflect *pd, float fac) @@ -653,7 +653,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin sim.psys= eff->psys; /* TODO: time from actual previous calculated frame (step might not be 1) */ - state.time = cfra - 1.0; + state.time = cfra - 1.0f; ret = psys_get_particle_state(&sim, *efd->index, &state, 0); /* TODO */ @@ -705,7 +705,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin if(real_velocity) { VECCOPY(efd->vel, ob->obmat[3]); - where_is_object_time(eff->scene, ob, cfra - 1.0); + where_is_object_time(eff->scene, ob, cfra - 1.0f); sub_v3_v3v3(efd->vel, efd->vel, ob->obmat[3]); } @@ -931,10 +931,10 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected case PFIELD_LENNARDJ: fac = pow((efd->size + point->size) / efd->distance, 6.0); - fac = - fac * (1.0 - fac) / efd->distance; + fac = - fac * (1.0f - fac) / efd->distance; /* limit the repulsive term drastically to avoid huge forces */ - fac = ((fac>2.0) ? 2.0 : fac); + fac = ((fac>2.0f) ? 2.0f : fac); mul_v3_fl(force, strength * fac); break; diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 25d6860cb50..844f25e6d21 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -346,7 +346,7 @@ static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, floa case FCM_GENERATOR_FN_LN: /* natural log */ { /* check that value is greater than 1? */ - if (arg > 1.0f) { + if (arg > 1.0) { fn= log; } else { @@ -358,7 +358,7 @@ static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, floa case FCM_GENERATOR_FN_SQRT: /* square root */ { /* no negative numbers */ - if (arg > 0.0f) { + if (arg > 0.0) { fn= sqrt; } else { @@ -374,7 +374,7 @@ static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, floa /* execute function callback to set value if appropriate */ if (fn) { - float value= (float)(data->amplitude*fn(arg) + data->value_offset); + float value= (float)(data->amplitude*(float)fn(arg) + data->value_offset); if (data->flag & FCM_GENERATOR_ADDITIVE) *cvalue += value; diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index a07baa92998..dc1f80ce1d4 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -2725,7 +2725,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) node= getExecutableNode(ntree); if(node) { if(ntree->progress && totnode) - ntree->progress(ntree->prh, (1.0 - curnode/(float)totnode)); + ntree->progress(ntree->prh, (1.0f - curnode/(float)totnode)); if(ntree->stats_draw) { char str[64]; sprintf(str, "Compositing %d %s", curnode, node->name); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 5c1c8eae622..e96dc638a88 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -880,7 +880,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot) if((arearatio < 1.0f || viewport < 1.0f) && elem->totchild) { /* lambda is percentage of elements to keep */ - lambda= (arearatio < 1.0f)? pow(arearatio, powrate): 1.0f; + lambda= (arearatio < 1.0f)? powf(arearatio, powrate): 1.0f; lambda *= viewport; lambda= MAX2(lambda, 1.0f/elem->totchild); @@ -2254,7 +2254,7 @@ static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheK pd_point_from_particle(sim, sim->psys->particles+i, &eff_key, &epoint); pdDoEffectors(sim->psys->effectors, sim->colliders, sim->psys->part->effector_weights, &epoint, force, NULL); - mul_v3_fl(force, effector*pow((float)k / (float)steps, 100.0f * sim->psys->part->eff_hair) / (float)steps); + mul_v3_fl(force, effector*powf((float)k / (float)steps, 100.0f * sim->psys->part->eff_hair) / (float)steps); add_v3_v3(force, vec); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 2fe7f42abe3..13f5d619daa 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -659,7 +659,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount) if(num==0) return; - rad1= (float)(1.0f/sqrt((float)num)); + rad1= (float)(1.0f/sqrtf((float)num)); rad2= (float)(1.0f/((float)num)); rad3= (float)sqrt((float)num)/((float)num); @@ -1668,7 +1668,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, zero_v3(pa->state.vel); /* boids store direction in ave */ - if(fabs(nor[2])==1.0f) { + if(fabsf(nor[2])==1.0f) { sub_v3_v3v3(pa->state.ave, loc, ob->obmat[3]); normalize_v3(pa->state.ave); } @@ -2334,7 +2334,7 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist) pfr->neighbors[pfr->tot_neighbors].psys = pfr->npsys; pfr->tot_neighbors++; - q = (1.f - sqrt(squared_dist)/pfr->h) * pfr->massfac; + q = (1.f - sqrtf(squared_dist)/pfr->h) * pfr->massfac; if(pfr->use_size) q *= npa->size; @@ -2658,7 +2658,7 @@ static float nr_distance_to_edge(float *p, float radius, ParticleCollisionElemen cross_v3_v3v3(c, v1, v2); - return fabs(len_v3(c)/len_v3(v0)) - radius; + return fabsf(len_v3(c)/len_v3(v0)) - radius; } static float nr_distance_to_vert(float *p, float radius, ParticleCollisionElement *pce, float *UNUSED(nor)) { diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 618945b27bd..587d1dc01a2 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2557,7 +2557,7 @@ static void *ptcache_bake_thread(void *ptr) { ptcache_dt_to_str(run, ctime-stime); ptcache_dt_to_str(etd, fetd); - printf("Baked for %s, current frame: %i/%i (%.3fs), ETC: %s \r", run, *data->cfra_ptr-sfra+1, efra-sfra+1, (float)(ctime-ptime), etd); + printf("Baked for %s, current frame: %i/%i (%.3fs), ETC: %s \r", run, *data->cfra_ptr-sfra+1, efra-sfra+1, ctime-ptime, etd); } ptime = ctime; } diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index e6360620048..3dfef2e9d78 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -1582,11 +1582,11 @@ typedef struct WipeZone { static void precalc_wipe_zone(WipeZone *wipezone, WipeVars *wipe, int xo, int yo) { wipezone->flip = (wipe->angle < 0); - wipezone->angle = pow(fabs(wipe->angle)/45.0f, log(xo)/log(2.0f)); + wipezone->angle = pow(fabsf(wipe->angle)/45.0f, log(xo)/log(2.0f)); wipezone->xo = xo; wipezone->yo = yo; wipezone->width = (int)(wipe->edgeWidth*((xo+yo)/2.0f)); - wipezone->pythangle = 1.0f/sqrt(wipe->angle*wipe->angle + 1.0f); + wipezone->pythangle = 1.0f/sqrtf(wipe->angle*wipe->angle + 1.0f); if(wipe->wipetype == DO_SINGLE_WIPE) wipezone->invwidth = 1.0f/wipezone->width; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 8c5696c9a3f..7a6eb1adc9f 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1029,7 +1029,7 @@ static float give_stripelem_index(Sequence *seq, float cfra) if (seq->strobe < 1.0f) seq->strobe = 1.0f; if (seq->strobe > 1.0f) { - nr -= fmod((double)nr, (double)seq->strobe); + nr -= fmodf((double)nr, (double)seq->strobe); } return nr; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index cfc98b4a67d..52e1faaabee 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -329,7 +329,7 @@ static float sound_get_volume(Scene* scene, Sequence* sequence, float time) fcu= list_find_fcurve(&adt->action->curves, buf, 0); if(fcu) - return evaluate_fcurve(fcu, time * FPS); + return evaluate_fcurve(fcu, time * (float)FPS); else return sequence->volume; } |