diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp index 3bc1fa34a98..cffc533f87b 100644 --- a/intern/cycles/blender/blender_camera.cpp +++ b/intern/cycles/blender/blender_camera.cpp @@ -297,7 +297,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int cam->fisheye_lens = bcam->fisheye_lens; /* perspective */ - cam->fov = 2.0f*atan((0.5f*sensor_size)/bcam->lens/aspectratio); + cam->fov = 2.0f * atanf((0.5f * sensor_size) / bcam->lens / aspectratio); cam->focaldistance = bcam->focaldistance; cam->aperturesize = bcam->aperturesize; cam->blades = bcam->apertureblades; @@ -405,7 +405,7 @@ static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL: } else if(b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_ORTHO) { /* orthographic view */ - bcam->farclip *= 0.5; + bcam->farclip *= 0.5f; bcam->nearclip = -bcam->farclip; bcam->type = CAMERA_ORTHOGRAPHIC; diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index aeda40ae40e..be0c2686713 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -433,7 +433,7 @@ void BlenderSession::tag_redraw() update_status_progress(); /* offline render, redraw if timeout passed */ - if(time_dt() - last_redraw_time > 1.0f) { + if(time_dt() - last_redraw_time > 1.0) { write_render_result(); engine_tag_redraw((RenderEngine*)b_engine.ptr.data); last_redraw_time = time_dt(); diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index 28237aea611..705b805a3a9 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -196,14 +196,14 @@ BVHNode* BVHBuild::run() void BVHBuild::progress_update() { - if(time_dt() - progress_start_time < 0.25f) + if(time_dt() - progress_start_time < 0.25) return; double progress_start = (double)progress_count/(double)progress_total; double duplicates = (double)(progress_total - progress_original_total)/(double)progress_total; string msg = string_printf("Building BVH %.0f%%, duplicates %.0f%%", - progress_start*100.0f, duplicates*100.0f); + progress_start * 100.0, duplicates * 100.0); progress.set_substatus(msg); progress_start_time = time_dt(); diff --git a/intern/cycles/kernel/kernel_random.h b/intern/cycles/kernel/kernel_random.h index 008ef2061a2..9083b7cbfd7 100644 --- a/intern/cycles/kernel/kernel_random.h +++ b/intern/cycles/kernel/kernel_random.h @@ -119,7 +119,7 @@ __device_inline float path_rng(KernelGlobals *kg, RNG *rng, int sample, int dime else shift = (*rng & 0xFFFF)/((float)0xFFFF); - return r + shift - floor(r + shift); + return r + shift - floorf(r + shift); #endif } diff --git a/intern/cycles/kernel/svm/svm_gradient.h b/intern/cycles/kernel/svm/svm_gradient.h index ce551a680b8..b29abed4edc 100644 --- a/intern/cycles/kernel/svm/svm_gradient.h +++ b/intern/cycles/kernel/svm/svm_gradient.h @@ -45,7 +45,7 @@ __device float svm_gradient(float3 p, NodeGradientType type) return (x + y)/2.0f; } else if(type == NODE_BLEND_RADIAL) { - return atan2(y, x)/(2.0f*M_PI_F) + 0.5f; + return atan2f(y, x) / (2.0f * M_PI_F) + 0.5f; } else { float r = fmaxf(1.0f - sqrtf(x*x + y*y + z*z), 0.0f); diff --git a/intern/cycles/kernel/svm/svm_musgrave.h b/intern/cycles/kernel/svm/svm_musgrave.h index 9444dc20e6e..425909e59f1 100644 --- a/intern/cycles/kernel/svm/svm_musgrave.h +++ b/intern/cycles/kernel/svm/svm_musgrave.h @@ -41,7 +41,7 @@ __device_noinline float noise_musgrave_fBm(float3 p, NodeNoiseBasis basis, float p *= lacunarity; } - rmd = octaves - floor(octaves); + rmd = octaves - floorf(octaves); if(rmd != 0.0f) value += rmd * snoise(p) * pwr; @@ -69,7 +69,7 @@ __device_noinline float noise_musgrave_multi_fractal(float3 p, NodeNoiseBasis ba p *= lacunarity; } - rmd = octaves - floor(octaves); + rmd = octaves - floorf(octaves); if(rmd != 0.0f) value *= (rmd * pwr * snoise(p) + 1.0f); /* correct? */ @@ -102,7 +102,7 @@ __device_noinline float noise_musgrave_hetero_terrain(float3 p, NodeNoiseBasis b p *= lacunarity; } - rmd = octaves - floor(octaves); + rmd = octaves - floorf(octaves); if(rmd != 0.0f) { increment = (snoise(p) + offset) * pwr * value; value += rmd * increment; @@ -141,7 +141,7 @@ __device_noinline float noise_musgrave_hybrid_multi_fractal(float3 p, NodeNoiseB p *= lacunarity; } - rmd = octaves - floor(octaves); + rmd = octaves - floorf(octaves); if(rmd != 0.0f) result += rmd * ((snoise(p) + offset) * pwr); diff --git a/intern/cycles/kernel/svm/svm_texture.h b/intern/cycles/kernel/svm/svm_texture.h index d8582621132..d12a85a5402 100644 --- a/intern/cycles/kernel/svm/svm_texture.h +++ b/intern/cycles/kernel/svm/svm_texture.h @@ -191,7 +191,7 @@ __device float noise_basis_hard(float3 p, NodeNoiseBasis basis, int hard) __device float noise_wave(NodeWaveBasis wave, float a) { if(wave == NODE_WAVE_SINE) { - return 0.5f + 0.5f*sin(a); + return 0.5f + 0.5f * sinf(a); } else if(wave == NODE_WAVE_SAW) { float b = 2.0f*M_PI_F; @@ -234,7 +234,7 @@ __device_noinline float noise_turbulence(float3 p, NodeNoiseBasis basis, float o fscale *= 2.0f; } - float rmd = octaves - floor(octaves); + float rmd = octaves - floorf(octaves); if(rmd != 0.0f) { float t = noise_basis(fscale*p, basis); diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 8fb92d2476e..0f64d858de0 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -332,7 +332,7 @@ static void sky_texture_precompute(KernelSunSky *ksunsky, float3 dir, float turb float T2 = T * T; float chi = (4.0f / 9.0f - T / 120.0f) * (M_PI_F - 2.0f * theta); - ksunsky->zenith_Y = (4.0453f * T - 4.9710f) * tan(chi) - 0.2155f * T + 2.4192f; + ksunsky->zenith_Y = (4.0453f * T - 4.9710f) * tanf(chi) - 0.2155f * T + 2.4192f; ksunsky->zenith_Y *= 0.06f; ksunsky->zenith_x = diff --git a/intern/cycles/util/util_color.h b/intern/cycles/util/util_color.h index 8b4a175f498..5136ea5c5db 100644 --- a/intern/cycles/util/util_color.h +++ b/intern/cycles/util/util_color.h @@ -29,15 +29,15 @@ __device float color_srgb_to_scene_linear(float c) if(c < 0.04045f) return (c < 0.0f)? 0.0f: c * (1.0f/12.92f); else - return pow((c + 0.055f)*(1.0f/1.055f), 2.4f); + return powf((c + 0.055f) * (1.0f / 1.055f), 2.4f); } __device float color_scene_linear_to_srgb(float c) { if(c < 0.0031308f) return (c < 0.0f)? 0.0f: c * 12.92f; - else - return 1.055f * pow(c, 1.0f/2.4f) - 0.055f; + else + return 1.055f * powf(c, 1.0f / 2.4f) - 0.055f; } #ifndef __KERNEL_OPENCL__ diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index cd44b7e8cda..a6bc478ee64 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -334,7 +334,7 @@ __device_inline float2 as_float2(const float4 a) __device_inline void print_float2(const char *label, const float2& a) { - printf("%s: %.8f %.8f\n", label, a.x, a.y); + printf("%s: %.8f %.8f\n", label, (double)a.x, (double)a.y); } #endif @@ -532,7 +532,7 @@ __device_inline float4 float3_to_float4(const float3 a) __device_inline void print_float3(const char *label, const float3& a) { - printf("%s: %.8f %.8f %.8f\n", label, a.x, a.y, a.z); + printf("%s: %.8f %.8f %.8f\n", label, (double)a.x, (double)a.y, (double)a.z); } __device_inline float3 rcp(const float3& a) @@ -844,7 +844,7 @@ __device_inline float4 reduce_add(const float4& a) __device_inline void print_float4(const char *label, const float4& a) { - printf("%s: %.8f %.8f %.8f %.8f\n", label, a.x, a.y, a.z, a.w); + printf("%s: %.8f %.8f %.8f %.8f\n", label, (double)a.x, (double)a.y, (double)a.z, (double)a.w); } #endif diff --git a/intern/cycles/util/util_transform.cpp b/intern/cycles/util/util_transform.cpp index 860f2d4d888..b3c6506dfa0 100644 --- a/intern/cycles/util/util_transform.cpp +++ b/intern/cycles/util/util_transform.cpp @@ -160,15 +160,15 @@ static float4 transform_to_quat(const Transform& tfm) double trace = tfm[0][0] + tfm[1][1] + tfm[2][2]; float4 qt; - if(trace > 0.0f) { + if(trace > 0.0) { double s = sqrt(trace + 1.0); qt.w = (float)(s/2.0); s = 0.5/s; - qt.x = (float)((tfm[2][1] - tfm[1][2]) * s); - qt.y = (float)((tfm[0][2] - tfm[2][0]) * s); - qt.z = (float)((tfm[1][0] - tfm[0][1]) * s); + qt.x = (float)((double)(tfm[2][1] - tfm[1][2]) * s); + qt.y = (float)((double)(tfm[0][2] - tfm[2][0]) * s); + qt.z = (float)((double)(tfm[1][0] - tfm[0][1]) * s); } else { int i = 0; @@ -181,16 +181,16 @@ static float4 transform_to_quat(const Transform& tfm) int j = (i + 1)%3; int k = (j + 1)%3; - double s = sqrt((tfm[i][i] - (tfm[j][j] + tfm[k][k])) + 1.0); + double s = sqrt((double)(tfm[i][i] - (tfm[j][j] + tfm[k][k])) + 1.0); double q[3]; q[i] = s * 0.5; if(s != 0.0) s = 0.5/s; - double w = (tfm[k][j] - tfm[j][k]) * s; - q[j] = (tfm[j][i] + tfm[i][j]) * s; - q[k] = (tfm[k][i] + tfm[i][k]) * s; + double w = (double)(tfm[k][j] - tfm[j][k]) * s; + q[j] = (double)(tfm[j][i] + tfm[i][j]) * s; + q[k] = (double)(tfm[k][i] + tfm[i][k]) * s; qt.x = (float)q[0]; qt.y = (float)q[1];