warning cleanup for -Wdouble-promotion

This commit is contained in:
Campbell Barton 2011-08-19 16:21:29 +00:00
parent 2c1182664c
commit 3a81f23e09
20 changed files with 94 additions and 94 deletions

@ -923,7 +923,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
for(i = 0; i < dm->getNumVerts(dm); i++)
{
maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0));
maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0f));
}
clmd->clothObject->bvhselftree = bvhselftree_build_from_cloth ( clmd, maxdist );

@ -53,10 +53,10 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
y = jit1[i+1];
for (j = 2*num-2; j>=0 ; j-=2) {
if (i != j){
vecx = jit1[j] - x - 1.0;
vecy = jit1[j+1] - y - 1.0;
vecx = jit1[j] - x - 1.0f;
vecy = jit1[j+1] - y - 1.0f;
for (k = 3; k>0 ; k--){
if( fabs(vecx)<rad1 && fabs(vecy)<rad1) {
if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
len= sqrt(vecx*vecx + vecy*vecy);
if(len>0 && len<rad1) {
len= len/rad1;
@ -64,9 +64,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
dvecy += vecy/len;
}
}
vecx += 1.0;
vecx += 1.0f;
if( fabs(vecx)<rad1 && fabs(vecy)<rad1) {
if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
len= sqrt(vecx*vecx + vecy*vecy);
if(len>0 && len<rad1) {
len= len/rad1;
@ -74,9 +74,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
dvecy += vecy/len;
}
}
vecx += 1.0;
vecx += 1.0f;
if( fabs(vecx)<rad1 && fabs(vecy)<rad1) {
if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
len= sqrt(vecx*vecx + vecy*vecy);
if(len>0 && len<rad1) {
len= len/rad1;
@ -84,16 +84,16 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
dvecy += vecy/len;
}
}
vecx -= 2.0;
vecy += 1.0;
vecx -= 2.0f;
vecy += 1.0f;
}
}
}
x -= dvecx/18.0 ;
y -= dvecy/18.0;
x -= floor(x) ;
y -= floor(y);
x -= dvecx/18.0f;
y -= dvecy/18.0f;
x -= floorf(x) ;
y -= floorf(y);
jit2[i] = x;
jit2[i+1] = y;
}
@ -111,28 +111,28 @@ void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2)
y = jit1[i+1];
for (j =2*num -2; j>= 0 ; j-=2){
if (i != j){
vecx = jit1[j] - x - 1.0;
vecy = jit1[j+1] - y - 1.0;
vecx = jit1[j] - x - 1.0f;
vecy = jit1[j+1] - y - 1.0f;
if( fabs(vecx)<rad2) dvecx+= vecx*rad2;
vecx += 1.0;
if( fabs(vecx)<rad2) dvecx+= vecx*rad2;
vecx += 1.0;
if( fabs(vecx)<rad2) dvecx+= vecx*rad2;
if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
vecx += 1.0f;
if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
vecx += 1.0f;
if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
if( fabs(vecy)<rad2) dvecy+= vecy*rad2;
vecy += 1.0;
if( fabs(vecy)<rad2) dvecy+= vecy*rad2;
vecy += 1.0;
if( fabs(vecy)<rad2) dvecy+= vecy*rad2;
if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
vecy += 1.0f;
if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
vecy += 1.0f;
if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
}
}
x -= dvecx/2 ;
y -= dvecy/2;
x -= floor(x) ;
y -= floor(y);
x -= dvecx/2.0f;
y -= dvecy/2.0f;
x -= floorf(x) ;
y -= floorf(y);
jit2[i] = x;
jit2[i+1] = y;
}
@ -148,17 +148,17 @@ void BLI_initjit(float *jitarr, int num)
if(num==0) return;
jit2= MEM_mallocN(12 + 2*sizeof(float)*num, "initjit");
rad1= 1.0/sqrt((float)num);
rad2= 1.0/((float)num);
rad3= sqrt((float)num)/((float)num);
rad1= 1.0f/sqrtf((float)num);
rad2= 1.0f/((float)num);
rad3= sqrtf((float)num)/((float)num);
BLI_srand(31415926 + num);
x= 0;
for(i=0; i<2*num; i+=2) {
jitarr[i]= x+ rad1*(0.5-BLI_drand());
jitarr[i+1]= ((float)i/2)/num +rad1*(0.5-BLI_drand());
jitarr[i]= x+ rad1*(float)(0.5-BLI_drand());
jitarr[i+1]= ((float)i/2)/num +rad1*(float)(0.5-BLI_drand());
x+= rad3;
x -= floor(x);
x -= floorf(x);
}
for (i=0 ; i<24 ; i++) {
@ -171,8 +171,8 @@ void BLI_initjit(float *jitarr, int num)
/* finally, move jittertab to be centered around (0,0) */
for(i=0; i<2*num; i+=2) {
jitarr[i] -= 0.5;
jitarr[i+1] -= 0.5;
jitarr[i] -= 0.5f;
jitarr[i+1] -= 0.5f;
}
}

