From dd56ebe6076d7ffbe9dd698a5c1bc94fff6ff306 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 28 Mar 2011 04:22:50 +0000 Subject: blenkernel: floats were being implicitly promoted to doubles, adjust to use floats. --- source/blender/blenkernel/intern/armature.c | 18 ++-- source/blender/blenkernel/intern/brush.c | 20 ++-- source/blender/blenkernel/intern/bvhutils.c | 20 ++-- source/blender/blenkernel/intern/colortools.c | 20 ++-- source/blender/blenkernel/intern/curve.c | 126 +++++++++++++------------- source/blender/blenkernel/intern/displist.c | 16 ++-- source/blender/blenkernel/intern/fcurve.c | 28 +++--- source/blender/blenkernel/intern/image_gen.c | 4 +- source/blender/blenkernel/intern/key.c | 26 +++--- source/blender/blenkernel/intern/material.c | 12 +-- source/blender/blenkernel/intern/mball.c | 52 +++++------ source/blender/blenkernel/intern/mesh.c | 8 +- source/blender/blenkernel/intern/nla.c | 43 ++++----- source/blender/blenkernel/intern/texture.c | 14 +-- 14 files changed, 203 insertions(+), 204 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 99c70564d66..ddfa738449d 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -438,7 +438,7 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest) scale[1]= len_v3(pchan->pose_mat[1]); scale[2]= len_v3(pchan->pose_mat[2]); - if(fabs(scale[0] - scale[1]) > 1e-6f || fabs(scale[1] - scale[2]) > 1e-6f) { + if(fabsf(scale[0] - scale[1]) > 1e-6f || fabsf(scale[1] - scale[2]) > 1e-6f) { unit_m4(scalemat); scalemat[0][0]= scale[0]; scalemat[1][1]= scale[1]; @@ -734,11 +734,11 @@ static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f fac= distfactor_to_bone(cop, bone->arm_head, bone->arm_tail, bone->rad_head, bone->rad_tail, bone->dist); - if (fac>0.0) { + if (fac > 0.0f) { fac*=bone->weight; contrib= fac; - if(contrib>0.0) { + if(contrib > 0.0f) { if(vec) { if(bone->segments>1) // applies on cop and bbonemat @@ -1277,7 +1277,7 @@ void BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], floa } /* when converting to axis-angle, we need a special exception for the case when there is no axis */ - if (IS_EQ(axis[0], axis[1]) && IS_EQ(axis[1], axis[2])) { + if (IS_EQF(axis[0], axis[1]) && IS_EQF(axis[1], axis[2])) { /* for now, rotate around y-axis then (so that it simply becomes the roll) */ axis[1]= 1.0f; } @@ -1336,7 +1336,7 @@ void vec_roll_to_mat3(float *vec, float roll, float mat[][3]) /* was 0.0000000000001, caused bug [#23954], smaller values give unstable * roll when toggling editmode */ - if (dot_v3v3(axis,axis) > 0.00001) { + if (dot_v3v3(axis,axis) > 0.00001f) { /* if nor is *not* a multiple of target ... */ normalize_v3(axis); @@ -1379,7 +1379,7 @@ void where_is_armature_bone(Bone *bone, Bone *prevbone) bone->length= len_v3v3(bone->head, bone->tail); /* this is called on old file reading too... */ - if(bone->xwidth==0.0) { + if(bone->xwidth==0.0f) { bone->xwidth= 0.1f; bone->zwidth= 0.1f; bone->segments= 1; @@ -1970,12 +1970,12 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o /* calculate volume preservation factor which is * basically the inverse of the y-scaling factor */ - if (fabs(scaleFac) != 0.0f) { - scale= 1.0 / fabs(scaleFac); + if (fabsf(scaleFac) != 0.0f) { + scale= 1.0f / fabsf(scaleFac); /* we need to clamp this within sensible values */ // NOTE: these should be fine for now, but should get sanitised in future - scale= MIN2(MAX2(scale, 0.0001) , 100000); + CLAMP(scale, 0.0001f, 100000.0f); } else scale= 1.0f; diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 869123de97f..be73ee0656b 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -912,13 +912,13 @@ void brush_painter_break_stroke(BrushPainter *painter) static void brush_apply_pressure(BrushPainter *painter, Brush *brush, float pressure) { if (brush_use_alpha_pressure(brush)) - brush_set_alpha(brush, MAX2(0.0, painter->startalpha*pressure)); + brush_set_alpha(brush, MAX2(0.0f, painter->startalpha*pressure)); if (brush_use_size_pressure(brush)) - brush_set_size(brush, MAX2(1.0, painter->startsize*pressure)); + brush_set_size(brush, MAX2(1.0f, painter->startsize*pressure)); if (brush->flag & BRUSH_JITTER_PRESSURE) - brush->jitter = MAX2(0.0, painter->startjitter*pressure); + brush->jitter = MAX2(0.0f, painter->startjitter*pressure); if (brush->flag & BRUSH_SPACING_PRESSURE) - brush->spacing = MAX2(1.0, painter->startspacing*(1.5f-pressure)); + brush->spacing = MAX2(1.0f, painter->startspacing*(1.5f-pressure)); } void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos) @@ -1075,7 +1075,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl else painter->accumtime -= painttime; - while (painter->accumtime >= brush->rate) { + while (painter->accumtime >= (double)brush->rate) { brush_apply_pressure(painter, brush, pressure); brush_jitter_pos(brush, pos, finalpos); @@ -1085,7 +1085,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl totpaintops += func(user, painter->cache.ibuf, painter->lastmousepos, finalpos); - painter->accumtime -= brush->rate; + painter->accumtime -= (double)brush->rate; } painter->lasttime= curtime; @@ -1111,7 +1111,7 @@ float brush_curve_strength_clamp(Brush *br, float p, const float len) else p= p/len; p= curvemapping_evaluateF(br->curve, 0, p); - if(p < 0.0) p= 0.0f; + if(p < 0.0f) p= 0.0f; else if(p > 1.0f) p= 1.0f; return p; } @@ -1158,10 +1158,10 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side) * if the texture didn't give an RGB value, copy the intensity across */ if(hasrgb & TEX_RGB) - texres.tin = (0.35 * texres.tr + 0.45 * - texres.tg + 0.2 * texres.tb); + texres.tin = (0.35f * texres.tr + 0.45f * + texres.tg + 0.2f * texres.tb); - texres.tin = texres.tin * 255.0; + texres.tin = texres.tin * 255.0f; ((char*)texcache)[(iy*side+ix)*4] = (char)texres.tin; ((char*)texcache)[(iy*side+ix)*4+1] = (char)texres.tin; ((char*)texcache)[(iy*side+ix)*4+2] = (char)texres.tin; diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index d3afb93b5dd..5520e4d1d41 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -131,7 +131,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const } else { - if(fabs(A00) > FLT_EPSILON) + if(fabsf(A00) > FLT_EPSILON) S = -B0/A00; else S = 0.0f; @@ -156,7 +156,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const } else { - if(fabs(A11) > FLT_EPSILON) + if(fabsf(A11) > FLT_EPSILON) T = -B1 / A11; else T = 0.0f; @@ -182,7 +182,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const } else { - if(fabs(A11) > FLT_EPSILON) + if(fabsf(A11) > FLT_EPSILON) T = -B1 / A11; else T = 0.0; @@ -208,7 +208,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const } else { - if(fabs(A00) > FLT_EPSILON) + if(fabsf(A00) > FLT_EPSILON) S = -B0 / A00; else S = 0.0f; @@ -220,7 +220,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const { // Minimum at interior lv float invDet; - if(fabs(Det) > FLT_EPSILON) + if(fabsf(Det) > FLT_EPSILON) invDet = 1.0f / Det; else invDet = 0.0f; @@ -251,7 +251,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const } else { - if(fabs(denom) > FLT_EPSILON) + if(fabsf(denom) > FLT_EPSILON) S = numer / denom; else S = 0.0f; @@ -278,7 +278,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const } else { - if(fabs(A11) > FLT_EPSILON) + if(fabsf(A11) > FLT_EPSILON) T = -B1 / A11; else T = 0.0f; @@ -304,7 +304,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const } else { - if(fabs(denom) > FLT_EPSILON) + if(fabsf(denom) > FLT_EPSILON) T = numer / denom; else T = 0.0f; @@ -331,7 +331,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const } else { - if(fabs(A00) > FLT_EPSILON) + if(fabsf(A00) > FLT_EPSILON) S = -B0 / A00; else S = 0.0f; @@ -362,7 +362,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const } else { - if(fabs(denom) > FLT_EPSILON) + if(fabsf(denom) > FLT_EPSILON) S = numer / denom; else S = 0.0f; diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index b4c69bddefc..46f3e124bcc 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -421,14 +421,14 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex } if(bezt->h1==HD_VECT) { /* vector */ - dx/=3.0; - dy/=3.0; + dx/=3.0f; + dy/=3.0f; *(p2-3)= *p2-dx; *(p2-2)= *(p2+1)-dy; } if(bezt->h2==HD_VECT) { - dx1/=3.0; - dy1/=3.0; + dx1/=3.0f; + dy1/=3.0f; *(p2+3)= *p2+dx1; *(p2+4)= *(p2+1)+dy1; } @@ -700,7 +700,7 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles) for(a=0; atotpoint-1; a++) { dx= cmp[a].x - cmp[a+1].x; dy= cmp[a].y - cmp[a+1].y; - if( sqrt(dx*dx + dy*dy) < thresh ) { + if( sqrtf(dx*dx + dy*dy) < thresh ) { if(a==0) { cmp[a+1].flag|= 2; if(cmp[a+1].flag & CUMA_SELECT) @@ -962,7 +962,7 @@ void curvemapping_table_RGBA(CurveMapping *cumap, float **array, int *size) DO_INLINE int get_bin_float(float f) { - int bin= (int)((f*255) + 0.5); /* 0.5 to prevent quantisation differences */ + int bin= (int)((f*255.0f) + 0.5f); /* 0.5 to prevent quantisation differences */ /* note: clamp integer instead of float to avoid problems with NaN */ CLAMP(bin, 0, 255); @@ -1054,7 +1054,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management) bin_lum = MEM_callocN(256 * sizeof(unsigned int), "temp historgram bins"); /* convert to number of lines with logarithmic scale */ - scopes->sample_lines = (scopes->accuracy*0.01) * (scopes->accuracy*0.01) * ibuf->y; + scopes->sample_lines = (scopes->accuracy*0.01f) * (scopes->accuracy*0.01f) * ibuf->y; if (scopes->sample_full) scopes->sample_lines = ibuf->y; @@ -1105,7 +1105,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management) } /* we still need luma for histogram */ - luma = 0.299*rgb[0] + 0.587*rgb[1] + 0.114 * rgb[2]; + luma = 0.299f * rgb[0] + 0.587f * rgb[1] + 0.114f * rgb[2]; /* check for min max */ if(ycc_mode == -1 ) { @@ -1155,8 +1155,8 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management) if (bin_lum[x] > nl) nl = bin_lum[x]; } - div = 1.f/(double)n; - divl = 1.f/(double)nl; + div = 1.0/(double)n; + divl = 1.0/(double)nl; for (x=0; x<256; x++) { scopes->hist.data_r[x] = bin_r[x] * div; scopes->hist.data_g[x] = bin_g[x] * div; diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 105c357906f..7a5e0d5c33d 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -333,19 +333,19 @@ void tex_space_curve(Curve *cu) cu->size[1]= (max[1]-min[1])/2.0f; cu->size[2]= (max[2]-min[2])/2.0f; - cu->rot[0]= cu->rot[1]= cu->rot[2]= 0.0; + cu->rot[0]= cu->rot[1]= cu->rot[2]= 0.0f; - if(cu->size[0]==0.0) cu->size[0]= 1.0; - else if(cu->size[0]>0.0 && cu->size[0]<0.00001) cu->size[0]= 0.00001; - else if(cu->size[0]<0.0 && cu->size[0]> -0.00001) cu->size[0]= -0.00001; + if(cu->size[0]==0.0f) cu->size[0]= 1.0f; + else if(cu->size[0]>0.0f && cu->size[0]<0.00001f) cu->size[0]= 0.00001f; + else if(cu->size[0]<0.0f && cu->size[0]> -0.00001f) cu->size[0]= -0.00001f; - if(cu->size[1]==0.0) cu->size[1]= 1.0; - else if(cu->size[1]>0.0 && cu->size[1]<0.00001) cu->size[1]= 0.00001; - else if(cu->size[1]<0.0 && cu->size[1]> -0.00001) cu->size[1]= -0.00001; + if(cu->size[1]==0.0f) cu->size[1]= 1.0f; + else if(cu->size[1]>0.0f && cu->size[1]<0.00001f) cu->size[1]= 0.00001f; + else if(cu->size[1]<0.0f && cu->size[1]> -0.00001f) cu->size[1]= -0.00001f; - if(cu->size[2]==0.0) cu->size[2]= 1.0; - else if(cu->size[2]>0.0 && cu->size[2]<0.00001) cu->size[2]= 0.00001; - else if(cu->size[2]<0.0 && cu->size[2]> -0.00001) cu->size[2]= -0.00001; + if(cu->size[2]==0.0f) cu->size[2]= 1.0f; + else if(cu->size[2]>0.0f && cu->size[2]<0.00001f) cu->size[2]= 0.00001f; + else if(cu->size[2]<0.0f && cu->size[2]> -0.00001f) cu->size[2]= -0.00001f; } } @@ -590,7 +590,7 @@ static void calcknots(float *knots, short aantal, short order, short type) k= 0.0; for(a=1;a<=t;a++) { knots[a-1]= k; - if(a>=order && a<=aantal) k+= 1.0; + if(a>=order && a<=aantal) k+= 1.0f; } } else if(type==2) { @@ -598,15 +598,15 @@ static void calcknots(float *knots, short aantal, short order, short type) if(order==4) { k= 0.34; for(a=0;a=order && a<=aantal) k+= (0.5); - knots[a]= (float)floor(k); + if(a>=order && a<=aantal) k+= 0.5f; + knots[a]= floorf(k); } } else { @@ -630,7 +630,7 @@ static void makecyclicknots(float *knots, short pnts, short order) for(a=1; a= orderpluspnts) i2= opp2-j; for(i= i1; i<=i2; i++) { - if(basis[i]!=0.0) + if(basis[i]!=0.0f) d= ((t-knots[i])*basis[i]) / (knots[i+j-1]-knots[i]); else - d= 0.0; + d= 0.0f; - if(basis[i+1]!=0.0) + if(basis[i+1] != 0.0f) e= ((knots[i+j]-t)*basis[i+1]) / (knots[i+j]-knots[i+1]); else e= 0.0; @@ -740,7 +740,7 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas *end= 0; for(i=i1; i<=i2; i++) { - if(basis[i]>0.0) { + if(basis[i] > 0.0f) { *end= i; if(*start==1000) *start= i; } @@ -782,7 +782,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int i= nu->pntsu*nu->pntsv; ratcomp=0; while(i--) { - if(bp->vec[3]!=1.0) { + if(bp->vec[3] != 1.0f) { ratcomp= 1; break; } @@ -888,7 +888,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int } else bp++; - if(*fp!=0.0) { + if(*fp != 0.0f) { in[0]+= (*fp) * bp->vec[0]; in[1]+= (*fp) * bp->vec[1]; in[2]+= (*fp) * bp->vec[2]; @@ -964,7 +964,7 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu *fp= basisu[i]*bp->vec[3]; sumdiv+= *fp; } - if(sumdiv!=0.0) if(sumdiv<0.999 || sumdiv>1.001) { + if(sumdiv != 0.0f) if(sumdiv < 0.999f || sumdiv > 1.001f) { /* is normalizing needed? */ fp= sum; for(i= istart; i<=iend; i++, fp++) { @@ -980,7 +980,7 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu if(i>=nu->pntsu) bp= nu->bp+(i - nu->pntsu); else bp++; - if(*fp!=0.0) { + if(*fp != 0.0f) { coord_fp[0]+= (*fp) * bp->vec[0]; coord_fp[1]+= (*fp) * bp->vec[1]; @@ -1264,7 +1264,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) if (cu->bevobj->type!=OB_CURVE) return; bevcu= cu->bevobj->data; - if(bevcu->ext1==0.0 && bevcu->ext2==0.0) { + if(bevcu->ext1==0.0f && bevcu->ext2==0.0f) { ListBase bevdisp= {NULL, NULL}; facx= cu->bevobj->size[0]; facy= cu->bevobj->size[1]; @@ -1305,10 +1305,10 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) freedisplist(&bevdisp); } } - else if(cu->ext1==0.0 && cu->ext2==0.0) { + else if(cu->ext1==0.0f && cu->ext2==0.0f) { ; } - else if(cu->ext2==0.0) { + else if(cu->ext2==0.0f) { dl= MEM_callocN(sizeof(DispList), "makebevelcurve2"); dl->verts= MEM_mallocN(2*3*sizeof(float), "makebevelcurve2"); BLI_addtail(disp, dl); @@ -1337,13 +1337,13 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) /* a circle */ fp= dl->verts; - dangle= (2.0f*M_PI/(nr)); + dangle= (2.0f*(float)M_PI/(nr)); angle= -(nr-1)*dangle; for(a=0; aext2)); - fp[2]= (float)(sin(angle)*(cu->ext2)) - cu->ext1; + fp[1]= (cosf(angle)*(cu->ext2)); + fp[2]= (sinf(angle)*(cu->ext2)) - cu->ext1; angle+= dangle; fp+= 3; } @@ -1374,15 +1374,15 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) for(a=0; aext2)); - fp[2]= (float)(sin(angle)*(cu->ext2)) - cu->ext1; + fp[1]= (float)(cosf(angle)*(cu->ext2)); + fp[2]= (float)(sinf(angle)*(cu->ext2)) - cu->ext1; angle+= dangle; fp+= 3; } } /* part 2, sidefaces */ - if(cu->ext1!=0.0) { + if(cu->ext1!=0.0f) { nr= 2; dl= MEM_callocN(sizeof(DispList), "makebevelcurve p2"); @@ -1432,8 +1432,8 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) for(a=0; aext2)); - fp[2]= (float)(sin(angle)*(cu->ext2)) + cu->ext1; + fp[1]= (float)(cosf(angle)*(cu->ext2)); + fp[2]= (float)(sinf(angle)*(cu->ext2)) + cu->ext1; angle+= dangle; fp+= 3; } @@ -1452,7 +1452,7 @@ static int cu_isectLL(float *v1, float *v2, float *v3, float *v4, short cox, sho float deler; deler= (v1[cox]-v2[cox])*(v3[coy]-v4[coy])-(v3[cox]-v4[cox])*(v1[coy]-v2[coy]); - if(deler==0.0) return -1; + if(deler==0.0f) return -1; *labda= (v1[coy]-v3[coy])*(v3[cox]-v4[cox])-(v1[cox]-v3[cox])*(v3[coy]-v4[coy]); *labda= -(*labda/deler); @@ -1467,8 +1467,8 @@ static int cu_isectLL(float *v1, float *v2, float *v3, float *v4, short cox, sho vec[cox]= *labda*(v2[cox]-v1[cox])+v1[cox]; vec[coy]= *labda*(v2[coy]-v1[coy])+v1[coy]; - if(*labda>=0.0 && *labda<=1.0 && *mu>=0.0 && *mu<=1.0) { - if(*labda==0.0 || *labda==1.0 || *mu==0.0 || *mu==1.0) return 1; + if(*labda>=0.0f && *labda<=1.0f && *mu>=0.0f && *mu<=1.0f) { + if(*labda==0.0f || *labda==1.0f || *mu==0.0f || *mu==1.0f) return 1; return 2; } return 0; @@ -1513,7 +1513,7 @@ static short bevelinside(BevList *bl1,BevList *bl2) /* if lab==0.0 or lab==1.0 then the edge intersects exactly a transition only allow for one situation: we choose lab= 1.0 */ - if(mode>=0 && lab!=0.0) { + if(mode >= 0 && lab != 0.0f) { if(vec[0]nr; while(nr--) { - if(RAD2DEG(angle_v2v2(bevp0->tan, bevp1->tan)) > 90) + if(RAD2DEGF(angle_v2v2(bevp0->tan, bevp1->tan)) > 90.0f) negate_v3(bevp1->tan); bevp0= bevp1; @@ -1889,7 +1889,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl) /* flip rotation if needs be */ cross_v3_v3v3(cross_tmp, vec_1, vec_2); normalize_v3(cross_tmp); - if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < 90/(180.0/M_PI)) + if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < 90.0f/(float)(180.0/M_PI)) angle = -angle; bevp2= (BevPoint *)(bl+1); @@ -2283,7 +2283,7 @@ void makeBevelList(Object *ob) inp= (bevp1->vec[0]- bevp0->vec[0]) * (bevp0->vec[1]- bevp2->vec[1]) + (bevp0->vec[1]- bevp1->vec[1]) * (bevp0->vec[0]- bevp2->vec[0]); - if(inp>0.0) sd->dir= 1; + if(inp > 0.0f) sd->dir= 1; else sd->dir= 0; sd++; @@ -2483,11 +2483,11 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) if(mode==2 && next && prev) { // keep horizontal if extrema float ydiff1= prev->vec[1][1] - bezt->vec[1][1]; float ydiff2= next->vec[1][1] - bezt->vec[1][1]; - if( (ydiff1<=0.0 && ydiff2<=0.0) || (ydiff1>=0.0 && ydiff2>=0.0) ) { + if( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) { bezt->vec[0][1]= bezt->vec[1][1]; } else { // handles should not be beyond y coord of two others - if(ydiff1<=0.0) { + if(ydiff1 <= 0.0f) { if(prev->vec[1][1] > bezt->vec[0][1]) { bezt->vec[0][1]= prev->vec[1][1]; leftviolate= 1; @@ -2511,11 +2511,11 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) if(mode==2 && next && prev) { // keep horizontal if extrema float ydiff1= prev->vec[1][1] - bezt->vec[1][1]; float ydiff2= next->vec[1][1] - bezt->vec[1][1]; - if( (ydiff1<=0.0 && ydiff2<=0.0) || (ydiff1>=0.0 && ydiff2>=0.0) ) { + if( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) { bezt->vec[2][1]= bezt->vec[1][1]; } else { // handles should not be beyond y coord of two others - if(ydiff1<=0.0) { + if(ydiff1 <= 0.0f) { if(next->vec[1][1] < bezt->vec[2][1]) { bezt->vec[2][1]= next->vec[1][1]; rightviolate= 1; @@ -2556,17 +2556,17 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) } if(bezt->h1==HD_VECT) { /* vector */ - dx/=3.0; - dy/=3.0; - dz/=3.0; + dx/=3.0f; + dy/=3.0f; + dz/=3.0f; *(p2-3)= *p2-dx; *(p2-2)= *(p2+1)-dy; *(p2-1)= *(p2+2)-dz; } if(bezt->h2==HD_VECT) { - dx1/=3.0; - dy1/=3.0; - dz1/=3.0; + dx1/=3.0f; + dy1/=3.0f; + dz1/=3.0f; *(p2+3)= *p2+dx1; *(p2+4)= *(p2+1)+dy1; *(p2+5)= *(p2+2)+dz1; @@ -2574,8 +2574,8 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) len2= len_v3v3(p2, p2+3); len1= len_v3v3(p2, p2-3); - if(len1==0.0) len1=1.0; - if(len2==0.0) len2=1.0; + if(len1==0.0f) len1= 1.0f; + if(len2==0.0f) len2= 1.0f; if(bezt->f1 & SELECT) { /* order of calculation */ if(bezt->h2==HD_ALIGN) { /* aligned */ @@ -2700,18 +2700,18 @@ void autocalchandlesNurb(Nurb *nu, int flag) if(flag==0 || (bezt1->f1 & flag) ) { bezt1->h1= 0; /* distance too short: vectorhandle */ - if( len_v3v3( bezt1->vec[1], bezt0->vec[1] ) < 0.0001) { + if( len_v3v3( bezt1->vec[1], bezt0->vec[1] ) < 0.0001f) { bezt1->h1= HD_VECT; leftsmall= 1; } else { /* aligned handle? */ - if(dist_to_line_v2(bezt1->vec[1], bezt1->vec[0], bezt1->vec[2]) < 0.0001) { + if(dist_to_line_v2(bezt1->vec[1], bezt1->vec[0], bezt1->vec[2]) < 0.0001f) { align= 1; bezt1->h1= HD_ALIGN; } /* or vector handle? */ - if(dist_to_line_v2(bezt1->vec[0], bezt1->vec[1], bezt0->vec[1]) < 0.0001) + if(dist_to_line_v2(bezt1->vec[0], bezt1->vec[1], bezt0->vec[1]) < 0.0001f) bezt1->h1= HD_VECT; } @@ -2720,7 +2720,7 @@ void autocalchandlesNurb(Nurb *nu, int flag) if(flag==0 || (bezt1->f3 & flag) ) { bezt1->h2= 0; /* distance too short: vectorhandle */ - if( len_v3v3( bezt1->vec[1], bezt2->vec[1] ) < 0.0001) { + if( len_v3v3( bezt1->vec[1], bezt2->vec[1] ) < 0.0001f) { bezt1->h2= HD_VECT; rightsmall= 1; } @@ -2729,7 +2729,7 @@ void autocalchandlesNurb(Nurb *nu, int flag) if(align) bezt1->h2= HD_ALIGN; /* or vector handle? */ - if(dist_to_line_v2(bezt1->vec[2], bezt1->vec[1], bezt2->vec[1]) < 0.0001) + if(dist_to_line_v2(bezt1->vec[2], bezt1->vec[1], bezt2->vec[1]) < 0.0001f) bezt1->h2= HD_VECT; } diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 35c4fb5311c..c8e5998774d 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -178,8 +178,8 @@ void addnormalsDispList(ListBase *lb) if(dl->type==DL_INDEX3) { if(dl->nors==NULL) { dl->nors= MEM_callocN(sizeof(float)*3, "dlnors"); - if(dl->verts[2]<0.0) dl->nors[2]= -1.0; - else dl->nors[2]= 1.0; + if(dl->verts[2] < 0.0f) dl->nors[2]= -1.0f; + else dl->nors[2]= 1.0f; } } else if(dl->type==DL_SURF) { @@ -413,10 +413,10 @@ static void fastshade(float *co, float *nor, float *orco, Material *ma, char *co VECCOPY(shi.orn, shi.vn); } if(ma->texco & TEXCO_REFL) { - float inp= 2.0*(shi.vn[2]); + float inp= 2.0f * (shi.vn[2]); shi.ref[0]= (inp*shi.vn[0]); shi.ref[1]= (inp*shi.vn[1]); - shi.ref[2]= (-1.0+inp*shi.vn[2]); + shi.ref[2]= (-1.0f + inp*shi.vn[2]); } } @@ -589,9 +589,7 @@ static void mesh_create_shadedColors(Render *re, Object *ob, int onlyForMesh, un mul_v3_m4v3(vec, mat, mv->co); - vec[0]+= 0.001*vn[0]; - vec[1]+= 0.001*vn[1]; - vec[2]+= 0.001*vn[2]; + mul_v3_v3fl(vec, vn, 0.001f); fastshade_customdata(&dm->faceData, i, j, ma); fastshade(vec, vn, orco?&orco[vidx[j]*3]:mv->co, ma, col1, col2); @@ -1160,7 +1158,7 @@ float calc_taper(Scene *scene, Object *taperobj, int cur, int tot) /* horizontal size */ minx= dl->verts[0]; dx= dl->verts[3*(dl->nr-1)] - minx; - if(dx>0.0) { + if(dx > 0.0f) { fp= dl->verts; for(a=0; anr; a++, fp+=3) { @@ -1741,7 +1739,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba if (!dlbev.first && cu->width==1.0f) { curve_to_displist(cu, nubase, dispbase, forRender); } else { - float widfac= cu->width-1.0; + float widfac= cu->width - 1.0f; BevList *bl= cu->bev.first; Nurb *nu= nubase->first; diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index a5391ee20cc..b1272ee2d53 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1119,7 +1119,7 @@ static float dvar_eval_rotDiff (ChannelDriver *driver, DriverVar *dvar) angle = 2.0f * (saacos(quat[0])); angle= ABS(angle); - return (angle > M_PI) ? (float)((2.0f * M_PI) - angle) : (float)(angle); + return (angle > (float)M_PI) ? (float)((2.0f * (float)M_PI) - angle) : (float)(angle); } /* evaluate 'location difference' driver variable */ @@ -1652,9 +1652,9 @@ static int findzero (float x, float q0, float q1, float q2, float q3, float *o) int nr= 0; c0= q0 - x; - c1= 3.0 * (q1 - q0); - c2= 3.0 * (q0 - 2.0*q1 + q2); - c3= q3 - q0 + 3.0 * (q1 - q2); + c1= 3.0f * (q1 - q0); + c2= 3.0f * (q0 - 2.0f*q1 + q2); + c3= q3 - q0 + 3.0f * (q1 - q2); if (c3 != 0.0) { a= c2/c3; @@ -1670,17 +1670,17 @@ static int findzero (float x, float q0, float q1, float q2, float q3, float *o) t= sqrt(d); o[0]= (float)(sqrt3d(-q+t) + sqrt3d(-q-t) - a); - if ((o[0] >= SMALL) && (o[0] <= 1.000001)) return 1; + if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) return 1; else return 0; } else if (d == 0.0) { t= sqrt3d(-q); o[0]= (float)(2*t - a); - if ((o[0] >= SMALL) && (o[0] <= 1.000001)) nr++; + if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++; o[nr]= (float)(-t-a); - if ((o[nr] >= SMALL) && (o[nr] <= 1.000001)) return nr+1; + if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr+1; else return nr; } else { @@ -1690,13 +1690,13 @@ static int findzero (float x, float q0, float q1, float q2, float q3, float *o) q= sqrt(3 - 3*p*p); o[0]= (float)(2*t*p - a); - if ((o[0] >= SMALL) && (o[0] <= 1.000001)) nr++; + if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++; o[nr]= (float)(-t * (p + q) - a); - if ((o[nr] >= SMALL) && (o[nr] <= 1.000001)) nr++; + if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) nr++; o[nr]= (float)(-t * (p - q) - a); - if ((o[nr] >= SMALL) && (o[nr] <= 1.000001)) return nr+1; + if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr+1; else return nr; } } @@ -1713,22 +1713,22 @@ static int findzero (float x, float q0, float q1, float q2, float q3, float *o) p= sqrt(p); o[0]= (float)((-b-p) / (2 * a)); - if ((o[0] >= SMALL) && (o[0] <= 1.000001)) nr++; + if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++; o[nr]= (float)((-b+p)/(2*a)); - if ((o[nr] >= SMALL) && (o[nr] <= 1.000001)) return nr+1; + if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr+1; else return nr; } else if (p == 0) { o[0]= (float)(-b / (2 * a)); - if ((o[0] >= SMALL) && (o[0] <= 1.000001)) return 1; + if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) return 1; else return 0; } } else if (b != 0.0) { o[0]= (float)(-c/b); - if ((o[0] >= SMALL) && (o[0] <= 1.000001)) return 1; + if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) return 1; else return 0; } else if (c == 0.0) { diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index 1a1b073352e..8f6408f1939 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -161,8 +161,8 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt /* Utility functions for BKE_image_buf_fill_checker_color */ -#define BLEND_FLOAT(real, add) (real+add <= 1.0) ? (real+add) : 1.0 -#define BLEND_CHAR(real, add) ((real + (char)(add * 255.0)) <= 255) ? (real + (char)(add * 255.0)) : 255 +#define BLEND_FLOAT(real, add) (real+add <= 1.0f) ? (real+add) : 1.0f +#define BLEND_CHAR(real, add) ((real + (char)(add * 255.0f)) <= 255) ? (real + (char)(add * 255.0f)) : 255 static int is_pow2(int n) { diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index f8c7a71f210..4b532362cd8 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -422,7 +422,7 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl) t[3]= k1->pos+ofs; k[3]= k1; - if(ofs>2.1+lastpos) break; + if(ofs > 2.1f + lastpos) break; } bsplinetype= 0; @@ -448,7 +448,7 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl) } d= t[2]-t[1]; - if(d==0.0) { + if(d == 0.0f) { if(bsplinetype==0) { return 1; /* both keys equal */ } @@ -649,8 +649,8 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key /* are we going to be nasty? */ if(flagflo) { ktot+= kd; - while(ktot>=1.0) { - ktot-= 1.0; + while(ktot >= 1.0f) { + ktot -= 1.0f; k1+= elemsize; kref+= elemsize; } @@ -953,8 +953,8 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key if(flagdo & 1) { if(flagflo & 1) { k1tot+= k1d; - while(k1tot>=1.0) { - k1tot-= 1.0; + while(k1tot >= 1.0f) { + k1tot -= 1.0f; k1+= elemsize; } } @@ -963,8 +963,8 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key if(flagdo & 2) { if(flagflo & 2) { k2tot+= k2d; - while(k2tot>=1.0) { - k2tot-= 1.0; + while(k2tot >= 1.0f) { + k2tot -= 1.0f; k2+= elemsize; } } @@ -973,8 +973,8 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key if(flagdo & 4) { if(flagflo & 4) { k3tot+= k3d; - while(k3tot>=1.0) { - k3tot-= 1.0; + while(k3tot >= 1.0f) { + k3tot -= 1.0f; k3+= elemsize; } } @@ -983,8 +983,8 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key if(flagdo & 8) { if(flagflo & 8) { k4tot+= k4d; - while(k4tot>=1.0) { - k4tot-= 1.0; + while(k4tot >= 1.0f) { + k4tot -= 1.0f; k4+= elemsize; } } @@ -1473,7 +1473,7 @@ KeyBlock *add_keyblock(Key *key, const char *name) // XXX kb->pos is the confusing old horizontal-line RVK crap in old IPO Editor... if(key->type == KEY_RELATIVE) - kb->pos= curpos+0.1; + kb->pos= curpos + 0.1f; else { #if 0 // XXX old animation system curpos= bsystem_time(scene, 0, (float)CFRA, 0.0); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index b5b872ebf01..3ca5cdb9bb1 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1006,9 +1006,9 @@ void automatname(Material *ma) if(ma->mode & MA_SHLESS) ref= 1.0; else ref= ma->ref; - r= (int)(4.99*(ref*ma->r)); - g= (int)(4.99*(ref*ma->g)); - b= (int)(4.99*(ref*ma->b)); + r= (int)(4.99f*(ref*ma->r)); + g= (int)(4.99f*(ref*ma->g)); + b= (int)(4.99f*(ref*ma->b)); nr= r + 5*g + 25*b; if(nr>124) nr= 124; new_id(&G.main->mat, (ID *)ma, colname_array[nr]); @@ -1174,10 +1174,10 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col) } break; case MA_RAMP_DIFF: - *r = facm*(*r) + fac*fabs(*r-col[0]); + *r = facm*(*r) + fac*fabsf(*r-col[0]); if(g) { - *g = facm*(*g) + fac*fabs(*g-col[1]); - *b = facm*(*b) + fac*fabs(*b-col[2]); + *g = facm*(*g) + fac*fabsf(*g-col[1]); + *b = facm*(*b) + fac*fabsf(*b-col[2]); } break; case MA_RAMP_DARK: diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index dd96736b8c3..e6e32be9634 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -587,13 +587,13 @@ float densfunc(MetaElem *ball, float x, float y, float z) if(ball->flag & MB_NEGATIVE) { dist2= 1.0f-(dist2/ball->rad2); - if(dist2 < 0.0) return 0.5f; + if(dist2 < 0.0f) return 0.5f; return 0.5f-ball->s*dist2*dist2*dist2; } else { dist2= 1.0f-(dist2/ball->rad2); - if(dist2 < 0.0) return -0.5f; + if(dist2 < 0.0f) return -0.5f; return ball->s*dist2*dist2*dist2 -0.5f; } @@ -685,8 +685,8 @@ float metaball(float x, float y, float z) ml_p= ml_p->next; } - dens+= -0.5*(metaball_tree->pos - node->pos); - dens+= 0.5*(metaball_tree->neg - node->neg); + dens+= -0.5f*(metaball_tree->pos - node->pos); + dens+= 0.5f*(metaball_tree->neg - node->neg); } else{ for(a=0; acorners[i]->value > 0.0) index += (1<corners[i]->value > 0.0f) index += (1<next) { INTLIST *edges; @@ -906,7 +906,7 @@ void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, i corn3= old->corners[c3]; corn4= old->corners[c4]; - pos = corn1->value > 0.0 ? 1 : 0; + pos = corn1->value > 0.0f ? 1 : 0; /* test if no surface crossing */ if( (corn2->value > 0) == pos && (corn3->value > 0) == pos && (corn4->value > 0) == pos) return; @@ -1219,9 +1219,9 @@ void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v) v->x = p->function(point->x+delta, point->y, point->z)-f; v->y = p->function(point->x, point->y+delta, point->z)-f; v->z = p->function(point->x, point->y, point->z+delta)-f; - f = (float)sqrt(v->x*v->x + v->y*v->y + v->z*v->z); + f = sqrtf(v->x*v->x + v->y*v->y + v->z*v->z); - if (f != 0.0) { + if (f != 0.0f) { v->x /= f; v->y /= f; v->z /= f; @@ -1230,16 +1230,16 @@ void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v) if(FALSE) { MB_POINT temp; - delta*= 2.0; + delta *= 2.0f; f = p->function(point->x, point->y, point->z); temp.x = p->function(point->x+delta, point->y, point->z)-f; temp.y = p->function(point->x, point->y+delta, point->z)-f; temp.z = p->function(point->x, point->y, point->z+delta)-f; - f = (float)sqrt(temp.x*temp.x + temp.y*temp.y + temp.z*temp.z); + f = sqrtf(temp.x*temp.x + temp.y*temp.y + temp.z*temp.z); - if (f != 0.0) { + if (f != 0.0f) { temp.x /= f; temp.y /= f; temp.z /= f; @@ -1248,9 +1248,9 @@ void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v) v->y+= temp.y; v->z+= temp.z; - f = (float)sqrt(v->x*v->x + v->y*v->y + v->z*v->z); + f = sqrtf(v->x*v->x + v->y*v->y + v->z*v->z); - if (f != 0.0) { + if (f != 0.0f) { v->x /= f; v->y /= f; v->z /= f; @@ -1317,7 +1317,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2, /* Aproximation by linear interpolation is faster then binary subdivision, * but it results sometimes (mb->thresh < 0.2) into the strange results */ - if((mb->thresh >0.2) && (f==1)){ + if((mb->thresh > 0.2f) && (f==1)){ if((dy == 0.0f) && (dz == 0.0f)){ p->x = neg.x - negative*dx/(positive-negative); p->y = neg.y; @@ -1344,7 +1344,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2, while (1) { if (i++ == RES) return; p->x = 0.5f*(pos.x + neg.x); - if ((function(p->x,p->y,p->z)) > 0.0) pos.x = p->x; else neg.x = p->x; + if ((function(p->x,p->y,p->z)) > 0.0f) pos.x = p->x; else neg.x = p->x; } } @@ -1354,7 +1354,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2, while (1) { if (i++ == RES) return; p->y = 0.5f*(pos.y + neg.y); - if ((function(p->x,p->y,p->z)) > 0.0) pos.y = p->y; else neg.y = p->y; + if ((function(p->x,p->y,p->z)) > 0.0f) pos.y = p->y; else neg.y = p->y; } } @@ -1364,7 +1364,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2, while (1) { if (i++ == RES) return; p->z = 0.5f*(pos.z + neg.z); - if ((function(p->x,p->y,p->z)) > 0.0) pos.z = p->z; else neg.z = p->z; + if ((function(p->x,p->y,p->z)) > 0.0f) pos.z = p->z; else neg.z = p->z; } } @@ -1376,7 +1376,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2, if (i++ == RES) return; - if ((function(p->x, p->y, p->z)) > 0.0){ + if ((function(p->x, p->y, p->z)) > 0.0f){ pos.x = p->x; pos.y = p->y; pos.z = p->z; @@ -1437,7 +1437,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a) /* Skip, when Stiffness of MetaElement is too small ... MetaElement can't be * visible alone ... but still can influence others MetaElements :-) */ - if(f > 0.0) { + if(f > 0.0f) { OUT.x = IN.x = in.x= 0.0; OUT.y = IN.y = in.y= 0.0; OUT.z = IN.z = in.z= 0.0; @@ -1495,7 +1495,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a) workp.y = in.y; workp.z = in.z; workp_v = in_v; - max_len = sqrt((out.x-in.x)*(out.x-in.x) + (out.y-in.y)*(out.y-in.y) + (out.z-in.z)*(out.z-in.z)); + max_len = sqrtf((out.x-in.x)*(out.x-in.x) + (out.y-in.y)*(out.y-in.y) + (out.z-in.z)*(out.z-in.z)); nx = abs((out.x - in.x)/mbproc->size); ny = abs((out.y - in.y)/mbproc->size); @@ -1515,7 +1515,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a) /* compute value of implicite function */ tmp_v = mbproc->function(workp.x, workp.y, workp.z); /* add cube to the stack, when value of implicite function crosses zero value */ - if((tmp_v<0.0 && workp_v>=0.0)||(tmp_v>0.0 && workp_v<=0.0)) { + if((tmp_v<0.0f && workp_v>=0.0f)||(tmp_v>0.0f && workp_v<=0.0f)) { /* indexes of CUBE, which includes "first point" */ c_i= (int)floor(workp.x/mbproc->size); @@ -1529,7 +1529,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a) else add_cube(mbproc, c_i, c_j, c_k, 1); } - len = sqrt((workp.x-in.x)*(workp.x-in.x) + (workp.y-in.y)*(workp.y-in.y) + (workp.z-in.z)*(workp.z-in.z)); + len = sqrtf((workp.x-in.x)*(workp.x-in.x) + (workp.y-in.y)*(workp.y-in.y) + (workp.z-in.z)*(workp.z-in.z)); workp_v = tmp_v; } @@ -1627,13 +1627,13 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */ /* when metaball object hase zero scale, then MetaElem ot this MetaBall * will not be put to mainb array */ - if(bob->size[0]==0.0 || bob->size[1]==0.0 || bob->size[2]==0.0) { + if(bob->size[0]==0.0f || bob->size[1]==0.0f || bob->size[2]==0.0f) { zero_size= 1; } else if(bob->parent) { struct Object *pob=bob->parent; while(pob) { - if(pob->size[0]==0.0 || pob->size[1]==0.0 || pob->size[2]==0.0) { + if(pob->size[0]==0.0f || pob->size[1]==0.0f || pob->size[2]==0.0f) { zero_size= 1; break; } @@ -1662,7 +1662,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */ /* too big stiffness seems only ugly due to linear interpolation * no need to have possibility for too big stiffness */ - if(ml->s > 10.0) ml->s = 10.0; + if(ml->s > 10.0f) ml->s = 10.0f; /* Rotation of MetaElem is stored in quat */ quat_to_mat4( temp3,ml->quat); @@ -2228,7 +2228,7 @@ void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase) if(G.moving && mb->flag==MB_UPDATE_HALFRES) width*= 2; } /* nr_cubes is just for safety, minimum is totsize */ - nr_cubes= (int)(0.5+totsize/width); + nr_cubes= (int)(0.5f+totsize/width); /* init process */ mbproc.function = metaball; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 66e9d09fb7e..6f528ec3ea8 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -362,9 +362,9 @@ void tex_space_mesh(Mesh *me) if(me->texflag & AUTOSPACE) { for (a=0; a<3; a++) { - if(size[a]==0.0) size[a]= 1.0; - else if(size[a]>0.0 && size[a]<0.00001) size[a]= 0.00001; - else if(size[a]<0.0 && size[a]> -0.00001) size[a]= -0.00001; + if(size[a]==0.0f) size[a]= 1.0f; + else if(size[a]>0.0f && size[a]<0.00001f) size[a]= 0.00001f; + else if(size[a]<0.0f && size[a]> -0.00001f) size[a]= -0.00001f; } copy_v3_v3(me->loc, loc); @@ -1433,7 +1433,7 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned sub_v2_v2v2(uvdiff, uv2, uv); - if(fabs(uv[0]-uv2[0]) < limit[0] && fabs(uv[1]-uv2[1]) < limit[1]) { + if(fabsf(uv[0]-uv2[0]) < limit[0] && fabsf(uv[1]-uv2[1]) < limit[1]) { if(lastv) lastv->next= next; else vlist= next; iterv->next= newvlist; diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 6694f74cd1e..c02b5dda9ce 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -296,7 +296,7 @@ NlaStrip *add_nlastrip (bAction *act) calc_action_range(strip->act, &strip->actstart, &strip->actend, 0); strip->start = strip->actstart; - strip->end = (IS_EQ(strip->actstart, strip->actend)) ? (strip->actstart + 1.0f): (strip->actend); + strip->end = (IS_EQF(strip->actstart, strip->actend)) ? (strip->actstart + 1.0f): (strip->actend); /* strip should be referenced as-is */ strip->scale= 1.0f; @@ -347,19 +347,20 @@ NlaStrip *add_nlastrip_to_stack (AnimData *adt, bAction *act) */ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short mode) { - float actlength, repeat, scale; + float actlength, scale; + // float repeat; // UNUSED /* get number of repeats */ - if (IS_EQ(strip->repeat, 0.0f)) strip->repeat = 1.0f; - repeat = strip->repeat; + if (IS_EQF(strip->repeat, 0.0f)) strip->repeat = 1.0f; + // repeat = strip->repeat; // UNUSED /* scaling */ - if (IS_EQ(strip->scale, 0.0f)) strip->scale= 1.0f; + if (IS_EQF(strip->scale, 0.0f)) strip->scale= 1.0f; scale = (float)fabs(strip->scale); /* scale must be positive - we've got a special flag for reversing */ /* length of referenced action */ actlength = strip->actend - strip->actstart; - if (IS_EQ(actlength, 0.0f)) actlength = 1.0f; + if (IS_EQF(actlength, 0.0f)) actlength = 1.0f; /* reversed = play strip backwards */ if (strip->flag & NLASTRIP_FLAG_REVERSE) { @@ -371,7 +372,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short return (strip->end + (strip->actstart * scale - cframe)) / scale; } else /* if (mode == NLATIME_CONVERT_EVAL) */{ - if (IS_EQ(cframe, strip->end) && IS_EQ(strip->repeat, ((int)strip->repeat))) { + if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, ((int)strip->repeat))) { /* this case prevents the motion snapping back to the first frame at the end of the strip * by catching the case where repeats is a whole number, which means that the end of the strip * could also be interpreted as the end of the start of a repeat @@ -382,7 +383,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short /* - the 'fmod(..., actlength*scale)' is needed to get the repeats working * - the '/ scale' is needed to ensure that scaling influences the timing within the repeat */ - return strip->actend - fmod(cframe - strip->start, actlength*scale) / scale; + return strip->actend - fmodf(cframe - strip->start, actlength*scale) / scale; } } } @@ -394,7 +395,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short return strip->actstart + (cframe - strip->start) / scale; } else /* if (mode == NLATIME_CONVERT_EVAL) */{ - if (IS_EQ(cframe, strip->end) && IS_EQ(strip->repeat, ((int)strip->repeat))) { + if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, ((int)strip->repeat))) { /* this case prevents the motion snapping back to the first frame at the end of the strip * by catching the case where repeats is a whole number, which means that the end of the strip * could also be interpreted as the end of the start of a repeat @@ -405,7 +406,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short /* - the 'fmod(..., actlength*scale)' is needed to get the repeats working * - the '/ scale' is needed to ensure that scaling influences the timing within the repeat */ - return strip->actstart + fmod(cframe - strip->start, actlength*scale) / scale; + return strip->actstart + fmodf(cframe - strip->start, actlength*scale) / scale; } } } @@ -507,7 +508,7 @@ short BKE_nlastrips_has_space (ListBase *strips, float start, float end) NlaStrip *strip; /* sanity checks */ - if ((strips == NULL) || IS_EQ(start, end)) + if ((strips == NULL) || IS_EQF(start, end)) return 0; if (start > end) { puts("BKE_nlastrips_has_space() error... start and end arguments swapped"); @@ -800,13 +801,13 @@ void BKE_nlameta_flush_transforms (NlaStrip *mstrip) * don't flush if nothing changed yet * TODO: maybe we need a flag to say always flush? */ - if (IS_EQ(oStart, mstrip->start) && IS_EQ(oEnd, mstrip->end)) + if (IS_EQF(oStart, mstrip->start) && IS_EQF(oEnd, mstrip->end)) return; /* check if scale changed */ oLen = oEnd - oStart; nLen = mstrip->end - mstrip->start; - if (IS_EQ(nLen, oLen) == 0) + if (IS_EQF(nLen, oLen) == 0) scaleChanged= 1; /* for each child-strip, calculate new start/end points based on this new info */ @@ -927,7 +928,7 @@ short BKE_nlatrack_has_space (NlaTrack *nlt, float start, float end) * - track must be editable * - bounds cannot be equal (0-length is nasty) */ - if ((nlt == NULL) || (nlt->flag & NLATRACK_PROTECTED) || IS_EQ(start, end)) + if ((nlt == NULL) || (nlt->flag & NLATRACK_PROTECTED) || IS_EQF(start, end)) return 0; if (start > end) { @@ -1044,7 +1045,7 @@ short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max) const float boundsLen= (float)fabs(max - min); /* sanity checks */ - if ((strip == NULL) || IS_EQ(stripLen, 0.0f) || IS_EQ(boundsLen, 0.0f)) + if ((strip == NULL) || IS_EQF(stripLen, 0.0f) || IS_EQF(boundsLen, 0.0f)) return 0; /* only ok if at least part of the strip is within the bounding window @@ -1084,12 +1085,12 @@ void BKE_nlastrip_recalculate_bounds (NlaStrip *strip) /* calculate new length factors */ actlen= strip->actend - strip->actstart; - if (IS_EQ(actlen, 0.0f)) actlen= 1.0f; + if (IS_EQF(actlen, 0.0f)) actlen= 1.0f; mapping= strip->scale * strip->repeat; /* adjust endpoint of strip in response to this */ - if (IS_EQ(mapping, 0.0f) == 0) + if (IS_EQF(mapping, 0.0f) == 0) strip->end = (actlen * mapping) + strip->start; } @@ -1313,11 +1314,11 @@ static void nlastrip_get_endpoint_overlaps (NlaStrip *strip, NlaTrack *track, fl /* if this strip is not part of an island of continuous strips, it can be used * - this check needs to be done for each end of the strip we try and use... */ - if ((nls->next == NULL) || IS_EQ(nls->next->start, nls->end)==0) { + if ((nls->next == NULL) || IS_EQF(nls->next->start, nls->end)==0) { if ((nls->end > strip->start) && (nls->end < strip->end)) *start= &nls->end; } - if ((nls->prev == NULL) || IS_EQ(nls->prev->end, nls->start)==0) { + if ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start)==0) { if ((nls->start < strip->end) && (nls->start > strip->start)) *end= &nls->start; } @@ -1349,7 +1350,7 @@ static void BKE_nlastrip_validate_autoblends (NlaTrack *nlt, NlaStrip *nls) * is directly followed/preceeded by another strip, forming an * 'island' of continuous strips */ - if ( (ps || ns) && ((nls->prev == NULL) || IS_EQ(nls->prev->end, nls->start)==0) ) + if ( (ps || ns) && ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start)==0) ) { /* start overlaps - pick the largest overlap */ if ( ((ps && ns) && (*ps > *ns)) || (ps) ) @@ -1360,7 +1361,7 @@ static void BKE_nlastrip_validate_autoblends (NlaTrack *nlt, NlaStrip *nls) else /* no overlap allowed/needed */ nls->blendin= 0.0f; - if ( (pe || ne) && ((nls->next == NULL) || IS_EQ(nls->next->start, nls->end)==0) ) + if ( (pe || ne) && ((nls->next == NULL) || IS_EQF(nls->next->start, nls->end)==0) ) { /* end overlaps - pick the largest overlap */ if ( ((pe && ne) && (*pe > *ne)) || (pe) ) diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index c0261d3b5a3..e8c4a21d041 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -223,9 +223,9 @@ void init_mapping(TexMapping *texmap) size_to_mat3( smat,texmap->size); - eul[0]= (M_PI/180.0f)*texmap->rot[0]; - eul[1]= (M_PI/180.0f)*texmap->rot[1]; - eul[2]= (M_PI/180.0f)*texmap->rot[2]; + eul[0]= DEG2RADF(texmap->rot[0]); + eul[1]= DEG2RADF(texmap->rot[1]); + eul[2]= DEG2RADF(texmap->rot[2]); eul_to_mat3( rmat,eul); mul_m3_m3m3(mat, rmat, smat); @@ -373,10 +373,10 @@ int do_colorband(ColorBand *coba, float in, float out[4]) out[1]= t[3]*cbd3->g +t[2]*cbd2->g +t[1]*cbd1->g +t[0]*cbd0->g; out[2]= t[3]*cbd3->b +t[2]*cbd2->b +t[1]*cbd1->b +t[0]*cbd0->b; out[3]= t[3]*cbd3->a +t[2]*cbd2->a +t[1]*cbd1->a +t[0]*cbd0->a; - CLAMP(out[0], 0.0, 1.0); - CLAMP(out[1], 0.0, 1.0); - CLAMP(out[2], 0.0, 1.0); - CLAMP(out[3], 0.0, 1.0); + CLAMP(out[0], 0.0f, 1.0f); + CLAMP(out[1], 0.0f, 1.0f); + CLAMP(out[2], 0.0f, 1.0f); + CLAMP(out[3], 0.0f, 1.0f); } else { -- cgit v1.2.3