From 094c9799f9926ae37515a1fe0380403ce3298a77 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 11 Nov 2011 12:00:08 +0000 Subject: quiet -Wdouble-promotion warnings --- source/blender/blenkernel/intern/boids.c | 4 +- source/blender/blenkernel/intern/cloth.c | 10 ++-- source/blender/blenkernel/intern/collision.c | 22 ++++----- source/blender/blenkernel/intern/dynamicpaint.c | 16 +++---- source/blender/blenkernel/intern/nla.c | 2 +- source/blender/blenkernel/intern/particle.c | 2 +- source/blender/blenkernel/intern/softbody.c | 10 ++-- source/blender/blenkernel/intern/tracking.c | 4 +- source/blender/blenlib/intern/math_matrix.c | 6 +-- source/blender/blenlib/intern/math_rotation.c | 28 +++++------ source/blender/blenloader/intern/readfile.c | 4 +- .../editors/armature/editarmature_retarget.c | 24 +++++----- .../blender/editors/armature/editarmature_sketch.c | 10 ++-- source/blender/editors/armature/reeb.c | 4 +- source/blender/editors/interface/interface_draw.c | 8 ++-- .../blender/editors/interface/interface_handlers.c | 6 +-- source/blender/editors/mesh/editmesh_loop.c | 14 +++--- source/blender/editors/object/object_vgroup.c | 4 +- source/blender/editors/space_clip/clip_ops.c | 4 +- source/blender/editors/space_clip/tracking_ops.c | 12 ++--- source/blender/editors/space_view3d/drawobject.c | 6 +-- source/blender/editors/space_view3d/view3d_view.c | 8 ++-- source/blender/editors/transform/transform.c | 8 ++-- .../blender/editors/transform/transform_generics.c | 11 +++-- source/blender/gpu/intern/gpu_draw.c | 4 +- source/blender/gpu/intern/gpu_material.c | 8 ++-- source/blender/ikplugin/intern/iksolver_plugin.c | 24 +++++----- .../blender/nodes/composite/node_composite_tree.c | 2 +- .../blender/nodes/composite/node_composite_util.c | 10 ++-- .../composite/nodes/node_composite_bilateralblur.c | 15 +++--- .../nodes/composite/nodes/node_composite_blur.c | 2 +- .../composite/nodes/node_composite_channelMatte.c | 12 ++--- .../composite/nodes/node_composite_chromaMatte.c | 40 ++++++++-------- .../composite/nodes/node_composite_colorMatte.c | 6 +-- .../composite/nodes/node_composite_colorbalance.c | 2 +- .../nodes/composite/nodes/node_composite_curves.c | 6 +-- .../nodes/composite/nodes/node_composite_defocus.c | 54 +++++++++++----------- .../composite/nodes/node_composite_diffMatte.c | 2 +- .../nodes/node_composite_directionalblur.c | 8 ++-- .../composite/nodes/node_composite_displace.c | 2 +- .../nodes/composite/nodes/node_composite_gamma.c | 2 +- .../nodes/composite/nodes/node_composite_glare.c | 2 +- .../composite/nodes/node_composite_hueSatVal.c | 4 +- .../composite/nodes/node_composite_huecorrect.c | 4 +- .../nodes/composite/nodes/node_composite_invert.c | 2 +- .../nodes/composite/nodes/node_composite_levels.c | 8 ++-- .../nodes/composite/nodes/node_composite_mapUV.c | 24 +++++----- .../nodes/composite/nodes/node_composite_math.c | 6 +-- .../nodes/composite/nodes/node_composite_rotate.c | 2 +- .../composite/nodes/node_composite_sepcombYCCA.c | 24 +++++----- .../python/mathutils/mathutils_Quaternion.c | 2 +- .../blender/render/intern/source/convertblender.c | 18 ++++---- source/blender/render/intern/source/envmap.c | 10 ++-- source/blender/render/intern/source/pixelshading.c | 14 +++--- .../blender/render/intern/source/render_texture.c | 31 ++++++------- source/blender/render/intern/source/shadeoutput.c | 20 ++++---- 56 files changed, 300 insertions(+), 297 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index c9868bd900f..6656d06e72e 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -175,7 +175,7 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, if(len2 > 0.0f && efd.distance - surface < len2) { len2 = (efd.distance - surface)/len2; - bbd->wanted_speed *= pow(len2, boids->landing_smoothness); + bbd->wanted_speed *= powf(len2, boids->landing_smoothness); } } @@ -242,7 +242,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * mul_v3_fl(bbd->wanted_co, (1.0f - t) * val->personal_space * pa->size); - bbd->wanted_speed = sqrt(t) * len_v3(pa->prev_state.vel); + bbd->wanted_speed = sqrtf(t) * len_v3(pa->prev_state.vel); bbd->wanted_speed = MAX2(bbd->wanted_speed, val->min_speed); return 1; diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index ae6a6ec012a..57a9dbcbc0f 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -1093,7 +1093,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) cloth->verts[spring->kl].spring_count++; spring->type = CLOTH_SPRING_TYPE_STRUCTURAL; spring->flags = 0; - spring->stiffness = (cloth->verts[spring->kl].struct_stiff + cloth->verts[spring->ij].struct_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].struct_stiff + cloth->verts[spring->ij].struct_stiff) / 2.0f; struct_springs++; BLI_linklist_prepend ( &cloth->springs, spring ); @@ -1110,7 +1110,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) for(i = 0; i < numverts; i++) { - cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49 / ((float)cloth->verts[i].spring_count); + cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49f / ((float)cloth->verts[i].spring_count); } // shear springs @@ -1132,7 +1132,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) spring->kl = MAX2(mface[i].v3, mface[i].v1); spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest); spring->type = CLOTH_SPRING_TYPE_SHEAR; - spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0f; BLI_linklist_append ( &edgelist[spring->ij], spring ); BLI_linklist_append ( &edgelist[spring->kl], spring ); @@ -1195,7 +1195,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) spring->kl = MAX2(tspring2->ij, index2); spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest); spring->type = CLOTH_SPRING_TYPE_BENDING; - spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f; BLI_edgehash_insert ( edgehash, spring->ij, spring->kl, NULL ); bend_springs++; @@ -1234,7 +1234,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) spring->kl = tspring->kl; spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest); spring->type = CLOTH_SPRING_TYPE_BENDING; - spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f; bend_springs++; BLI_linklist_prepend ( &cloth->springs, spring ); diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 09030575438..456c0c9fe3b 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -464,7 +464,7 @@ static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3 d = ( a * c - b * b ); - if ( ABS ( d ) < ALMOST_ZERO ) + if ( ABS ( d ) < (double)ALMOST_ZERO ) { *w1 = *w2 = *w3 = 1.0 / 3.0; return; @@ -554,14 +554,14 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // Decrease in magnitude of relative tangential velocity due to coulomb friction // in original formula "magrelVel" should be the "change of relative velocity in normal direction" - magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( INPR ( vrel_t_pre,vrel_t_pre ) ) ); + magtangent = MIN2 ( clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf( INPR ( vrel_t_pre,vrel_t_pre ) ) ); // Apply friction impulse. if ( magtangent > ALMOST_ZERO ) { normalize_v3( vrel_t_pre ); - impulse = magtangent / ( 1.0 + w1*w1 + w2*w2 + w3*w3 ); // 2.0 * + impulse = magtangent / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // 2.0 * VECADDMUL ( cloth1->verts[collpair->ap1].impulse, vrel_t_pre, w1 * impulse ); VECADDMUL ( cloth1->verts[collpair->ap2].impulse, vrel_t_pre, w2 * impulse ); VECADDMUL ( cloth1->verts[collpair->ap3].impulse, vrel_t_pre, w3 * impulse ); @@ -585,17 +585,17 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // I_r = -min(dt*kd, m(0,1d/dt - v_n)) spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale; - d = clmd->coll_parms->epsilon*8.0/9.0 + epsilon2*8.0/9.0 - collpair->distance; - if ( ( magrelVel < 0.1*d*spf ) && ( d > ALMOST_ZERO ) ) + d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance; + if ( ( magrelVel < 0.1f*d*spf ) && ( d > ALMOST_ZERO ) ) { - repulse = MIN2 ( d*1.0/spf, 0.1*d*spf - magrelVel ); + repulse = MIN2 ( d*1.0f/spf, 0.1f*d*spf - magrelVel ); // stay on the safe side and clamp repulse if ( impulse > ALMOST_ZERO ) repulse = MIN2 ( repulse, 5.0*impulse ); repulse = MAX2 ( impulse, repulse ); - impulse = repulse / ( 1.0 + w1*w1 + w2*w2 + w3*w3 ); // original 2.0 / 0.25 + impulse = repulse / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // original 2.0 / 0.25 VECADDMUL ( cloth1->verts[collpair->ap1].impulse, collpair->normal, impulse ); VECADDMUL ( cloth1->verts[collpair->ap2].impulse, collpair->normal, impulse ); VECADDMUL ( cloth1->verts[collpair->ap3].impulse, collpair->normal, impulse ); @@ -1492,8 +1492,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, collmd->current_xnew[collpair->bp2].co, collmd->current_xnew[collpair->bp3].co, &l, 0)) { - if (l >= 0.0 && l < sdis) { - mul_v3_fl(n2, (l-sdis)*cloth->verts[collpair->ap1].mass*dt*clmd->coll_parms->repel_force*0.1); + if (l >= 0.0f && l < sdis) { + mul_v3_fl(n2, (l-sdis)*cloth->verts[collpair->ap1].mass*dt*clmd->coll_parms->repel_force*0.1f); add_v3_v3(cloth->verts[collpair->ap1].tv, n2); add_v3_v3(cloth->verts[collpair->ap2].tv, n2); @@ -1507,7 +1507,7 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, verts1[collpair->ap1].txold, verts1[collpair->ap2].txold, verts1[collpair->ap3].txold, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, collpair->pa,collpair->pb,collpair->vector ); #else // just be sure that we don't add anything - distance = 2.0 * ( epsilon1 + epsilon2 + ALMOST_ZERO ); + distance = 2.0 * (double)( epsilon1 + epsilon2 + ALMOST_ZERO ); #endif if ( distance <= ( epsilon1 + epsilon2 + ALMOST_ZERO ) ) @@ -2534,7 +2534,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl } else { - mul_v3_fl( temp, -correction*0.5 ); + mul_v3_fl( temp, correction * -0.5 ); VECADD ( verts[j].tx, verts[j].tx, temp ); VECSUB ( verts[i].tx, verts[i].tx, temp ); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index df7cd85e6a1..40421c25607 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -677,7 +677,7 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface) volume = td[0]*td[1]*td[2]; /* determine final grid size by trying to fit average 10.000 points per grid cell */ - dim_factor = pow(volume / ((double)sData->total_points / 10000.f), 1.0f/axis); + dim_factor = (float)pow(volume / ((double)sData->total_points / 10000.0), 1.0/(double)axis); /* define final grid size using dim_factor, use min 3 for active axises */ for (i=0; i<3; i++) { @@ -3695,7 +3695,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE || surface->type == MOD_DPAINT_SURFACE_T_WAVE) { /* get displace depth */ - disp_intersect = (1.0f - sqrt(disp_intersect / radius)) * radius; + disp_intersect = (1.0f - sqrtf(disp_intersect / radius)) * radius; depth = (radius - disp_intersect) / bData->bNormal[index].normal_scale; if (depth<0.0f) depth = 0.0f; } @@ -3803,7 +3803,7 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE || surface->type == MOD_DPAINT_SURFACE_T_WAVE) { /* get displace depth */ - float disp_intersect = (1.0f - sqrt((brush->paint_distance-distance) / brush->paint_distance)) * brush->paint_distance; + float disp_intersect = (1.0f - sqrtf((brush->paint_distance-distance) / brush->paint_distance)) * brush->paint_distance; depth = (brush->paint_distance - disp_intersect) / bData->bNormal[index].normal_scale; if (depth<0.0f) depth = 0.0f; } @@ -3863,7 +3863,7 @@ static void dynamicPaint_prepareNeighbourData(DynamicPaintSurface *surface, int int numOfNeighs = adj_data->n_num[index]; for (i=0; iaverage_dist += bNeighs[adj_data->n_index[index]+i].dist; + bData->average_dist += (double)bNeighs[adj_data->n_index[index]+i].dist; } } bData->average_dist /= adj_data->total_targets; @@ -3922,18 +3922,18 @@ void surface_determineForceTargetPoints(PaintSurfaceData *sData, int index, floa /* get drip factor based on force dir in relation to angle between those neighbours */ temp = dot_v3v3(bNeighs[closest_id[0]].dir, force_proj); CLAMP(temp, -1.0f, 1.0f); /* float precision might cause values > 1.0f that return infinite */ - closest_d[1] = acos(temp)/neigh_diff; + closest_d[1] = acosf(temp)/neigh_diff; closest_d[0] = 1.0f - closest_d[1]; /* and multiply depending on how deeply force intersects surface */ temp = fabs(force_intersect); CLAMP(temp, 0.0f, 1.0f); - closest_d[0] *= acos(temp)/1.57079633f; - closest_d[1] *= acos(temp)/1.57079633f; + closest_d[0] *= acosf(temp)/1.57079633f; + closest_d[1] *= acosf(temp)/1.57079633f; } else { /* if only single neighbour, still linearize force intersection effect */ - closest_d[0] = 1.0f - acos(closest_d[0])/1.57079633f; + closest_d[0] = 1.0f - acosf(closest_d[0])/1.57079633f; } } diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index fd5c7912e1f..8a908097862 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -356,7 +356,7 @@ NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker) { AUD_SoundInfo info = AUD_getInfo(speaker->sound->playback_handle); - strip->end = ceil(info.length * FPS); + strip->end = (float)ceil((double)info.length * FPS); } else #endif diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index a86e819ae9f..d28fe8b8509 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -638,7 +638,7 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center w= co[2]*data->winmat[2][3] + data->winmat[3][3]; dx= data->winx*ortho2[0]*data->winmat[0][0]; dy= data->winy*ortho2[1]*data->winmat[1][1]; - w= sqrt(dx*dx + dy*dy)/w; + w= sqrtf(dx*dx + dy*dy)/w; /* w squared because we are working with area */ area= area*w*w; diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 5b02731050e..7f18db63c36 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2270,7 +2270,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo kd = sb->goalfrict * sb_fric_force_scale(ob) ; add_v3_v3v3(auxvect,velgoal,bp->vec); - if (forcetime > 0.0 ) { /* make sure friction does not become rocket motor on time reversal */ + if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */ bp->force[0]-= kd * (auxvect[0]); bp->force[1]-= kd * (auxvect[1]); bp->force[2]-= kd * (auxvect[2]); @@ -2675,7 +2675,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa kd = sb->goalfrict * sb_fric_force_scale(ob) ; add_v3_v3v3(auxvect,velgoal,bp->vec); - if (forcetime > 0.0 ) { /* make sure friction does not become rocket motor on time reversal */ + if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */ bp->force[0]-= kd * (auxvect[0]); bp->force[1]-= kd * (auxvect[1]); bp->force[2]-= kd * (auxvect[2]); @@ -3149,7 +3149,7 @@ static void apply_spring_memory(Object *ob) bp2 =&sb->bpoint[bs->v2]; l = len_v3v3(bp1->pos,bp2->pos); r = bs->len/l; - if (( r > 1.05f) || (r < 0.95)){ + if (( r > 1.05f) || (r < 0.95f)){ bs->len = ((100.0f - b) * bs->len + b*l)/100.0f; } } @@ -3952,7 +3952,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime) while ( (ABS(timedone) < ABS(dtime)) && (loops < 2000) ) { /* set goals in time */ - interpolate_exciter(ob,200,(int)(200.0*(timedone/dtime))); + interpolate_exciter(ob,200,(int)(200.0f*(timedone/dtime))); sb->scratch->flag &= ~SBF_DOFUZZY; /* do predictive euler step */ @@ -3993,7 +3993,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime) timedone += forcetime; newtime=MIN2(forcetimemax,MAX2(newtime,forcetimemin)); //if (newtime > forcetime) printf("up,"); - if (forcetime > 0.0) + if (forcetime > 0.0f) forcetime = MIN2(dtime - timedone,newtime); else forcetime = MAX2(dtime - timedone,newtime); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 38bb615896b..65b27f725bc 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1794,8 +1794,8 @@ static void calculate_stabdata(MovieTracking *tracking, int framenr, float width *angle*= stab->rotinf; /* convert to rotation around image center */ - loc[0]-= (x0 + (x-x0)*cos(*angle)-(y-y0)*sin(*angle) - x)*(*scale); - loc[1]-= (y0 + (x-x0)*sin(*angle)+(y-y0)*cos(*angle) - y)*(*scale); + loc[0]-= (x0 + (x-x0)*cosf(*angle)-(y-y0)*sinf(*angle) - x)*(*scale); + loc[1]-= (y0 + (x-x0)*sinf(*angle)+(y-y0)*cosf(*angle) - y)*(*scale); } } diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 241ab62e175..b2c9a5706a3 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -426,9 +426,9 @@ void mul_m3_v3_double(float mat[][3], double vec[3]) x=vec[0]; y=vec[1]; - vec[0]= x*mat[0][0] + y*mat[1][0] + mat[2][0]*vec[2]; - vec[1]= x*mat[0][1] + y*mat[1][1] + mat[2][1]*vec[2]; - vec[2]= x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2]; + vec[0]= x*(double)mat[0][0] + y*(double)mat[1][0] + (double)mat[2][0]*vec[2]; + vec[1]= x*(double)mat[0][1] + y*(double)mat[1][1] + (double)mat[2][1]*vec[2]; + vec[2]= x*(double)mat[0][2] + y*(double)mat[1][2] + (double)mat[2][2]*vec[2]; } void add_m3_m3m3(float m1[][3], float m2[][3], float m3[][3]) diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 7fecbae8229..1637cd16161 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -211,7 +211,7 @@ void quat_to_mat4(float m[][4], const float q[4]) double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc; #ifdef DEBUG - if(!((q0=dot_qtqt(q, q))==0.0f || (fabs(q0-1.0) < QUAT_EPSILON))) { + if(!((q0=dot_qtqt(q, q))==0.0f || (fabsf(q0-1.0) < QUAT_EPSILON))) { fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0); } #endif @@ -257,7 +257,7 @@ void mat3_to_quat(float *q, float wmat[][3]) /* work on a copy */ copy_m3_m3(mat, wmat); - normalize_m3(mat); /* this is needed AND a NormalQuat in the end */ + normalize_m3(mat); /* this is needed AND a 'normalize_qt' in the end */ tr= 0.25* (double)(1.0f+mat[0][0]+mat[1][1]+mat[2][2]); @@ -271,31 +271,31 @@ void mat3_to_quat(float *q, float wmat[][3]) } else { if(mat[0][0] > mat[1][1] && mat[0][0] > mat[2][2]) { - s= 2.0*sqrtf(1.0f + mat[0][0] - mat[1][1] - mat[2][2]); + s= 2.0f*sqrtf(1.0f + mat[0][0] - mat[1][1] - mat[2][2]); q[1]= (float)(0.25*s); s= 1.0/s; - q[0]= (float)((mat[2][1] - mat[1][2])*s); - q[2]= (float)((mat[1][0] + mat[0][1])*s); - q[3]= (float)((mat[2][0] + mat[0][2])*s); + q[0]= (float)((double)(mat[2][1] - mat[1][2])*s); + q[2]= (float)((double)(mat[1][0] + mat[0][1])*s); + q[3]= (float)((double)(mat[2][0] + mat[0][2])*s); } else if(mat[1][1] > mat[2][2]) { - s= 2.0*sqrtf(1.0f + mat[1][1] - mat[0][0] - mat[2][2]); + s= 2.0f*sqrtf(1.0f + mat[1][1] - mat[0][0] - mat[2][2]); q[2]= (float)(0.25*s); s= 1.0/s; - q[0]= (float)((mat[2][0] - mat[0][2])*s); - q[1]= (float)((mat[1][0] + mat[0][1])*s); - q[3]= (float)((mat[2][1] + mat[1][2])*s); + q[0]= (float)((double)(mat[2][0] - mat[0][2])*s); + q[1]= (float)((double)(mat[1][0] + mat[0][1])*s); + q[3]= (float)((double)(mat[2][1] + mat[1][2])*s); } else { - s= 2.0*sqrtf(1.0 + mat[2][2] - mat[0][0] - mat[1][1]); + s= 2.0f*sqrtf(1.0f + mat[2][2] - mat[0][0] - mat[1][1]); q[3]= (float)(0.25*s); s= 1.0/s; - q[0]= (float)((mat[1][0] - mat[0][1])*s); - q[1]= (float)((mat[2][0] + mat[0][2])*s); - q[2]= (float)((mat[2][1] + mat[1][2])*s); + q[0]= (float)((double)(mat[1][0] - mat[0][1])*s); + q[1]= (float)((double)(mat[2][0] + mat[0][2])*s); + q[2]= (float)((double)(mat[2][1] + mat[1][2])*s); } } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 852b4adcfda..65e047ceb22 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12366,10 +12366,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { Camera *cam; for(cam= main->camera.first; cam; cam= cam->id.next) { - if (cam->sensor_x < 0.01) + if (cam->sensor_x < 0.01f) cam->sensor_x = DEFAULT_SENSOR_WIDTH; - if (cam->sensor_y < 0.01) + if (cam->sensor_y < 0.01f) cam->sensor_y = DEFAULT_SENSOR_HEIGHT; } } diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index b1651886620..ccc375a03f9 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -708,7 +708,7 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link) sub_v3_v3v3(offset, ctrl->bone->head, link->head); /* if root matches, check for direction too */ - if (dot_v3v3(offset, offset) < 0.0001) + if (dot_v3v3(offset, offset) < 0.0001f) { float vbone[3], vparent[3]; @@ -726,7 +726,7 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link) cross_v3_v3v3(nor, vbone, vparent); len = dot_v3v3(nor, nor); - if (len < 0.0001) + if (len < 0.0001f) { flag |= RIG_CTRL_FIT_BONE; } @@ -859,8 +859,8 @@ static void RIG_reconnectControlBones(RigGraph *rg) { int fit = 0; - fit = len_v3v3(ctrl->bone->head, edge->bone->head) < 0.0001; - fit = fit || len_v3v3(ctrl->bone->tail, edge->bone->tail) < 0.0001; + fit = len_v3v3(ctrl->bone->head, edge->bone->head) < 0.0001f; + fit = fit || len_v3v3(ctrl->bone->tail, edge->bone->tail) < 0.0001f; if (fit) { @@ -1016,13 +1016,13 @@ static void RIG_reconnectControlBones(RigGraph *rg) /* don't link with parent */ if (bone->parent != ctrl->bone) { - if (len_v3v3(ctrl->bone->tail, bone->head) < 0.01) + if (len_v3v3(ctrl->bone->tail, bone->head) < 0.01f) { ctrl->tail_mode = TL_HEAD; ctrl->link_tail = bone; break; } - else if (len_v3v3(ctrl->bone->tail, bone->tail) < 0.01) + else if (len_v3v3(ctrl->bone->tail, bone->tail) < 0.01f) { ctrl->tail_mode = TL_TAIL; ctrl->link_tail = bone; @@ -1122,14 +1122,14 @@ static void RIG_removeUneededOffsets(RigGraph *rg) if (first_edge->bone == NULL) { - if (first_edge->bone == NULL && len_v3v3(first_edge->tail, arc->head->p) <= 0.001) + if (first_edge->bone == NULL && len_v3v3(first_edge->tail, arc->head->p) <= 0.001f) { BLI_remlink(&arc->edges, first_edge); MEM_freeN(first_edge); } else if (arc->head->degree == 1) { - RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, first_edge->tail, 0.001); + RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, first_edge->tail, 0.001f); if (new_node) { @@ -1252,14 +1252,14 @@ static void RIG_removeUneededOffsets(RigGraph *rg) if (last_edge->bone == NULL) { - if (len_v3v3(last_edge->head, arc->tail->p) <= 0.001) + if (len_v3v3(last_edge->head, arc->tail->p) <= 0.001f) { BLI_remlink(&arc->edges, last_edge); MEM_freeN(last_edge); } else if (arc->tail->degree == 1) { - RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, last_edge->head, 0.001); + RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, last_edge->head, 0.001f); if (new_node) { @@ -2013,11 +2013,11 @@ static float costAngle(float original_angle, float vec_first[3], float vec_secon { current_angle = saacos(dot_v3v3(vec_first, vec_second)); - return angle_weight * fabs(current_angle - original_angle); + return angle_weight * fabsf(current_angle - original_angle); } else { - return angle_weight * M_PI; + return angle_weight * (float)M_PI; } } else diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index b97e843529a..f16771b624c 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -508,7 +508,7 @@ static void sk_drawEdge(GLUquadric *quad, SK_Point *pt0, SK_Point *pt1, float si angle = angle_normalized_v3v3(vec2, vec1); - glRotatef(angle * 180 / M_PI + 180, axis[0], axis[1], axis[2]); + glRotatef(angle * (float)(180.0/M_PI) + 180.0f, axis[0], axis[1], axis[2]); gluCylinder(quad, sk_clampPointSize(pt1, size), sk_clampPointSize(pt0, size), length, 8, 8); } @@ -529,7 +529,7 @@ static void sk_drawNormal(GLUquadric *quad, SK_Point *pt, float size, float heig angle = angle_normalized_v3v3(vec2, pt->no); - glRotatef(angle * 180 / M_PI, axis[0], axis[1], axis[2]); + glRotatef(angle * (float)(180.0/M_PI), axis[0], axis[1], axis[2]); glColor3f(0, 1, 1); gluCylinder(quad, sk_clampPointSize(pt, size), 0, sk_clampPointSize(pt, height), 10, 2); @@ -1817,7 +1817,7 @@ int sk_detectTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE sub_v3_v3v3(s1, gest->segments->points[1].p, gest->segments->points[0].p); sub_v3_v3v3(s2, gest->segments->points[2].p, gest->segments->points[1].p); - angle = RAD2DEG(angle_v2v2(s1, s2)); + angle = RAD2DEGF(angle_v2v2(s1, s2)); if (angle > 60 && angle < 120) { @@ -1935,7 +1935,7 @@ int sk_detectDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNU sub_v3_v3v3(s1, gest->segments->points[1].p, gest->segments->points[0].p); sub_v3_v3v3(s2, gest->segments->points[2].p, gest->segments->points[1].p); - angle = RAD2DEG(angle_v2v2(s1, s2)); + angle = RAD2DEGF(angle_v2v2(s1, s2)); if (angle > 120) { @@ -2067,7 +2067,7 @@ int sk_detectReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN sub_v3_v3v3(end_v, sk_lastStrokePoint(gest->stk)->p, isect->p); } - angle = RAD2DEG(angle_v2v2(start_v, end_v)); + angle = RAD2DEGF(angle_v2v2(start_v, end_v)); if (angle > 120) { diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index ce4092b2b84..6a43564e5f1 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -545,12 +545,12 @@ static void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc) } } - if (ceil(head->weight) != arc->buckets[0].val) + if (ceilf(head->weight) != arc->buckets[0].val) { printArc(arc); printf("alloc error in first bucket: %f should be %f \n", arc->buckets[0].val, ceil(head->weight)); } - if (floor(tail->weight) != arc->buckets[arc->bcount - 1].val) + if (floorf(tail->weight) != arc->buckets[arc->bcount - 1].val) { printArc(arc); printf("alloc error in last bucket: %f should be %f \n", arc->buckets[arc->bcount - 1].val, floor(tail->weight)); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 4bc0963aad4..67030f1aca7 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1560,11 +1560,11 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc /* draw content of pattern area */ glScissor(ar->winrct.xmin+rect.xmin, ar->winrct.ymin+rect.ymin, scissor[2], scissor[3]); - zoomx= (rect.xmax-rect.xmin) / (scopes->track_preview->x-2.f); - zoomy= (rect.ymax-rect.ymin) / (scopes->track_preview->y-2.f); + zoomx= (rect.xmax-rect.xmin) / (scopes->track_preview->x-2.0f); + zoomy= (rect.ymax-rect.ymin) / (scopes->track_preview->y-2.0f); - off_x= ((int)scopes->track_pos[0]-scopes->track_pos[0]-0.5)*zoomx; - off_y= ((int)scopes->track_pos[1]-scopes->track_pos[1]-0.5)*zoomy; + off_x= ((int)scopes->track_pos[0]-scopes->track_pos[0]-0.5f)*zoomx; + off_y= ((int)scopes->track_pos[1]-scopes->track_pos[1]-0.5f)*zoomy; drawibuf= scale_trackpreview_ibuf(scopes->track_preview, zoomx, zoomy); glaDrawPixelsSafe(off_x+rect.xmin, off_y+rect.ymin, rect.xmax-rect.xmin+1.f-off_x, rect.ymax-rect.ymin+1.f-off_y, drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 06a05740585..7338aa1983f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3231,7 +3231,7 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF { float *hsv= ui_block_hsv_get(but->block); float rgb[3]; - float sensitivity = (shift?0.15:0.3) * ndof->dt; + float sensitivity = (shift ? 0.15f : 0.3f) * ndof->dt; int color_profile = but->block->color_profile; @@ -3426,7 +3426,7 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); /* Convert current colour on hue/sat disc to circular coordinates phi, r */ - phi = fmodf(hsv[0]+0.25f, 1.0f) * -2.0f*M_PI; + phi = fmodf(hsv[0] + 0.25f, 1.0f) * -2.0f * (float)M_PI; r = hsv[1]; /* sqr= r>0.f?sqrtf(r):1; */ /* UNUSED */ @@ -3439,7 +3439,7 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND v[1] += ndof->rx * sensitivity; /* convert back to polar coords on circle */ - phi = atan2(v[0], v[1])/(2.0f*(float)M_PI) + 0.5f; + phi = atan2f(v[0], v[1])/(2.0f*(float)M_PI) + 0.5f; /* use ndof z rotation to additionally rotate hue */ phi -= ndof->rz * sensitivity * 0.5f; diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index a671de71636..70cbbf5a93c 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -546,21 +546,21 @@ static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct m1=MAXSLOPE; b1=x12; } - x2max=MAX2(x21,x22)+0.001; /* prevent missed edges */ - x2min=MIN2(x21,x22)-0.001; /* due to round off error */ - y2max=MAX2(y21,y22)+0.001; - y2min=MIN2(y21,y22)-0.001; + x2max=MAX2(x21,x22)+0.001f; /* prevent missed edges */ + x2min=MIN2(x21,x22)-0.001f; /* due to round off error */ + y2max=MAX2(y21,y22)+0.001f; + y2min=MIN2(y21,y22)-0.001f; /* Found an intersect, calc intersect point */ if (m1==m2){ /* co-incident lines */ /* cut at 50% of overlap area*/ x1max=MAX2(x11, x12); x1min=MIN2(x11, x12); - xi= (MIN2(x2max,x1max)+MAX2(x2min,x1min))/2.0; + xi= (MIN2(x2max,x1max)+MAX2(x2min,x1min))/2.0f; y1max=MAX2(y11, y12); y1min=MIN2(y11, y12); - yi= (MIN2(y2max,y1max)+MAX2(y2min,y1min))/2.0; + yi= (MIN2(y2max,y1max)+MAX2(y2min,y1min))/2.0f; } else if (m2==MAXSLOPE){ xi=x22; @@ -594,7 +594,7 @@ static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct } } } - if ((m2<=1.0)&&(m2>=-1.0)) perc = (xi-x21)/(x22-x21); + if ((m2 <= 1.0f) && (m2 >= -1.0f)) perc = (xi-x21)/(x22-x21); else perc=(yi-y21)/(y22-y21); /*lower slope more accurate*/ //isect=32768.0*(perc+0.0000153); /* Percentage in 1/32768ths */ diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index a59ca5ad954..0d210fa83eb 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1094,8 +1094,8 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in dm_deform_clear(dm, ob); dm = NULL; } } - } while(wasChange && (distToStart-distToBe)/fabs(distToStart-distToBe) == - (dists[bestIndex]-distToBe)/fabs(dists[bestIndex]-distToBe)); + } while(wasChange && (distToStart-distToBe)/fabsf(distToStart-distToBe) == + (dists[bestIndex]-distToBe)/fabsf(dists[bestIndex]-distToBe)); MEM_freeN(upDown); MEM_freeN(changes); MEM_freeN(dists); diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 98abbad13dd..d713303ca8b 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -555,8 +555,8 @@ static int view_zoom_inout_invoke(bContext *C, wmOperator *op, wmEvent *event, i ED_space_clip_size(sc, &width, &height); - sc->xof+= ((co[0]-0.5)*width-sc->xof)*(sc->zoom-oldzoom)/sc->zoom; - sc->yof+= ((co[1]-0.5)*height-sc->yof)*(sc->zoom-oldzoom)/sc->zoom; + sc->xof+= ((co[0]-0.5f)*width-sc->xof)*(sc->zoom-oldzoom)/sc->zoom; + sc->yof+= ((co[1]-0.5f)*height-sc->yof)*(sc->zoom-oldzoom)/sc->zoom; } return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 78bfb1498ac..e9006f5b1e9 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1317,8 +1317,8 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo break; exec_time= PIL_check_seconds_timer()-start_time; - if(tmj->delay>exec_time) - PIL_sleep_ms(tmj->delay-exec_time); + if(tmj->delay > (float)exec_time) + PIL_sleep_ms(tmj->delay-(float)exec_time); } else if(!BKE_tracking_next(tmj->context)) break; @@ -1820,13 +1820,13 @@ static void set_axis(Scene *scene, Object *ob, MovieTrackingTrack *track, char BKE_get_tracking_mat(scene, NULL, mat); mul_v3_m4v3(vec, mat, track->bundle_pos); - if(len_v2(vec)<1e-3) + if(len_v2(vec) < 1e-3f) return; unit_m4(mat); if(axis=='X') { - if(fabsf(vec[1])<1e-3) { + if(fabsf(vec[1])<1e-3f) { mat[0][0]= -1.0f; mat[0][1]= 0.0f; mat[0][2]= 0.0f; mat[1][0]= 0.0f; mat[1][1]= -1.0f; mat[1][2]= 0.0f; mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f; @@ -1837,7 +1837,7 @@ static void set_axis(Scene *scene, Object *ob, MovieTrackingTrack *track, char cross_v3_v3v3(mat[1], mat[2], mat[0]); } } else { - if(fabsf(vec[0])<1e-3) { + if(fabsf(vec[0])<1e-3f) { mat[0][0]= -1.0f; mat[0][1]= 0.0f; mat[0][2]= 0.0f; mat[1][0]= 0.0f; mat[1][1]= -1.0f; mat[1][2]= 0.0f; mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f; @@ -2062,7 +2062,7 @@ static int set_scale_exec(bContext *C, wmOperator *op) sub_v3_v3(vec[0], vec[1]); - if(len_v3(vec[0])>1e-5) { + if(len_v3(vec[0])>1e-5f) { scale= dist / len_v3(vec[0]); mul_v3_fl(parent->size, scale); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index d66197549d9..21fcc067764 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1479,7 +1479,7 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d, glPushMatrix(); glTranslatef(track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]); - glScalef(v3d->bundle_size/0.05, v3d->bundle_size/0.05, v3d->bundle_size/0.05); + glScalef(v3d->bundle_size/0.05f, v3d->bundle_size/0.05f, v3d->bundle_size/0.05f); if(v3d->drawtype==OB_WIRE) { glDisable(GL_LIGHTING); @@ -1720,8 +1720,8 @@ static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D glBegin(GL_LINE_LOOP); for(i = 0; i < 16; i++) { - vec[0] = cosf(M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); - vec[1] = sinf(M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); + vec[0] = cosf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); + vec[1] = sinf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); glVertex3fv(vec); } glEnd(); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index a5849864d86..cc0e93740ea 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1068,14 +1068,14 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy float dfac; if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) { - if(winx>winy) dfac= (sensor_x * 2.0) / (fac*winx*lens); - else dfac= (sensor_x * 2.0) / (fac*winy*lens); + if(winx>winy) dfac= (sensor_x * 2.0f) / (fac*winx*lens); + else dfac= (sensor_x * 2.0f) / (fac*winy*lens); } else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { - dfac= (sensor_x * 2.0) / (fac*winx*lens); + dfac= (sensor_x * 2.0f) / (fac*winx*lens); } else { - dfac= (sensor_y * 2.0) / (fac*winy*lens); + dfac= (sensor_y * 2.0f) / (fac*winy*lens); } x1= - *clipsta * winx*dfac; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 95daa11d97f..5060f55c533 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4691,7 +4691,7 @@ static int createSlideVerts(TransInfo *t) uv_new = tf->uv[k]; if (ev->tmp.l) { - if (fabsf(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) { + if (fabsf(suv->origuv[0]-uv_new[0]) > 0.0001f || fabsf(suv->origuv[1]-uv_new[1]) > 0.0001f) { ev->tmp.l = -1; /* Tag as invalid */ BLI_linklist_free(suv->fuv_list,NULL); suv->fuv_list = NULL; @@ -5462,7 +5462,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, else #endif { - val= (float)( floor(val+0.5f) ); + val= floorf(val+0.5f); } /* convert frame out of nla-action time */ @@ -5548,13 +5548,13 @@ static void headerTimeTranslate(TransInfo *t, char *str) /* apply snapping + frame->seconds conversions */ if (autosnap == SACTSNAP_STEP) { if (doTime) - val= floor(val/secf + 0.5f); + val= floor((double)val/secf + 0.5f); else val= floor(val + 0.5f); } else { if (doTime) - val= val / secf; + val= (float)((double)val / secf); } if (autosnap == SACTSNAP_FRAME) diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 0e053e68496..3a8c2e80351 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -197,8 +197,9 @@ static void clipMirrorModifier(TransInfo *t, Object *ob) clip = 0; if(axis & 1) { - if(fabs(iloc[0])<=tolerance[0] || - loc[0]*iloc[0]<0.0f) { + if(fabsf(iloc[0])<=tolerance[0] || + loc[0]*iloc[0]<0.0f) + { loc[0]= 0.0f; clip = 1; } @@ -206,14 +207,16 @@ static void clipMirrorModifier(TransInfo *t, Object *ob) if(axis & 2) { if(fabs(iloc[1])<=tolerance[1] || - loc[1]*iloc[1]<0.0f) { + loc[1]*iloc[1]<0.0f) + { loc[1]= 0.0f; clip = 1; } } if(axis & 4) { if(fabs(iloc[2])<=tolerance[2] || - loc[2]*iloc[2]<0.0f) { + loc[2]*iloc[2]<0.0f) + { loc[2]= 0.0f; clip = 1; } diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index d08d7cf2ead..3981e9fac02 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -775,7 +775,7 @@ int GPU_update_image_time(Image *ima, double time) if (ima->lastupdate<0) ima->lastupdate = 0; - if (ima->lastupdate>time) + if (ima->lastupdate > (float)time) ima->lastupdate=(float)time; if(ima->tpageflag & IMA_TWINANIM) { @@ -783,7 +783,7 @@ int GPU_update_image_time(Image *ima, double time) /* check: is the bindcode not in the array? Then free. (still to do) */ - diff = (float)(time-ima->lastupdate); + diff = (float)((float)time - ima->lastupdate); inc = (int)(diff*(float)ima->animspeed); ima->lastupdate+=((float)inc/(float)ima->animspeed); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 02ba2eba9e9..397c0e32c69 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1337,8 +1337,8 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) if(world) { /* exposure correction */ if(world->exp!=0.0f || world->range!=1.0f) { - linfac= 1.0 + pow((2.0*world->exp + 0.5), -10); - logfac= log((linfac-1.0f)/linfac)/world->range; + linfac= 1.0f + powf((2.0f*world->exp + 0.5f), -10); + logfac= logf((linfac-1.0f)/linfac)/world->range; GPU_link(mat, "set_value", GPU_uniform(&linfac), &ulinfac); GPU_link(mat, "set_value", GPU_uniform(&logfac), &ulogfac); @@ -1518,7 +1518,7 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l if(lamp->mode & LA_HALO) if(lamp->spotsi > 170.0f) lamp->spotsi = 170.0f; - lamp->spotsi= cos(M_PI*lamp->spotsi/360.0); + lamp->spotsi= cosf((float)M_PI*lamp->spotsi/360.0f); lamp->spotbl= (1.0f - lamp->spotsi)*la->spotblend; lamp->k= la->k; @@ -1539,7 +1539,7 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l /* makeshadowbuf */ angle= saacos(lamp->spotsi); - temp= 0.5f*lamp->size*cos(angle)/sin(angle); + temp= 0.5f*lamp->size*cosf(angle)/sinf(angle); pixsize= (lamp->d)/temp; wsize= pixsize*0.5f*lamp->size; diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 2a83052c827..7159c09d703 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -71,7 +71,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t if (data->flag & CONSTRAINT_IK_AUTO) break; if (data->tar==NULL) continue; if (data->tar->type==OB_ARMATURE && data->subtarget[0]==0) continue; - if ((con->flag & (CONSTRAINT_DISABLE|CONSTRAINT_OFF))==0 && (con->enforce!=0.0)) break; + if ((con->flag & (CONSTRAINT_DISABLE|CONSTRAINT_OFF))==0 && (con->enforce != 0.0f)) break; } } if(con==NULL) return; @@ -255,7 +255,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) if(!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP)) flag |= IK_ZDOF; - if(tree->stretch && (pchan->ikstretch > 0.0)) { + if(tree->stretch && (pchan->ikstretch > 0.0f)) { flag |= IK_TRANS_YDOF; hasstretch = 1; } @@ -320,9 +320,9 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) IK_SetStiffness(seg, IK_Y, pchan->stiffness[1]); IK_SetStiffness(seg, IK_Z, pchan->stiffness[2]); - if(tree->stretch && (pchan->ikstretch > 0.0)) { + if(tree->stretch && (pchan->ikstretch > 0.0f)) { float ikstretch = pchan->ikstretch*pchan->ikstretch; - IK_SetStiffness(seg, IK_TRANS_Y, MIN2(1.0-ikstretch, 0.99)); + IK_SetStiffness(seg, IK_TRANS_Y, MIN2(1.0f-ikstretch, 0.99f)); IK_SetLimit(seg, IK_TRANS_Y, 0.001, 1e10); } } @@ -389,10 +389,10 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) } /* do we need blending? */ - if (!resultblend && target->con->enforce!=1.0) { + if (!resultblend && target->con->enforce != 1.0f) { float q1[4], q2[4], q[4]; float fac= target->con->enforce; - float mfac= 1.0-fac; + float mfac= 1.0f-fac; pchan= tree->pchan[target->tip]; @@ -415,13 +415,13 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) iktarget= iktree[target->tip]; - if(data->weight != 0.0) { + if(data->weight != 0.0f) { if(poleconstrain) IK_SolverSetPoleVectorConstraint(solver, iktarget, goalpos, polepos, data->poleangle, (poleangledata == data)); IK_SolverAddGoal(solver, iktarget, goalpos, data->weight); } - if((data->flag & CONSTRAINT_IK_ROT) && (data->orientweight != 0.0)) + if((data->flag & CONSTRAINT_IK_ROT) && (data->orientweight != 0.0f)) if((data->flag & CONSTRAINT_IK_AUTO)==0) IK_SolverAddGoalOrientation(solver, iktarget, goalrot, data->orientweight); @@ -448,20 +448,20 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) float parentstretch, stretch; pchan= tree->pchan[a]; - parentstretch= (tree->parent[a] >= 0)? ikstretch[tree->parent[a]]: 1.0; + parentstretch= (tree->parent[a] >= 0)? ikstretch[tree->parent[a]]: 1.0f; - if(tree->stretch && (pchan->ikstretch > 0.0)) { + if(tree->stretch && (pchan->ikstretch > 0.0f)) { float trans[3], length; IK_GetTranslationChange(iktree[a], trans); length= pchan->bone->length*len_v3(pchan->pose_mat[1]); - ikstretch[a]= (length == 0.0)? 1.0: (trans[1]+length)/length; + ikstretch[a]= (length == 0.0f)? 1.0f: (trans[1]+length)/length; } else ikstretch[a] = 1.0; - stretch= (parentstretch == 0.0)? 1.0: ikstretch[a]/parentstretch; + stretch= (parentstretch == 0.0f)? 1.0f: ikstretch[a]/parentstretch; mul_v3_fl(tree->basis_change[a][0], stretch); mul_v3_fl(tree->basis_change[a][1], stretch); diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 10b062977b2..1a1d744fb1b 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -603,7 +603,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) if(nodeexec) { node = nodeexec->node; if(ntree->progress && totnode) - ntree->progress(ntree->prh, (1.0 - curnode/(float)totnode)); + ntree->progress(ntree->prh, (1.0f - curnode/(float)totnode)); if(ntree->stats_draw) { char str[64]; sprintf(str, "Compositing %d %s", curnode, node->name); diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index 0356ed394f1..ddd55790436 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -762,7 +762,7 @@ void premul_compbuf(CompBuf *img, int inversed) drect= img->rect; if(inversed) { for(x=img->x*img->y; x>0; x--, drect+=4) { - if(fabs(drect[3]) < 1e-5f) { + if(fabsf(drect[3]) < 1e-5f) { drect[0]= 0.0f; drect[1]= 0.0f; drect[2]= 0.0f; @@ -1314,7 +1314,7 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) int i, x, y, sz; // <0.5 not valid, though can have a possibly useful sort of sharpening effect - if (sigma < 0.5) return; + if (sigma < 0.5f) return; if ((xy < 1) || (xy > 3)) xy = 3; @@ -1326,10 +1326,10 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 - if (sigma >= 3.556) - q = 0.9804*(sigma - 3.556) + 2.5091; + if (sigma >= 3.556f) + q = 0.9804f*(sigma - 3.556f) + 2.5091f; else // sigma >= 0.5 - q = (0.0561*sigma + 0.5784)*sigma - 0.2568; + q = (0.0561f*sigma + 0.5784f)*sigma - 0.2568f; q2 = q*q; sc = (1.1668 + q)*(3.203729649 + (2.21566 + q)*q); // no gabor filtering here, so no complex multiplies, just the regular coefs. diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c index 17038fd6780..0f341335783 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c @@ -62,13 +62,14 @@ static bNodeSocketTemplate cmp_node_bilateralblur_out[]= { #define KERNEL_ELEMENT_C3(k) \ temp_color = src + deltas[k]; \ ref_color = ref + deltas[k]; \ - w = weight_tab[k] + COLOR_DISTANCE_C3(ref, ref_color )*i2sigma_color; \ + w = weight_tab[k] + \ + (double)COLOR_DISTANCE_C3(ref, ref_color ) * i2sigma_color; \ w = 1.0/(w*w + 1); \ mean0 += w; \ - mean1[0] += temp_color[0]*w; \ - mean1[1] += temp_color[1]*w; \ - mean1[2] += temp_color[2]*w; \ - mean1[3] += temp_color[3]*w; + mean1[0] += (double)temp_color[0]*w; \ + mean1[1] += (double)temp_color[1]*w; \ + mean1[2] += (double)temp_color[2]*w; \ + mean1[3] += (double)temp_color[3]*w; /* write blurred values to image */ #define UPDATE_OUTPUT_C3 \ @@ -137,8 +138,8 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN sigma_color= nbbd->sigma_color; sigma_space= nbbd->sigma_space; - i2sigma_color= 1. / (sigma_color * sigma_color); - i2sigma_space= 1. / (sigma_space * sigma_space); + i2sigma_color= 1.0f / (sigma_color * sigma_color); + i2sigma_space= 1.0f / (sigma_space * sigma_space); INIT_3X3_DELTAS(deltas, step, pix); diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index d0ddfb47f08..816aacbe61c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -77,7 +77,7 @@ static float *make_bloomtab(int rad) bloomtab = (float *) MEM_mallocN(n * sizeof(float), "bloom"); for (i = -rad; i <= rad; i++) { - val = pow(1.0 - fabs((float)i)/((float)rad), 4.0); + val = powf(1.0f - fabsf((float)i)/((float)rad), 4.0f); bloomtab[i+rad] = val; } diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c index 10f0afb6cf6..6597ceaeee2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c @@ -49,18 +49,18 @@ static void do_normalized_rgba_to_ycca2(bNode *UNUSED(node), float *out, float * { /*normalize to the range 0.0 to 1.0) */ rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); - out[0]=(out[0])/255.0; - out[1]=(out[1])/255.0; - out[2]=(out[2])/255.0; + out[0]=(out[0])/255.0f; + out[1]=(out[1])/255.0f; + out[2]=(out[2])/255.0f; out[3]=in[3]; } static void do_normalized_ycca_to_rgba2(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ - in[0]=in[0]*255.0; - in[1]=in[1]*255.0; - in[2]=in[2]*255.0; + in[0]=in[0]*255.0f; + in[1]=in[1]*255.0f; + in[2]=in[2]*255.0f; ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); out[3]=in[3]; } diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c index 25891aeaa68..9aadfdf363b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c @@ -50,14 +50,14 @@ static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *i rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); //normalize to 0..1.0 - out[0]=out[0]/255.0; - out[1]=out[1]/255.0; - out[2]=out[2]/255.0; + out[0]=out[0]/255.0f; + out[1]=out[1]/255.0f; + out[2]=out[2]/255.0f; //rescale to -1.0..1.0 - out[0]=(out[0]*2.0)-1.0; - out[1]=(out[1]*2.0)-1.0; - out[2]=(out[2]*2.0)-1.0; + out[0]=(out[0]*2.0f)-1.0f; + out[1]=(out[1]*2.0f)-1.0f; + out[2]=(out[2]*2.0f)-1.0f; // out[0]=((out[0])-16)/255.0; // out[1]=((out[1])-128)/255.0; @@ -68,13 +68,13 @@ static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *i static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ - in[0]=(in[0]+1.0)/2.0; - in[1]=(in[1]+1.0)/2.0; - in[2]=(in[2]+1.0)/2.0; + in[0]=(in[0]+1.0f)/2.0f; + in[1]=(in[1]+1.0f)/2.0f; + in[2]=(in[2]+1.0f)/2.0f; - in[0]=(in[0]*255.0); - in[1]=(in[1]*255.0); - in[2]=(in[2]*255.0); + in[0]=(in[0]*255.0f); + in[1]=(in[1]*255.0f); + in[2]=(in[2]*255.0f); // in[0]=(in[0]*255.0)+16; // in[1]=(in[1]*255.0)+128; @@ -98,27 +98,27 @@ static void do_chroma_key(bNode *node, float *out, float *in) theta=atan2(c->key[2], c->key[1]); /*rotate the cb and cr into x/z space */ - x=in[1]*cos(theta)+in[2]*sin(theta); - z=in[2]*cos(theta)-in[1]*sin(theta); + x=in[1]*cosf(theta)+in[2]*sinf(theta); + z=in[2]*cosf(theta)-in[1]*sinf(theta); /*if within the acceptance angle */ - angle=c->t1*M_PI/180.0; /* convert to radians */ + angle=c->t1*(float)M_PI/180.0f; /* convert to radians */ /* if kfg is <0 then the pixel is outside of the key color */ - kfg=x-(fabs(z)/tan(angle/2.0)); + kfg= x-(fabsf(z)/tanf(angle/2.0f)); out[0]=in[0]; out[1]=in[1]; out[2]=in[2]; - if(kfg>0.0) { /* found a pixel that is within key color */ - alpha=(1.0-kfg)*(c->fstrength); + if(kfg>0.0f) { /* found a pixel that is within key color */ + alpha=(1.0f-kfg)*(c->fstrength); beta=atan2(z,x); - angle2=c->t2*M_PI/180.0; + angle2=c->t2*(float)(M_PI/180.0); /* if beta is within the cutoff angle */ - if(fabs(beta)<(angle2/2.0)) { + if(fabsf(beta) < (angle2/2.0f)) { alpha=0.0; } diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c index b226e562799..66dc9ff0304 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c @@ -57,13 +57,13 @@ static void do_color_key(bNode *node, float *out, float *in) if( /* do hue last because it needs to wrap, and does some more checks */ - /* sat */ (fabs(in[1]-c->key[1]) < c->t2) && - /* val */ (fabs(in[2]-c->key[2]) < c->t3) && + /* sat */ (fabsf(in[1]-c->key[1]) < c->t2) && + /* val */ (fabsf(in[2]-c->key[2]) < c->t3) && /* multiply by 2 because it wraps on both sides of the hue, * otherwise 0.5 would key all hue's */ - /* hue */ ((h_wrap= 2.0f * fabs(in[0]-c->key[0])) < c->t1 || (2.0f - h_wrap) < c->t1) + /* hue */ ((h_wrap= 2.0f * fabsf(in[0]-c->key[0])) < c->t1 || (2.0f - h_wrap) < c->t1) ) { out[3]=0.0; /*make transparent*/ } diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c index eb75802c0a6..f7de5801a5e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c @@ -61,7 +61,7 @@ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slop float x = in * slope + offset; /* prevent NaN */ - CLAMP(x, 0.0, 1.0); + CLAMP(x, 0.0f, 1.0f); return powf(x, power); } diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c index 6f4d32f6573..2e54836e042 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.c +++ b/source/blender/nodes/composite/nodes/node_composite_curves.c @@ -141,9 +141,9 @@ static void do_curves(bNode *node, float *out, float *in) static void do_curves_fac(bNode *node, float *out, float *in, float *fac) { - if(*fac>=1.0) + if(*fac >= 1.0f) curvemapping_evaluate_premulRGBF(node->storage, out, in); - else if(*fac<=0.0) { + else if(*fac <= 0.0f) { copy_v3_v3(out, in); } else { @@ -175,7 +175,7 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS curvemapping_set_black_white(node->storage, in[2]->vec, in[3]->vec); - if(in[0]->data==NULL && in[0]->vec[0] == 1.0) + if(in[0]->data==NULL && in[0]->vec[0] == 1.0f) composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_curves, CB_RGBA); else composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_curves_fac, CB_RGBA, CB_VAL); diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 2232c4a489e..9b32e0f6f3f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -58,8 +58,8 @@ typedef struct BokehCoeffs { static void makeBokeh(char bktype, char ro, int* len_bkh, float* inradsq, BokehCoeffs BKH[8], float bkh_b[4]) { float x0, x1, y0, y1, dx, dy, iDxy; - float w = MAX2(1e-5f, ro)*M_PI/180.f; // never reported stangely enough, but a zero offset causes missing center line... - float wi = (360.f/bktype)*M_PI/180.f; + float w = MAX2(1e-5f, ro)*(float)(M_PI/180); // never reported stangely enough, but a zero offset causes missing center line... + float wi = (360.f/bktype)*(float)(M_PI/180); int i, ov, nv; // bktype must be at least 3 & <= 8 @@ -81,7 +81,7 @@ static void makeBokeh(char bktype, char ro, int* len_bkh, float* inradsq, BokehC BKH[i].x0 = x0; BKH[i].y0 = y0; dx = x1-x0, dy = y1-y0; - iDxy = 1.f / sqrt(dx*dx + dy*dy); + iDxy = 1.f / sqrtf(dx*dx + dy*dy); dx *= iDxy; dy *= iDxy; BKH[i].dx = dx; @@ -146,6 +146,7 @@ static float RI_vdC(unsigned int bits, unsigned int r) // single channel IIR gaussian filtering // much faster than anything else, constant time independent of width // should extend to multichannel and make this a node, could be useful +// note: this is an almost exact copy of 'IIR_gauss' static void IIR_gauss_single(CompBuf* buf, float sigma) { double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3]; @@ -156,14 +157,14 @@ static void IIR_gauss_single(CompBuf* buf, float sigma) if (buf->type != CB_VAL) return; // <0.5 not valid, though can have a possibly useful sort of sharpening effect - if (sigma < 0.5) return; + if (sigma < 0.5f) return; // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 - if (sigma >= 3.556) - q = 0.9804*(sigma - 3.556) + 2.5091; + if (sigma >= 3.556f) + q = 0.9804f*(sigma - 3.556f) + 2.5091f; else // sigma >= 0.5 - q = (0.0561*sigma + 0.5784)*sigma - 0.2568; + q = (0.0561f*sigma + 0.5784f)*sigma - 0.2568f; q2 = q*q; sc = (1.1668 + q)*(3.203729649 + (2.21566 + q)*q); // no gabor filtering here, so no complex multiplies, just the regular coefs. @@ -260,7 +261,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, Camera* cam = (Camera*)camob->data; cam_lens = cam->lens; cam_fdist = dof_camera(camob); - if (cam_fdist==0.0) cam_fdist = 1e10f; /* if the dof is 0.0 then set it be be far away */ + if (cam_fdist==0.0f) cam_fdist = 1e10f; /* if the dof is 0.0 then set it be be far away */ cam_invfdist = 1.f/cam_fdist; } @@ -362,7 +363,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // scale crad back to original maximum and blend crad->rect[px] = bcrad + wts->rect[px]*(scf*crad->rect[px] - bcrad); */ - crad->rect[px] = 0.5f*fabs(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f)); + crad->rect[px] = 0.5f*fabsf(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f)); // 'bug' #6615, limit minimum radius to 1 pixel, not really a solution, but somewhat mitigates the problem crad->rect[px] = MAX2(crad->rect[px], 0.5f); @@ -530,12 +531,13 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, }\ }\ } + i = ceil(ct_crad); j = 0; T = 0; while (i > j) { Dj = sqrt(cR2 - j*j); - Dj -= floor(Dj); + Dj -= floorf(Dj); di = 0; if (Dj > T) { i--; di = 1; } T = Dj; @@ -548,26 +550,26 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, lwt = wt*Dj; if (i!=j) { // outer pixels - AAPIX(x+j, y+i); - AAPIX(x+j, y-i); + AAPIX(x+j, y+i) + AAPIX(x+j, y-i) if (j) { - AAPIX(x-j, y+i); // BL - AAPIX(x-j, y-i); // TL + AAPIX(x-j, y+i) // BL + AAPIX(x-j, y-i) // TL } if (di) { // only when i changed, interior of outer section - CSCAN(j, i); // bottom - CSCAN(j, -i); // top + CSCAN(j, i) // bottom + CSCAN(j, -i) // top } } // lower mid section - AAPIX(x+i, y+j); - if (i) AAPIX(x-i, y+j); - CSCAN(i, j); + AAPIX(x+i, y+j) + if (i) AAPIX(x-i, y+j) + CSCAN(i, j) // upper mid section if (j) { - AAPIX(x+i, y-j); - if (i) AAPIX(x-i, y-j); - CSCAN(i, -j); + AAPIX(x+i, y-j) + if (i) AAPIX(x-i, y-j) + CSCAN(i, -j) } j++; } @@ -600,7 +602,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, fxe = fxe*ct_crad + x; xs = (int)floor(fxs), xe = (int)ceil(fxe); // AA hack for first and last x pixel, near vertical edges only - if (fabs(mind) <= 1.f) { + if (fabsf(mind) <= 1.f) { if ((xs >= 0) && (xs < new->x)) { lwt = 1.f-(fxs - xs); aacol[0] = wtcol[0]*lwt; @@ -619,7 +621,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, } } } - if (fabs(maxd) <= 1.f) { + if (fabsf(maxd) <= 1.f) { if ((xe >= 0) && (xe < new->x)) { lwt = 1.f-(xe - fxe); aacol[0] = wtcol[0]*lwt; @@ -676,7 +678,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, fys = fys*ct_crad + y; fye = fye*ct_crad + y; // near horizontal edges only, line slope <= 1 - if (fabs(mind) <= 1.f) { + if (fabsf(mind) <= 1.f) { int iys = (int)floor(fys); if ((iys >= 0) && (iys < new->y)) { lwt = 1.f - (fys - iys); @@ -696,7 +698,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, } } } - if (fabs(maxd) <= 1.f) { + if (fabsf(maxd) <= 1.f) { int iye = ceil(fye); if ((iye >= 0) && (iye < new->y)) { lwt = 1.f - (iye - fye); diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index 17156ab3492..5ca38b74420 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -58,7 +58,7 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float * fabs(inColor2[2]-inColor1[2]); /*average together the distances*/ - difference=difference/3.0; + difference=difference/3.0f; copy_v3_v3(outColor, inColor1); diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c index 591870d0911..802ef2d8e12 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c @@ -48,7 +48,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, if ((dist != 0.f) || (spin != 0.f) || (zoom != 0.f)) { void (*getpix)(CompBuf*, float, float, float*) = wrap ? qd_getPixelLerpWrap : qd_getPixelLerp; const float a= angle * (float)M_PI / 180.f; - const float itsc= 1.f / pow(2.f, (float)iterations); + const float itsc= 1.f / powf(2.f, (float)iterations); float D; float center_x_pix, center_y_pix; float tx, ty; @@ -62,14 +62,14 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, center_x_pix= center_x * img->x; center_y_pix= center_y * img->y; - tx= itsc * D * cos(a); - ty= -itsc * D * sin(a); + tx= itsc * D * cosf(a); + ty= -itsc * D * sinf(a); sc= itsc * zoom; rot= itsc * spin * (float)M_PI / 180.f; /* blur the image */ for(i= 0; i < iterations; ++i) { - const float cs= cos(rot), ss= sin(rot); + const float cs= cosf(rot), ss= sinf(rot); const float isc= 1.f / (1.f + sc); unsigned int x, y; float col[4]= {0,0,0,0}; diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c index 02a1d203bef..a55a6093f12 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.c +++ b/source/blender/nodes/composite/nodes/node_composite_displace.c @@ -49,7 +49,7 @@ static bNodeSocketTemplate cmp_node_displace_out[]= { /* minimum distance (in pixels) a pixel has to be displaced * in order to take effect */ -#define DISPLACE_EPSILON 0.01 +#define DISPLACE_EPSILON 0.01f static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *UNUSED(veccol), CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale) { diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c index 2bb600db99d..ad377799dea 100644 --- a/source/blender/nodes/composite/nodes/node_composite_gamma.c +++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c @@ -50,7 +50,7 @@ static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac) int i=0; for(i=0; i<3; i++) { /* check for negative to avoid nan's */ - out[i] = (in[i] > 0.0f)? pow(in[i],fac[0]): in[i]; + out[i] = (in[i] > 0.0f)? powf(in[i],fac[0]): in[i]; } out[3] = in[3]; } diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c index f4391a1af77..b7cc1d3c92d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.c +++ b/source/blender/nodes/composite/nodes/node_composite_glare.c @@ -253,7 +253,7 @@ static void streaks(NodeGlare* ndg, CompBuf* dst, CompBuf* src) const float p4 = pow(4.0, (double)n); const float vxp = vx*p4, vyp = vy*p4; const float wt = pow((double)ndg->fade, (double)p4); - const float cmo = 1.f - pow((double)ndg->colmod, (double)n+1); // colormodulation amount relative to current pass + const float cmo = 1.f - (float)pow((double)ndg->colmod, (double)n+1); // colormodulation amount relative to current pass float* tdstcol = tdst->rect; for (y=0; yy; ++y) { for (x=0; xx; ++x, tdstcol+=4) { diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c index 3c73d07d96c..711560a0a94 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c @@ -48,12 +48,12 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac) { NodeHueSat *nhs= node->storage; - if(*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0 || nhs->val!=1.0)) { + if(*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0f || nhs->val!=1.0f)) { float col[3], hsv[3], mfac= 1.0f - *fac; rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2); hsv[0]+= (nhs->hue - 0.5f); - if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0; + if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f; hsv[1]*= nhs->sat; hsv[2]*= nhs->val; hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c index f18eca3dfcc..acb70f13ec2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c @@ -61,7 +61,7 @@ static void do_huecorrect(bNode *node, float *out, float *in) f = curvemapping_evaluateF(node->storage, 2, hsv[0]); hsv[2] *= (f * 2.f); - hsv[0] = hsv[0] - floor(hsv[0]); /* mod 1.0 */ + hsv[0] = hsv[0] - floorf(hsv[0]); /* mod 1.0 */ CLAMP(hsv[1], 0.f, 1.f); /* convert back to rgb */ @@ -89,7 +89,7 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac) f = curvemapping_evaluateF(node->storage, 2, hsv[0]); hsv[2] *= (f * 2.f); - hsv[0] = hsv[0] - floor(hsv[0]); /* mod 1.0 */ + hsv[0] = hsv[0] - floorf(hsv[0]); /* mod 1.0 */ CLAMP(hsv[1], 0.f, 1.f); /* convert back to rgb */ diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c index daf2ee0cbe7..d98f5a1c64b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.c +++ b/source/blender/nodes/composite/nodes/node_composite_invert.c @@ -65,7 +65,7 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac) do_invert(node, col, in); /* blend inverted result against original input with fac */ - facm = 1.0 - fac[0]; + facm = 1.0f - fac[0]; if(node->custom1 & CMP_CHAN_RGB) { col[0] = fac[0]*col[0] + (facm*in[0]); diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c index 54e48bb749d..f3e4f0db8b6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.c +++ b/source/blender/nodes/composite/nodes/node_composite_levels.c @@ -63,7 +63,7 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins) /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0) { /* don't count transparent pixels */ + if(value[3] > 0.0f) { /* don't count transparent pixels */ switch(node->custom1) { case 1: { /* all colors */ rgb_tobw(value[0],value[1],value[2], &value[0]); @@ -120,7 +120,7 @@ static float brightness_mean(bNode* node, CompBuf* in) /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0) { /* don't count transparent pixels */ + if(value[3] > 0.0f) { /* don't count transparent pixels */ numPixels++; switch(node->custom1) { @@ -172,7 +172,7 @@ static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean) /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0) { /* don't count transparent pixels */ + if(value[3] > 0.0f) { /* don't count transparent pixels */ numPixels++; switch(node->custom1) { @@ -233,7 +233,7 @@ static void draw_histogram(bNode *node, CompBuf *out, int* bins) for(y=0;yy; y++) { /* get normalized value (0..255) */ - value=((float)bins[x]/(float)max)*255.0; + value=((float)bins[x]/(float)max)*255.0f; if(y < (int)value) { /*if the y value is below the height of the bar for this line then draw with the color */ switch (node->custom1) { diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c index 5dc6d1c3aaa..b596f67a886 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c @@ -73,40 +73,40 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr /* adaptive sampling, red (U) channel */ /* prevent alpha zero UVs to be used */ - uv_l= uv[-1]!=0.0f? fabs(uv[0]-uv[-3]) : 0.0f; - uv_r= uv[ 5]!=0.0f? fabs(uv[0]-uv[ 3]) : 0.0f; + uv_l= uv[-1]!=0.0f? fabsf(uv[0]-uv[-3]) : 0.0f; + uv_r= uv[ 5]!=0.0f? fabsf(uv[0]-uv[ 3]) : 0.0f; //dx= 0.5f*(fabs(uv[0]-uv[-3]) + fabs(uv[0]-uv[3])); dx= 0.5f*(uv_l + uv_r); - uv_l= uvprev[-1]!=0.0f? fabs(uv[0]-uvprev[-3]) : 0.0f; - uv_r= uvnext[-1]!=0.0f? fabs(uv[0]-uvnext[-3]) : 0.0f; + uv_l= uvprev[-1]!=0.0f? fabsf(uv[0]-uvprev[-3]) : 0.0f; + uv_r= uvnext[-1]!=0.0f? fabsf(uv[0]-uvnext[-3]) : 0.0f; //dx+= 0.25f*(fabs(uv[0]-uvprev[-3]) + fabs(uv[0]-uvnext[-3])); dx+= 0.25f*(uv_l + uv_r); - uv_l= uvprev[ 5]!=0.0f? fabs(uv[0]-uvprev[+3]) : 0.0f; - uv_r= uvnext[ 5]!=0.0f? fabs(uv[0]-uvnext[+3]) : 0.0f; + uv_l= uvprev[ 5]!=0.0f? fabsf(uv[0]-uvprev[+3]) : 0.0f; + uv_r= uvnext[ 5]!=0.0f? fabsf(uv[0]-uvnext[+3]) : 0.0f; //dx+= 0.25f*(fabs(uv[0]-uvprev[+3]) + fabs(uv[0]-uvnext[+3])); dx+= 0.25f*(uv_l + uv_r); /* adaptive sampling, green (V) channel */ - uv_l= uv[-row+2]!=0.0f? fabs(uv[1]-uv[-row+1]) : 0.0f; - uv_r= uv[ row+2]!=0.0f? fabs(uv[1]-uv[ row+1]) : 0.0f; + uv_l= uv[-row+2]!=0.0f? fabsf(uv[1]-uv[-row+1]) : 0.0f; + uv_r= uv[ row+2]!=0.0f? fabsf(uv[1]-uv[ row+1]) : 0.0f; //dy= 0.5f*(fabs(uv[1]-uv[-row+1]) + fabs(uv[1]-uv[row+1])); dy= 0.5f*(uv_l + uv_r); - uv_l= uvprev[-1]!=0.0f? fabs(uv[1]-uvprev[+1-3]) : 0.0f; - uv_r= uvnext[-1]!=0.0f? fabs(uv[1]-uvnext[+1-3]) : 0.0f; + uv_l= uvprev[-1]!=0.0f? fabsf(uv[1]-uvprev[+1-3]) : 0.0f; + uv_r= uvnext[-1]!=0.0f? fabsf(uv[1]-uvnext[+1-3]) : 0.0f; //dy+= 0.25f*(fabs(uv[1]-uvprev[+1-3]) + fabs(uv[1]-uvnext[+1-3])); dy+= 0.25f*(uv_l + uv_r); - uv_l= uvprev[ 5]!=0.0f? fabs(uv[1]-uvprev[+1+3]) : 0.0f; - uv_r= uvnext[ 5]!=0.0f? fabs(uv[1]-uvnext[+1+3]) : 0.0f; + uv_l= uvprev[ 5]!=0.0f? fabsf(uv[1]-uvprev[+1+3]) : 0.0f; + uv_r= uvnext[ 5]!=0.0f? fabsf(uv[1]-uvnext[+1+3]) : 0.0f; //dy+= 0.25f*(fabs(uv[1]-uvprev[+1+3]) + fabs(uv[1]-uvnext[+1+3])); dy+= 0.25f*(uv_l + uv_r); diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c index a0e7beff1ab..27fdcfc1d4e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.c +++ b/source/blender/nodes/composite/nodes/node_composite_math.c @@ -103,10 +103,10 @@ static void do_math(bNode *node, float *out, float *in, float *in2) } else { float y_mod_1 = fmod(in2[0], 1); /* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */ - if (y_mod_1 > 0.999 || y_mod_1 < 0.001) { - out[0]= pow(in[0], floor(in2[0] + 0.5)); + if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) { + out[0]= powf(in[0], floorf(in2[0] + 0.5f)); } else { - out[0] = 0.0; + out[0] = 0.0f; } } } diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c index 96712baf8b0..730c53a1a29 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c @@ -58,7 +58,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac int x, y, yo, xo; ImBuf *ibuf, *obuf; - rad= (M_PI*in[1]->vec[0])/180.0f; + rad= ((float)M_PI*in[1]->vec[0])/180.0f; s= sin(rad); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c index 3b3d57bf442..7944176c5d3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c @@ -53,9 +53,9 @@ static void do_sepycca_601(bNode *UNUSED(node), float *out, float *in) rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_ITU_BT601); /*divided by 255 to normalize for viewing in */ - out[0]= y/255.0; - out[1]= cb/255.0; - out[2]= cr/255.0; + out[0]= y/255.0f; + out[1]= cb/255.0f; + out[2]= cr/255.0f; out[3]= in[3]; } @@ -66,9 +66,9 @@ static void do_sepycca_709(bNode *UNUSED(node), float *out, float *in) rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_ITU_BT709); /*divided by 255 to normalize for viewing in */ - out[0]= y/255.0; - out[1]= cb/255.0; - out[2]= cr/255.0; + out[0]= y/255.0f; + out[1]= cb/255.0f; + out[2]= cr/255.0f; out[3]= in[3]; } @@ -79,9 +79,9 @@ static void do_sepycca_jfif(bNode *UNUSED(node), float *out, float *in) rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_JFIF_0_255); /*divided by 255 to normalize for viewing in */ - out[0]= y/255.0; - out[1]= cb/255.0; - out[2]= cr/255.0; + out[0]= y/255.0f; + out[1]= cb/255.0f; + out[2]= cr/255.0f; out[3]= in[3]; } @@ -106,9 +106,9 @@ static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeSta } /*divided by 255 to normalize for viewing in */ - out[0]->vec[0] = y/255.0; - out[1]->vec[0] = cb/255.0; - out[2]->vec[0] = cr/255.0; + out[0]->vec[0] = y/255.0f; + out[1]->vec[0] = cb/255.0f; + out[2]->vec[0] = cr/255.0f; out[3]->vec[0] = in[0]->vec[3]; } else if ((out[0]->hasoutput) || (out[1]->hasoutput) || (out[2]->hasoutput) || (out[3]->hasoutput)) { diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 3f0a5d55ec2..51ab5b50919 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -945,7 +945,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN angle= PyFloat_AsDouble(value); - if (angle==-1.0 && PyErr_Occurred()) { /* parsed item not a number */ + if (angle==-1.0f && PyErr_Occurred()) { /* parsed item not a number */ PyErr_SetString(PyExc_TypeError, "Quaternion.angle = value: float expected"); return -1; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 00805be2e42..440c7170341 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3621,7 +3621,7 @@ static void area_lamp_vectors(LampRen *lar) float xsize= 0.5f*lar->area_size, ysize= 0.5f*lar->area_sizey, multifac; /* make it smaller, so area light can be multisampled */ - multifac= 1.0f/sqrt((float)lar->ray_totsamp); + multifac= 1.0f/sqrtf((float)lar->ray_totsamp); xsize *= multifac; ysize *= multifac; @@ -3801,7 +3801,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) if(lar->mode & LA_HALO) { if(lar->spotsi>170.0f) lar->spotsi= 170.0f; } - lar->spotsi= cos( M_PI*lar->spotsi/360.0f ); + lar->spotsi= cosf( (float)M_PI*lar->spotsi/360.0f ); lar->spotbl= (1.0f-lar->spotsi)*la->spotblend; memcpy(lar->mtex, la->mtex, MAX_MTEX*sizeof(void *)); @@ -4028,8 +4028,8 @@ void init_render_world(Render *re) re->wrld.misi= 1.0f; } - re->wrld.linfac= 1.0 + pow((2.0*re->wrld.exp + 0.5), -10); - re->wrld.logfac= log( (re->wrld.linfac-1.0)/re->wrld.linfac )/re->wrld.range; + re->wrld.linfac= 1.0f + powf((2.0f*re->wrld.exp + 0.5f), -10); + re->wrld.logfac= logf((re->wrld.linfac-1.0f)/re->wrld.linfac) / re->wrld.range; } @@ -4082,7 +4082,7 @@ static void set_phong_threshold(ObjectRen *obr) if(tot) { thresh/= (float)tot; - obr->ob->smoothresh= cos(0.5*M_PI-saacos(thresh)); + obr->ob->smoothresh= cosf(0.5f*(float)M_PI-saacos(thresh)); } } @@ -5260,11 +5260,11 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con /* angle between (0,0,-1) and (co) */ copy_v3_v3(vec, co); - ang= saacos(-vec[2]/sqrt(vec[0]*vec[0] + vec[2]*vec[2])); + ang= saacos(-vec[2]/sqrtf(vec[0]*vec[0] + vec[2]*vec[2])); if(vec[0]<0.0f) ang= -ang; zco[0]= ang/pixelphix + zmulx; - ang= 0.5f*M_PI - saacos(vec[1]/sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2])); + ang= 0.5f*M_PI - saacos(vec[1]/sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2])); zco[1]= ang/pixelphiy + zmuly; } @@ -5292,7 +5292,7 @@ static void calculate_speedvector(const float vectors[2], int step, float winsq, /* maximize speed for image width, otherwise it never looks good */ len= zco[0]*zco[0] + zco[1]*zco[1]; if(len > winsq) { - len= winroot/sqrt(len); + len= winroot/sqrtf(len); zco[0]*= len; zco[1]*= len; } @@ -5502,7 +5502,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * // maximize speed as usual len= zco[0]*zco[0] + zco[1]*zco[1]; if(len > winsq) { - len= winroot/sqrt(len); + len= winroot/sqrtf(len); zco[0]*= len; zco[1]*= len; } diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 6ea62828601..62cb29c3d5f 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -601,31 +601,31 @@ static int envcube_isect(EnvMap *env, float *vec, float *answ) } else { /* which face */ - if( vec[2]<=-fabs(vec[0]) && vec[2]<=-fabs(vec[1]) ) { + if( vec[2] <= -fabsf(vec[0]) && vec[2] <= -fabsf(vec[1]) ) { face= 0; labda= -1.0f/vec[2]; answ[0]= labda*vec[0]; answ[1]= labda*vec[1]; } - else if( vec[2]>=fabs(vec[0]) && vec[2]>=fabs(vec[1]) ) { + else if (vec[2] >= fabsf(vec[0]) && vec[2] >= fabsf(vec[1])) { face= 1; labda= 1.0f/vec[2]; answ[0]= labda*vec[0]; answ[1]= -labda*vec[1]; } - else if( vec[1]>=fabs(vec[0]) ) { + else if (vec[1] >= fabsf(vec[0])) { face= 2; labda= 1.0f/vec[1]; answ[0]= labda*vec[0]; answ[1]= labda*vec[2]; } - else if( vec[0]<=-fabs(vec[1]) ) { + else if (vec[0] <= -fabsf(vec[1])) { face= 3; labda= -1.0f/vec[0]; answ[0]= labda*vec[1]; answ[1]= labda*vec[2]; } - else if( vec[1]<=-fabs(vec[0]) ) { + else if (vec[1] <= -fabsf(vec[0])) { face= 4; labda= -1.0f/vec[1]; answ[0]= -labda*vec[0]; diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index 36709408496..a78cc3e2288 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -331,7 +331,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, /* halo being intersected? */ if(har->zs> zz-har->zd) { t= ((float)(zz-har->zs))/(float)har->zd; - alpha*= sqrt(sqrt(t)); + alpha*= sqrtf(sqrtf(t)); } } @@ -351,7 +351,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, rc= hashvectf + (ofs % 768); - fac= fabs( rc[1]*(har->rad*fabs(rc[0]) - radist) ); + fac= fabsf( rc[1]*(har->rad*fabsf(rc[0]) - radist) ); if(fac< 1.0f) { ringf+= (1.0f-fac); @@ -360,7 +360,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, } if(har->type & HA_VECT) { - dist= fabs( har->cos*(yn) - har->sin*(xn) )/har->rad; + dist= fabsf( har->cos*(yn) - har->sin*(xn) )/har->rad; if(dist>1.0f) dist= 1.0f; if(har->tex) { zn= har->sin*xn - har->cos*yn; @@ -379,7 +379,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, if(har->hard>=30) { dist= sqrt(dist); if(har->hard>=40) { - dist= sin(dist*M_PI_2); + dist= sinf(dist*(float)M_PI_2); if(har->hard>=50) { dist= sqrt(dist); } @@ -418,8 +418,8 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, angle= atan2(yn, xn); angle*= (1.0f+0.25f*har->starpoints); - co= cos(angle); - si= sin(angle); + co= cosf(angle); + si= sinf(angle); angle= (co*xn+si*yn)*(co*yn-si*xn); @@ -427,7 +427,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, if(ster>1.0f) { ster= (har->rad)/(ster); - if(ster<1.0f) dist*= sqrt(ster); + if(ster<1.0f) dist*= sqrtf(ster); } } diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 2d3f6fa6005..85954d20a30 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -325,7 +325,7 @@ static float wood_int(Tex *tex, float x, float y, float z) wi = waveform[wf]((x + y + z)*10.0f); } else if (wt==TEX_RING) { - wi = waveform[wf](sqrt(x*x + y*y + z*z)*20.0f); + wi = waveform[wf](sqrtf(x*x + y*y + z*z)*20.0f); } else if (wt==TEX_BANDNOISE) { wi = tex->turbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); @@ -333,7 +333,7 @@ static float wood_int(Tex *tex, float x, float y, float z) } else if (wt==TEX_RINGNOISE) { wi = tex->turbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); - wi = waveform[wf](sqrt(x*x + y*y + z*z)*20.0f + wi); + wi = waveform[wf](sqrtf(x*x + y*y + z*z)*20.0f + wi); } return wi; @@ -659,7 +659,7 @@ static float voronoiTex(Tex *tex, float *texvec, TexResult *texres) if (sc!=0.f) sc = tex->ns_outscale/sc; voronoi(texvec[0], texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); - texres->tin = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + texres->tin = sc * fabsf(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); if (tex->vn_coltype) { float ca[3]; /* cell color */ @@ -699,11 +699,11 @@ static float voronoiTex(Tex *tex, float *texvec, TexResult *texres) /* calculate bumpnormal */ voronoi(texvec[0] + offs, texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); - texres->nor[0] = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + texres->nor[0] = sc * fabsf(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); voronoi(texvec[0], texvec[1] + offs, texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); - texres->nor[1] = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + texres->nor[1] = sc * fabsf(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); voronoi(texvec[0], texvec[1], texvec[2] + offs, da, pa, tex->vn_mexp, tex->vn_distm); - texres->nor[2] = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + texres->nor[2] = sc * fabsf(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); tex_normal_derivate(tex, texres); rv |= TEX_NOR; @@ -1450,9 +1450,9 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa case MTEX_DIFF: fact*= facg; facm= 1.0f-fact; - in[0]= facm*out[0] + fact*fabs(tex[0]-out[0]); - in[1]= facm*out[1] + fact*fabs(tex[1]-out[1]); - in[2]= facm*out[2] + fact*fabs(tex[2]-out[2]); + in[0]= facm*out[0] + fact*fabsf(tex[0]-out[0]); + in[1]= facm*out[1] + fact*fabsf(tex[1]-out[1]); + in[2]= facm*out[2] + fact*fabsf(tex[2]-out[2]); break; case MTEX_DARK: @@ -1557,7 +1557,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen break; case MTEX_DIFF: - in= facm*out + fact*fabs(tex-out); + in= facm*out + fact*fabsf(tex-out); break; case MTEX_DARK: @@ -2478,7 +2478,7 @@ void do_material_tex(ShadeInput *shi, Render *re) texres.nor[0] = -texres.nor[0]; texres.nor[1] = -texres.nor[1]; } - fact = Tnor*fabs(norfac); + fact = Tnor*fabsf(norfac); if (fact>1.f) fact = 1.f; facm = 1.f-fact; if(mtex->normapspace == MTEX_NSPACE_TANGENT) { @@ -3031,7 +3031,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h /* only works with texture being "real" */ /* use saacos(), fixes bug [#22398], float precision caused lo[2] to be slightly less then -1.0 */ if(lo[0] || lo[1]) { /* check for zero case [#24807] */ - fact= (1.0f/(float)M_PI)*saacos(lo[2])/(sqrt(lo[0]*lo[0] + lo[1]*lo[1])); + fact= (1.0f/(float)M_PI)*saacos(lo[2])/(sqrtf(lo[0]*lo[0] + lo[1]*lo[1])); tempvec[0]= lo[0]*fact; tempvec[1]= lo[1]*fact; tempvec[2]= 0.0; @@ -3721,15 +3721,12 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const obi.ob = ob; shi.obi = &obi; unit_m4(re.viewinv); - - color[0] = mat->vol.reflection_col[0]; - color[1] = mat->vol.reflection_col[1]; - color[2] = mat->vol.reflection_col[2]; + copy_v3_v3(color, mat->vol.reflection_col); *alpha = mat->vol.density; /* do texture */ do_volume_tex(&shi, volume_co, (MAP_TRANSMISSION_COL | MAP_REFLECTION_COL | MAP_DENSITY), - color, alpha, &re); + color, alpha, &re); } } diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index fde4eab37b0..e1f521db066 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -174,7 +174,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) VECCOPY(npos, p1); // npos is double! /* pre-scale */ - npos[2]*= lar->sh_zfac; + npos[2] *= (double)lar->sh_zfac; } else { VECCOPY(npos, lar->sh_invcampos); /* in initlamp calculated */ @@ -204,11 +204,11 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) maxz*= lar->sh_zfac; maxy= lar->imat[0][1]*p1[0]+lar->imat[1][1]*p1[1]+lar->imat[2][1]*p1[2]; - if( fabs(nray[2]) < FLT_EPSILON ) use_yco= 1; + if( fabsf(nray[2]) < FLT_EPSILON ) use_yco= 1; } /* scale z to make sure volume is normalized */ - nray[2]*= lar->sh_zfac; + nray[2] *= (double)lar->sh_zfac; /* nray does not need normalization */ ladist= lar->sh_zfac*lar->dist; @@ -260,7 +260,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) /* intersction point with -ladist, the bottom of the cone */ if(use_yco==0) { - t3= (-ladist-npos[2])/nray[2]; + t3= ((double)(-ladist)-npos[2])/nray[2]; /* de we have to replace one of the intersection points? */ if(ok1) { @@ -413,7 +413,7 @@ float fresnel_fac(float *view, float *vn, float grad, float fac) if(t1>0.0f) t2= 1.0f+t1; else t2= 1.0f-t1; - t2= grad + (1.0f-grad)*pow(t2, fac); + t2= grad + (1.0f-grad)*powf(t2, fac); if(t2<0.0f) return 0.0f; else if(t2>1.0f) return 1.0f; @@ -698,7 +698,7 @@ static float WardIso_Spec( float *n, float *l, float *v, float rms, int tangent) angle = tan(saacos(nh)); alpha = MAX2(rms, 0.001f); - i= nl * (1.0f/(4.0f*M_PI*alpha*alpha)) * (exp( -(angle*angle)/(alpha*alpha))/(sqrt(nv*nl))); + i= nl * (1.0f/(4.0f*(float)M_PI*alpha*alpha)) * (expf( -(angle*angle)/(alpha*alpha))/(sqrtf(nv*nl))); return i; } @@ -777,7 +777,7 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough b*= 0.95f; /* prevent tangens from shooting to inf, 'nl' can be not a dot product here. */ /* overflow only happens with extreme size area light, and higher roughness */ - i = nl * ( A + ( B * t * sin(a) * tan(b) ) ); + i = nl * ( A + ( B * t * sinf(a) * tanf(b) ) ); return i; } @@ -1636,9 +1636,9 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr) static void wrld_exposure_correct(float diff[3]) { - diff[0]= R.wrld.linfac*(1.0f-exp( diff[0]*R.wrld.logfac) ); - diff[1]= R.wrld.linfac*(1.0f-exp( diff[1]*R.wrld.logfac) ); - diff[2]= R.wrld.linfac*(1.0f-exp( diff[2]*R.wrld.logfac) ); + diff[0]= R.wrld.linfac*(1.0f-expf( diff[0]*R.wrld.logfac) ); + diff[1]= R.wrld.linfac*(1.0f-expf( diff[1]*R.wrld.logfac) ); + diff[2]= R.wrld.linfac*(1.0f-expf( diff[2]*R.wrld.logfac) ); } void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) -- cgit v1.2.3