@ -402,7 +402,7 @@ int isect_line_sphere_v3(const float l1[3], const float l2[3],
madd_v3_v3v3fl(r_p1, l1, ldir, mu);
return 1;
}
else if (i > 0.0) {
else if (i > 0.0f) {
const float i_sqrt= sqrt(i); /* avoid calc twice */
/* first intersection */
@ -456,7 +456,7 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2],
madd_v2_v2v2fl(r_p1, l1, ldir, mu);
return 1;
}
else if (i > 0.0) {
else if (i > 0.0f) {
const float i_sqrt= sqrt(i); /* avoid calc twice */
/* first intersection */
@ -2010,7 +2010,7 @@ void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const f
}
if(IS_ZERO(denom)==0)
uv[1]= (float) (( (1-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom);
uv[1]= (float) (( (1.0f-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom);
}
}

@ -213,7 +213,7 @@ void quat_to_mat4(float m[][4], const float q[4])
double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc;
#ifdef DEBUG
if(!((q0=dot_qtqt(q, q))==0.0f || (fabsf(q0-1.0f) < (float)QUAT_EPSILON))) {
if(!((q0=dot_qtqt(q, q))==0.0f || (fabs(q0-1.0) < QUAT_EPSILON))) {
fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0);
}
#endif
@ -492,8 +492,8 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
else angle= (float)(-0.5*atan2(-fp[0], -fp[1]));
}
co= (float)cos(angle);
si= (float)(sin(angle)/len1);
co= cosf(angle);
si= sinf(angle)/len1;
q2[0]= co;
q2[1]= x2*si;
q2[2]= y2*si;

@ -233,10 +233,10 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
{
tar->xmin= floor(src->xmin + 0.5);
tar->xmax= floor((src->xmax - src->xmin) + 0.5);
tar->ymin= floor(src->ymin + 0.5);
tar->ymax= floor((src->ymax - src->ymin) + 0.5);
tar->xmin= floor(src->xmin + 0.5f);
tar->xmax= floor((src->xmax - src->xmin) + 0.5f);
tar->ymin= floor(src->ymin + 0.5f);
tar->ymax= floor((src->ymax - src->ymin) + 0.5f);
}
void print_rctf(const char *str, rctf *rect)

@ -288,7 +288,7 @@ static short testedgeside(float *v1, float *v2, float *v3)
inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy])
+(v1[coy]-v2[coy])*(v1[cox]-v3[cox]);
if(inp<0.0) return 0;
if(inp < 0.0f) return 0;
else if(inp==0) {
if(v1[cox]==v3[cox] && v1[coy]==v3[coy]) return 0;
if(v2[cox]==v3[cox] && v2[coy]==v3[coy]) return 0;
@ -312,8 +312,8 @@ static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed)
y= eed->v1->co[coy];
fac1= eed->v2->co[coy]-y;
if(fac1==0.0) {
fac1= 1.0e10*(eed->v2->co[cox]-x);
if(fac1==0.0f) {
fac1= 1.0e10f*(eed->v2->co[cox]-x);
}
else fac1= (x-eed->v2->co[cox])/fac1;
@ -324,8 +324,8 @@ static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed)
if(ed->v2==eed->v2) return 0;
fac= ed->v2->co[coy]-y;
if(fac==0.0) {
fac= 1.0e10*(ed->v2->co[cox]-x);
if(fac==0.0f) {
fac= 1.0e10f*(ed->v2->co[cox]-x);
}
else fac= (x-ed->v2->co[cox])/fac;
@ -443,7 +443,7 @@ static void testvertexnearedge(void)
vec2[1]= eed->v2->co[coy];
if(boundinsideEV(eed,eve)) {
dist= dist_to_line_v2(vec1,vec2,vec3);
if(dist<COMPLIMIT) {
if(dist<(float)COMPLIMIT) {
/* new edge */
ed1= BLI_addfilledge(eed->v1, eve);
@ -816,7 +816,7 @@ int BLI_edgefill(short mat_nr)
if(v2) {
if( compare_v3v3(v2, eve->co, COMPLIMIT)==0) {
len= normal_tri_v3( norm,v1, v2, eve->co);
if(len != 0.0) break;
if(len != 0.0f) break;
}
}
else if(compare_v3v3(v1, eve->co, COMPLIMIT)==0) {
@ -825,7 +825,7 @@ int BLI_edgefill(short mat_nr)
eve= eve->next;
}
if(len==0.0) return 0; /* no fill possible */
if(len==0.0f) return 0; /* no fill possible */
norm[0]= fabs(norm[0]);
norm[1]= fabs(norm[1]);

@ -180,7 +180,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
glEnable(GL_BLEND);
glGetFloatv(GL_CURRENT_COLOR, color);
color[3]*= 0.125;
color[3] *= 0.125f;
glColor4fv(color);
/* for each AA step */

@ -182,7 +182,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
}
RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object", -FLT_MAX, FLT_MAX);
RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -M_PI * 2.0f, M_PI * 2.0f);
RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f);
prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
RNA_def_property_flag(prop, PROP_HIDDEN);

@ -636,14 +636,14 @@ static void apply_heights_data(void *bake_data)
if(ibuf->rect_float) {
float *rrgbf= ibuf->rect_float + i*4;
if(max-min > 1e-5) height= (heights[i]-min)/(max-min);
if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
else height= 0;
rrgbf[0]=rrgbf[1]=rrgbf[2]= height;
} else {
char *rrgb= (char*)ibuf->rect + i*4;
if(max-min > 1e-5) height= (heights[i]-min)/(max-min);
if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
else height= 0;
rrgb[0]=rrgb[1]=rrgb[2]= FTOCHAR(height);

@ -124,8 +124,8 @@ typedef struct TreeElement {
#define OL_TOGW OL_TOG_RESTRICT_VIEWX
#define OL_RNA_COLX (UI_UNIT_X*15)
#define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5)
#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5)
#define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5f)
#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5f)
/* outliner_tree.c ----------------------------------------------- */

@ -721,7 +721,7 @@ static void draw_rotation_guide(RegionView3D *rv3d)
{
#define ROT_AXIS_DETAIL 13
const float s = 0.05f * scale;
const float step = 2.f * M_PI / ROT_AXIS_DETAIL;
const float step = 2.f * (float)(M_PI / ROT_AXIS_DETAIL);
float angle;
int i;
@ -1041,7 +1041,7 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons
glBegin(GL_LINES);
if(w > h) {
if(golden) {
ofs = w * (1.0f-(1.0f/1.61803399));
ofs = w * (1.0f-(1.0f/1.61803399f));
}
else {
ofs = h * (h / w);
@ -1059,7 +1059,7 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons
}
else {
if(golden) {
ofs = h * (1.0f-(1.0f/1.61803399));
ofs = h * (1.0f-(1.0f/1.61803399f));
}
else {
ofs = w * (w / h);
@ -1203,7 +1203,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
if (ca->dtx & CAM_DTX_GOLDEN) {
UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399));
drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399f));
}
if (ca->dtx & CAM_DTX_GOLDEN_TRI_A) {

@ -1697,7 +1697,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot)
static void view_dolly_mouseloc(ARegion *ar, float orig_ofs[3], float dvec[3], float dfac)
{
RegionView3D *rv3d= ar->regiondata;
madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0 - dfac));
madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0f - dfac));
}
static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_invert)
@ -1718,7 +1718,7 @@ static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_inv
if (zoom_invert)
SWAP(float, len1, len2);
zfac = 1.0 + ((len2 - len1) * 0.01 * vod->rv3d->dist);
zfac = 1.0f + ((len2 - len1) * 0.01f * vod->rv3d->dist);
}
if(zfac != 1.0f)

