From 617e6a83bc89ca36e18bd06d851a31c010e11db2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 27 Mar 2011 14:59:55 +0000 Subject: object/paint/misc-files: floats were being implicitly promoted to doubles, adjust to use floats. - also UV angle stretching was using radians->deg which wasn't needed. --- source/blender/editors/animation/keyframing.c | 10 +- source/blender/editors/armature/poselib.c | 2 +- source/blender/editors/curve/editcurve.c | 56 +++++----- source/blender/editors/gpencil/drawgpencil.c | 6 +- source/blender/editors/metaball/mball_edit.c | 2 +- source/blender/editors/object/object_edit.c | 2 +- source/blender/editors/object/object_transform.c | 4 +- source/blender/editors/object/object_vgroup.c | 6 +- source/blender/editors/screen/glutil.c | 22 ++-- source/blender/editors/screen/screen_ops.c | 2 +- source/blender/editors/sculpt_paint/paint_image.c | 2 +- source/blender/editors/sculpt_paint/paint_ops.c | 2 +- source/blender/editors/sculpt_paint/paint_stroke.c | 28 ++--- source/blender/editors/sculpt_paint/paint_utils.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 30 +++--- source/blender/editors/sculpt_paint/sculpt.c | 4 +- source/blender/editors/space_image/image_draw.c | 14 +-- source/blender/editors/space_image/image_ops.c | 10 +- .../editors/space_sequencer/sequencer_edit.c | 8 +- source/blender/editors/space_time/space_time.c | 4 +- source/blender/editors/space_view3d/drawarmature.c | 6 +- source/blender/editors/uvedit/uvedit_draw.c | 114 ++++++++++----------- 22 files changed, 168 insertions(+), 168 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 05fbab78039..fe461b50a98 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -403,14 +403,14 @@ static short new_key_needed (FCurve *fcu, float cFrame, float nValue) prevVal= prev->vec[1][1]; /* keyframe to be added at point where there are already two similar points? */ - if (IS_EQ(prevPosi, cFrame) && IS_EQ(beztPosi, cFrame) && IS_EQ(beztPosi, prevPosi)) { + if (IS_EQF(prevPosi, cFrame) && IS_EQF(beztPosi, cFrame) && IS_EQF(beztPosi, prevPosi)) { return KEYNEEDED_DONTADD; } /* keyframe between prev+current points ? */ if ((prevPosi <= cFrame) && (cFrame <= beztPosi)) { /* is the value of keyframe to be added the same as keyframes on either side ? */ - if (IS_EQ(prevVal, nValue) && IS_EQ(beztVal, nValue) && IS_EQ(prevVal, beztVal)) { + if (IS_EQF(prevVal, nValue) && IS_EQF(beztVal, nValue) && IS_EQF(prevVal, beztVal)) { return KEYNEEDED_DONTADD; } else { @@ -420,7 +420,7 @@ static short new_key_needed (FCurve *fcu, float cFrame, float nValue) realVal= evaluate_fcurve(fcu, cFrame); /* compare whether it's the same as proposed */ - if (IS_EQ(realVal, nValue)) + if (IS_EQF(realVal, nValue)) return KEYNEEDED_DONTADD; else return KEYNEEDED_JUSTADD; @@ -433,7 +433,7 @@ static short new_key_needed (FCurve *fcu, float cFrame, float nValue) * stays around or not depends on whether the values of previous/current * beztriples and new keyframe are the same. */ - if (IS_EQ(prevVal, nValue) && IS_EQ(beztVal, nValue) && IS_EQ(prevVal, beztVal)) + if (IS_EQF(prevVal, nValue) && IS_EQF(beztVal, nValue) && IS_EQF(prevVal, beztVal)) return KEYNEEDED_DELNEXT; else return KEYNEEDED_JUSTADD; @@ -471,7 +471,7 @@ static short new_key_needed (FCurve *fcu, float cFrame, float nValue) else valB= bezt->vec[1][1] + 1.0f; - if (IS_EQ(valA, nValue) && IS_EQ(valA, valB)) + if (IS_EQF(valA, nValue) && IS_EQF(valA, valB)) return KEYNEEDED_DELPREV; else return KEYNEEDED_JUSTADD; diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 5fc872d070d..5897da97f85 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -298,7 +298,7 @@ static int poselib_sanitise_exec (bContext *C, wmOperator *op) /* check if any pose matches this */ // TODO: don't go looking through the list like this every time... for (marker= act->markers.first; marker; marker= marker->next) { - if (IS_EQ(marker->frame, ak->cfra)) { + if (IS_EQ(marker->frame, (double)ak->cfra)) { marker->flag = -1; break; } diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index a14a75fc545..12d1327da68 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2167,8 +2167,8 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op)) if(bezt->f2 & SELECT) { for(i=0; i<3; i++) { val = bezt->vec[1][i]; - newval = ((beztOrig+(a-1))->vec[1][i] * 0.5) + ((beztOrig+(a+1))->vec[1][i] * 0.5); - offset = (val*((1.0/6.0)*5)) + (newval*(1.0/6.0)) - val; + newval = ((beztOrig+(a-1))->vec[1][i] * 0.5f) + ((beztOrig+(a+1))->vec[1][i] * 0.5f); + offset = (val*((1.0f/6.0f)*5.0f)) + (newval*(1.0f/6.0f)) - val; /* offset handles */ bezt->vec[1][i] += offset; bezt->vec[0][i] += offset; @@ -2187,8 +2187,8 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op)) if(bp->f1 & SELECT) { for(i=0; i<3; i++) { val = bp->vec[i]; - newval = ((bpOrig+(a-1))->vec[i] * 0.5) + ((bpOrig+(a+1))->vec[i] * 0.5); - offset = (val*((1.0/6.0)*5)) + (newval*(1.0/6.0)) - val; + newval = ((bpOrig+(a-1))->vec[i] * 0.5f) + ((bpOrig+(a+1))->vec[i] * 0.5f); + offset = (val*((1.0f/6.0f)*5.0f)) + (newval*(1.0f/6.0f)) - val; bp->vec[i] += offset; } @@ -2272,9 +2272,9 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) if (start_sel>0) start_rad = (nu->bezt+start_sel-1)->radius; if (end_sel!=-1 && end_sel < nu->pntsu) end_rad = (nu->bezt+start_sel+1)->radius; - if (start_rad >= 0.0 && end_rad >= 0.0) (nu->bezt+start_sel)->radius = (start_rad + end_rad)/2; - else if (start_rad >= 0.0) (nu->bezt+start_sel)->radius = start_rad; - else if (end_rad >= 0.0) (nu->bezt+start_sel)->radius = end_rad; + if (start_rad >= 0.0f && end_rad >= 0.0f) (nu->bezt+start_sel)->radius = (start_rad + end_rad)/2; + else if (start_rad >= 0.0f) (nu->bezt+start_sel)->radius = start_rad; + else if (end_rad >= 0.0f) (nu->bezt+start_sel)->radius = end_rad; } else { /* if endpoints selected, then use them */ if (start_sel==0) { @@ -2294,7 +2294,7 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) range = (float)(end_sel - start_sel) + 2.0f; for(bezt=nu->bezt+start_sel, a=start_sel; a<=end_sel; a++, bezt++) { fac = (float)(1+a-start_sel) / range; - bezt->radius = start_rad*(1.0-fac) + end_rad*fac; + bezt->radius = start_rad*(1.0f-fac) + end_rad*fac; } } } @@ -2334,9 +2334,9 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) if (start_sel>0) start_rad = (nu->bp+start_sel-1)->radius; if (end_sel!=-1 && end_sel < nu->pntsu) end_rad = (nu->bp+start_sel+1)->radius; - if (start_rad >= 0.0 && end_rad >= 0.0) (nu->bp+start_sel)->radius = (start_rad + end_rad)/2; - else if (start_rad >= 0.0) (nu->bp+start_sel)->radius = start_rad; - else if (end_rad >= 0.0) (nu->bp+start_sel)->radius = end_rad; + if (start_rad >= 0.0f && end_rad >= 0.0f) (nu->bp+start_sel)->radius = (start_rad + end_rad)/2; + else if (start_rad >= 0.0f) (nu->bp+start_sel)->radius = start_rad; + else if (end_rad >= 0.0f) (nu->bp+start_sel)->radius = end_rad; } else { /* if endpoints selected, then use them */ if (start_sel==0) { @@ -2356,7 +2356,7 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) range = (float)(end_sel - start_sel) + 2.0f; for(bp=nu->bp+start_sel, a=start_sel; a<=end_sel; a++, bp++) { fac = (float)(1+a-start_sel) / range; - bp->radius = start_rad*(1.0-fac) + end_rad*fac; + bp->radius = start_rad*(1.0f-fac) + end_rad*fac; } } } @@ -3751,7 +3751,7 @@ static void make_selection_list_nurb(ListBase *editnurb) add_v3_v3(nus->vec, bp->vec); bp++; } - mul_v3_fl(nus->vec, 1.0/(float)nu->pntsu); + mul_v3_fl(nus->vec, 1.0f/(float)nu->pntsu); } @@ -4107,7 +4107,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) nu1->knotsu= fp; - offset= nu1->knotsu[a-1] +1.0; + offset= nu1->knotsu[a-1] + 1.0f; fp= nu1->knotsu+a; for(a=0; apntsu; a++, fp++) { if(nu2->knotsu) @@ -4292,8 +4292,8 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen mul_m3_m3m3(scalemat1,imat,tmat); unit_m3(scalemat2); - scalemat2[0][0]/= M_SQRT2; - scalemat2[1][1]/= M_SQRT2; + scalemat2[0][0]/= (float)M_SQRT2; + scalemat2[1][1]/= (float)M_SQRT2; mul_m3_m3m3(tmat,persmat,bmat); mul_m3_m3m3(cmat,scalemat2,tmat); @@ -6218,10 +6218,10 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) bezt->radius = 1.0; bezt->vec[1][0]+= -grid; - bezt->vec[0][0]+= -1.5*grid; - bezt->vec[0][1]+= -0.5*grid; - bezt->vec[2][0]+= -0.5*grid; - bezt->vec[2][1]+= 0.5*grid; + bezt->vec[0][0]+= -1.5f*grid; + bezt->vec[0][1]+= -0.5f*grid; + bezt->vec[2][0]+= -0.5f*grid; + bezt->vec[2][1]+= 0.5f*grid; for(a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]); bezt++; @@ -6254,7 +6254,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) } bp= nu->bp; - bp->vec[0]+= -1.5*grid; + bp->vec[0]+= -1.5f*grid; bp++; bp->vec[0]+= -grid; bp->vec[1]+= grid; @@ -6262,7 +6262,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) bp->vec[0]+= grid; bp->vec[1]+= grid; bp++; - bp->vec[0]+= 1.5*grid; + bp->vec[0]+= 1.5f*grid; bp= nu->bp; for(a=0;a<4;a++, bp++) mul_m4_v3(mat,bp->vec); @@ -6290,13 +6290,13 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) } bp= nu->bp; - bp->vec[0]+= -2.0*grid; + bp->vec[0]+= -2.0f*grid; bp++; bp->vec[0]+= -grid; bp++; bp++; bp->vec[0]+= grid; bp++; - bp->vec[0]+= 2.0*grid; + bp->vec[0]+= 2.0f*grid; bp= nu->bp; for(a=0;a<5;a++, bp++) mul_m4_v3(mat,bp->vec); @@ -6361,8 +6361,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) bp->vec[1]+= nurbcircle[a][1]*grid; } else { - bp->vec[0]+= 0.25*nurbcircle[a][0]*grid-.75*grid; - bp->vec[2]+= 0.25*nurbcircle[a][1]*grid; + bp->vec[0]+= 0.25f*nurbcircle[a][0]*grid-0.75f*grid; + bp->vec[2]+= 0.25f*nurbcircle[a][1]*grid; } if(a & 1) bp->vec[3]= 0.25*M_SQRT2; else bp->vec[3]= 1.0; @@ -6391,9 +6391,9 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) for(a=0; a<4; a++) { for(b=0; b<4; b++) { bp->f1= SELECT; - fac= (float)a -1.5; + fac= (float)a -1.5f; bp->vec[0]+= fac*grid; - fac= (float)b -1.5; + fac= (float)b -1.5f; bp->vec[1]+= fac*grid; if(a==1 || a==2) if(b==1 || b==2) { bp->vec[2]+= grid; diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index ffaedf6a5bc..8d41ed5fec1 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -123,7 +123,7 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick /* if there was a significant pressure change, stop the curve, change the thickness of the stroke, * and continue drawing again (since line-width cannot change in middle of GL_LINE_STRIP) */ - if (fabs(pt->pressure - oldpressure) > 0.2f) { + if (fabsf(pt->pressure - oldpressure) > 0.2f) { glEnd(); glLineWidth(pt->pressure * thickness); glBegin(GL_LINE_STRIP); @@ -217,7 +217,7 @@ static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thicknes /* if there was a significant pressure change, stop the curve, change the thickness of the stroke, * and continue drawing again (since line-width cannot change in middle of GL_LINE_STRIP) */ - if (fabs(pt->pressure - oldpressure) > 0.2f) { + if (fabsf(pt->pressure - oldpressure) > 0.2f) { glEnd(); glLineWidth(pt->pressure * thickness); glBegin(GL_LINE_STRIP); @@ -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) < pthick) && (IS_EQ(athick, pthick)==0) ) + if ( ((athick * 2.0f) < pthick) && (IS_EQ(athick, pthick)==0) ) { mt[0] += (mb[0] * dfac); mt[1] += (mb[1] * dfac); diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 43871285ee5..1cbd7e82b95 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -230,7 +230,7 @@ static int select_random_metaelems_exec(bContext *C, wmOperator *op) MetaElem *ml; float percent= RNA_float_get(op->ptr, "percent"); - if(percent == 0.0) + if(percent == 0.0f) return OPERATOR_CANCELLED; ml= mb->editelems->first; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index a8d0b93fa60..eb04a2743e3 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1863,7 +1863,7 @@ static void rand_timeoffs(Scene *scene, View3D *v3d) for(base= FIRSTBASE; base; base= base->next) { if(TESTBASELIB(v3d, base)) { - base->object->sf += (BLI_drand()-0.5) * rand_ofs; + base->object->sf += ((float)BLI_drand()-0.5f) * rand_ofs; if (base->object->sf < -MAXFRAMEF) base->object->sf = -MAXFRAMEF; else if (base->object->sf > MAXFRAMEF) base->object->sf = MAXFRAMEF; } diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index c41a1bf9a75..e6bb65b1a84 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -101,9 +101,9 @@ static void object_clear_rot(Object *ob) ob->rotAxis[2]= ob->drotAxis[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(ob->rotAxis[0], ob->rotAxis[1]) && IS_EQ(ob->rotAxis[1], ob->rotAxis[2])) + if (IS_EQF(ob->rotAxis[0], ob->rotAxis[1]) && IS_EQF(ob->rotAxis[1], ob->rotAxis[2])) ob->rotAxis[1] = 1.0f; - if (IS_EQ(ob->drotAxis[0], ob->drotAxis[1]) && IS_EQ(ob->drotAxis[1], ob->drotAxis[2])) + if (IS_EQF(ob->drotAxis[0], ob->drotAxis[1]) && IS_EQF(ob->drotAxis[1], ob->drotAxis[2])) ob->drotAxis[1]= 1.0f; } else if (ob->rotmode == ROT_MODE_QUAT) { diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 3b0c1ff62b0..a724e5850ec 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -421,15 +421,15 @@ static void ED_vgroup_nr_vert_add(Object *ob, int def_nr, int vertnum, float wei break; case WEIGHT_ADD: dv->dw[i].weight+=weight; - if(dv->dw[i].weight >= 1.0) - dv->dw[i].weight = 1.0; + if(dv->dw[i].weight >= 1.0f) + dv->dw[i].weight = 1.0f; break; case WEIGHT_SUBTRACT: dv->dw[i].weight-=weight; /* if the weight is zero or less then * remove the vert from the deform group */ - if(dv->dw[i].weight <= 0.0) + if(dv->dw[i].weight <= 0.0f) ED_vgroup_nr_vert_remove(ob, def_nr, vertnum); break; } diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index d541550c2a7..2918c98c84a 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -346,7 +346,7 @@ void glutil_draw_filled_arc(float start, float angle, float radius, int nsegment float t= (float) i/(nsegments-1); float cur= start + t*angle; - glVertex2f(cos(cur)*radius, sin(cur)*radius); + glVertex2f(cosf(cur)*radius, sinf(cur)*radius); } glEnd(); } @@ -359,7 +359,7 @@ void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments float t= (float) i/(nsegments-1); float cur= start + t*angle; - glVertex2f(cos(cur)*radius, sin(cur)*radius); + glVertex2f(cosf(cur)*radius, sinf(cur)*radius); } glEnd(); } @@ -761,9 +761,9 @@ void bglBegin(int mode) if(mode==GL_POINTS) { float value[4]; glGetFloatv(GL_POINT_SIZE_RANGE, value); - if(value[1]<2.0) { + if(value[1] < 2.0f) { glGetFloatv(GL_POINT_SIZE, value); - pointhack= floor(value[0]+0.5); + pointhack= floor(value[0] + 0.5f); if(pointhack>4) pointhack= 4; } else glBegin(mode); @@ -774,9 +774,9 @@ int bglPointHack(void) { float value[4]; int pointhack_px; glGetFloatv(GL_POINT_SIZE_RANGE, value); - if(value[1]<2.0) { + if(value[1] < 2.0f) { glGetFloatv(GL_POINT_SIZE, value); - pointhack_px= floor(value[0]+0.5); + pointhack_px= floorf(value[0]+0.5f); if(pointhack_px>4) pointhack_px= 4; return pointhack_px; } @@ -789,7 +789,7 @@ void bglVertex3fv(float *vec) case GL_POINTS: if(pointhack) { glRasterPos3fv(vec); - glBitmap(pointhack, pointhack, (float)pointhack/2.0, (float)pointhack/2.0, 0.0, 0.0, Squaredot); + glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot); } else glVertex3fv(vec); break; @@ -802,7 +802,7 @@ void bglVertex3f(float x, float y, float z) case GL_POINTS: if(pointhack) { glRasterPos3f(x, y, z); - glBitmap(pointhack, pointhack, (float)pointhack/2.0, (float)pointhack/2.0, 0.0, 0.0, Squaredot); + glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot); } else glVertex3f(x, y, z); break; @@ -860,7 +860,7 @@ void bglPolygonOffset(float viewdist, float dist) { static float winmat[16], offset=0.0; - if(dist!=0.0) { + if(dist != 0.0f) { float offs; // glEnable(GL_POLYGON_OFFSET_FILL); @@ -872,8 +872,8 @@ void bglPolygonOffset(float viewdist, float dist) /* dist is from camera to center point */ - if(winmat[15]>0.5) offs= 0.00001*dist*viewdist; // ortho tweaking - else offs= 0.0005*dist; // should be clipping value or so... + if(winmat[15]>0.5f) offs= 0.00001f*dist*viewdist; // ortho tweaking + else offs= 0.0005f*dist; // should be clipping value or so... winmat[14]-= offs; offset+= offs; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index d4b547154ed..d07cc61e680 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2776,7 +2776,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e scene->r.cfra -= step; else scene->r.cfra += step; - wt->duration -= ((float)step)/FPS; + wt->duration -= ((double)step)/FPS; } else { /* one frame +/- */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 83f3661ac31..27fc13a0a0a 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -866,7 +866,7 @@ static int line_isect_x(const float p1[2], const float p2[2], const float x_leve x_diff= fabsf(p1[0]-p2[0]); /* yuck, horizontal line, we cant do much here */ - if (x_diff < 0.000001) { /* yuck, vertical line, we cant do much here */ + if (x_diff < 0.000001f) { /* yuck, vertical line, we cant do much here */ *y_isect = (p1[0]+p2[0]) * 0.5f; return ISECT_TRUE; } diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index e3b92975383..eb9fbea22f4 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -111,7 +111,7 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op) { float unprojected_radius= scalar*brush_unprojected_radius(brush); - if (unprojected_radius < 0.001) // XXX magic number + if (unprojected_radius < 0.001f) // XXX magic number unprojected_radius= 0.001f; brush_set_unprojected_radius(brush, unprojected_radius); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 1e3aa4fca1b..b63c2973758 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -265,11 +265,11 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc) /* 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 (br->mtex.tex && (rotation > 0.001 || rotation < -0.001)) { - const float angle = atan2(y, x) + rotation; + if (br->mtex.tex && (rotation > 0.001f || rotation < -0.001f)) { + const float angle = atan2f(y, x) + rotation; - x = len * cos(angle); - y = len * sin(angle); + x = len * cosf(angle); + y = len * sinf(angle); } x *= br->mtex.size[0]; @@ -337,20 +337,20 @@ static int project_brush_radius(RegionView3D* rv3d, float radius, float location // create a vector that is not orthogonal to view - if (fabsf(view[0]) < 0.1) { - nonortho[0] = view[0] + 1; + if (fabsf(view[0]) < 0.1f) { + nonortho[0] = view[0] + 1.0f; nonortho[1] = view[1]; nonortho[2] = view[2]; } - else if (fabsf(view[1]) < 0.1) { + else if (fabsf(view[1]) < 0.1f) { nonortho[0] = view[0]; - nonortho[1] = view[1] + 1; + nonortho[1] = view[1] + 1.0f; nonortho[2] = view[2]; } else { nonortho[0] = view[0]; nonortho[1] = view[1]; - nonortho[2] = view[2] + 1; + nonortho[2] = view[2] + 1.0f; } // get a vector in the plane of the view @@ -446,10 +446,10 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush, if(brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) { /* brush rotation */ - glTranslatef(0.5f, 0.5f, 0); - glRotatef(((brush->flag & BRUSH_RAKE) ? - sd->last_angle : sd->special_rotation) * (180.0f/M_PI), - 0, 0, 1); + glTranslatef(0.5, 0.5, 0); + glRotatef((double)((brush->flag & BRUSH_RAKE) ? + sd->last_angle : sd->special_rotation) * (180.0/M_PI), + 0.0, 0.0, 1.0); glTranslatef(-0.5f, -0.5f, 0); /* scale based on tablet pressure */ @@ -730,7 +730,7 @@ static int paint_smooth_stroke(PaintStroke *stroke, float output[2], wmEvent *ev !(stroke->brush->flag & BRUSH_ANCHORED) && !(stroke->brush->flag & BRUSH_RESTORE_MESH)) { - float u = stroke->brush->smooth_stroke_factor, v = 1.0 - u; + float u = stroke->brush->smooth_stroke_factor, v = 1.0f - u; float dx = stroke->last_mouse_position[0] - event->x, dy = stroke->last_mouse_position[1] - event->y; /* If the mouse is moving within the radius of the last move, diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 73b6d170a92..ad85a4bf29b 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -84,7 +84,7 @@ float paint_get_tex_pixel(Brush* br, float u, float v) hasrgb = multitex_ext(br->mtex.tex, co, NULL, NULL, 0, &texres); if (hasrgb & TEX_RGB) - texres.tin = (0.35*texres.tr + 0.45*texres.tg + 0.2*texres.tb)*texres.ta; + texres.tin = (0.35f*texres.tr + 0.45f*texres.tg + 0.2f*texres.tb)*texres.ta; return texres.tin; } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 6859fd333bc..7d8c3c70708 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -171,13 +171,13 @@ static unsigned int rgba_to_mcol(float r, float g, float b, float a) unsigned int col; char *cp; - ir= floor(255.0*r); + ir= floor(255.0f * r); if(ir<0) ir= 0; else if(ir>255) ir= 255; - ig= floor(255.0*g); + ig= floor(255.0f * g); if(ig<0) ig= 0; else if(ig>255) ig= 255; - ib= floor(255.0*b); + ib= floor(255.0f * b); if(ib<0) ib= 0; else if(ib>255) ib= 255; - ia= floor(255.0*a); + ia= floor(255.0f * a); if(ia<0) ia= 0; else if(ia>255) ia= 255; cp= (char *)&col; @@ -667,7 +667,7 @@ static void vpaint_blend(VPaint *vp, unsigned int *col, unsigned int *colorig, u unsigned int testcol=0, a; char *cp, *ct, *co; - alpha= (int)(255.0*brush_alpha(brush)); + alpha= (int)(255.0f*brush_alpha(brush)); if(brush->vertexpaint_tool==VP_MIX || brush->vertexpaint_tool==VP_BLUR) testcol= mcol_blend( *colorig, paintcol, alpha); else if(brush->vertexpaint_tool==VP_ADD) testcol= mcol_add( *colorig, paintcol, alpha); @@ -762,7 +762,7 @@ static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], fl /* transpose ! */ fac= vpimat[2][0]*no[0]+vpimat[2][1]*no[1]+vpimat[2][2]*no[2]; - if(fac>0.0) { + if(fac > 0.0f) { dx= vpimat[0][0]*no[0]+vpimat[0][1]*no[1]+vpimat[0][2]*no[2]; dy= vpimat[1][0]*no[0]+vpimat[1][1]*no[1]+vpimat[1][2]*no[2]; @@ -797,20 +797,20 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float } if(tool==VP_MIX || tool==VP_BLUR) - dw->weight = paintval*alpha + dw->weight*(1.0-alpha); + dw->weight = paintval*alpha + dw->weight*(1.0f-alpha); else if(tool==VP_ADD) dw->weight += paintval*alpha; else if(tool==VP_SUB) dw->weight -= paintval*alpha; else if(tool==VP_MUL) /* first mul, then blend the fac */ - dw->weight = ((1.0-alpha) + alpha*paintval)*dw->weight; + dw->weight = ((1.0f-alpha) + alpha*paintval)*dw->weight; else if(tool==VP_LIGHTEN) { if (dw->weight < paintval) - dw->weight = paintval*alpha + dw->weight*(1.0-alpha); + dw->weight = paintval*alpha + dw->weight*(1.0f-alpha); } else if(tool==VP_DARKEN) { if (dw->weight > paintval) - dw->weight = paintval*alpha + dw->weight*(1.0-alpha); + dw->weight = paintval*alpha + dw->weight*(1.0f-alpha); } CLAMP(dw->weight, 0.0f, 1.0f); @@ -820,22 +820,22 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float alpha= brush_alpha(brush); if(tool==VP_MIX || tool==VP_BLUR) - testw = paintval*alpha + uw->weight*(1.0-alpha); + testw = paintval*alpha + uw->weight*(1.0f-alpha); else if(tool==VP_ADD) testw = uw->weight + paintval*alpha; else if(tool==VP_SUB) testw = uw->weight - paintval*alpha; else if(tool==VP_MUL) /* first mul, then blend the fac */ - testw = ((1.0-alpha) + alpha*paintval)*uw->weight; + testw = ((1.0f-alpha) + alpha*paintval)*uw->weight; else if(tool==VP_LIGHTEN) { if (uw->weight < paintval) - testw = paintval*alpha + uw->weight*(1.0-alpha); + testw = paintval*alpha + uw->weight*(1.0f-alpha); else testw = uw->weight; } else if(tool==VP_DARKEN) { if (uw->weight > paintval) - testw = paintval*alpha + uw->weight*(1.0-alpha); + testw = paintval*alpha + uw->weight*(1.0f-alpha); else testw = uw->weight; } @@ -1858,7 +1858,7 @@ static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index for(i = 0; i < (mface->v4 ? 4 : 3); ++i) { alpha= calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*(&mface->v1)[i], mval, pressure); if(alpha) - vpaint_blend(vp, mcol+i, mcolorig+i, vpd->paintcol, (int)(alpha*255.0)); + vpaint_blend(vp, mcol+i, mcolorig+i, vpd->paintcol, (int)(alpha*255.0f)); } } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index c82b7ffdafa..1428a9a9075 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3153,8 +3153,8 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, st float halfway[2]; float out[3]; - halfway[0] = dx*0.5 + cache->initial_mouse[0]; - halfway[1] = dy*0.5 + cache->initial_mouse[1]; + halfway[0] = (float)dx * 0.5f + cache->initial_mouse[0]; + halfway[1] = (float)dy * 0.5f + cache->initial_mouse[1]; if (sculpt_stroke_get_location(C, stroke, out, halfway)) { copy_v3_v3(sd->anchored_location, out); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index aa748745cd2..3e028607172 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -151,7 +151,7 @@ void draw_image_info(ARegion *ar, int channels, int x, int y, char *cp, float *f } if(zp) - ofs+= BLI_snprintf(str + ofs, sizeof(str)-ofs, "| Z: %.4f ", 0.5+0.5*(((float)*zp)/(float)0x7fffffff)); + ofs+= BLI_snprintf(str + ofs, sizeof(str)-ofs, "| Z: %.4f ", 0.5f+0.5f*(((float)*zp)/(float)0x7fffffff)); if(zpf) ofs+= BLI_snprintf(str + ofs, sizeof(str)-ofs, "| Z: %.3f ", *zpf); (void)ofs; @@ -193,21 +193,21 @@ static void draw_image_grid(ARegion *ar, float zoomx, float zoomy) if(gridsize<1.0f) { while(gridsize<1.0f) { - gridsize*= 4.0; - gridstep*= 4.0; + gridsize*= 4.0f; + gridstep*= 4.0f; } } else { while(gridsize>=4.0f) { - gridsize/= 4.0; - gridstep/= 4.0; + gridsize/= 4.0f; + gridstep/= 4.0f; } } /* the fine resolution level */ - blendfac= 0.25*gridsize - floor(0.25*gridsize); + blendfac= 0.25*gridsize - floor(0.25f*gridsize); CLAMP(blendfac, 0.0, 1.0); - UI_ThemeColorShade(TH_BACK, (int)(20.0*(1.0-blendfac))); + UI_ThemeColorShade(TH_BACK, (int)(20.0f*(1.0f-blendfac))); fac= 0.0f; glBegin(GL_LINES); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 3aa509ab998..56b5ed10c56 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -394,7 +394,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event) switch(event->type) { case MOUSEMOVE: - factor= 1.0 + (vpd->x-event->x+vpd->y-event->y)/300.0f; + factor= 1.0f + (vpd->x-event->x+vpd->y-event->y)/300.0f; RNA_float_set(op->ptr, "factor", factor); sima_zoom_set(sima, ar, vpd->zoom*factor); ED_region_tag_redraw(CTX_wm_region(C)); @@ -522,10 +522,10 @@ static int view_selected_exec(bContext *C, wmOperator *UNUSED(op)) d[0]= max[0] - min[0]; d[1]= max[1] - min[1]; - size= 0.5*MAX2(d[0], d[1])*MAX2(width, height)/256.0f; + size= 0.5f*MAX2(d[0], d[1])*MAX2(width, height)/256.0f; - if(size<=0.01) size= 0.01; - sima_zoom_set(sima, ar, 0.7/size); + if(size<=0.01f) size= 0.01f; + sima_zoom_set(sima, ar, 0.7f/size); ED_region_tag_redraw(CTX_wm_region(C)); @@ -1655,7 +1655,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event) my= event->y - ar->winrct.ymin; UI_view2d_region_to_view(&ar->v2d, mx, my, &fx, &fy); - if(fx>=0.0 && fy>=0.0 && fx<1.0 && fy<1.0) { + if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) { float *fp; char *cp; int x= (int)(fx*ibuf->x), y= (int)(fy*ibuf->y); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index dd64c17b703..a86f16ee10f 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2815,10 +2815,10 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op) rect.xmax /= (float)(ABS(v2d->tot.xmax - v2d->tot.xmin)); rect.ymax /= (float)(ABS(v2d->tot.ymax - v2d->tot.ymin)); - rect.xmin+=0.5; - rect.xmax+=0.5; - rect.ymin+=0.5; - rect.ymax+=0.5; + rect.xmin+=0.5f; + rect.xmax+=0.5f; + rect.ymin+=0.5f; + rect.ymax+=0.5f; CLAMP(rect.xmin, 0.0f, 1.0f); CLAMP(rect.ymin, 0.0f, 1.0f); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index b3c51953d59..ca9d786c4de 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -192,9 +192,9 @@ static void time_draw_cache(SpaceTime *stime, Object *ob) glRectf((float)sta, 0.0, (float)end, 1.0); - col[3] = 0.4; + col[3] = 0.4f; if (pid->cache->flag & PTCACHE_BAKED) { - col[0] -= 0.4; col[1] -= 0.4; col[2] -= 0.4; + col[0] -= 0.4f; col[1] -= 0.4f; col[2] -= 0.4f; } glColor4fv(col); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index a69ad1c7050..e68e1657096 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1515,7 +1515,7 @@ static void draw_pose_dofs(Object *ob) /* arcs */ if (pchan->ikflag & BONE_IK_ZLIMIT) { /* OpenGL requires rotations in degrees; so we're taking the average angle here */ - theta= 0.5f*(pchan->limitmin[2]+pchan->limitmax[2]) * (float)(180.0f/M_PI); + theta= RAD2DEGF(0.5f * (pchan->limitmin[2]+pchan->limitmax[2])); glRotatef(theta, 0.0f, 0.0f, 1.0f); glColor3ub(50, 50, 255); // blue, Z axis limit @@ -1538,7 +1538,7 @@ static void draw_pose_dofs(Object *ob) if (pchan->ikflag & BONE_IK_XLIMIT) { /* OpenGL requires rotations in degrees; so we're taking the average angle here */ - theta= 0.5f*(pchan->limitmin[0] + pchan->limitmax[0]) * (float)(180.0f/M_PI); + theta= RAD2DEGF(0.5f * (pchan->limitmin[0] + pchan->limitmax[0])); glRotatef(theta, 1.0f, 0.0f, 0.0f); glColor3ub(255, 50, 50); // Red, X axis limit @@ -1596,7 +1596,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* hacky... prevent outline select from drawing dashed helplines */ glGetFloatv(GL_LINE_WIDTH, &tmp); - if (tmp > 1.1) do_dashed &= ~1; + if (tmp > 1.1f) do_dashed &= ~1; if (v3d->flag & V3D_HIDE_HELPLINES) do_dashed &= ~2; /* precalc inverse matrix for drawing screen aligned */ diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 38df9a48fd0..b2a76681bff 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -72,35 +72,35 @@ static void drawcursor_sima(SpaceImage *sima, ARegion *ar) h= zoomy*height/256.0f; cpack(0xFFFFFF); - glTranslatef(sima->cursor[0], sima->cursor[1], 0.0f); - fdrawline(-0.05/w, 0, 0, 0.05/h); - fdrawline(0, 0.05/h, 0.05/w, 0); - fdrawline(0.05/w, 0, 0, -0.05/h); - fdrawline(0, -0.05/h, -0.05/w, 0); - + glTranslatef(sima->cursor[0], sima->cursor[1], 0.0); + fdrawline(-0.05f/w, 0, 0, 0.05f/h); + fdrawline(0, 0.05f/h, 0.05f/w, 0.0f); + fdrawline(0.05f/w, 0.0f, 0.0f, -0.05f/h); + fdrawline(0.0f, -0.05f/h, -0.05f/w, 0.0f); + setlinestyle(4); cpack(0xFF); - fdrawline(-0.05/w, 0, 0, 0.05/h); - fdrawline(0, 0.05/h, 0.05/w, 0); - fdrawline(0.05/w, 0, 0, -0.05/h); - fdrawline(0, -0.05/h, -0.05/w, 0); - - - setlinestyle(0); + fdrawline(-0.05f/w, 0.0f, 0.0f, 0.05f/h); + fdrawline(0.0f, 0.05f/h, 0.05f/w, 0.0f); + fdrawline(0.05f/w, 0.0f, 0.0f, -0.05f/h); + fdrawline(0.0f, -0.05f/h, -0.05f/w, 0.0f); + + + setlinestyle(0.0f); cpack(0x0); - fdrawline(-0.020/w, 0, -0.1/w, 0); - fdrawline(0.1/w, 0, .020/w, 0); - fdrawline(0, -0.020/h, 0, -0.1/h); - fdrawline(0, 0.1/h, 0, 0.020/h); - + fdrawline(-0.020f/w, 0.0f, -0.1f/w, 0.0f); + fdrawline(0.1f/w, 0.0f, 0.020f/w, 0.0f); + fdrawline(0.0f, -0.020f/h, 0.0f, -0.1f/h); + fdrawline(0.0f, 0.1f/h, 0.0f, 0.020f/h); + setlinestyle(1); cpack(0xFFFFFF); - fdrawline(-0.020/w, 0, -0.1/w, 0); - fdrawline(0.1/w, 0, .020/w, 0); - fdrawline(0, -0.020/h, 0, -0.1/h); - fdrawline(0, 0.1/h, 0, 0.020/h); - - glTranslatef(-sima->cursor[0], -sima->cursor[1], 0.0f); + fdrawline(-0.020f/w, 0.0f, -0.1f/w, 0.0f); + fdrawline(0.1f/w, 0.0f, 0.020f/w, 0.0f); + fdrawline(0.0f, -0.020f/h, 0.0f, -0.1f/h); + fdrawline(0.0f, 0.1f/h, 0.0f, 0.020f/h); + + glTranslatef(-sima->cursor[0], -sima->cursor[1], 0.0); setlinestyle(0); } @@ -215,11 +215,11 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac uvarea = uv_area(tf_uv, efa->v4 != NULL) / totuvarea; if(area < FLT_EPSILON || uvarea < FLT_EPSILON) - areadiff = 1.0; + areadiff = 1.0f; else if(area>uvarea) - areadiff = 1.0-(uvarea/area); + areadiff = 1.0f-(uvarea/area); else - areadiff = 1.0-(area/uvarea); + areadiff = 1.0f-(area/uvarea); weight_to_rgb(areadiff, col, col+1, col+2); glColor3fv(col); @@ -276,10 +276,10 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac /* This is the correct angle however we are only comparing angles * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90);*/ - uvang1 = angle_normalized_v2v2(av1, av2)*180.0/M_PI; - uvang2 = angle_normalized_v2v2(av2, av3)*180.0/M_PI; - uvang3 = angle_normalized_v2v2(av3, av4)*180.0/M_PI; - uvang4 = angle_normalized_v2v2(av4, av1)*180.0/M_PI; + uvang1 = angle_normalized_v2v2(av1, av2); + uvang2 = angle_normalized_v2v2(av2, av3); + uvang3 = angle_normalized_v2v2(av3, av4); + uvang4 = angle_normalized_v2v2(av4, av1); /* 3d angles */ VECSUB(av1, efa->v4->co, efa->v1->co); normalize_v3(av1); @@ -289,30 +289,30 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac /* This is the correct angle however we are only comparing angles * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90);*/ - ang1 = angle_normalized_v3v3(av1, av2)*180.0/M_PI; - ang2 = angle_normalized_v3v3(av2, av3)*180.0/M_PI; - ang3 = angle_normalized_v3v3(av3, av4)*180.0/M_PI; - ang4 = angle_normalized_v3v3(av4, av1)*180.0/M_PI; + ang1 = angle_normalized_v3v3(av1, av2); + ang2 = angle_normalized_v3v3(av2, av3); + ang3 = angle_normalized_v3v3(av3, av4); + ang4 = angle_normalized_v3v3(av4, av1); glBegin(GL_QUADS); /* This simple makes the angles display worse then they really are ;) - * 1.0-pow((1.0-a), 2) */ + * 1.0-powf((1.0-a), 2) */ - a = fabs(uvang1-ang1)/180.0; - weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2); + a = fabsf(uvang1-ang1)/(float)M_PI; + weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); glColor3fv(col); glVertex2fv(tf->uv[0]); - a = fabs(uvang2-ang2)/180.0; - weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2); + a = fabsf(uvang2-ang2)/(float)M_PI; + weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); glColor3fv(col); glVertex2fv(tf->uv[1]); - a = fabs(uvang3-ang3)/180.0; - weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2); + a = fabsf(uvang3-ang3)/(float)M_PI; + weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); glColor3fv(col); glVertex2fv(tf->uv[2]); - a = fabs(uvang4-ang4)/180.0; - weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2); + a = fabsf(uvang4-ang4)/(float)M_PI; + weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); glColor3fv(col); glVertex2fv(tf->uv[3]); @@ -336,9 +336,9 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac /* This is the correct angle however we are only comparing angles * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90); */ - uvang1 = angle_normalized_v2v2(av1, av2)*180.0/M_PI; - uvang2 = angle_normalized_v2v2(av2, av3)*180.0/M_PI; - uvang3 = angle_normalized_v2v2(av3, av1)*180.0/M_PI; + uvang1 = angle_normalized_v2v2(av1, av2); + uvang2 = angle_normalized_v2v2(av2, av3); + uvang3 = angle_normalized_v2v2(av3, av1); /* 3d angles */ VECSUB(av1, efa->v3->co, efa->v1->co); normalize_v3(av1); @@ -346,24 +346,24 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac VECSUB(av3, efa->v2->co, efa->v3->co); normalize_v3(av3); /* This is the correct angle however we are only comparing angles * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90); */ - ang1 = angle_normalized_v3v3(av1, av2)*180.0/M_PI; - ang2 = angle_normalized_v3v3(av2, av3)*180.0/M_PI; - ang3 = angle_normalized_v3v3(av3, av1)*180.0/M_PI; + ang1 = angle_normalized_v3v3(av1, av2); + ang2 = angle_normalized_v3v3(av2, av3); + ang3 = angle_normalized_v3v3(av3, av1); /* This simple makes the angles display worse then they really are ;) - * 1.0-pow((1.0-a), 2) */ + * 1.0f-powf((1.0-a), 2) */ glBegin(GL_TRIANGLES); - a = fabs(uvang1-ang1)/180.0; - weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2); + a = fabsf(uvang1-ang1)/(float)M_PI; + weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); glColor3fv(col); glVertex2fv(tf->uv[0]); - a = fabs(uvang2-ang2)/180.0; - weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2); + a = fabsf(uvang2-ang2)/(float)M_PI; + weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); glColor3fv(col); glVertex2fv(tf->uv[1]); - a = fabs(uvang3-ang3)/180.0; - weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2); + a = fabsf(uvang3-ang3)/(float)M_PI; + weight_to_rgb(1.0f-powf((1.0f-a), 2.0f), col, col+1, col+2); glColor3fv(col); glVertex2fv(tf->uv[2]); } -- cgit v1.2.3