diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-31 09:23:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-31 17:17:21 +0300 |
commit | 9e9cd77b8de68015a98659671272cc9d78710e69 (patch) | |
tree | a705baa2b3d4c2667085815c865a826c1f884173 /source/blender/render | |
parent | 535de7ec1fee94eae1769630b512c6ef4eb5bcad (diff) |
Compiler warning: double-promotion
Diffstat (limited to 'source/blender/render')
5 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index b5b75f47193..a0fcc7cdcd2 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -157,7 +157,7 @@ float RE_filter_value(int type, float x) { const float two_gaussfac2 = 2.0f * gaussfac * gaussfac; x *= 3.0f * gaussfac; - return 1.0f / sqrtf(M_PI * two_gaussfac2) * expf(-x*x / two_gaussfac2); + return 1.0f / sqrtf((float)M_PI * two_gaussfac2) * expf(-x*x / two_gaussfac2); } case R_FILTER_MITCH: diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index ac4a7dbdccd..104cde0a0b5 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -155,7 +155,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 / (sqrtf(1.0f + x * x)); + inpr = 1.0f / (sqrtf(1.0f + x * x)); } else inpr= 0.0; } @@ -201,7 +201,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) /* dot product and reflectivity*/ - inp = 1.0 - fabsf(dot_v3v3(vn, lv)); + inp = 1.0f - fabsf(dot_v3v3(vn, lv)); /* inp= cos(0.5*M_PI-acos(inp)); */ @@ -361,7 +361,7 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz, else dist= dist/har->radsq; if (har->type & HA_FLARECIRC) { - dist = 0.5 + fabsf(dist - 0.5f); + dist = 0.5f + fabsf(dist - 0.5f); } if (har->hard>=30) { diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 3575b78f95f..065cdeab61c 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -1273,7 +1273,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 = (sqrtf(pre_x * pre_x + pre_y * pre_y) + sqrtf(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.0f; return speedavg; } diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 049823ec9ad..17039bca63a 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -220,10 +220,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 = (atan2f(y, x) / (2 * M_PI) + 0.5f); + texres->tin = (atan2f(y, x) / (float)(2 * M_PI) + 0.5f); } else { /* sphere TEX_SPHERE */ - texres->tin = 1.0 - sqrtf(x * x + y * y + texvec[2] * texvec[2]); + texres->tin = 1.0f - 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 */ } @@ -274,7 +274,7 @@ 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 * sinf(a); + a = 0.5f + 0.5f * sinf(a); return a; } diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c index 6078989f9f6..d4e53eb7305 100644 --- a/source/blender/render/intern/source/sunsky.c +++ b/source/blender/render/intern/source/sunsky.c @@ -254,14 +254,14 @@ void GetSkyXYZRadiance(struct SunSky *sunsky, float theta, float phi, float colo float hfade = 1, nfade = 1; - if (theta > (0.5f * (float)M_PI)) { + if (theta > (float)M_PI_2) { hfade = 1.0f - (theta * (float)M_1_PI - 0.5f) * 2.0f; hfade = hfade * hfade * (3.0f - 2.0f * hfade); - theta = 0.5 * M_PI; + theta = M_PI_2; } - if (sunsky->theta > (0.5f * (float)M_PI)) { - if (theta <= 0.5f * (float)M_PI) { + if (sunsky->theta > (float)M_PI_2) { + if (theta <= (float)M_PI_2) { nfade = 1.0f - (0.5f - theta * (float)M_1_PI) * 2.0f; nfade *= 1.0f - (sunsky->theta * (float)M_1_PI - 0.5f) * 2.0f; nfade = nfade * nfade * (3.0f - 2.0f * nfade); |