From 3a40aed3d52aeb24973385d3aa8e0c2234bf0435 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 17 Sep 2014 14:11:37 +1000 Subject: Cleanup: use float versions of functions when in/output are floats --- source/blender/blenkernel/intern/armature.c | 4 +- source/blender/blenkernel/intern/camera.c | 2 +- source/blender/blenkernel/intern/colortools.c | 4 +- source/blender/blenkernel/intern/constraint.c | 2 +- source/blender/blenkernel/intern/curve.c | 4 +- source/blender/blenkernel/intern/effect.c | 2 +- source/blender/blenkernel/intern/implicit.c | 2 +- source/blender/blenkernel/intern/paint.c | 2 +- source/blender/blenkernel/intern/particle.c | 53 ++++++++++++---------- source/blender/blenkernel/intern/particle_system.c | 2 +- source/blender/blenkernel/intern/seqeffects.c | 6 +-- source/blender/blenlib/intern/math_geom.c | 2 +- source/blender/blenlib/intern/math_rotation.c | 4 +- .../blender/editors/armature/armature_relations.c | 2 +- .../blender/editors/interface/interface_widgets.c | 6 +-- source/blender/editors/physics/particle_edit.c | 8 ++-- .../blender/editors/sculpt_paint/paint_image_2d.c | 2 +- .../editors/sculpt_paint/paint_image_proj.c | 2 +- source/blender/editors/sculpt_paint/paint_ops.c | 6 +-- source/blender/editors/sculpt_paint/paint_stroke.c | 6 +-- source/blender/editors/sculpt_paint/sculpt.c | 12 ++--- source/blender/editors/sculpt_paint/sculpt_uv.c | 16 +++---- source/blender/editors/space_view3d/view3d_edit.c | 6 +-- source/blender/editors/space_view3d/view3d_walk.c | 2 +- source/blender/editors/transform/transform_snap.c | 6 +-- .../blender/editors/uvedit/uvedit_parametrizer.c | 28 ++++++------ .../nodes/shader/nodes/node_shader_camera.c | 2 +- .../blender/nodes/shader/nodes/node_shader_math.c | 22 ++++----- .../nodes/shader/nodes/node_shader_vectMath.c | 4 +- .../nodes/texture/nodes/node_texture_math.c | 12 ++--- .../python/mathutils/mathutils_Quaternion.c | 2 +- .../render/intern/raytrace/rayobject_octree.cpp | 2 +- .../blender/render/intern/source/convertblender.c | 16 +++---- source/blender/render/intern/source/initrender.c | 2 +- .../blender/render/intern/source/multires_bake.c | 6 +-- source/blender/render/intern/source/pipeline.c | 4 +- source/blender/render/intern/source/pixelshading.c | 24 +++++----- source/blender/render/intern/source/pointdensity.c | 2 +- source/blender/render/intern/source/rayshade.c | 18 ++++---- .../blender/render/intern/source/render_texture.c | 42 ++++++++--------- source/blender/render/intern/source/rendercore.c | 4 +- .../blender/render/intern/source/renderdatabase.c | 16 +++---- source/blender/render/intern/source/shadbuf.c | 8 ++-- source/blender/render/intern/source/shadeoutput.c | 16 +++---- source/blender/render/intern/source/sss.c | 10 ++-- source/blender/render/intern/source/strand.c | 2 +- source/blender/render/intern/source/sunsky.c | 6 +-- source/blender/render/intern/source/zbuf.c | 6 +-- source/blender/windowmanager/intern/wm_operators.c | 6 +-- 49 files changed, 212 insertions(+), 211 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 16b5574709e..bb05b5de8a6 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -505,7 +505,7 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB invert_m3_m3(imat3, mat3); mul_m3_m3m3(mat3, result, imat3); /* the matrix transforming vec_roll to desired roll */ - roll1 = (float)atan2(mat3[2][0], mat3[2][2]); + roll1 = atan2f(mat3[2][0], mat3[2][2]); } } else { @@ -543,7 +543,7 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB invert_m3_m3(imat3, mat3); mul_m3_m3m3(mat3, imat3, result); /* the matrix transforming vec_roll to desired roll */ - roll2 = (float)atan2(mat3[2][0], mat3[2][2]); + roll2 = atan2f(mat3[2][0], mat3[2][2]); /* and only now negate handle */ mul_v3_fl(h2, -hlength2); diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 6ce3abe7a32..1402f62291f 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -232,7 +232,7 @@ void BKE_camera_params_from_object(CameraParams *params, Object *ob) /* lamp object */ Lamp *la = ob->data; float fac = cosf(la->spotsize * 0.5f); - float phi = acos(fac); + float phi = acosf(fac); params->lens = 16.0f * fac / sinf(phi); if (params->lens == 0.0f) diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index c6d07a959d1..a63e06c7cb8 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -577,14 +577,14 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) /* store first and last handle for extrapolation, unit length */ cuma->ext_in[0] = bezt[0].vec[0][0] - bezt[0].vec[1][0]; cuma->ext_in[1] = bezt[0].vec[0][1] - bezt[0].vec[1][1]; - range = sqrt(cuma->ext_in[0] * cuma->ext_in[0] + cuma->ext_in[1] * cuma->ext_in[1]); + range = sqrtf(cuma->ext_in[0] * cuma->ext_in[0] + cuma->ext_in[1] * cuma->ext_in[1]); cuma->ext_in[0] /= range; cuma->ext_in[1] /= range; a = cuma->totpoint - 1; cuma->ext_out[0] = bezt[a].vec[1][0] - bezt[a].vec[2][0]; cuma->ext_out[1] = bezt[a].vec[1][1] - bezt[a].vec[2][1]; - range = sqrt(cuma->ext_out[0] * cuma->ext_out[0] + cuma->ext_out[1] * cuma->ext_out[1]); + range = sqrtf(cuma->ext_out[0] * cuma->ext_out[0] + cuma->ext_out[1] * cuma->ext_out[1]); cuma->ext_out[0] /= range; cuma->ext_out[1] /= range; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index d80529ee780..ee7bad773fa 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3592,7 +3592,7 @@ static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t cross_v3_v3v3(raxis, obvec, tarvec); rangle = dot_v3v3(obvec, tarvec); - rangle = acos(max_ff(-1.0f, min_ff(1.0f, rangle))); + rangle = acosf(max_ff(-1.0f, min_ff(1.0f, rangle))); /* construct rotation matrix from the axis-angle rotation found above * - this call takes care to make sure that the axis provided is a unit vector first diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index a06834f61b3..cee5241cb5c 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2468,7 +2468,7 @@ static void make_bevel_list_2D(BevList *bl) /* first */ bevp = bl->bevpoints; - angle = atan2(bevp->dir[0], bevp->dir[1]) - M_PI / 2.0; + angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)(M_PI / 2.0f); bevp->sina = sinf(angle); bevp->cosa = cosf(angle); vec_to_quat(bevp->quat, bevp->dir, 5, 1); @@ -2476,7 +2476,7 @@ static void make_bevel_list_2D(BevList *bl) /* last */ bevp = bl->bevpoints; bevp += (bl->nr - 1); - angle = atan2(bevp->dir[0], bevp->dir[1]) - M_PI / 2.0; + angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)(M_PI / 2.0f); bevp->sina = sinf(angle); bevp->cosa = cosf(angle); vec_to_quat(bevp->quat, bevp->dir, 5, 1); diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 24ee470eaa7..ced9da8d0b1 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -872,7 +872,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected case PFIELD_HARMONIC: mul_v3_fl(force, -strength * efd->falloff); copy_v3_v3(temp, point->vel); - mul_v3_fl(temp, -damp * 2.0f * (float)sqrt(fabs(strength)) * point->vel_to_sec); + mul_v3_fl(temp, -damp * 2.0f * sqrtf(fabsf(strength)) * point->vel_to_sec); add_v3_v3(force, temp); break; case PFIELD_CHARGE: diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 4d80256426d..4cf9d52989f 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1236,7 +1236,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, sub_v3_v3v3(extent, X[s->kl], X[s->ij]); sub_v3_v3v3(vel, V[s->kl], V[s->ij]); dot = dot_v3v3(extent, extent); - length = sqrt(dot); + length = sqrtf(dot); s->flags &= ~CLOTH_SPRING_FLAG_NEEDED; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index df2f0c84f00..d16575d80c8 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -486,7 +486,7 @@ void paint_calculate_rake_rotation(UnifiedPaintSettings *ups, const float mouse_ sub_v2_v2v2(dpos, ups->last_rake, mouse_pos); if (len_squared_v2(dpos) >= r * r) { - ups->brush_rotation = atan2(dpos[0], dpos[1]); + ups->brush_rotation = atan2f(dpos[0], dpos[1]); interp_v2_v2v2(ups->last_rake, ups->last_rake, mouse_pos, u); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 27d346f65b9..530573d6e38 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -656,7 +656,7 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center } /* screen space radius */ - radius = sqrt(area / (float)M_PI); + radius = sqrtf(area / (float)M_PI); /* make smaller using fallof once over screen edge */ *viewport = 1.0f; @@ -917,8 +917,8 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot) elem->scalemax = (lambda + t < 1.0f) ? 1.0f / lambda : 1.0f / (1.0f - elem->t * elem->t / t); elem->scalemin = (lambda + t < 1.0f) ? 0.0f : elem->scalemax * (1.0f - elem->t / t); - elem->scalemin = sqrt(elem->scalemin); - elem->scalemax = sqrt(elem->scalemax); + elem->scalemin = sqrtf(elem->scalemin); + elem->scalemax = sqrtf(elem->scalemax); /* clamp scaling */ scaleclamp = (float)min_ii(elem->totchild, 10); @@ -939,8 +939,8 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot) } elem->lambda = lambda; - elem->scalemin = sqrt(elem->scalemin); - elem->scalemax = sqrt(elem->scalemax); + elem->scalemin = sqrtf(elem->scalemin); + elem->scalemax = sqrtf(elem->scalemax); elem->curchild = 0; } @@ -1950,10 +1950,10 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float t = time * freq * (float)M_PI; if (smooth_start) { - dt = fabs(t); + dt = fabsf(t); /* smooth the beginning of kink */ CLAMP(dt, 0.f, (float)M_PI); - dt = sin(dt / 2.f); + dt = sinf(dt / 2.f); } if (type != PART_KINK_RADIAL) { @@ -2014,12 +2014,12 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float madd_v3_v3fl(result, proj, flat); } - madd_v3_v3fl(result, par_vec, -amplitude * (float)sin(t)); + madd_v3_v3fl(result, par_vec, -amplitude * sinf(t)); break; } case PART_KINK_WAVE: { - madd_v3_v3fl(result, kink, amplitude * (float)sin(t)); + madd_v3_v3fl(result, kink, amplitude * sinf(t)); if (flat > 0.f) { float proj[3]; @@ -2054,22 +2054,22 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float if (inp_y > 0.5f) { copy_v3_v3(state_co, y_vec); - mul_v3_fl(y_vec, amplitude * (float)cos(t)); - mul_v3_fl(z_vec, amplitude / 2.f * (float)sin(2.f * t)); + mul_v3_fl(y_vec, amplitude * cosf(t)); + mul_v3_fl(z_vec, amplitude / 2.f * sinf(2.f * t)); } else if (inp_z > 0.0f) { - mul_v3_v3fl(state_co, z_vec, (float)sin((float)M_PI / 3.f)); + mul_v3_v3fl(state_co, z_vec, sinf((float)M_PI / 3.f)); madd_v3_v3fl(state_co, y_vec, -0.5f); - mul_v3_fl(y_vec, -amplitude * (float)cos(t + (float)M_PI / 3.f)); - mul_v3_fl(z_vec, amplitude / 2.f * (float)cos(2.f * t + (float)M_PI / 6.f)); + mul_v3_fl(y_vec, -amplitude * cosf(t + (float)M_PI / 3.f)); + mul_v3_fl(z_vec, amplitude / 2.f * cosf(2.f * t + (float)M_PI / 6.f)); } else { - mul_v3_v3fl(state_co, z_vec, -(float)sin((float)M_PI / 3.f)); + mul_v3_v3fl(state_co, z_vec, -sinf((float)M_PI / 3.f)); madd_v3_v3fl(state_co, y_vec, -0.5f); - mul_v3_fl(y_vec, amplitude * (float)-sin(t + (float)M_PI / 6.f)); - mul_v3_fl(z_vec, amplitude / 2.f * (float)-sin(2.f * t + (float)M_PI / 3.f)); + mul_v3_fl(y_vec, amplitude * -sinf(t + (float)M_PI / 6.f)); + mul_v3_fl(z_vec, amplitude / 2.f * -sinf(2.f * t + (float)M_PI / 3.f)); } mul_v3_fl(state_co, amplitude); @@ -2271,8 +2271,11 @@ static void do_rough(float *loc, float mat[4][4], float t, float fac, float size float rough[3]; float rco[3]; - if (thres != 0.0f) - if ((float)fabs((float)(-1.5f + loc[0] + loc[1] + loc[2])) < 1.5f * thres) return; + if (thres != 0.0f) { + if (fabsf((float)(-1.5f + loc[0] + loc[1] + loc[2])) < 1.5f * thres) { + return; + } + } copy_v3_v3(rco, loc); mul_v3_fl(rco, t); @@ -4567,8 +4570,8 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa normalize_v3(nor); /* make sure that we get a proper side vector */ - if (fabs(dot_v3v3(nor, vec)) > 0.999999) { - if (fabs(dot_v3v3(nor, xvec)) > 0.999999) { + if (fabsf(dot_v3v3(nor, vec)) > 0.999999) { + if (fabsf(dot_v3v3(nor, xvec)) > 0.999999) { nor[0] = 0.0f; nor[1] = 1.0f; nor[2] = 0.0f; @@ -4676,12 +4679,12 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3] copy_v3_v3(tvec, xvec); copy_v3_v3(tvec2, yvec); - mul_v3_fl(xvec, cos(bb->tilt * (float)M_PI)); - mul_v3_fl(tvec2, sin(bb->tilt * (float)M_PI)); + mul_v3_fl(xvec, cosf(bb->tilt * (float)M_PI)); + mul_v3_fl(tvec2, sinf(bb->tilt * (float)M_PI)); add_v3_v3(xvec, tvec2); - mul_v3_fl(yvec, cos(bb->tilt * (float)M_PI)); - mul_v3_fl(tvec, -sin(bb->tilt * (float)M_PI)); + mul_v3_fl(yvec, cosf(bb->tilt * (float)M_PI)); + mul_v3_fl(tvec, -sinf(bb->tilt * (float)M_PI)); add_v3_v3(yvec, tvec); mul_v3_fl(xvec, bb->size[0]); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 09e20c02691..155299b69c3 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -701,7 +701,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount) rad1= (float)(1.0f/sqrtf((float)num)); rad2= (float)(1.0f/((float)num)); - rad3= (float)sqrt((float)num)/((float)num); + rad3= (float)sqrtf((float)num)/((float)num); rng = BLI_rng_new(31415926 + num + seed2); x= 0; diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index a8e578eae0d..11a6cb7acc3 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -1322,7 +1322,7 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f if (angle == 0.0f) { b1 = posy; b2 = y; - hyp = fabs(y - posy); + hyp = fabsf(y - posy); } else { b1 = posy - (-angle) * posx; @@ -1745,8 +1745,8 @@ static void transform_image(int x, int y, ImBuf *ibuf1, ImBuf *out, float scale yo = y; /* Rotate */ - s = sin(rotate); - c = cos(rotate); + s = sinf(rotate); + c = cosf(rotate); for (yi = 0; yi < yo; yi++) { for (xi = 0; xi < xo; xi++) { diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 17a1dcbf34d..4db9015d9e2 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -3193,7 +3193,7 @@ void map_to_tube(float *r_u, float *r_v, const float x, const float y, const flo len = sqrtf(x * x + y * y); if (len > 0.0f) { - *r_u = (float)((1.0 - (atan2(x / len, y / len) / M_PI)) / 2.0); + *r_u = (1.0f - (atan2f(x / len, y / len) / (float)M_PI)) / 2.0f; } else { *r_v = *r_u = 0.0f; /* to avoid un-initialized variables */ diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 141f9201689..9a6515daf68 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -366,7 +366,7 @@ void mat3_to_quat_is_ok(float q[4], float wmat[3][3]) mul_m3_v3(matn, mat[0]); /* and align x-axes */ - angle = (float)(0.5 * atan2(mat[0][1], mat[0][0])); + angle = 0.5f * atan2f(mat[0][1], mat[0][0]); co = cosf(angle); si = sinf(angle); @@ -765,7 +765,7 @@ void tri_to_quat_ex(float quat[4], const float v1[3], const float v2[3], const f vec[2] = 0.0f; normalize_v3(vec); - angle = (float)(0.5 * atan2(vec[1], vec[0])); + angle = 0.5f * atan2f(vec[1], vec[0]); co = cosf(angle); si = sinf(angle); q2[0] = co; diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index e4ba8728e55..75fa4a5433f 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -245,7 +245,7 @@ int join_armature_exec(bContext *C, wmOperator *op) invert_m4_m4(imat, premat); mul_m4_m4m4(difmat, imat, postmat); - curbone->roll -= (float)atan2(difmat[2][0], difmat[2][2]); + curbone->roll -= atan2f(difmat[2][0], difmat[2][2]); } /* Fix Constraints and Other Links to this Bone and Armature */ diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 5cd6b1e2b4c..11b9b9c83cc 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2172,8 +2172,8 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * glVertex2f(centx, centy); for (a = 0; a <= tot; a++, ang += radstep) { - float si = sin(ang); - float co = cos(ang); + float si = sinf(ang); + float co = cosf(ang); ui_hsvcircle_vals_from_pos(hsv, hsv + 1, rect, centx + co * radius, centy + si * radius); @@ -3841,7 +3841,7 @@ void ui_draw_pie_center(uiBlock *block) int subd = 40; - float angle = atan2(pie_dir[1], pie_dir[0]); + float angle = atan2f(pie_dir[1], pie_dir[0]); float range = (block->pie_data.flags & UI_PIE_DEGREES_RANGE_LARGE) ? ((float)M_PI / 2.0f) : ((float)M_PI / 4.0f); glPushMatrix(); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 5401cef8351..76344b77dd3 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -319,7 +319,7 @@ void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra) if (pset->flag & PE_FADE_TIME && pset->selectmode==SCE_SELECT_POINT) { LOOP_POINTS { LOOP_KEYS { - if (fabs(cfra-*key->time) < pset->fade_frames) + if (fabsf(cfra - *key->time) < pset->fade_frames) key->flag &= ~PEK_HIDE; else { key->flag |= PEK_HIDE; @@ -463,7 +463,7 @@ static bool key_inside_circle(PEData *data, float rad, const float co[3], float dx= data->mval[0] - screen_co[0]; dy= data->mval[1] - screen_co[1]; - dist= sqrt(dx*dx + dy*dy); + dist = sqrtf(dx * dx + dy * dy); if (dist > rad) return 0; @@ -2932,7 +2932,7 @@ static void brush_cut(PEData *data, int pa_index) d= dv * rad2 - d*d; if (d > 0.0f) { - d= sqrt(d); + d= sqrtf(d); cut_time= -(v0*xo0 + v1*xo1 + d); @@ -3678,7 +3678,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) pset->flag &= ~PE_LOCK_FIRST; if (((pset->brushtype == PE_BRUSH_ADD) ? - (sqrt(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0)) || bedit->first) + (sqrtf(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0)) || bedit->first) { PEData data= bedit->data; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 165888b3c09..5530f947b8c 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -1564,7 +1564,7 @@ void paint_2d_gradient_fill( sub_v2_v2v2(tangent, image_final, image_init); line_len = len_squared_v2(tangent); line_len_sq_inv = 1.0f / line_len; - line_len = sqrt(line_len); + line_len = sqrtf(line_len); do_float = (ibuf->rect_float != NULL); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index e9d1d5487a0..ee9181b7d3f 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -4077,7 +4077,7 @@ static void *do_projectpaint_thread(void *ph_v) sub_v2_v2v2(tangent, pos, lastpos); line_len = len_squared_v2(tangent); line_len_sq_inv = 1.0f / line_len; - line_len = sqrt(line_len); + line_len = sqrtf(line_len); switch (brush->gradient_fill_mode) { case BRUSH_GRADIENT_LINEAR: diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 9eaaf5fe122..dc6be9caa53 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -667,7 +667,7 @@ static void stencil_set_target(StencilControlData *scd) scd->lenorig = len_v2(mdiff); - scd->init_angle = atan2(mdiff[1], mdiff[0]); + scd->init_angle = atan2f(mdiff[1], mdiff[0]); } static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *event) @@ -763,7 +763,7 @@ static void stencil_control_calculate(StencilControlData *scd, const int mval[2] { float angle; sub_v2_v2v2(mdiff, mvalf, scd->pos_target); - angle = atan2(mdiff[1], mdiff[0]); + angle = atan2f(mdiff[1], mdiff[0]); angle = scd->init_rot + angle - scd->init_angle; if (angle < 0.0f) angle += (float)(2 * M_PI); @@ -916,7 +916,7 @@ static int stencil_fit_image_aspect_exec(bContext *C, wmOperator *op) stencil_area = br->stencil_dimension[0] * br->stencil_dimension[1]; } - factor = sqrt(stencil_area / orig_area); + factor = sqrtf(stencil_area / orig_area); if (do_mask) { br->mask_stencil_dimension[0] = factor * aspx; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 8f189b49aa6..1ed5ad8160c 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -283,9 +283,9 @@ static bool paint_brush_update(bContext *C, const float dx = mouse[0] - stroke->initial_mouse[0]; const float dy = mouse[1] - stroke->initial_mouse[1]; - ups->anchored_size = ups->pixel_radius = sqrt(dx * dx + dy * dy); + ups->anchored_size = ups->pixel_radius = sqrtf(dx * dx + dy * dy); - ups->brush_rotation = atan2(dx, dy) + M_PI; + ups->brush_rotation = atan2f(dx, dy) + M_PI; if (brush->flag & BRUSH_EDGE_TO_EDGE) { halfway[0] = dx * 0.5f + stroke->initial_mouse[0]; @@ -498,7 +498,7 @@ static float paint_stroke_overlapped_curve(Brush *br, float x, float spacing) for (i = 0; i < n; i++) { float xx; - xx = fabs(x0 + i * h); + xx = fabsf(x0 + i * h); if (xx < 1.0f) sum += BKE_brush_curve_strength(br, xx, 1); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 33d0510c08a..7e518242b00 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -550,7 +550,7 @@ static bool sculpt_brush_test(SculptBrushTest *test, const float co[3]) if (sculpt_brush_test_clipping(test, co)) { return 0; } - test->dist = sqrt(distsq); + test->dist = sqrtf(distsq); return 1; } else { @@ -2553,7 +2553,7 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno sub_v3_v3v3(val, intr, vd.co); if (plane_trim(ss->cache, brush, val)) { - const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrt(test.dist), + const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2626,7 +2626,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) sub_v3_v3v3(val, intr, vd.co); if (plane_trim(ss->cache, brush, val)) { - const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrt(test.dist), + const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2792,7 +2792,7 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength(ss, brush, vd.co, - sqrt(test.dist), + sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2856,7 +2856,7 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength(ss, brush, vd.co, - sqrt(test.dist), + sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2899,7 +2899,7 @@ static void do_gravity(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, fl BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if (sculpt_brush_test_sq(&test, vd.co)) { - const float fade = tex_strength(ss, brush, vd.co, sqrt(test.dist), vd.no, + const float fade = tex_strength(ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], offset, fade); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 292d6236bab..5b46e5c3a59 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -273,7 +273,7 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, Temp_UVData *tmp_uvdata; float diff[2]; int i; - float radius_root = sqrt(radius); + float radius_root = sqrtf(radius); Brush *brush = BKE_paint_brush(sculptdata->uvsculpt); tmp_uvdata = (Temp_UVData *)MEM_callocN(sculptdata->totalUniqueUvs * sizeof(Temp_UVData), "Temporal data"); @@ -316,7 +316,7 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter)); sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter)); @@ -345,7 +345,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul Temp_UVData *tmp_uvdata; float diff[2]; int i; - float radius_root = sqrt(radius); + float radius_root = sqrtf(radius); Brush *brush = BKE_paint_brush(sculptdata->uvsculpt); tmp_uvdata = (Temp_UVData *)MEM_callocN(sculptdata->totalUniqueUvs * sizeof(Temp_UVData), "Temporal data"); @@ -380,7 +380,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0]; sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1]; @@ -434,7 +434,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, const wmEvent *e /* We will compare squares to save some computation */ radius = radius * radius; - radius_root = sqrt(radius); + radius_root = sqrtf(radius); /* * Pinch Tool @@ -455,7 +455,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, const wmEvent *e if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); normalize_v2(diff); sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001f; @@ -803,7 +803,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm aspectRatio = width / (float)height; radius /= (width * zoomx); radius = radius * radius; - radius_root = sqrt(radius); + radius_root = sqrtf(radius); /* Allocate selection stack */ data->initial_stroke = MEM_mallocN(sizeof(*data->initial_stroke), "uv_sculpt_initial_stroke"); @@ -829,7 +829,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm diff[1] /= aspectRatio; if ((dist = dot_v2v2(diff, diff)) <= radius) { float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); data->initial_stroke->initialSelection[counter].uv = i; data->initial_stroke->initialSelection[counter].strength = strength; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index db675b09896..cff6761d628 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1037,8 +1037,8 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) * - dragged. */ phi = si * (float)(M_PI / 2.0); - q1[0] = cos(phi); - mul_v3_fl(q1 + 1, sin(phi)); + q1[0] = cosf(phi); + mul_v3_fl(q1 + 1, sinf(phi)); mul_qt_qtqt(vod->viewquat, q1, vod->oldquat); viewrotate_apply_dyn_ofs(vod, vod->viewquat); @@ -1448,7 +1448,7 @@ static void view3d_ndof_orbit(const struct wmNDOFMotionData *ndof, ScrArea *sa, /* Perform the up/down rotation */ angle = ndof->dt * rot[0]; quat[0] = cosf(angle); - mul_v3_v3fl(quat + 1, xvec, sin(angle)); + mul_v3_v3fl(quat + 1, xvec, sinf(angle)); mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, quat); /* Perform the orbital rotation */ diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 7bdf39d6768..c54948b23c6 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -961,7 +961,7 @@ static int walkApply(bContext *C, WalkInfo *walk) /* clamp the angle limits */ /* it ranges from 90.0f to -90.0f */ - angle = -asin(rv3d->viewmat[2][2]); + angle = -asinf(rv3d->viewmat[2][2]); if (angle > WALK_TOP_LIMIT && y > 0.0f) y = 0.0f; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index abef2c9fc30..fcdebad02d1 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -872,9 +872,9 @@ static float RotationBetween(TransInfo *t, const float p1[3], const float p2[3]) cross_v3_v3v3(tmp, start, end); if (dot_v3v3(tmp, axis) < 0.0f) - angle = -acos(dot_v3v3(start, end)); + angle = -acosf(dot_v3v3(start, end)); else - angle = acos(dot_v3v3(start, end)); + angle = acosf(dot_v3v3(start, end)); } else { float mtx[3][3]; @@ -884,7 +884,7 @@ static float RotationBetween(TransInfo *t, const float p1[3], const float p2[3]) mul_m3_v3(mtx, end); mul_m3_v3(mtx, start); - angle = atan2(start[1], start[0]) - atan2(end[1], end[0]); + angle = atan2f(start[1], start[0]) - atan2f(end[1], end[0]); } if (angle > (float)M_PI) { diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 5f22a201600..79f53e1d971 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -372,7 +372,7 @@ static float p_vec_angle(float *v1, float *v2, float *v3) else if (dot >= 1.0f) return 0.0f; else - return (float)acos(dot); + return acosf(dot); } static float p_vec2_angle(float *v1, float *v2, float *v3) @@ -433,7 +433,7 @@ static float p_edge_length(PEdge *e) d[1] = v2->co[1] - v1->co[1]; d[2] = v2->co[2] - v1->co[2]; - return sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); + return sqrtf(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); } static float p_edge_uv_length(PEdge *e) @@ -444,7 +444,7 @@ static float p_edge_uv_length(PEdge *e) d[0] = v2->uv[0] - v1->uv[0]; d[1] = v2->uv[1] - v1->uv[1]; - return sqrt(d[0] * d[0] + d[1] * d[1]); + return sqrtf(d[0] * d[0] + d[1] * d[1]); } static void p_chart_uv_bbox(PChart *chart, float minv[2], float maxv[2]) @@ -2353,8 +2353,8 @@ static void p_abf_compute_sines(PAbfSystem *sys) float *sine = sys->sine, *cosine = sys->cosine, *alpha = sys->alpha; for (i = 0; i < sys->nangles; i++, sine++, cosine++, alpha++) { - *sine = sin(*alpha); - *cosine = cos(*alpha); + *sine = sinf(*alpha); + *cosine = cosf(*alpha); } } @@ -3163,9 +3163,9 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart) SWAP(PVert *, v2, v3); } - sina1 = sin(a1); - sina2 = sin(a2); - sina3 = sin(a3); + sina1 = sinf(a1); + sina2 = sinf(a2); + sina3 = sinf(a3); sinmax = max_fff(sina1, sina2, sina3); @@ -3314,7 +3314,7 @@ static float p_face_stretch(PFace *f) a = dot_v3v3(Ps, Ps); c = dot_v3v3(Pt, Pt); - T = sqrt(0.5f * (a + c)); + T = sqrtf(0.5f * (a + c)); if (f->flag & PFACE_FILLED) T *= 0.2f; @@ -3630,8 +3630,8 @@ static float p_chart_minimum_area_angle(PChart *chart) static void p_chart_rotate_minimum_area(PChart *chart) { float angle = p_chart_minimum_area_angle(chart); - float sine = sin(angle); - float cosine = cos(angle); + float sine = sinf(angle); + float cosine = cosf(angle); PVert *v; for (v = chart->verts; v; v = v->nextlink) { @@ -4045,7 +4045,7 @@ static void p_smooth(PChart *chart) diff[0] = p[0] - oldp[0]; diff[1] = p[1] - oldp[1]; - length = sqrt(diff[0] * diff[0] + diff[1] * diff[1]); + length = len_v2(diff); d = max_ff(d, length); moved += length; } @@ -4559,7 +4559,7 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate) box->index = i; /* warning this index skips PCHART_NOPACK boxes */ if (margin > 0.0f) - area += sqrt(box->w * box->h); + area += sqrtf(box->w * box->h); } if (margin > 0.0f) { @@ -4661,7 +4661,7 @@ void param_average(ParamHandle *handle) /* Move center to 0,0 */ p_chart_uv_translate(chart, trans); - p_chart_uv_scale(chart, sqrt(fac / tot_fac)); + p_chart_uv_scale(chart, sqrtf(fac / tot_fac)); /* Move to original center */ trans[0] = -trans[0]; diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c index 231af7e7d37..49ebb15d7a4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_camera.c +++ b/source/blender/nodes/shader/nodes/node_shader_camera.c @@ -47,7 +47,7 @@ static void node_shader_exec_camera(void *data, int UNUSED(thread), bNode *UNUSE ShadeInput *shi = ((ShaderCallData *)data)->shi; /* Data we need for shading. */ copy_v3_v3(out[0]->vec, shi->co); /* get view vector */ - out[1]->vec[0] = fabs(shi->co[2]); /* get view z-depth */ + out[1]->vec[0] = fabsf(shi->co[2]); /* get view z-depth */ out[2]->vec[0] = normalize_v3(out[0]->vec); /* get view distance */ } } diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c index d5ba8231cce..dc5971909d2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.c +++ b/source/blender/nodes/shader/nodes/node_shader_math.c @@ -74,25 +74,25 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode case 4: /* Sine */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ - r = sin(a); + r = sinf(a); else - r = sin(b); + r = sinf(b); break; } case 5: /* Cosine */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ - r = cos(a); + r = cosf(a); else - r = cos(b); + r = cosf(b); break; } case 6: /* Tangent */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ - r = tan(a); + r = tanf(a); else - r = tan(b); + r = tanf(b); break; } case 7: /* Arc-Sine */ @@ -100,14 +100,14 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ /* Can't do the impossible... */ if (a <= 1 && a >= -1) - r = asin(a); + r = asinf(a); else r = 0.0; } else { /* Can't do the impossible... */ if (b <= 1 && b >= -1) - r = asin(b); + r = asinf(b); else r = 0.0; } @@ -118,14 +118,14 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ /* Can't do the impossible... */ if (a <= 1 && a >= -1) - r = acos(a); + r = acosf(a); else r = 0.0; } else { /* Can't do the impossible... */ if (b <= 1 && b >= -1) - r = acos(b); + r = acosf(b); else r = 0.0; } @@ -218,7 +218,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode } case 18: /* Absolute */ { - r = fabs(a); + r = fabsf(a); break; } } diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c index b40bf6bc71a..f2ea2faa5a7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c +++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c @@ -59,14 +59,14 @@ static void node_shader_exec_vect_math(void *UNUSED(data), int UNUSED(thread), b out[0]->vec[1] = vec1[1] + vec2[1]; out[0]->vec[2] = vec1[2] + vec2[2]; - out[1]->vec[0] = (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3; + out[1]->vec[0] = (fabsf(out[0]->vec[0]) + fabsf(out[0]->vec[0]) + fabsf(out[0]->vec[0])) / 3; } else if (node->custom1 == 1) { /* Subtract */ out[0]->vec[0] = vec1[0] - vec2[0]; out[0]->vec[1] = vec1[1] - vec2[1]; out[0]->vec[2] = vec1[2] - vec2[2]; - out[1]->vec[0] = (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3; + out[1]->vec[0] = (fabsf(out[0]->vec[0]) + fabsf(out[0]->vec[0]) + fabsf(out[0]->vec[0])) / 3; } else if (node->custom1 == 2) { /* Average */ out[0]->vec[0] = vec1[0] + vec2[0]; diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index 9bd2532b4b8..94e778e10fb 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -72,24 +72,24 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor } case 4: /* Sine */ { - *out = sin(in0); + *out = sinf(in0); break; } case 5: /* Cosine */ { - *out = cos(in0); + *out = cosf(in0); break; } case 6: /* Tangent */ { - *out = tan(in0); + *out = tanf(in0); break; } case 7: /* Arc-Sine */ { /* Can't do the impossible... */ if (in0 <= 1 && in0 >= -1) - *out = asin(in0); + *out = asinf(in0); else *out = 0.0; break; @@ -98,7 +98,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor { /* Can't do the impossible... */ if (in0 <= 1 && in0 >= -1) - *out = acos(in0); + *out = acosf(in0); else *out = 0.0; break; @@ -185,7 +185,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 18: /* Absolute */ { - *out = fabs(in0); + *out = fabsf(in0); break; } diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 75fe05ae2f5..ae3476f5802 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -947,7 +947,7 @@ static PyObject *Quaternion_magnitude_get(QuaternionObject *self, void *UNUSED(c if (BaseMath_ReadCallback(self) == -1) return NULL; - return PyFloat_FromDouble(sqrt(dot_qtqt(self->quat, self->quat))); + return PyFloat_FromDouble(sqrtf(dot_qtqt(self->quat, self->quat))); } PyDoc_STRVAR(Quaternion_angle_doc, diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp index 24804b8c0ad..6cbb0761358 100644 --- a/source/blender/render/intern/raytrace/rayobject_octree.cpp +++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp @@ -657,7 +657,7 @@ static void RE_rayobject_octree_done(RayObject *tree) oc->ocfacy = (oc->ocres - 0.1f) / t01; oc->ocfacz = (oc->ocres - 0.1f) / t02; - oc->ocsize = sqrt(t00 * t00 + t01 * t01 + t02 * t02); /* global, max size octree */ + oc->ocsize = sqrtf(t00 * t00 + t01 * t01 + t02 * t02); /* global, max size octree */ for (c = 0; c < oc->ro_nodes_used; c++) { octree_fill_rayface(oc, oc->ro_nodes[c]); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index e6f054583b1..69dd9607c3b 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -762,7 +762,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par w= vec[2]*re->winmat[2][3] + re->winmat[3][3]; dx= re->winx*cross[0]*re->winmat[0][0]; dy= re->winy*cross[1]*re->winmat[1][1]; - w= sqrt(dx*dx + dy*dy)/w; + w = sqrtf(dx * dx + dy * dy) / w; if (w!=0.0f) { float fac; @@ -927,7 +927,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par w= vec[2]*re->winmat[2][3] + re->winmat[3][3]; dx= re->winx*dvec[0]*re->winmat[0][0]/w; dy= re->winy*dvec[1]*re->winmat[1][1]/w; - w= sqrt(dx*dx + dy*dy); + w = sqrtf(dx * dx + dy * dy); if (dot_v3v3(anor, nor)adapt_angle && w>sd->adapt_pix) { vlr= RE_findOrAddVlak(obr, obr->totvlak++); vlr->flag= flag; @@ -3796,8 +3796,8 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) normalize_v3(lar->imat[1]); normalize_v3(lar->imat[2]); - xn= saacos(lar->spotsi); - xn= sin(xn)/cos(xn); + xn = saacos(lar->spotsi); + xn = sinf(xn) / cosf(xn); lar->spottexfac= 1.0f/(xn); if (lar->mode & LA_ONLYSHADOW) { @@ -3820,7 +3820,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) /* z factor, for a normalized volume */ angle= saacos(lar->spotsi); xn= lar->spotsi; - yn= sin(angle); + yn = sinf(angle); lar->sh_zfac= yn/xn; /* pre-scale */ lar->sh_invcampos[2]*= lar->sh_zfac; @@ -5438,7 +5438,7 @@ static float *calculate_strandsurface_speedvectors(Render *re, ObjectInstanceRen { if (mesh->co && mesh->prevco && mesh->nextco) { float winsq= (float)re->winx*(float)re->winy; /* int's can wrap on large images */ - float winroot= sqrt(winsq); + float winroot= sqrtf(winsq); float (*winspeed)[4]; float ho[4], prevho[4], nextho[4], winmat[4][4], vec[2]; int a; @@ -5477,7 +5477,7 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve StrandSurface *mesh= NULL; float *speed, (*winspeed)[4]=NULL, ho[4], winmat[4][4]; float *co1, *co2, *co3, *co4, w[4]; - float winsq= (float)re->winx*(float)re->winy, winroot= sqrt(winsq); /* int's can wrap on large images */ + float winsq = (float)re->winx * (float)re->winy, winroot = sqrtf(winsq); /* int's can wrap on large images */ int a, *face, *index; if (obi->flag & R_TRANSFORMED) @@ -5544,7 +5544,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * VertRen *ver= NULL; float *speed, div, zco[2], avgvel[4] = {0.0, 0.0, 0.0, 0.0}; float zmulx= re->winx/2, zmuly= re->winy/2, len; - float winsq= (float)re->winx*(float)re->winy, winroot= sqrt(winsq); /* int's can wrap on large images */ + float winsq = (float)re->winx * (float)re->winy, winroot= sqrtf(winsq); /* int's can wrap on large images */ int a, j; float hoco[4], ho[4], fsvec[4], camco[4]; float mat[4][4], winmat[4][4]; diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index 5fd4747f19b..353ba5d5caa 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -190,7 +190,7 @@ static float calc_weight(Render *re, float *weight, int i, int j) for (a = 0; a < re->osa; a++) { x = re->jit[a][0] + i; y = re->jit[a][1] + j; - dist = sqrt(x * x + y * y); + dist = sqrtf(x * x + y * y); weight[a] = 0.0; diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c index d02bda258e4..6ba85ea5329 100644 --- a/source/blender/render/intern/source/multires_bake.c +++ b/source/blender/render/intern/source/multires_bake.c @@ -1155,10 +1155,10 @@ static void apply_ao_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, void /* this gives results identical to the so-called cosine * weighted distribution relative to the north pole. */ - float SiPhi = sqrt(SiSqPhi); + float SiPhi = sqrtf(SiSqPhi); float CoPhi = SiSqPhi < 1.0f ? sqrtf(1.0f - SiSqPhi) : 0; - float CoThe = cos(Theta); - float SiThe = sin(Theta); + float CoThe = cosf(Theta); + float SiThe = sinf(Theta); const float dx = CoThe * CoPhi; const float dy = SiThe * CoPhi; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 7e6d2122330..2a07474a5dd 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1013,8 +1013,8 @@ static bool find_next_pano_slice(Render *re, int *slice, int *minx, rctf *viewpl /* rotate database according to part coordinates */ project_renderdata(re, projectverto, 1, -R.panodxp * phi, 1); - R.panosi = sin(R.panodxp * phi); - R.panoco = cos(R.panodxp * phi); + R.panosi = sinf(R.panodxp * phi); + R.panoco = cosf(R.panodxp * phi); } (*slice)++; diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index 09a6a6374be..014df802a78 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -160,7 +160,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) x = max_ff(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2])); /* 1.0/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */ - inpr= 1.0/(sqrt(1.0f+x*x)); + inpr = 1.0 / (sqrtf(1.0f + x * x)); } else inpr= 0.0; } @@ -206,7 +206,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) /* dot product and reflectivity*/ - inp = 1.0 - fabs(dot_v3v3(vn, lv)); + inp = 1.0 - fabsf(dot_v3v3(vn, lv)); /* inp= cos(0.5*M_PI-acos(inp)); */ @@ -329,7 +329,7 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz, } } - radist= sqrt(dist); + radist = sqrtf(dist); /* watch it: not used nicely: flarec is set at zero in pixstruct */ if (flarec) har->pixels+= (int)(har->rad-radist); @@ -366,17 +366,15 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz, else dist= dist/har->radsq; if (har->type & HA_FLARECIRC) { - - dist= 0.5+fabs(dist-0.5f); - + dist = 0.5 + fabsf(dist - 0.5f); } if (har->hard>=30) { - dist= sqrt(dist); + dist = sqrtf(dist); if (har->hard>=40) { - dist= sinf(dist*(float)M_PI_2); + dist = sinf(dist*(float)M_PI_2); if (har->hard>=50) { - dist= sqrt(dist); + dist = sqrtf(dist); } } } @@ -399,7 +397,7 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz, rc= hashvectf + (ofs % 768); - fac= fabs( (xn)*rc[0]+(yn)*rc[1]); + fac = fabsf((xn) * rc[0] + (yn) * rc[1]); if (fac< 1.0f ) linef+= (1.0f-fac); @@ -411,15 +409,15 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz, if (har->starpoints) { float ster, angle; /* rotation */ - angle= atan2(yn, xn); - angle*= (1.0f+0.25f*har->starpoints); + angle = atan2f(yn, xn); + angle *= (1.0f+0.25f*har->starpoints); co= cosf(angle); si= sinf(angle); angle= (co*xn+si*yn)*(co*yn-si*xn); - ster= fabs(angle); + ster = fabsf(angle); if (ster>1.0f) { ster= (har->rad)/(ster); diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 799f7fa2f2e..ac2e85a33b3 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -384,7 +384,7 @@ static void accum_density(void *userdata, int index, float squared_dist) else if (pdr->falloff_type == TEX_PD_FALLOFF_CONSTANT) density = pdr->squared_radius; else if (pdr->falloff_type == TEX_PD_FALLOFF_ROOT) - density = sqrt(dist); + density = sqrtf(dist); else if (pdr->falloff_type == TEX_PD_FALLOFF_PARTICLE_AGE) { if (pdr->point_data_used & POINT_DATA_LIFE) density = dist*MIN2(pdr->point_data[pdr->offset + index], 1.0f); diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 7e56d93f23b..05e83f35179 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -651,7 +651,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) const float dx= shi->co[0] - is->start[0]; const float dy= shi->co[1] - is->start[1]; const float dz= shi->co[2] - is->start[2]; - d= sqrt(dx*dx+dy*dy+dz*dz); + d = sqrtf(dx * dx + dy * dy + dz * dz); if (d > shi->mat->tx_limit) d= shi->mat->tx_limit; @@ -1117,7 +1117,7 @@ static void QMC_samplePhong(float vec[3], QMCSampler *qsa, int thread, int num, phi = s[0]*2*M_PI; pz = pow(s[1], blur); - sqr = sqrt(1.0f-pz*pz); + sqr = sqrtf(1.0f - pz * pz); vec[0] = (float)(cosf(phi)*sqr); vec[1] = (float)(sinf(phi)*sqr); @@ -1281,7 +1281,7 @@ static float get_avg_speed(ShadeInput *shi) post_x = (shi->winspeed[2] == PASS_VECTOR_MAX)?0.0f:shi->winspeed[2]; post_y = (shi->winspeed[3] == PASS_VECTOR_MAX)?0.0f:shi->winspeed[3]; - speedavg = (sqrt(pre_x*pre_x + pre_y*pre_y) + sqrt(post_x*post_x + post_y*post_y)) / 2.0; + speedavg = (sqrtf(pre_x * pre_x + pre_y * pre_y) + sqrtf(post_x * post_x + post_y * post_y)) / 2.0; return speedavg; } @@ -1786,10 +1786,10 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in sphere= threadsafe_table_sphere(0, thread, xs, ys, tot); /* random rotation */ - ang= BLI_thread_frand(thread); - sinfi= sin(ang); cosfi= cos(ang); - ang= BLI_thread_frand(thread); - sint= sin(ang); cost= cos(ang); + ang = BLI_thread_frand(thread); + sinfi = sinf(ang); cosfi = cosf(ang); + ang = BLI_thread_frand(thread); + sint = sinf(ang); cost = cosf(ang); vec= R.wrld.aosphere; vec1= sphere; @@ -2406,9 +2406,9 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[ else { /* sqrt makes nice umbra effect */ if (lar->ray_samp_type & LA_SAMP_UMBRA) - shadfac[3]= sqrt(1.0f-fac/div); + shadfac[3] = sqrtf(1.0f - fac / div); else - shadfac[3]= 1.0f-fac/div; + shadfac[3] = 1.0f - fac / div; } } /* extern call from shade_lamp_loop */ diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index dd14c2495e8..ae01779e814 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -212,10 +212,10 @@ static int blend(Tex *tex, const float texvec[3], TexResult *texres) texres->tin= (2.0f+x+y)/4.0f; } else if (tex->stype==TEX_RAD) { /* radial */ - texres->tin= (atan2(y, x) / (2*M_PI) + 0.5); + texres->tin = (atan2f(y, x) / (2 * M_PI) + 0.5f); } else { /* sphere TEX_SPHERE */ - texres->tin= 1.0-sqrt(x*x+ y*y+texvec[2]*texvec[2]); + texres->tin = 1.0 - sqrtf(x * x + y * y + texvec[2] * texvec[2]); if (texres->tin<0.0f) texres->tin= 0.0f; if (tex->stype==TEX_HALO) texres->tin*= texres->tin; /* halo */ } @@ -266,8 +266,8 @@ static int clouds(Tex *tex, const float texvec[3], TexResult *texres) /* creates a sine wave */ static float tex_sin(float a) { - a = 0.5 + 0.5*sin(a); - + a = 0.5 + 0.5 * sinf(a); + return a; } @@ -366,10 +366,10 @@ static float marble_int(Tex *tex, float x, float y, float z) if (mt>=TEX_SOFT) { /* TEX_SOFT always true */ mi = waveform[wf](mi); if (mt==TEX_SHARP) { - mi = sqrt(mi); + mi = sqrtf(mi); } else if (mt==TEX_SHARPER) { - mi = sqrt(sqrt(mi)); + mi = sqrtf(sqrtf(mi)); } } @@ -408,41 +408,41 @@ static int magic(Tex *tex, const float texvec[3], TexResult *texres) n= tex->noisedepth; turb= tex->turbul/5.0f; - x= sin( ( texvec[0]+texvec[1]+texvec[2])*5.0f ); - y= cos( (-texvec[0]+texvec[1]-texvec[2])*5.0f ); - z= -cos( (-texvec[0]-texvec[1]+texvec[2])*5.0f ); + x = sinf(( texvec[0] + texvec[1] + texvec[2]) * 5.0f); + y = cosf((-texvec[0] + texvec[1] - texvec[2]) * 5.0f); + z = -cosf((-texvec[0] - texvec[1] + texvec[2]) * 5.0f); if (n>0) { x*= turb; y*= turb; z*= turb; - y= -cos(x-y+z); + y= -cosf(x-y+z); y*= turb; if (n>1) { - x= cos(x-y-z); + x= cosf(x-y-z); x*= turb; if (n>2) { - z= sin(-x-y-z); + z= sinf(-x-y-z); z*= turb; if (n>3) { - x= -cos(-x+y-z); + x= -cosf(-x+y-z); x*= turb; if (n>4) { - y= -sin(-x+y+z); + y= -sinf(-x+y+z); y*= turb; if (n>5) { - y= -cos(-x+y+z); + y= -cosf(-x+y+z); y*= turb; if (n>6) { - x= cos(x+y+z); + x= cosf(x+y+z); x*= turb; if (n>7) { - z= sin(x+y-z); + z= sinf(x+y-z); z*= turb; if (n>8) { - x= -cos(-x-y+z); + x= -cosf(-x-y+z); x*= turb; if (n>9) { - y= -sin(x-y+z); + y= -sinf(x-y+z); y*= turb; } } @@ -2348,8 +2348,8 @@ void do_material_tex(ShadeInput *shi, Render *re) copy_v3_v3(texres.nor, &texres.tr); } else { - float co_nor= 0.5*cos(texres.tin-0.5f); - float si= 0.5*sin(texres.tin-0.5f); + float co_nor= 0.5f * cosf(texres.tin - 0.5f); + float si = 0.5f * sinf(texres.tin - 0.5f); float f1, f2; f1= shi->vn[0]; diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 27bc449dce3..a67140c6334 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -1906,9 +1906,9 @@ static void renderflare(RenderResult *rr, float *rectf, HaloRen *har) fla.hard= 20.0f + fabsf(70.0f*rc[7]); fla.tex= 0; - type= (int)(fabs(3.9f*rc[6])); + type= (int)(fabsf(3.9f*rc[6])); - fla.rad= ma->subsize*sqrtf(fabs(2.0f*har->rad*rc[4])); + fla.rad = ma->subsize * sqrtf(fabsf(2.0f * har->rad * rc[4])); if (type==3) { fla.rad*= 3.0f; diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 6a3787289d8..46c504aaabf 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -992,10 +992,10 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, xn= har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]); yn= har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]); if (xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0f; - else zn= atan2(yn, xn); + else zn = atan2f(yn, xn); - har->sin= sin(zn); - har->cos= cos(zn); + har->sin = sinf(zn); + har->cos = cosf(zn); zn= len_v3v3(vec1, vec); har->hasize= vectsize*zn + (1.0f-vectsize)*hasize; @@ -1112,10 +1112,10 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater xn= har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]); yn= har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]); if (xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0; - else zn= atan2(yn, xn); + else zn = atan2f(yn, xn); - har->sin= sin(zn); - har->cos= cos(zn); + har->sin = sinf(zn); + har->cos = cosf(zn); zn= len_v3v3(vec1, vec)*0.5f; har->hasize= vectsize*zn + (1.0f-vectsize)*hasize; @@ -1284,8 +1284,8 @@ void project_renderdata(Render *re, if (do_pano) { float panophi= xoffs; - re->panosi= sin(panophi); - re->panoco= cos(panophi); + re->panosi = sinf(panophi); + re->panoco = cosf(panophi); } for (obr=re->objecttable.first; obr; obr=obr->next) { diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index aa420d7e7c8..9d83ff1d7e8 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -536,7 +536,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square) if (x< a) minx= x+15-a; else minx= x-a; - dist= sqrt( (float)(minx*minx+miny*miny) ); + dist = sqrtf((float)(minx * minx + miny * miny)); if (square==0 && dist>(float)(a+12)) { /* 12, tested with a onlyshadow lamp */ a= 256; verg= 0; /* 0x80000000; */ /* 0x7FFFFFFF; */ @@ -1685,7 +1685,7 @@ static int point_behind_strand(const float p[3], BSPFace *face) if (face->len==0.0f) { rc[0]= p[0]-face->vec1[0]; rc[1]= p[1]-face->vec1[1]; - dist= (float)(sqrt(rc[0]*rc[0]+ rc[1]*rc[1])); + dist = len_v2(rc); if (dist < face->radline) return 1; @@ -1699,10 +1699,10 @@ static int point_behind_strand(const float p[3], BSPFace *face) pt[0]= lambda*face->rc[0]+face->vec1[0]; pt[1]= lambda*face->rc[1]+face->vec1[1]; - + rc[0]= pt[0]-p[0]; rc[1]= pt[1]-p[1]; - dist= sqrtf(rc[0]*rc[0]+ rc[1]*rc[1]); + dist = len_v2(rc); if (dist < face->radline) { float zval= face->vec1[2] + lambda*face->rc[2]; diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 427d0eeed11..6d6bba834ba 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -144,7 +144,7 @@ float mistfactor(float zcor, float const co[3]) /* pass */ } else { - fac = sqrt(fac); + fac = sqrtf(fac); } } else { @@ -338,9 +338,9 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) /* now we have 2 points, make three lengths with it */ - a= sqrt(p1[0]*p1[0]+p1[1]*p1[1]+p1[2]*p1[2]); - b= sqrt(p2[0]*p2[0]+p2[1]*p2[1]+p2[2]*p2[2]); - c= len_v3v3(p1, p2); + a = len_v3(p1); + b = len_v3(p2); + c = len_v3v3(p1, p2); a/= ladist; a= sqrt(a); @@ -640,7 +640,7 @@ static float Blinn_Spec(const float n[3], const float l[3], const float v[3], fl /* conversion from 'hardness' (1-255) to 'spec_power' (50 maps at 0.1) */ if (spec_power<100.0f) - spec_power= sqrt(1.0f/spec_power); + spec_power = sqrtf(1.0f / spec_power); else spec_power= 10.0f/spec_power; h[0]= v[0]+l[0]; @@ -731,7 +731,7 @@ static float WardIso_Spec(const float n[3], const float l[3], const float v[3], if (tangent) nl = sasqrt(1.0f - nl*nl); if (nl<=0.0f) nl = 0.001f; - angle = tan(saacos(nh)); + angle = tanf(saacos(nh)); alpha = MAX2(rms, 0.001f); i= nl * (1.0f/(4.0f*(float)M_PI*alpha*alpha)) * (expf( -(angle*angle)/(alpha*alpha))/(sqrtf(nv*nl))); @@ -746,7 +746,7 @@ static float Toon_Diff(const float n[3], const float l[3], const float UNUSED(v[ rslt = n[0]*l[0] + n[1]*l[1] + n[2]*l[2]; - ang = saacos( (double)(rslt) ); + ang = saacos(rslt); if ( ang < size ) rslt = 1.0f; else if ( ang >= (size + smooth) || smooth == 0.0f ) rslt = 0.0f; @@ -1257,7 +1257,7 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d x = max_ff(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2])); /* 1.0f/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */ - inpr= 1.0f/(sqrt(1.0f+x*x)); + inpr = 1.0f / (sqrtf(1.0f + x * x)); } else inpr= 0.0f; } diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index 52d3815c4ad..7e9003aaee7 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -165,7 +165,7 @@ static float f_Rd(float alpha_, float A, float ro) { float sq; - sq= sqrt(3.0f*(1.0f - alpha_)); + sq = sqrtf(3.0f * (1.0f - alpha_)); return (alpha_/2.0f)*(1.0f + expf((-4.0f/3.0f)*A*sq))*expf(-sq) - ro; } @@ -212,8 +212,8 @@ static float Rd_rsquare(ScatterSettings *ss, float rr) { float sr, sv, Rdr, Rdv; - sr= sqrt(rr + ss->zr*ss->zr); - sv= sqrt(rr + ss->zv*ss->zv); + sr = sqrtf(rr + ss->zr * ss->zr); + sv = sqrtf(rr + ss->zv * ss->zv); Rdr= ss->zr*(1.0f + ss->sigma*sr)*expf(-ss->sigma*sr)/(sr*sr*sr); Rdv= ss->zv*(1.0f + ss->sigma*sv)*expf(-ss->sigma*sv)/(sv*sv*sv); @@ -241,7 +241,7 @@ static void approximate_Rd_rgb(ScatterSettings **ss, float rr, float *rd) /* pass */ } else if (rr > RD_TABLE_RANGE) { - rr= sqrt(rr); + rr = sqrtf(rr); indexf= rr*(RD_TABLE_SIZE/RD_TABLE_RANGE_2); index= (int)indexf; idxf= (float)index; @@ -286,7 +286,7 @@ static void build_Rd_table(ScatterSettings *ss) r= i*(RD_TABLE_RANGE/RD_TABLE_SIZE); /*if (r < ss->invsigma_t_*ss->invsigma_t_) r= ss->invsigma_t_*ss->invsigma_t_;*/ - ss->tableRd[i]= Rd(ss, sqrt(r)); + ss->tableRd[i]= Rd(ss, sqrtf(r)); r= i*(RD_TABLE_RANGE_2/RD_TABLE_SIZE); /*if (r < ss->invsigma_t_) diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 50343cfaa0b..485680da76f 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -145,7 +145,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) w= spoint->co[2]*strandbuf->winmat[2][3] + strandbuf->winmat[3][3]; dx= strandbuf->winx*cross[0]*strandbuf->winmat[0][0]/w; dy= strandbuf->winy*cross[1]*strandbuf->winmat[1][1]/w; - w= sqrt(dx*dx + dy*dy); + w = sqrtf(dx * dx + dy * dy); if (w > 0.0f) { if (strandbuf->flag & R_STRAND_B_UNITS) { diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c index 71ef5b8f62f..1836b3f48a7 100644 --- a/source/blender/render/intern/source/sunsky.c +++ b/source/blender/render/intern/source/sunsky.c @@ -89,14 +89,14 @@ void ClipColor(float c[3]) * */ static float AngleBetween(float thetav, float phiv, float theta, float phi) { - float cospsi = sin(thetav) * sin(theta) * cos(phi - phiv) + cos(thetav) * cos(theta); + float cospsi = sinf(thetav) * sinf(theta) * cosf(phi - phiv) + cosf(thetav) * cosf(theta); if (cospsi > 1.0f) return 0; if (cospsi < -1.0f) return M_PI; - return acos(cospsi); + return acosf(cospsi); } /** @@ -112,7 +112,7 @@ static void DirectionToThetaPhi(float *toSun, float *theta, float *phi) if (fabsf(*theta) < 1e-5f) *phi = 0; else - *phi = atan2(toSun[1], toSun[0]); + *phi = atan2f(toSun[1], toSun[0]); } /** diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 28849ed7686..87e546ef24e 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -2951,7 +2951,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float * dvec2[1]= 0.0f; } else { - speedsq= 1.0f - minspeed/sqrt(speedsq); + speedsq = 1.0f - minspeed / sqrtf(speedsq); dvec2[0]= speedsq*dvec1[0]; dvec2[1]= speedsq*dvec1[1]; } @@ -3027,7 +3027,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float * if (maxspeed) { float speedsq= dvz[0]*dvz[0] + dvz[1]*dvz[1]; if (speedsq > maxspeedsq) { - speedsq= (float)maxspeed/sqrt(speedsq); + speedsq = (float)maxspeed / sqrtf(speedsq); dvz[0]*= speedsq; dvz[1]*= speedsq; } @@ -3386,7 +3386,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase * projectverto(vec, obwinmat, hoco); fval= mul*(1.0f+hoco[2]/hoco[3]); - polygon_offset= (int) fabs(zval - fval ); + polygon_offset= (int)fabsf(zval - fval); } else polygon_offset= 0; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 523eeb380aa..415187ecf69 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3749,8 +3749,8 @@ static void radial_control_set_initial_mouse(RadialControl *rc, const wmEvent *e d[0] = (1 - rc->initial_value) * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE; break; case PROP_ANGLE: - d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(rc->initial_value); - d[1] = WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(rc->initial_value); + d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * cosf(rc->initial_value); + d[1] = WM_RADIAL_CONTROL_DISPLAY_SIZE * sinf(rc->initial_value); break; default: return; @@ -4251,7 +4251,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even if (snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f; break; case PROP_ANGLE: - new_value = atan2(delta[1], delta[0]) + M_PI + angle_precision; + new_value = atan2f(delta[1], delta[0]) + M_PI + angle_precision; new_value = fmod(new_value, 2.0f * (float)M_PI); if (new_value < 0.0f) new_value += 2.0f * (float)M_PI; -- cgit v1.2.3