From a73c3fe5c992777718431d5e5bb5f8a2c3b7a1bc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 27 Mar 2011 17:22:04 +0000 Subject: subsurf, derived mesh and other misc files: floats were being implicitly promoted to doubles, adjust to use floats. --- source/blender/blenkernel/intern/CCGSubSurf.c | 58 +++++++++++----------- source/blender/blenkernel/intern/DerivedMesh.c | 14 ++---- source/blender/blenkernel/intern/anim.c | 2 +- source/blender/blenkernel/intern/anim_sys.c | 4 +- source/blender/blenkernel/intern/lattice.c | 14 +++--- source/blender/blenkernel/intern/object.c | 36 +++++++------- source/blender/editors/animation/anim_draw.c | 6 +-- source/blender/editors/animation/fmodifier_ui.c | 2 +- source/blender/editors/animation/keyframes_draw.c | 6 +-- source/blender/editors/animation/keyframes_edit.c | 6 +-- source/blender/editors/armature/editarmature.c | 8 +-- source/blender/editors/gpencil/drawgpencil.c | 2 +- source/blender/editors/screen/area.c | 2 +- source/blender/editors/screen/screen_edit.c | 7 ++- source/blender/editors/sculpt_paint/sculpt.c | 16 +++--- source/blender/editors/space_file/file_draw.c | 2 +- source/blender/editors/space_file/filesel.c | 4 +- source/blender/editors/space_graph/graph_edit.c | 10 ++-- source/blender/editors/space_image/image_draw.c | 4 +- source/blender/editors/space_image/image_ops.c | 2 +- source/blender/editors/space_image/space_image.c | 2 +- source/blender/editors/space_info/info_ops.c | 4 +- source/blender/editors/space_nla/nla_draw.c | 12 ++--- .../editors/space_sequencer/sequencer_edit.c | 2 +- source/blender/editors/space_text/text_draw.c | 2 +- source/blender/editors/util/ed_util.c | 6 +-- source/blender/makesrna/intern/rna_access.c | 12 ++--- source/blender/windowmanager/intern/wm_operators.c | 6 +-- source/blender/windowmanager/intern/wm_subwindow.c | 12 ++--- 29 files changed, 129 insertions(+), 134 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index c682b189ae8..2cfd17a95f3 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -229,9 +229,9 @@ static int VertDataEqual(float *a, float *b) { #define VertDataAvg4(tv, av, bv, cv, dv) \ { \ float *_t = (float*) tv, *_a = (float*) av, *_b = (float*) bv, *_c = (float*) cv, *_d = (float*) dv; \ - _t[0] = (_a[0]+_b[0]+_c[0]+_d[0])*.25; \ - _t[1] = (_a[1]+_b[1]+_c[1]+_d[1])*.25; \ - _t[2] = (_a[2]+_b[2]+_c[2]+_d[2])*.25; \ + _t[0] = (_a[0]+_b[0]+_c[0]+_d[0])*.25f; \ + _t[1] = (_a[1]+_b[1]+_c[1]+_d[1])*.25f; \ + _t[2] = (_a[2]+_b[2]+_c[2]+_d[2])*.25f; \ } #define NormZero(av) { float *_a = (float*) av; _a[0] = _a[1] = _a[2] = 0.0f; } #define NormCopy(av, bv) { float *_a = (float*) av, *_b = (float*) bv; _a[0] =_b[0]; _a[1] =_b[1]; _a[2] =_b[2]; } @@ -507,9 +507,9 @@ static float EDGE_getSharpness(CCGEdge *e, int lvl) { if (!lvl) return e->crease; else if (!e->crease) - return 0.0; - else if (e->crease - lvl < 0.0) - return 0.0; + return 0.0f; + else if (e->crease - lvl < 0.0f) + return 0.0f; else return e->crease - lvl; } @@ -1447,7 +1447,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss, float sharpness = EDGE_getSharpness(e, curLvl); int x, j; - if (_edge_isBoundary(e) || sharpness>1.0) { + if (_edge_isBoundary(e) || sharpness > 1.0f) { for (x=0; x1.0) { - avgSharpness = 1.0; + if (avgSharpness > 1.0f) { + avgSharpness = 1.0f; } } @@ -1542,7 +1542,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss, } VertDataCopy(nCo, co); - VertDataMulN(nCo, 0.75); + VertDataMulN(nCo, 0.75f); VertDataMulN(r, 0.25f/numBoundary); VertDataAdd(nCo, r); } else { @@ -1587,7 +1587,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss, if (seam) { if (_edge_isBoundary(e)) VertDataAdd(q, _edge_getCoVert(e, v, curLvl, 1, vertDataSize)); - } else if (sharpness != 0.0) { + } else if (sharpness != 0.0f) { VertDataAdd(q, _edge_getCoVert(e, v, curLvl, 1, vertDataSize)); } } @@ -1604,8 +1604,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss, // r = co*.75 + q*.25 VertDataCopy(r, co); - VertDataMulN(r, .75); - VertDataMulN(q, .25); + VertDataMulN(r, .75f); + VertDataMulN(q, .25f); VertDataAdd(r, q); // nCo = nCo + (r-nCo)*avgSharpness @@ -1631,8 +1631,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss, sharpCount = 2; avgSharpness += sharpness; - if (avgSharpness>1.0) { - avgSharpness = 1.0; + if (avgSharpness > 1.0f) { + avgSharpness = 1.0f; } } else { sharpCount = 0; @@ -1646,10 +1646,10 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss, void *nCo = EDGE_getCo(e, nextLvl, fx); VertDataCopy(r, EDGE_getCo(e, curLvl, x-1)); VertDataAdd(r, EDGE_getCo(e, curLvl, x+1)); - VertDataMulN(r, 0.5); + VertDataMulN(r, 0.5f); VertDataCopy(nCo, co); - VertDataMulN(nCo, 0.75); - VertDataMulN(r, 0.25); + VertDataMulN(nCo, 0.75f); + VertDataMulN(r, 0.25f); VertDataAdd(nCo, r); } } else { @@ -1671,8 +1671,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss, VertDataAdd(r, _face_getIFCoEdge(f, e, curLvl, x, 1, subdivLevels, vertDataSize)); numFaces++; } - VertDataMulN(q, 1.0/(numFaces*2.0f)); - VertDataMulN(r, 1.0/(2.0f + numFaces)); + VertDataMulN(q, 1.0f/(numFaces*2.0f)); + VertDataMulN(r, 1.0f/(2.0f + numFaces)); VertDataCopy(nCo, co); VertDataMulN(nCo, (float) numFaces); @@ -1895,7 +1895,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { void *co = EDGE_getCo(e, nextLvl, 1); float sharpness = EDGE_getSharpness(e, curLvl); - if (_edge_isBoundary(e) || sharpness>=1.0) { + if (_edge_isBoundary(e) || sharpness >= 1.0f) { VertDataCopy(co, VERT_getCo(e->v0, curLvl)); VertDataAdd(co, VERT_getCo(e->v1, curLvl)); VertDataMulN(co, 0.5f); @@ -1947,8 +1947,8 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { if(sharpCount) { avgSharpness /= sharpCount; - if (avgSharpness>1.0) { - avgSharpness = 1.0; + if (avgSharpness > 1.0f) { + avgSharpness = 1.0f; } } @@ -1969,7 +1969,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { } } VertDataCopy(nCo, co); - VertDataMulN(nCo, 0.75); + VertDataMulN(nCo, 0.75f); VertDataMulN(r, 0.25f/numBoundary); VertDataAdd(nCo, r); } else { @@ -2015,7 +2015,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { CCGVert *oV = _edge_getOtherVert(e, v); VertDataAdd(q, VERT_getCo(oV, curLvl)); } - } else if (sharpness != 0.0) { + } else if (sharpness != 0.0f) { CCGVert *oV = _edge_getOtherVert(e, v); VertDataAdd(q, VERT_getCo(oV, curLvl)); } @@ -2033,8 +2033,8 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { // r = co*.75 + q*.25 VertDataCopy(r, co); - VertDataMulN(r, .75); - VertDataMulN(q, .25); + VertDataMulN(r, 0.75f); + VertDataMulN(q, 0.25f); VertDataAdd(r, q); // nCo = nCo + (r-nCo)*avgSharpness diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 987f70e67ca..b0a1e74c30f 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1123,9 +1123,7 @@ static void emDM_getVert(DerivedMesh *dm, int index, MVert *vert_r) VECCOPY(vert_r->co, ev->co); - vert_r->no[0] = ev->no[0] * 32767.0; - vert_r->no[1] = ev->no[1] * 32767.0; - vert_r->no[2] = ev->no[2] * 32767.0; + normal_float_to_short_v3(vert_r->no, ev->no); /* TODO what to do with vert_r->flag? */ vert_r->bweight = (unsigned char) (ev->bweight*255.0f); @@ -1220,9 +1218,7 @@ static void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r) else copy_v3_v3(vert_r->co, ev->co); - vert_r->no[0] = ev->no[0] * 32767.0; - vert_r->no[1] = ev->no[1] * 32767.0; - vert_r->no[2] = ev->no[2] * 32767.0; + normal_float_to_short_v3(vert_r->no, ev->no); /* TODO what to do with vert_r->flag? */ vert_r->flag = 0; @@ -1425,7 +1421,7 @@ DerivedMesh *editmesh_get_derived(EditMesh *em, float (*vertexCos)[3]) float *no = emdm->vertexNos[i]; /* following Mesh convention; we use vertex coordinate itself * for normal in this case */ - if (normalize_v3(no)==0.0) { + if (normalize_v3(no) == 0.0f) { normalize_v3_v3(no, vertexCos[i]); } } @@ -1596,12 +1592,12 @@ void weight_to_rgb(float input, float *fr, float *fg, float *fb) *fg= blend; *fb= blend*(1.0f-((input-0.25f)*4.0f)); } - else if (input<=0.75){ // green->yellow + else if (input <= 0.75f){ // green->yellow *fr= blend * ((input-0.50f)*4.0f); *fg= blend; *fb= 0.0f; } - else if (input<=1.0){ // yellow->red + else if (input <= 1.0f){ // yellow->red *fr= blend; *fg= blend * (1.0f-((input-0.75f)*4.0f)); *fb= 0.0f; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 2e1fbf2917a..e12ec559f4b 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1125,7 +1125,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa /* scale */ if(par->transflag & OB_DUPLIFACES_SCALE) { float size= v4? area_quad_v3(v1, v2, v3, v4): area_tri_v3(v1, v2, v3); - size= sqrt(size) * par->dupfacesca; + size= sqrtf(size) * par->dupfacesca; mul_m3_fl(mat, size); } diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index b4adaa0ab07..6e933ddd386 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1905,7 +1905,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime) /* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */ calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1); dummy_strip.start = dummy_strip.actstart; - dummy_strip.end = (IS_EQ(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f): (dummy_strip.actend); + dummy_strip.end = (IS_EQF(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f): (dummy_strip.actend); dummy_strip.blendmode= adt->act_blendmode; dummy_strip.extendmode= adt->act_extendmode; @@ -2072,7 +2072,7 @@ void BKE_animsys_evaluate_animdata (ID *id, AnimData *adt, float ctime, short re void BKE_animsys_evaluate_all_animation (Main *main, float ctime) { ID *id; - + if (G.f & G_DEBUG) printf("Evaluate all animation - %f \n", ctime); diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 091c4a2fe50..f66afff0741 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -412,7 +412,7 @@ void calc_latt_deform(Object *ob, float *co, float weight) for(ww= wi-1; ww<=wi+2; ww++) { w= tw[ww-wi+1]; - if(w!=0.0) { + if(w != 0.0f) { if(ww>0) { if(wwpntsw) idx_w= ww*lt->pntsu*lt->pntsv; else idx_w= (lt->pntsw-1)*lt->pntsu*lt->pntsv; @@ -422,7 +422,7 @@ void calc_latt_deform(Object *ob, float *co, float weight) for(vv= vi-1; vv<=vi+2; vv++) { v= w*tv[vv-vi+1]; - if(v!=0.0) { + if(v != 0.0f) { if(vv>0) { if(vvpntsv) idx_v= idx_w + vv*lt->pntsu; else idx_v= idx_w + (lt->pntsv-1)*lt->pntsu; @@ -432,7 +432,7 @@ void calc_latt_deform(Object *ob, float *co, float weight) for(uu= ui-1; uu<=ui+2; uu++) { u= weight*v*tu[uu-ui+1]; - if(u!=0.0) { + if(u != 0.0f) { if(uu>0) { if(uupntsu) idx_u= idx_v + uu; else idx_u= idx_v + (lt->pntsu-1); @@ -508,7 +508,7 @@ static int where_on_path_deform(Object *ob, float ctime, float *vec, float *dir, if(bl && bl->poly> -1) cycl= 1; if(cycl==0) { - ctime1= CLAMPIS(ctime, 0.0, 1.0); + ctime1= CLAMPIS(ctime, 0.0f, 1.0f); } else ctime1= ctime; @@ -519,16 +519,16 @@ static int where_on_path_deform(Object *ob, float ctime, float *vec, float *dir, Path *path= cu->path; float dvec[3]; - if(ctime < 0.0) { + if(ctime < 0.0f) { sub_v3_v3v3(dvec, path->data[1].vec, path->data[0].vec); mul_v3_fl(dvec, ctime*(float)path->len); add_v3_v3(vec, dvec); if(quat) copy_qt_qt(quat, path->data[0].quat); if(radius) *radius= path->data[0].radius; } - else if(ctime > 1.0) { + else if(ctime > 1.0f) { sub_v3_v3v3(dvec, path->data[path->len-1].vec, path->data[path->len-2].vec); - mul_v3_fl(dvec, (ctime-1.0)*(float)path->len); + mul_v3_fl(dvec, (ctime-1.0f)*(float)path->len); add_v3_v3(vec, dvec); if(quat) copy_qt_qt(quat, path->data[path->len-1].quat); if(radius) *radius= path->data[path->len-1].radius; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 0348d188a7d..ca31cd1b0b1 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1814,19 +1814,19 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4]) * we divide the curvetime calculated in the previous step by the length of the path, to get a time * factor, which then gets clamped to lie within 0.0 - 1.0 range */ - if (IS_EQ(cu->pathlen, 0.0f) == 0) + if (IS_EQF(cu->pathlen, 0.0f) == 0) ctime= cu->ctime / cu->pathlen; else ctime= cu->ctime; - - CLAMP(ctime, 0.0, 1.0); + + CLAMP(ctime, 0.0f, 1.0f); } else { ctime= scene->r.cfra - give_timeoffset(ob); - if (IS_EQ(cu->pathlen, 0.0f) == 0) + if (IS_EQF(cu->pathlen, 0.0f) == 0) ctime /= cu->pathlen; - CLAMP(ctime, 0.0, 1.0); + CLAMP(ctime, 0.0f, 1.0f); } /* time calculus is correct, now apply distance offset */ @@ -2332,9 +2332,9 @@ void object_get_dimensions(Object *ob, float *value) mat4_to_size( scale,ob->obmat); - value[0] = fabs(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]); - value[1] = fabs(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]); - value[2] = fabs(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]); + value[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]); + value[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]); + value[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]); } else { value[0] = value[1] = value[2] = 0.f; } @@ -2853,18 +2853,18 @@ void object_camera_matrix( } else if(camera->type==OB_LAMP) { Lamp *la= camera->data; - float fac= cos( M_PI*la->spotsize/360.0 ); + float fac= cosf((float)M_PI*la->spotsize/360.0f); float phi= acos(fac); - (*lens)= 16.0*fac/sin(phi); + (*lens)= 16.0f*fac/sinf(phi); if((*lens)==0.0f) - (*lens)= 35.0; + (*lens)= 35.0f; (*clipsta)= la->clipsta; (*clipend)= la->clipend; } else { /* envmap exception... */; if((*lens)==0.0f) - (*lens)= 16.0; + (*lens)= 16.0f; if((*clipsta)==0.0f || (*clipend)==0.0f) { (*clipsta)= 0.1f; @@ -2884,8 +2884,8 @@ void object_camera_matrix( pixsize= cam->ortho_scale/viewfac; } else { - if(rd->xasp*winx >= rd->yasp*winy) viewfac= ((*lens) * winx)/32.0; - else viewfac= (*ycor) * ((*lens) * winy)/32.0; + if(rd->xasp*winx >= rd->yasp*winy) viewfac= ((*lens) * winx)/32.0f; + else viewfac= (*ycor) * ((*lens) * winy)/32.0f; pixsize= (*clipsta) / viewfac; } @@ -2898,12 +2898,12 @@ void object_camera_matrix( if(field_second) { if(rd->mode & R_ODDFIELD) { - viewplane->ymin-= 0.5 * (*ycor); - viewplane->ymax-= 0.5 * (*ycor); + viewplane->ymin-= 0.5f * (*ycor); + viewplane->ymax-= 0.5f * (*ycor); } else { - viewplane->ymin+= 0.5 * (*ycor); - viewplane->ymax+= 0.5 * (*ycor); + viewplane->ymin+= 0.5f * (*ycor); + viewplane->ymax+= 0.5f * (*ycor); } } /* the window matrix is used for clipping, and not changed during OSA steps */ diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index d0fa540a9dd..9c923d3492b 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -100,7 +100,7 @@ void ANIM_timecode_string_from_frame (char *str, Scene *scene, int power, short * to cope with 'half' frames, etc., which should be fine in most cases */ seconds= (int)cfra; - frames= (int)floor( ((cfra - seconds) * FPS) + 0.5f ); + frames= (int)floor( (((double)cfra - (double)seconds) * FPS) + 0.5 ); } else { /* seconds (with pixel offset rounding) */ @@ -399,9 +399,9 @@ float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short res /* if the radians flag is not set, default to using degrees which need conversions */ if ((scene) && (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS) == 0) { if (restore) - return M_PI / 180.0f; /* degrees to radians */ + return M_PI / 180.0; /* degrees to radians */ else - return 180.0f / M_PI; /* radians to degrees */ + return 180.0 / M_PI; /* radians to degrees */ } } diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index d14ebc2c7bb..85063be852d 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -301,7 +301,7 @@ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short /* --------------- */ -#define BINARYSEARCH_FRAMEEQ_THRESH 0.0001 +#define BINARYSEARCH_FRAMEEQ_THRESH 0.0001f /* Binary search algorithm for finding where to insert Envelope Data Point. * Returns the index to insert at (data already at that index will be offset if replace is 0) diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 662f038fd6e..c4108e0ce33 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -360,9 +360,9 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree, * -> secondly, handles which control that section of the curve must be constant */ if ((!prev) || (!beztn)) return; - if (IS_EQ(beztn->vec[1][1], prev->vec[1][1])==0) return; - if (IS_EQ(beztn->vec[1][1], beztn->vec[0][1])==0) return; - if (IS_EQ(prev->vec[1][1], prev->vec[2][1])==0) return; + if (IS_EQF(beztn->vec[1][1], prev->vec[1][1])==0) return; + if (IS_EQF(beztn->vec[1][1], beztn->vec[0][1])==0) return; + if (IS_EQF(prev->vec[1][1], prev->vec[2][1])==0) return; /* if there are no blocks already, just add as root */ diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index a2b5e2b1c8d..1ce05573e85 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -537,7 +537,7 @@ static short ok_bezier_frame(KeyframeEditData *ked, BezTriple *bezt) short ok = 0; /* frame is stored in f1 property (this float accuracy check may need to be dropped?) */ - #define KEY_CHECK_OK(_index) IS_EQ(bezt->vec[_index][0], ked->f1) + #define KEY_CHECK_OK(_index) IS_EQF(bezt->vec[_index][0], ked->f1) KEYFRAME_OK_CHECKS(KEY_CHECK_OK); #undef KEY_CHECK_OK @@ -577,7 +577,7 @@ static short ok_bezier_value(KeyframeEditData *ked, BezTriple *bezt) * - this float accuracy check may need to be dropped? * - should value be stored in f2 instead so that we won't have conflicts when using f1 for frames too? */ - #define KEY_CHECK_OK(_index) IS_EQ(bezt->vec[_index][1], ked->f1) + #define KEY_CHECK_OK(_index) IS_EQF(bezt->vec[_index][1], ked->f1) KEYFRAME_OK_CHECKS(KEY_CHECK_OK); #undef KEY_CHECK_OK @@ -697,7 +697,7 @@ void bezt_remap_times(KeyframeEditData *ked, BezTriple *bezt) static short snap_bezier_nearest(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) - bezt->vec[1][0]= (float)(floor(bezt->vec[1][0]+0.5)); + bezt->vec[1][0]= (float)(floorf(bezt->vec[1][0]+0.5f)); return 0; } diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 1709d8cb085..4e77cebf27d 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2127,7 +2127,7 @@ float ED_rollBoneToVector(EditBone *bone, const float align_axis[3], const short sub_v3_v3v3(align_axis_proj, align_axis, vec); if(axis_only) { - if(angle_v3v3(align_axis_proj, mat[2]) > M_PI/2) { + if(angle_v3v3(align_axis_proj, mat[2]) > (float)(M_PI/2.0)) { negate_v3(align_axis_proj); } } @@ -4704,14 +4704,14 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i bone->rad_head * scale, bone->rad_tail * scale, bone->dist * scale); /* add the vert to the deform group if weight!=0.0 */ - if (distance!=0.0) + if (distance != 0.0f) ED_vgroup_vert_add (ob, dgroup, i, distance, WEIGHT_REPLACE); else ED_vgroup_vert_remove (ob, dgroup, i); /* do same for mirror */ if (dgroupflip && dgroupflip[j] && iflip >= 0) { - if (distance!=0.0) + if (distance != 0.0f) ED_vgroup_vert_add (ob, dgroupflip[j], iflip, distance, WEIGHT_REPLACE); else @@ -4960,7 +4960,7 @@ static void pchan_clear_rot(bPoseChannel *pchan) pchan->rotAxis[2]= 0.0f; /* check validity of axis - axis should never be 0,0,0 (if so, then we make it rotate about y) */ - if (IS_EQ(pchan->rotAxis[0], pchan->rotAxis[1]) && IS_EQ(pchan->rotAxis[1], pchan->rotAxis[2])) + if (IS_EQF(pchan->rotAxis[0], pchan->rotAxis[1]) && IS_EQF(pchan->rotAxis[1], pchan->rotAxis[2])) pchan->rotAxis[1] = 1.0f; } else if (pchan->rotmode == ROT_MODE_QUAT) { diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 8d41ed5fec1..276f60bdf7f 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -384,7 +384,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness_s mt[1]= mb[1] * pthick; athick= len_v2(mt); dfac= pthick - (athick * 2); - if ( ((athick * 2.0f) < pthick) && (IS_EQ(athick, pthick)==0) ) + if ( ((athick * 2.0f) < pthick) && (IS_EQF(athick, pthick)==0) ) { mt[0] += (mb[0] * dfac); mt[1] += (mb[1] * dfac); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index f272352c183..aca9a401321 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -107,7 +107,7 @@ void ED_region_pixelspace(ARegion *ar) int width= ar->winrct.xmax-ar->winrct.xmin+1; int height= ar->winrct.ymax-ar->winrct.ymin+1; - wmOrtho2(-0.375, (float)width-0.375, -0.375, (float)height-0.375); + wmOrtho2(-0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f); glLoadIdentity(); } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 41354c83cec..a40c62360c9 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -324,8 +324,7 @@ static short testsplitpoint(ScrArea *sa, char dir, float fac) if(dir=='h' && (sa->v2->vec.y- sa->v1->vec.y <= 2*AREAMINY)) return 0; // to be sure - if(fac<0.0) fac= 0.0; - if(fac>1.0) fac= 1.0; + CLAMP(fac, 0.0f, 1.0f); if(dir=='h') { y= sa->v1->vec.y+ fac*(sa->v2->vec.y- sa->v1->vec.y); @@ -654,14 +653,14 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) /* FIXME, this resizing logic is no good when resizing the window + redrawing [#24428] * need some way to store these as floats internally and re-apply from there. */ tempf= ((float)sv->vec.x)*facx; - sv->vec.x= (short)(tempf+0.5); + sv->vec.x= (short)(tempf+0.5f); sv->vec.x+= AREAGRID-1; sv->vec.x-= (sv->vec.x % AREAGRID); CLAMP(sv->vec.x, 0, winsizex); tempf= ((float)sv->vec.y)*facy; - sv->vec.y= (short)(tempf+0.5); + sv->vec.y= (short)(tempf+0.5f); sv->vec.y+= AREAGRID-1; sv->vec.y-= (sv->vec.y % AREAGRID); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 1428a9a9075..1d818818908 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -537,8 +537,8 @@ static float calc_overlap(StrokeCache *cache, const char symm, const char axis, //distsq = len_squared_v3v3(mirror, cache->traced_location); distsq = len_squared_v3v3(mirror, cache->true_location); - if (distsq <= 4*(cache->radius_squared)) - return (2*(cache->radius) - sqrt(distsq)) / (2*(cache->radius)); + if (distsq <= 4.0f*(cache->radius_squared)) + return (2.0f*(cache->radius) - sqrtf(distsq)) / (2.0f*(cache->radius)); else return 0; } @@ -731,12 +731,12 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa /* it is probably worth optimizing for those cases where the texture is not rotated by skipping the calls to atan2, sqrtf, sin, and cos. */ - if (rotation > 0.001 || rotation < -0.001) { - const float angle = atan2(y, x) + rotation; + if (rotation > 0.001f || rotation < -0.001f) { + const float angle = atan2f(y, x) + rotation; const float flen = sqrtf(x*x + y*y); - x = flen * cos(angle); - y = flen * sin(angle); + x = flen * cosf(angle); + y = flen * sinf(angle); } x *= br->mtex.size[0]; @@ -798,7 +798,7 @@ static void sculpt_clip(Sculpt *sd, SculptSession *ss, float *co, const float va if(sd->flags & (SCULPT_LOCK_X << i)) continue; - if((ss->cache->flag & (CLIP_X << i)) && (fabs(co[i]) <= ss->cache->clip_tolerance[i])) + if((ss->cache->flag & (CLIP_X << i)) && (fabsf(co[i]) <= ss->cache->clip_tolerance[i])) co[i]= 0.0f; else co[i]= val[i]; @@ -3135,7 +3135,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, st (brush->flag & BRUSH_RANDOM_ROTATION) && !(brush->flag & BRUSH_RAKE)) { - cache->special_rotation = 2*M_PI*BLI_frand(); + cache->special_rotation = 2.0f*(float)M_PI*BLI_frand(); } } diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 4f523f0ca76..22bf99053e8 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -309,7 +309,7 @@ static void file_draw_string(int sx, int sy, const char* string, float width, in fs.align = align; BLI_strncpy(fname,string, FILE_MAXFILE); - file_shorten_string(fname, width+1.0, 0); + file_shorten_string(fname, width + 1.0f, 0); /* no text clipping needed, uiStyleFontDraw does it but is a bit too strict (for buttons it works) */ rect.xmin = sx; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 22f15b76dd3..0e61d30cccd 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -248,11 +248,11 @@ int ED_fileselect_layout_numfiles(FileLayout* layout, struct ARegion *ar) if (layout->flag & FILE_LAYOUT_HOR) { int width = ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*layout->tile_border_x; - numfiles = (float)width/(float)layout->tile_w+0.5; + numfiles = (float)width/(float)layout->tile_w + 0.5f; return numfiles*layout->rows; } else { int height = ar->v2d.cur.ymax - ar->v2d.cur.ymin - 2*layout->tile_border_y; - numfiles = (float)height/(float)layout->tile_h+0.5; + numfiles = (float)height/(float)layout->tile_h + 0.5f; return numfiles*layout->columns; } } diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index deffc60019e..1bb6e6f6edb 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -128,8 +128,8 @@ void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, flo } /* ensure that the extents are not too extreme that view implodes...*/ - if ((xmin && xmax) && (fabs(*xmax - *xmin) < 0.1)) *xmax += 0.1; - if ((ymin && ymax) && (fabs(*ymax - *ymin) < 0.1)) *ymax += 0.1; + if ((xmin && xmax) && (fabsf(*xmax - *xmin) < 0.1f)) *xmax += 0.1f; + if ((ymin && ymax) && (fabsf(*ymax - *ymin) < 0.1f)) *ymax += 0.1f; /* free memory */ BLI_freelistN(&anim_data); @@ -1621,17 +1621,17 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op) /* > 180 degree flip? */ if (fabs(prev->vec[1][1] - bezt->vec[1][1]) >= M_PI) { /* 360 degrees to add/subtract frame value until difference is acceptably small that there's no more flip */ - const double fac = 2.0 * M_PI; + const float fac = 2.0f * (float)M_PI; if (prev->vec[1][1] > bezt->vec[1][1]) { - while (fabs(bezt->vec[1][1] - prev->vec[1][1]) >= M_PI) { + while (fabsf(bezt->vec[1][1] - prev->vec[1][1]) >= (float)M_PI) { bezt->vec[0][1] += fac; bezt->vec[1][1] += fac; bezt->vec[2][1] += fac; } } else /* if (prev->vec[1][1] < bezt->vec[1][1]) */ { - while (fabs(bezt->vec[1][1] - prev->vec[1][1]) >= M_PI) { + while (fabsf(bezt->vec[1][1] - prev->vec[1][1]) >= (float)M_PI) { bezt->vec[0][1] -= fac; bezt->vec[1][1] -= fac; bezt->vec[2][1] -= fac; diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 3e028607172..4f2e68bb216 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -205,8 +205,8 @@ static void draw_image_grid(ARegion *ar, float zoomx, float zoomy) } /* the fine resolution level */ - blendfac= 0.25*gridsize - floor(0.25f*gridsize); - CLAMP(blendfac, 0.0, 1.0); + blendfac= 0.25f*gridsize - floorf(0.25f*gridsize); + CLAMP(blendfac, 0.0f, 1.0f); UI_ThemeColorShade(TH_BACK, (int)(20.0f*(1.0f-blendfac))); fac= 0.0f; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 56b5ed10c56..c560b68c01b 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -372,7 +372,7 @@ static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event) ARegion *ar= CTX_wm_region(C); float factor; - factor= 1.0 + (event->x-event->prevx+event->y-event->prevy)/300.0f; + factor= 1.0f + (event->x-event->prevx+event->y-event->prevy)/300.0f; RNA_float_set(op->ptr, "factor", factor); sima_zoom_set(sima, ar, sima->zoom*factor); ED_region_tag_redraw(CTX_wm_region(C)); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 1d643ba1a89..451e0e6e89b 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -204,7 +204,7 @@ void ED_image_aspect(Image *ima, float *aspx, float *aspy) *aspx= *aspy= 1.0; if((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) || - (ima->aspx==0.0 || ima->aspy==0.0)) + (ima->aspx==0.0f || ima->aspy==0.0f)) return; /* x is always 1 */ diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 5d3f3314bd9..701b0fc1de7 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -362,7 +362,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm return (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH); } - if (rti->widthfac == 0.0) { + if (rti->widthfac == 0.0f) { /* initialise colors based on report type */ if(report->type & RPT_ERROR_ALL) { rti->col[0] = 1.0; @@ -396,7 +396,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm /* collapse report at end of timeout */ if (progress*timeout > timeout - COLLAPSE_TIMEOUT) { rti->widthfac = (progress*timeout - (timeout - COLLAPSE_TIMEOUT)) / COLLAPSE_TIMEOUT; - rti->widthfac = 1.0 - rti->widthfac; + rti->widthfac = 1.0f - rti->widthfac; send_note= 1; } diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 8848d4be76f..e830a421a59 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -255,10 +255,10 @@ static void nla_draw_strip_curves (NlaStrip *strip, float yminc, float ymaxc) } else { /* use blend in/out values only if both aren't zero */ - if ((IS_EQ(strip->blendin, 0.0f) && IS_EQ(strip->blendout, 0.0f))==0) { + if ((IS_EQF(strip->blendin, 0.0f) && IS_EQF(strip->blendout, 0.0f))==0) { glBegin(GL_LINE_STRIP); /* start of strip - if no blendin, start straight at 1, otherwise from 0 to 1 over blendin frames */ - if (IS_EQ(strip->blendin, 0.0f) == 0) { + if (IS_EQF(strip->blendin, 0.0f) == 0) { glVertex2f(strip->start, yminc); glVertex2f(strip->start + strip->blendin, ymaxc); } @@ -266,7 +266,7 @@ static void nla_draw_strip_curves (NlaStrip *strip, float yminc, float ymaxc) glVertex2f(strip->start, ymaxc); /* end of strip */ - if (IS_EQ(strip->blendout, 0.0f) == 0) { + if (IS_EQF(strip->blendout, 0.0f) == 0) { glVertex2f(strip->end - strip->blendout, ymaxc); glVertex2f(strip->end, yminc); } @@ -321,7 +321,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *UNUSED(nlt) /* this only draws after the strip */ case NLASTRIP_EXTEND_HOLD_FORWARD: /* only need to try and draw if the next strip doesn't occur immediately after */ - if ((strip->next == NULL) || (IS_EQ(strip->next->start, strip->end)==0)) { + if ((strip->next == NULL) || (IS_EQF(strip->next->start, strip->end)==0)) { /* set the drawing color to the color of the strip, but this time less faint */ glColor4f(color[0], color[1], color[2], 0.3f); @@ -378,7 +378,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *UNUSED(nlt) uiDrawBoxShade(GL_LINE_LOOP, strip->start, yminc, strip->end, ymaxc, 0.0, 0.0, 0.1); /* if action-clip strip, draw lines delimiting repeats too (in the same color as outline) */ - if ((strip->type == NLASTRIP_TYPE_CLIP) && IS_EQ(strip->repeat, 1.0f)==0) { + if ((strip->type == NLASTRIP_TYPE_CLIP) && IS_EQF(strip->repeat, 1.0f)==0) { float repeatLen = (strip->actend - strip->actstart) * strip->scale; int i; @@ -403,7 +403,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *UNUSED(nlt) /* draw start-line if not same as end of previous (and only if not the first strip) * - on upper half of strip */ - if ((cs->prev) && IS_EQ(cs->prev->end, cs->start)==0) + if ((cs->prev) && IS_EQF(cs->prev->end, cs->start)==0) fdrawline(cs->start, y, cs->start, ymaxc); /* draw end-line if not the last strip diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index a86f16ee10f..48bdcb88618 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -176,7 +176,7 @@ void boundbox_seq(Scene *scene, rctf *rect) if( min[0] > seq->startdisp-1) min[0]= seq->startdisp-1; if( max[0] < seq->enddisp+1) max[0]= seq->enddisp+1; - if( max[1] < seq->machine+2.0) max[1]= seq->machine+2.0; + if( max[1] < seq->machine+2) max[1]= seq->machine+2; seq= seq->next; } diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 9539846df28..6ba047d741a 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1108,7 +1108,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back) CLAMP(st->txtbar.ymax, pix_bottom_margin, ar->winy - pix_top_margin); st->pix_per_line= (pix_available > 0)? (float) ltexth/pix_available: 0; - if(st->pix_per_line<.1) st->pix_per_line=.1f; + if(st->pix_per_line < 0.1f) st->pix_per_line=0.1f; curl_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->curl); sell_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->sell); diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index a81865fc3b4..705fb83264c 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -157,13 +157,13 @@ void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, fl ctrl= !ctrl; if(ctrl && shift) { - if(fac3!= 0.0) *val= fac3*floor(*val/fac3 +.5); + if(fac3 != 0.0f) *val= fac3*floorf(*val/fac3 +0.5f); } else if(ctrl) { - if(fac2!= 0.0) *val= fac2*floor(*val/fac2 +.5); + if(fac2 != 0.0f) *val= fac2*floorf(*val/fac2 +0.5f); } else { - if(fac1!= 0.0) *val= fac1*floor(*val/fac1 +.5); + if(fac1 != 0.0f) *val= fac1*floorf(*val/fac1 +0.5f); } } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 4d2e205d1a9..4ca73f81965 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -903,10 +903,10 @@ void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin IDProperty *item; item= IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_DOUBLE); - *hardmin= item ? IDP_Double(item) : FLT_MIN; + *hardmin= item ? (float)IDP_Double(item) : FLT_MIN; item= IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_DOUBLE); - *hardmax= item ? IDP_Double(item) : FLT_MAX; + *hardmax= item ? (float)IDP_Double(item) : FLT_MAX; return; } @@ -934,16 +934,16 @@ void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *soft IDProperty *item; item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_DOUBLE); - *softmin= item ? IDP_Double(item) : FLT_MIN; + *softmin= item ? (float)IDP_Double(item) : FLT_MIN; item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_DOUBLE); - *softmax= item ? IDP_Double(item) : FLT_MAX; + *softmax= item ? (float)IDP_Double(item) : FLT_MAX; item= IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_DOUBLE); - *step= item ? IDP_Double(item) : 1.0f; + *step= item ? (float)IDP_Double(item) : 1.0f; item= IDP_GetPropertyTypeFromGroup(idp_ui, "precision", IDP_DOUBLE); - *precision= item ? IDP_Double(item) : 3.0f; + *precision= item ? (float)IDP_Double(item) : 3.0f; return; } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 1622159efcb..a1cfe4a0390 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2665,7 +2665,7 @@ static void wm_radial_control_paint(bContext *C, int x, int y, void *customdata) // int hit = 0; if(rc->mode == WM_RADIALCONTROL_STRENGTH) - rc->tex_col[3]= (rc->value + 0.5); + rc->tex_col[3]= (rc->value + 0.5f); if(rc->mode == WM_RADIALCONTROL_SIZE) { r1= rc->value; @@ -2836,7 +2836,7 @@ int WM_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) rc->max_value = 360; mouse[0]-= WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(initial_value); mouse[1]-= WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(initial_value); - initial_value *= 180.0f/M_PI; + initial_value *= 180.0f/(float)M_PI; } if(op->customdata) { @@ -2884,7 +2884,7 @@ void WM_radial_control_string(wmOperator *op, char str[], int maxlen) else if(mode == WM_RADIALCONTROL_STRENGTH) BLI_snprintf(str, maxlen, "Strength: %d", (int)v); else if(mode == WM_RADIALCONTROL_ANGLE) - BLI_snprintf(str, maxlen, "Angle: %d", (int)(v * 180.0f/M_PI)); + BLI_snprintf(str, maxlen, "Angle: %d", (int)(v * 180.0f/(float)M_PI)); } /** Important: this doesn't define an actual operator, it diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c index 1117d296f94..a87001fb1b4 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.c +++ b/source/blender/windowmanager/intern/wm_subwindow.c @@ -143,7 +143,7 @@ void wm_subwindow_getmatrix(wmWindow *win, int swinid, float mat[][4]) int width, height; wm_subwindow_getsize(win, swin->swinid, &width, &height); - orthographic_m4(mat, -0.375, (float)width-0.375, -0.375, (float)height-0.375, -100, 100); + orthographic_m4(mat, -0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f, -100, 100); } else glGetFloatv(GL_PROJECTION_MATRIX, (float*)mat); @@ -174,7 +174,7 @@ int wm_subwindow_open(wmWindow *win, rcti *winrct) /* extra service */ wm_subwindow_getsize(win, swin->swinid, &width, &height); - wmOrtho2(-0.375, (float)width-0.375, -0.375, (float)height-0.375); + wmOrtho2(-0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f); glLoadIdentity(); return swin->swinid; @@ -229,7 +229,7 @@ void wm_subwindow_position(wmWindow *win, int swinid, rcti *winrct) /* extra service */ wmSubWindowSet(win, swinid); wm_subwindow_getsize(win, swinid, &width, &height); - wmOrtho2(-0.375, (float)width-0.375, -0.375, (float)height-0.375); + wmOrtho2(-0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f); } else { printf("wm_subwindow_position: Internal error, bad winid: %d\n", swinid); @@ -268,7 +268,7 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct) else glScissor(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height); - wmOrtho2(-0.375, (float)width-0.375, -0.375, (float)height-0.375); + wmOrtho2(-0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f); glLoadIdentity(); glFlush(); @@ -302,8 +302,8 @@ void wmOrtho(float x1, float x2, float y1, float y2, float n, float f) void wmOrtho2(float x1, float x2, float y1, float y2) { /* prevent opengl from generating errors */ - if(x1==x2) x2+=1.0; - if(y1==y2) y2+=1.0; + if(x1==x2) x2+=1.0f; + if(y1==y2) y2+=1.0f; wmOrtho(x1, x2, y1, y2, -100, 100); } -- cgit v1.2.3