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 --- .../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 ++-- 17 files changed, 91 insertions(+), 93 deletions(-) (limited to 'source/blender/render/intern') 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; -- cgit v1.2.3