Code cleanup: Add -Werror=float-conversion to Cycles
authorCampbell Barton <ideasman42@gmail.com>
Fri, 2 May 2014 21:22:14 +0000 (07:22 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 2 May 2014 21:31:46 +0000 (07:31 +1000)
21 files changed:
intern/cycles/CMakeLists.txt
intern/cycles/SConscript
intern/cycles/blender/blender_camera.cpp
intern/cycles/blender/blender_util.h
intern/cycles/bvh/bvh_binning.cpp
intern/cycles/device/device_cuda.cpp
intern/cycles/device/device_opencl.cpp
intern/cycles/kernel/closure/bsdf_hair.h
intern/cycles/kernel/geom/geom_curve.h
intern/cycles/kernel/geom/geom_object.h
intern/cycles/kernel/kernel_volume.h
intern/cycles/kernel/svm/svm_mix.h
intern/cycles/kernel/svm/svm_sky.h
intern/cycles/kernel/svm/svm_wavelength.h
intern/cycles/kernel/svm/svm_wireframe.h
intern/cycles/render/blackbody.cpp
intern/cycles/render/camera.cpp
intern/cycles/render/integrator.cpp
intern/cycles/render/nodes.cpp
intern/cycles/render/sky_model.cpp
intern/cycles/subd/subd_split.cpp

index 0d13c4b..50fd195 100644 (file)
@@ -1,4 +1,3 @@
-
 # Standalone or with Blender
 if(NOT WITH_BLENDER AND WITH_CYCLES_STANDALONE)
        set(CYCLES_INSTALL_PATH "")
@@ -127,6 +126,13 @@ include_directories(
        ${OPENEXR_INCLUDE_DIRS}
 )
 
+
+# Warnings
+if(CMAKE_COMPILER_IS_GNUCC)
+       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=float-conversion")
+endif()
+
+
 # Subdirectories
 
 if(WITH_CYCLES_BLENDER)
index 1aa873c..893ad09 100644 (file)
@@ -72,6 +72,10 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
 else:
     cxxflags.append('-ffast-math'.split())
 
+# Warnings
+if env['C_COMPILER_ID'] == 'gcc':
+    cxxflags.append(['-Werror=float-conversion'])
+
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs.append(env['BF_PTHREADS_INC'])
 
index 6bbd410..1a85561 100644 (file)
@@ -212,8 +212,8 @@ static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
        BoundBox2D *viewplane, float *aspectratio, float *sensor_size)
 {
        /* dimensions */
-       float xratio = width*bcam->pixelaspect.x;
-       float yratio = height*bcam->pixelaspect.y;
+       float xratio = (float)width*bcam->pixelaspect.x;
+       float yratio = (float)height*bcam->pixelaspect.y;
 
        /* compute x/y aspect and ratio */
        float xaspect, yaspect;
@@ -288,8 +288,8 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
 
        /* panorama sensor */
        if (bcam->type == CAMERA_PANORAMA && bcam->panorama_type == PANORAMA_FISHEYE_EQUISOLID) {
-               float fit_xratio = bcam->full_width*bcam->pixelaspect.x;
-               float fit_yratio = bcam->full_height*bcam->pixelaspect.y;
+               float fit_xratio = (float)bcam->full_width*bcam->pixelaspect.x;
+               float fit_yratio = (float)bcam->full_height*bcam->pixelaspect.y;
                bool horizontal_fit;
                float sensor_size;
 
@@ -565,10 +565,10 @@ BufferParams BlenderSync::get_buffer_params(BL::RenderSettings b_render, BL::Sce
 
        if(use_border) {
                /* border render */
-               params.full_x = cam->border.left*width;
-               params.full_y = cam->border.bottom*height;
-               params.width = (int)(cam->border.right*width) - params.full_x;
-               params.height = (int)(cam->border.top*height) - params.full_y;
+               params.full_x = (int)(cam->border.left * (float)width);
+               params.full_y = (int)(cam->border.bottom * (float)height);
+               params.width = (int)(cam->border.right * (float)width) - params.full_x;
+               params.height = (int)(cam->border.top * (float)height) - params.full_y;
 
                /* survive in case border goes out of view or becomes too small */
                params.width = max(params.width, 1);
index 2c83ee6..35e417d 100644 (file)
@@ -57,7 +57,7 @@ static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size
        for(int i = 0; i < size; i++) {
                float color[4];
 
-               ramp.evaluate(i/(float)(size-1), color);
+               ramp.evaluate((float)i/(float)(size-1), color);
                data[i] = make_float4(color[0], color[1], color[2], color[3]);
        }
 }
@@ -74,7 +74,7 @@ static inline void curvemapping_color_to_array(BL::CurveMapping cumap, float4 *d
                BL::CurveMap mapI = cumap.curves[3];
 
                for(int i = 0; i < size; i++) {
-                       float t = i/(float)(size-1);
+                       float t = (float)i/(float)(size-1);
 
                        data[i][0] = mapR.evaluate(mapI.evaluate(t));
                        data[i][1] = mapG.evaluate(mapI.evaluate(t));
@@ -83,7 +83,7 @@ static inline void curvemapping_color_to_array(BL::CurveMapping cumap, float4 *d
        }
        else {
                for(int i = 0; i < size; i++) {
-                       float t = i/(float)(size-1);
+                       float t = (float)i/(float)(size-1);
 
                        data[i][0] = mapR.evaluate(t);
                        data[i][1] = mapG.evaluate(t);
index 05a674a..bd37ffb 100644 (file)
@@ -83,14 +83,14 @@ BVHObjectBinning::BVHObjectBinning(const BVHRange& job, BVHReference *prims)
                        int4 bin1 = get_bin(prim1.bounds());
 
                        /* increase bounds for bins for even primitive */
-                       int b00 = extract<0>(bin0); bin_count[b00][0]++; bin_bounds[b00][0].grow(prim0.bounds());
-                       int b01 = extract<1>(bin0); bin_count[b01][1]++; bin_bounds[b01][1].grow(prim0.bounds());
-                       int b02 = extract<2>(bin0); bin_count[b02][2]++; bin_bounds[b02][2].grow(prim0.bounds());
+                       int b00 = (int)extract<0>(bin0); bin_count[b00][0]++; bin_bounds[b00][0].grow(prim0.bounds());
+                       int b01 = (int)extract<1>(bin0); bin_count[b01][1]++; bin_bounds[b01][1].grow(prim0.bounds());
+                       int b02 = (int)extract<2>(bin0); bin_count[b02][2]++; bin_bounds[b02][2].grow(prim0.bounds());
 
                        /* increase bounds of bins for odd primitive */
-                       int b10 = extract<0>(bin1); bin_count[b10][0]++; bin_bounds[b10][0].grow(prim1.bounds());
-                       int b11 = extract<1>(bin1); bin_count[b11][1]++; bin_bounds[b11][1].grow(prim1.bounds());
-                       int b12 = extract<2>(bin1); bin_count[b12][2]++; bin_bounds[b12][2].grow(prim1.bounds());
+                       int b10 = (int)extract<0>(bin1); bin_count[b10][0]++; bin_bounds[b10][0].grow(prim1.bounds());
+                       int b11 = (int)extract<1>(bin1); bin_count[b11][1]++; bin_bounds[b11][1].grow(prim1.bounds());
+                       int b12 = (int)extract<2>(bin1); bin_count[b12][2]++; bin_bounds[b12][2].grow(prim1.bounds());
                }
 
                /* for uneven number of primitives */
@@ -100,9 +100,9 @@ BVHObjectBinning::BVHObjectBinning(const BVHRange& job, BVHReference *prims)
                        int4 bin0 = get_bin(prim0.bounds());
 
                        /* increase bounds of bins */
-                       int b00 = extract<0>(bin0); bin_count[b00][0]++; bin_bounds[b00][0].grow(prim0.bounds());
-                       int b01 = extract<1>(bin0); bin_count[b01][1]++; bin_bounds[b01][1].grow(prim0.bounds());
-                       int b02 = extract<2>(bin0); bin_count[b02][2]++; bin_bounds[b02][2].grow(prim0.bounds());
+                       int b00 = (int)extract<0>(bin0); bin_count[b00][0]++; bin_bounds[b00][0].grow(prim0.bounds());
+                       int b01 = (int)extract<1>(bin0); bin_count[b01][1]++; bin_bounds[b01][1].grow(prim0.bounds());
+                       int b02 = (int)extract<2>(bin0); bin_count[b02][2]++; bin_bounds[b02][2].grow(prim0.bounds());
                }
        }
 
index 72453e8..48bde70 100644 (file)
@@ -1036,7 +1036,7 @@ public:
                                                float scaling_factor = (float)target_update_frequency / (float)msec;
 
                                                /* sync at earliest next sample and probably later */
-                                               sync_sample = (sample + 1) + sync_sample * ceil(scaling_factor);
+                                               sync_sample = (sample + 1) + sync_sample * (int)ceil(scaling_factor);
 
                                                sync_sample = min(end_sample - 1, sync_sample); // make sure we sync the last sample always
 
index 9a5b261..3076272 100644 (file)
@@ -932,7 +932,7 @@ public:
                        CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(size_t)*3, max_work_items, NULL);
        
                /* try to divide evenly over 2 dimensions */
-               size_t sqrt_workgroup_size = max(sqrt((double)workgroup_size), 1.0);
+               size_t sqrt_workgroup_size = max((size_t)sqrt((double)workgroup_size), 1);
                size_t local_size[2] = {sqrt_workgroup_size, sqrt_workgroup_size};
 
                /* some implementations have max size 1 on 2nd dimension */
index 163e7cc..26e1198 100644 (file)
@@ -99,7 +99,7 @@ ccl_device float3 bsdf_hair_reflection_eval_reflect(const ShaderClosure *sc, con
        float theta_h = (theta_i + theta_r) * 0.5f;
        float t = theta_h - offset;
 
-       float phi_pdf = cos(phi_i * 0.5f) * 0.25f / roughness2;
+       float phi_pdf = cosf(phi_i * 0.5f) * 0.25f / roughness2;
        float theta_pdf = roughness1 / (2 * (t*t + roughness1*roughness1) * (a_R - b_R)* costheta_i);
        *pdf = phi_pdf * theta_pdf;
 
@@ -191,7 +191,7 @@ ccl_device int bsdf_hair_reflection_sample(const ShaderClosure *sc, float3 Ng, f
 
        float phi = 2 * safe_asinf(1 - 2 * randv) * roughness2;
 
-       float phi_pdf = cos(phi * 0.5f) * 0.25f / roughness2;
+       float phi_pdf = cosf(phi * 0.5f) * 0.25f / roughness2;
 
        float theta_pdf = roughness1 / (2 * (t*t + roughness1*roughness1) * (a_R - b_R)*costheta_i);
 
index d1f8496..dbffcbc 100644 (file)
@@ -167,7 +167,7 @@ ccl_device_inline void curvebounds(float *lower, float *upper, float *extremta,
 
        if(halfdiscroot >= 0) {
                float inv3p3 = (1.0f/3.0f)/p3;
-               halfdiscroot = sqrt(halfdiscroot);
+               halfdiscroot = sqrtf(halfdiscroot);
                ta = (-p2 - halfdiscroot) * inv3p3;
                tb = (-p2 + halfdiscroot) * inv3p3;
        }
index 431cd63..de800d7 100644 (file)
@@ -364,7 +364,7 @@ ccl_device float3 particle_angular_velocity(KernelGlobals *kg, int particle)
 ccl_device_inline float3 bvh_clamp_direction(float3 dir)
 {
        /* clamp absolute values by exp2f(-80.0f) to avoid division by zero when calculating inverse direction */
-       float ooeps = 8.271806E-25;
+       float ooeps = 8.271806E-25f;
        return make_float3((fabsf(dir.x) > ooeps)? dir.x: copysignf(ooeps, dir.x),
                                           (fabsf(dir.y) > ooeps)? dir.y: copysignf(ooeps, dir.y),
                                           (fabsf(dir.z) > ooeps)? dir.z: copysignf(ooeps, dir.z));
index b3c97cf..faaa68e 100644 (file)
@@ -203,7 +203,7 @@ ccl_device float kernel_volume_equiangular_sample(Ray *ray, float3 light_P, floa
        float D = sqrtf(len_squared(light_P - ray->P) - delta * delta);
        float theta_a = -atan2f(delta, D);
        float theta_b = atan2f(t - delta, D);
-       float t_ = D * tan((xi * theta_b) + (1 - xi) * theta_a);
+       float t_ = D * tanf((xi * theta_b) + (1 - xi) * theta_a);
 
        *pdf = D / ((theta_b - theta_a) * (D * D + t_ * t_));
 
index 015925a..edc3903 100644 (file)
@@ -89,7 +89,7 @@ ccl_device float3 svm_mix_diff(float t, float3 col1, float3 col2)
 
 ccl_device float3 svm_mix_dark(float t, float3 col1, float3 col2)
 {
-       return min(col1, col2)*t + col1*(1.0 - t);
+       return min(col1, col2)*t + col1*(1.0f - t);
 }
 
 ccl_device float3 svm_mix_light(float t, float3 col1, float3 col2)
index 1e35526..500b514 100644 (file)
@@ -74,7 +74,7 @@ ccl_device float sky_radiance_internal(float *configuration, float theta, float
        float expM = expf(configuration[4] * gamma);
        float rayM = cgamma * cgamma;
        float mieM = (1.0f + rayM) / powf((1.0f + configuration[8]*configuration[8] - 2.0f*configuration[8]*cgamma), 1.5f);
-       float zenith = sqrt(ctheta);
+       float zenith = sqrtf(ctheta);
 
        return (1.0f + configuration[0] * expf(configuration[1] / (ctheta + 0.01f))) *
                (configuration[2] + configuration[3] * expM + configuration[5] * rayM + configuration[6] * mieM + configuration[7] * zenith);
index dca4003..9e57c47 100644 (file)
@@ -43,33 +43,33 @@ ccl_device void svm_node_wavelength(ShaderData *sd, float *stack, uint wavelengt
        //                cie_colour_match[(lambda - 380) / 5][1] = yBar
        //                cie_colour_match[(lambda - 380) / 5][2] = zBar
        const float cie_colour_match[81][3] = {
-               {0.0014,0.0000,0.0065}, {0.0022,0.0001,0.0105}, {0.0042,0.0001,0.0201},
-               {0.0076,0.0002,0.0362}, {0.0143,0.0004,0.0679}, {0.0232,0.0006,0.1102},
-               {0.0435,0.0012,0.2074}, {0.0776,0.0022,0.3713}, {0.1344,0.0040,0.6456},
-               {0.2148,0.0073,1.0391}, {0.2839,0.0116,1.3856}, {0.3285,0.0168,1.6230},
-               {0.3483,0.0230,1.7471}, {0.3481,0.0298,1.7826}, {0.3362,0.0380,1.7721},
-               {0.3187,0.0480,1.7441}, {0.2908,0.0600,1.6692}, {0.2511,0.0739,1.5281},
-               {0.1954,0.0910,1.2876}, {0.1421,0.1126,1.0419}, {0.0956,0.1390,0.8130},
-               {0.0580,0.1693,0.6162}, {0.0320,0.2080,0.4652}, {0.0147,0.2586,0.3533},
-               {0.0049,0.3230,0.2720}, {0.0024,0.4073,0.2123}, {0.0093,0.5030,0.1582},
-               {0.0291,0.6082,0.1117}, {0.0633,0.7100,0.0782}, {0.1096,0.7932,0.0573},
-               {0.1655,0.8620,0.0422}, {0.2257,0.9149,0.0298}, {0.2904,0.9540,0.0203},
-               {0.3597,0.9803,0.0134}, {0.4334,0.9950,0.0087}, {0.5121,1.0000,0.0057},
-               {0.5945,0.9950,0.0039}, {0.6784,0.9786,0.0027}, {0.7621,0.9520,0.0021},
-               {0.8425,0.9154,0.0018}, {0.9163,0.8700,0.0017}, {0.9786,0.8163,0.0014},
-               {1.0263,0.7570,0.0011}, {1.0567,0.6949,0.0010}, {1.0622,0.6310,0.0008},
-               {1.0456,0.5668,0.0006}, {1.0026,0.5030,0.0003}, {0.9384,0.4412,0.0002},
-               {0.8544,0.3810,0.0002}, {0.7514,0.3210,0.0001}, {0.6424,0.2650,0.0000},
-               {0.5419,0.2170,0.0000}, {0.4479,0.1750,0.0000}, {0.3608,0.1382,0.0000},
-               {0.2835,0.1070,0.0000}, {0.2187,0.0816,0.0000}, {0.1649,0.0610,0.0000},
-               {0.1212,0.0446,0.0000}, {0.0874,0.0320,0.0000}, {0.0636,0.0232,0.0000},
-               {0.0468,0.0170,0.0000}, {0.0329,0.0119,0.0000}, {0.0227,0.0082,0.0000},
-               {0.0158,0.0057,0.0000}, {0.0114,0.0041,0.0000}, {0.0081,0.0029,0.0000},
-               {0.0058,0.0021,0.0000}, {0.0041,0.0015,0.0000}, {0.0029,0.0010,0.0000},
-               {0.0020,0.0007,0.0000}, {0.0014,0.0005,0.0000}, {0.0010,0.0004,0.0000},
-               {0.0007,0.0002,0.0000}, {0.0005,0.0002,0.0000}, {0.0003,0.0001,0.0000},
-               {0.0002,0.0001,0.0000}, {0.0002,0.0001,0.0000}, {0.0001,0.0000,0.0000},
-               {0.0001,0.0000,0.0000}, {0.0001,0.0000,0.0000}, {0.0000,0.0000,0.0000}
+               {0.0014f,0.0000f,0.0065f}, {0.0022f,0.0001f,0.0105f}, {0.0042f,0.0001f,0.0201f},
+               {0.0076f,0.0002f,0.0362f}, {0.0143f,0.0004f,0.0679f}, {0.0232f,0.0006f,0.1102f},
+               {0.0435f,0.0012f,0.2074f}, {0.0776f,0.0022f,0.3713f}, {0.1344f,0.0040f,0.6456f},
+               {0.2148f,0.0073f,1.0391f}, {0.2839f,0.0116f,1.3856f}, {0.3285f,0.0168f,1.6230f},
+               {0.3483f,0.0230f,1.7471f}, {0.3481f,0.0298f,1.7826f}, {0.3362f,0.0380f,1.7721f},
+               {0.3187f,0.0480f,1.7441f}, {0.2908f,0.0600f,1.6692f}, {0.2511f,0.0739f,1.5281f},
+               {0.1954f,0.0910f,1.2876f}, {0.1421f,0.1126f,1.0419f}, {0.0956f,0.1390f,0.8130f},
+               {0.0580f,0.1693f,0.6162f}, {0.0320f,0.2080f,0.4652f}, {0.0147f,0.2586f,0.3533f},
+               {0.0049f,0.3230f,0.2720f}, {0.0024f,0.4073f,0.2123f}, {0.0093f,0.5030f,0.1582f},
+               {0.0291f,0.6082f,0.1117f}, {0.0633f,0.7100f,0.0782f}, {0.1096f,0.7932f,0.0573f},
+               {0.1655f,0.8620f,0.0422f}, {0.2257f,0.9149f,0.0298f}, {0.2904f,0.9540f,0.0203f},
+               {0.3597f,0.9803f,0.0134f}, {0.4334f,0.9950f,0.0087f}, {0.5121f,1.0000f,0.0057f},
+               {0.5945f,0.9950f,0.0039f}, {0.6784f,0.9786f,0.0027f}, {0.7621f,0.9520f,0.0021f},
+               {0.8425f,0.9154f,0.0018f}, {0.9163f,0.8700f,0.0017f}, {0.9786f,0.8163f,0.0014f},
+               {1.0263f,0.7570f,0.0011f}, {1.0567f,0.6949f,0.0010f}, {1.0622f,0.6310f,0.0008f},
+               {1.0456f,0.5668f,0.0006f}, {1.0026f,0.5030f,0.0003f}, {0.9384f,0.4412f,0.0002f},
+               {0.8544f,0.3810f,0.0002f}, {0.7514f,0.3210f,0.0001f}, {0.6424f,0.2650f,0.0000f},
+               {0.5419f,0.2170f,0.0000f}, {0.4479f,0.1750f,0.0000f}, {0.3608f,0.1382f,0.0000f},
+               {0.2835f,0.1070f,0.0000f}, {0.2187f,0.0816f,0.0000f}, {0.1649f,0.0610f,0.0000f},
+               {0.1212f,0.0446f,0.0000f}, {0.0874f,0.0320f,0.0000f}, {0.0636f,0.0232f,0.0000f},
+               {0.0468f,0.0170f,0.0000f}, {0.0329f,0.0119f,0.0000f}, {0.0227f,0.0082f,0.0000f},
+               {0.0158f,0.0057f,0.0000f}, {0.0114f,0.0041f,0.0000f}, {0.0081f,0.0029f,0.0000f},
+               {0.0058f,0.0021f,0.0000f}, {0.0041f,0.0015f,0.0000f}, {0.0029f,0.0010f,0.0000f},
+               {0.0020f,0.0007f,0.0000f}, {0.0014f,0.0005f,0.0000f}, {0.0010f,0.0004f,0.0000f},
+               {0.0007f,0.0002f,0.0000f}, {0.0005f,0.0002f,0.0000f}, {0.0003f,0.0001f,0.0000f},
+               {0.0002f,0.0001f,0.0000f}, {0.0002f,0.0001f,0.0000f}, {0.0001f,0.0000f,0.0000f},
+               {0.0001f,0.0000f,0.0000f}, {0.0001f,0.0000f,0.0000f}, {0.0000f,0.0000f,0.0000f}
        };
 
        float lambda_nm = stack_load_float(stack, wavelength);
index 5802b9d..7262a79 100644 (file)
@@ -53,7 +53,7 @@ ccl_device void svm_node_wireframe(KernelGlobals *kg, ShaderData *sd, float *sta
                float pixelwidth = 1.0f;
 
                /* Triangles */
-               float np = 3;
+               int np = 3;
                
                if(sd->type & PRIMITIVE_TRIANGLE)
                        triangle_vertices(kg, sd->prim, Co);
index ab61886..89af714 100644 (file)
@@ -59,33 +59,33 @@ vector<float> blackbody_table()
        */
 
        const float cie_colour_match[81][3] = {
-               {0.0014,0.0000,0.0065}, {0.0022,0.0001,0.0105}, {0.0042,0.0001,0.0201},
-               {0.0076,0.0002,0.0362}, {0.0143,0.0004,0.0679}, {0.0232,0.0006,0.1102},
-               {0.0435,0.0012,0.2074}, {0.0776,0.0022,0.3713}, {0.1344,0.0040,0.6456},
-               {0.2148,0.0073,1.0391}, {0.2839,0.0116,1.3856}, {0.3285,0.0168,1.6230},
-               {0.3483,0.0230,1.7471}, {0.3481,0.0298,1.7826}, {0.3362,0.0380,1.7721},
-               {0.3187,0.0480,1.7441}, {0.2908,0.0600,1.6692}, {0.2511,0.0739,1.5281},
-               {0.1954,0.0910,1.2876}, {0.1421,0.1126,1.0419}, {0.0956,0.1390,0.8130},
-               {0.0580,0.1693,0.6162}, {0.0320,0.2080,0.4652}, {0.0147,0.2586,0.3533},
-               {0.0049,0.3230,0.2720}, {0.0024,0.4073,0.2123}, {0.0093,0.5030,0.1582},
-               {0.0291,0.6082,0.1117}, {0.0633,0.7100,0.0782}, {0.1096,0.7932,0.0573},
-               {0.1655,0.8620,0.0422}, {0.2257,0.9149,0.0298}, {0.2904,0.9540,0.0203},
-               {0.3597,0.9803,0.0134}, {0.4334,0.9950,0.0087}, {0.5121,1.0000,0.0057},
-               {0.5945,0.9950,0.0039}, {0.6784,0.9786,0.0027}, {0.7621,0.9520,0.0021},
-               {0.8425,0.9154,0.0018}, {0.9163,0.8700,0.0017}, {0.9786,0.8163,0.0014},
-               {1.0263,0.7570,0.0011}, {1.0567,0.6949,0.0010}, {1.0622,0.6310,0.0008},
-               {1.0456,0.5668,0.0006}, {1.0026,0.5030,0.0003}, {0.9384,0.4412,0.0002},
-               {0.8544,0.3810,0.0002}, {0.7514,0.3210,0.0001}, {0.6424,0.2650,0.0000},
-               {0.5419,0.2170,0.0000}, {0.4479,0.1750,0.0000}, {0.3608,0.1382,0.0000},
-               {0.2835,0.1070,0.0000}, {0.2187,0.0816,0.0000}, {0.1649,0.0610,0.0000},
-               {0.1212,0.0446,0.0000}, {0.0874,0.0320,0.0000}, {0.0636,0.0232,0.0000},
-               {0.0468,0.0170,0.0000}, {0.0329,0.0119,0.0000}, {0.0227,0.0082,0.0000},
-               {0.0158,0.0057,0.0000}, {0.0114,0.0041,0.0000}, {0.0081,0.0029,0.0000},
-               {0.0058,0.0021,0.0000}, {0.0041,0.0015,0.0000}, {0.0029,0.0010,0.0000},
-               {0.0020,0.0007,0.0000}, {0.0014,0.0005,0.0000}, {0.0010,0.0004,0.0000},
-               {0.0007,0.0002,0.0000}, {0.0005,0.0002,0.0000}, {0.0003,0.0001,0.0000},
-               {0.0002,0.0001,0.0000}, {0.0002,0.0001,0.0000}, {0.0001,0.0000,0.0000},
-               {0.0001,0.0000,0.0000}, {0.0001,0.0000,0.0000}, {0.0000,0.0000,0.0000}
+               {0.0014f,0.0000f,0.0065f}, {0.0022f,0.0001f,0.0105f}, {0.0042f,0.0001f,0.0201f},
+               {0.0076f,0.0002f,0.0362f}, {0.0143f,0.0004f,0.0679f}, {0.0232f,0.0006f,0.1102f},
+               {0.0435f,0.0012f,0.2074f}, {0.0776f,0.0022f,0.3713f}, {0.1344f,0.0040f,0.6456f},
+               {0.2148f,0.0073f,1.0391f}, {0.2839f,0.0116f,1.3856f}, {0.3285f,0.0168f,1.6230f},
+               {0.3483f,0.0230f,1.7471f}, {0.3481f,0.0298f,1.7826f}, {0.3362f,0.0380f,1.7721f},
+               {0.3187f,0.0480f,1.7441f}, {0.2908f,0.0600f,1.6692f}, {0.2511f,0.0739f,1.5281f},
+               {0.1954f,0.0910f,1.2876f}, {0.1421f,0.1126f,1.0419f}, {0.0956f,0.1390f,0.8130f},
+               {0.0580f,0.1693f,0.6162f}, {0.0320f,0.2080f,0.4652f}, {0.0147f,0.2586f,0.3533f},
+               {0.0049f,0.3230f,0.2720f}, {0.0024f,0.4073f,0.2123f}, {0.0093f,0.5030f,0.1582f},
+               {0.0291f,0.6082f,0.1117f}, {0.0633f,0.7100f,0.0782f}, {0.1096f,0.7932f,0.0573f},
+               {0.1655f,0.8620f,0.0422f}, {0.2257f,0.9149f,0.0298f}, {0.2904f,0.9540f,0.0203f},
+               {0.3597f,0.9803f,0.0134f}, {0.4334f,0.9950f,0.0087f}, {0.5121f,1.0000f,0.0057f},
+               {0.5945f,0.9950f,0.0039f}, {0.6784f,0.9786f,0.0027f}, {0.7621f,0.9520f,0.0021f},
+               {0.8425f,0.9154f,0.0018f}, {0.9163f,0.8700f,0.0017f}, {0.9786f,0.8163f,0.0014f},
+               {1.0263f,0.7570f,0.0011f}, {1.0567f,0.6949f,0.0010f}, {1.0622f,0.6310f,0.0008f},
+               {1.0456f,0.5668f,0.0006f}, {1.0026f,0.5030f,0.0003f}, {0.9384f,0.4412f,0.0002f},
+               {0.8544f,0.3810f,0.0002f}, {0.7514f,0.3210f,0.0001f}, {0.6424f,0.2650f,0.0000f},
+               {0.5419f,0.2170f,0.0000f}, {0.4479f,0.1750f,0.0000f}, {0.3608f,0.1382f,0.0000f},
+               {0.2835f,0.1070f,0.0000f}, {0.2187f,0.0816f,0.0000f}, {0.1649f,0.0610f,0.0000f},
+               {0.1212f,0.0446f,0.0000f}, {0.0874f,0.0320f,0.0000f}, {0.0636f,0.0232f,0.0000f},
+               {0.0468f,0.0170f,0.0000f}, {0.0329f,0.0119f,0.0000f}, {0.0227f,0.0082f,0.0000f},
+               {0.0158f,0.0057f,0.0000f}, {0.0114f,0.0041f,0.0000f}, {0.0081f,0.0029f,0.0000f},
+               {0.0058f,0.0021f,0.0000f}, {0.0041f,0.0015f,0.0000f}, {0.0029f,0.0010f,0.0000f},
+               {0.0020f,0.0007f,0.0000f}, {0.0014f,0.0005f,0.0000f}, {0.0010f,0.0004f,0.0000f},
+               {0.0007f,0.0002f,0.0000f}, {0.0005f,0.0002f,0.0000f}, {0.0003f,0.0001f,0.0000f},
+               {0.0002f,0.0001f,0.0000f}, {0.0002f,0.0001f,0.0000f}, {0.0001f,0.0000f,0.0000f},
+               {0.0001f,0.0000f,0.0000f}, {0.0001f,0.0000f,0.0000f}, {0.0000f,0.0000f,0.0000f}
        };
 
        const double c1 = 3.74183e-16; // 2*pi*h*c^2, W*m^2
index d2e2a22..8659fe4 100644 (file)
@@ -44,8 +44,8 @@ Camera::Camera()
        fisheye_lens = 10.5f;
        fov = M_PI_4_F;
 
-       sensorwidth = 0.036;
-       sensorheight = 0.024;
+       sensorwidth = 0.036f;
+       sensorheight = 0.024f;
 
        nearclip = 1e-5f;
        farclip = 1e5f;
index e079e7e..b145ebe 100644 (file)
@@ -43,7 +43,7 @@ Integrator::Integrator()
 
        volume_homogeneous_sampling = 0;
        volume_max_steps = 1024;
-       volume_step_size = 0.1;
+       volume_step_size = 0.1f;
 
        no_caustics = false;
        filter_glossy = 0.0f;
index 1d59b21..8748294 100644 (file)
@@ -582,13 +582,13 @@ static void sky_texture_precompute_new(SunSky *sunsky, float3 dir, float turbidi
 
        /* Copy values from sky_state to SunSky */
        for (int i = 0; i < 9; ++i) {
-               sunsky->config_x[i] = sky_state->configs[0][i];
-               sunsky->config_y[i] = sky_state->configs[1][i];
-               sunsky->config_z[i] = sky_state->configs[2][i];
+               sunsky->config_x[i] = (float)sky_state->configs[0][i];
+               sunsky->config_y[i] = (float)sky_state->configs[1][i];
+               sunsky->config_z[i] = (float)sky_state->configs[2][i];
        }
-       sunsky->radiance_x = sky_state->radiances[0];
-       sunsky->radiance_y = sky_state->radiances[1];
-       sunsky->radiance_z = sky_state->radiances[2];
+       sunsky->radiance_x = (float)sky_state->radiances[0];
+       sunsky->radiance_y = (float)sky_state->radiances[1];
+       sunsky->radiance_z = (float)sky_state->radiances[2];
 
        /* Free sky_state */
        arhosekskymodelstate_free(sky_state);
index 6f250c0..adb07d9 100644 (file)
@@ -310,7 +310,7 @@ double arhosekskymodel_radiance(
         double                  wavelength
         )
 {
-    int low_wl = (wavelength - 320.0 ) / 40.0;
+    int low_wl = (int)((wavelength - 320.0) / 40.0);
 
     if ( low_wl < 0 || low_wl >= 11 )
         return 0.0f;
index 417ecff..6bbf4af 100644 (file)
@@ -94,7 +94,7 @@ void DiagSplit::partition_edge(Patch *patch, float2 *P, int *t0, int *t1, float2
                *t1 = T(patch, *P, Pend);
        }
        else {
-               int I = floor(t*0.5f);
+               int I = (int)floor((float)t*0.5f);
                *P = interp(Pstart, Pend, (t == 0)? 0: I/(float)t); /* XXX is t faces or verts */
                *t0 = I;
                *t1 = t - I;