@ -867,7 +867,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
upvec[2]=1;
mul_m3_v3(mat, upvec);
/*make sure we have some z rolling*/
if (fabs(upvec[2]) > 0.00001f) {
if (fabsf(upvec[2]) > 0.00001f) {
roll= upvec[2] * -5.0f;
upvec[0]= 1.0f; /*rotate the view about this axis*/

@ -4648,7 +4648,7 @@ static int createSlideVerts(TransInfo *t)
uv_new = tf->uv[k];
if (ev->tmp.l) {
if (fabs(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) {
if (fabsf(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) {
ev->tmp.l = -1; /* Tag as invalid */
BLI_linklist_free(suv->fuv_list,NULL);
suv->fuv_list = NULL;

@ -1481,7 +1481,7 @@ static void rna_def_wipe(BlenderRNA *brna)
#if 1 /* expose as radians */
prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_funcs(prop, "rna_WipeSequence_angle_get", "rna_WipeSequence_angle_set", NULL);
RNA_def_property_range(prop, DEG2RAD(-90.0f), DEG2RAD(90.0f));
RNA_def_property_range(prop, DEG2RAD(-90.0), DEG2RAD(90.0));
#else
prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "angle");

@ -192,10 +192,10 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
/* minimal free space (starting at camera) */
starmindist= wrld->starmindist;
if (stargrid <= 0.10) return;
if (stargrid <= 0.10f) return;
if (re) re->flag |= R_HALO;
else stargrid *= 1.0; /* then it draws fewer */
else stargrid *= 1.0f; /* then it draws fewer */
if(re) invert_m4_m4(mat, re->viewmat);
else unit_m4(mat);
@ -267,17 +267,17 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
if (alpha >= clipend) alpha = 0.0;
else if (alpha <= starmindist) alpha = 0.0;
else if (alpha <= 2.0 * starmindist) {
else if (alpha <= 2.0f * starmindist) {
alpha = (alpha - starmindist) / starmindist;
} else {
alpha -= 2.0 * starmindist;
alpha /= (clipend - 2.0 * starmindist);
alpha = 1.0 - alpha;
alpha -= 2.0f * starmindist;
alpha /= (clipend - 2.0f * starmindist);
alpha = 1.0f - alpha;
}
}
if (alpha != 0.0) {
if (alpha != 0.0f) {
fac = force * BLI_drand();
har = initstar(re, obr, vec, fac);
@ -822,7 +822,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
if(obr->totvert==0) return;
asverts= MEM_callocN(sizeof(ASvert)*obr->totvert, "all smooth verts");
thresh= cos( M_PI*(0.5f+(float)degr)/180.0 );
thresh= cosf((float)M_PI*(0.5f+(float)degr)/180.0f );
/* step zero: give faces normals of original mesh, if this is provided */

@ -400,7 +400,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
sb[j] += vp->data_b[i];
/* Displays progress every second */
if(time-lasttime>1.0f) {
if(time-lasttime>1.0) {
char str[64];
BLI_snprintf(str, sizeof(str), "Simulating multiple scattering: %d%%", (int)(100.0f * (c / total)));
re->i.infostr= str;
@ -747,7 +747,7 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o
caching=0;
time= PIL_check_seconds_timer();
if(time-lasttime>1.0f) {
if(time-lasttime>1.0) {
char str[64];
BLI_snprintf(str, sizeof(str), "Precaching volume: %d%%", (int)(100.0f * ((float)counter / (float)totparts)));
re->i.infostr= str;

@ -422,9 +422,9 @@ static void vol_get_transmittance_seg(ShadeInput *shi, float *tr, float stepsize
tau[1] += stepd * sigma_t[1];
tau[2] += stepd * sigma_t[2];
tr[0] *= exp(-tau[0]);
tr[1] *= exp(-tau[1]);
tr[2] *= exp(-tau[2]);
tr[0] *= expf(-tau[0]);
tr[1] *= expf(-tau[1]);
tr[2] *= expf(-tau[2]);
}
/* Compute transmittance = e^(-attenuation) */
@ -473,7 +473,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar,
if (lar->mode & LA_LAYER) if((lar->lay & shi->obi->lay)==0) return;
if ((lar->lay & shi->lay)==0) return;
if (lar->energy == 0.0) return;
if (lar->energy == 0.0f) return;
if ((visifac= lamp_get_visibility(lar, co, lv, &lampdist)) == 0.f) return;
@ -613,7 +613,7 @@ static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float
/* transmittance component (alpha) */
vol_get_transmittance_seg(shi, tr, stepsize, co, density);
if (t0 > t1 * 0.25) {
if (t0 > t1 * 0.25f) {
/* only use depth cutoff after we've traced a little way into the volume */
if (luminance(tr) < shi->mat->vol.depth_cutoff) break;
}
@ -623,9 +623,9 @@ static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float
if (shi->obi->volume_precache) {
float p2[3];
p2[0] = p[0] + (step_vec[0] * 0.5);
p2[1] = p[1] + (step_vec[1] * 0.5);
p2[2] = p[2] + (step_vec[2] * 0.5);
p2[0] = p[0] + (step_vec[0] * 0.5f);
p2[1] = p[1] + (step_vec[1] * 0.5f);
p2[2] = p[2] + (step_vec[2] * 0.5f);
vol_get_precached_scattering(&R, shi, scatter_col, p2);
} else
@ -817,7 +817,7 @@ void shade_volume_inside(ShadeInput *shi, ShadeResult *shr)
volume_trace(shi, shr, VOL_SHADE_INSIDE);
shr->alpha = shr->alpha + prev_alpha;
CLAMP(shr->alpha, 0.0, 1.0);
CLAMP(shr->alpha, 0.0f, 1.0f);
shi->mat = mat_backup;
shi->obi = obi_backup;

@ -413,9 +413,9 @@ int voxeldatatex(struct Tex *tex, float *texvec, struct TexResult *texres)
}
case TEX_REPEAT:
{
co[0] = co[0] - floor(co[0]);
co[1] = co[1] - floor(co[1]);
co[2] = co[2] - floor(co[2]);
co[0] = co[0] - floorf(co[0]);
co[1] = co[1] - floorf(co[1]);
co[2] = co[2] - floorf(co[2]);
break;
}
case TEX_EXTEND:

@ -2926,7 +2926,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
case PROP_FACTOR:
r1= (1 - rc->current_value) * WM_RADIAL_CONTROL_DISPLAY_SIZE;
r2= tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE;
alpha = rc->current_value / 2 + 0.5;
alpha = rc->current_value / 2.0f + 0.5f;
break;
case PROP_ANGLE:
r1= r2= tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE;