Cleanup: Simplify camera sample motion blur code.
authorThomas Dinges <blender@dingto.org>
Thu, 26 Feb 2015 09:17:59 +0000 (10:17 +0100)
committerThomas Dinges <blender@dingto.org>
Thu, 26 Feb 2015 09:30:01 +0000 (10:30 +0100)
intern/cycles/kernel/kernel_camera.h
intern/cycles/kernel/kernel_path.h

index ded222e20fffc1737fcbf7dfab90622ef0aa2c2f..6c32a7e46b12e8c28d1b2b520578cd47928becb5 100644 (file)
@@ -245,21 +245,13 @@ ccl_device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float
 /* Common */
 
 ccl_device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, float filter_v,
-       float lens_u, float lens_v, float time, Ray *ray)
+       float lens_u, float lens_v, Ray *ray)
 {
        /* pixel filter */
        int filter_table_offset = kernel_data.film.filter_table_offset;
        float raster_x = x + lookup_table_read(kg, filter_u, filter_table_offset, FILTER_TABLE_SIZE);
        float raster_y = y + lookup_table_read(kg, filter_v, filter_table_offset, FILTER_TABLE_SIZE);
 
-#ifdef __CAMERA_MOTION__
-       /* motion blur */
-       if(kernel_data.cam.shuttertime == -1.0f)
-               ray->time = TIME_INVALID;
-       else
-               ray->time = time;
-#endif
-
        /* sample */
        if(kernel_data.cam.type == CAMERA_PERSPECTIVE)
                camera_sample_perspective(kg, raster_x, raster_y, lens_u, lens_v, ray);
index 151e762020b94819055a55bc280f31323bf68988..9f3709ea5f7e8aa54a93a4dc36f714f0d5b5ad39 100644 (file)
@@ -1191,14 +1191,15 @@ ccl_device_inline void kernel_path_trace_setup(KernelGlobals *kg, ccl_global uin
        if(kernel_data.cam.aperturesize > 0.0f)
                path_rng_2D(kg, rng, sample, num_samples, PRNG_LENS_U, &lens_u, &lens_v);
 
-       float time = 0.0f;
-
 #ifdef __CAMERA_MOTION__
-       if(kernel_data.cam.shuttertime != -1.0f)
-               time = path_rng_1D(kg, rng, sample, num_samples, PRNG_TIME);
+       /* motion blur */
+       if(kernel_data.cam.shuttertime == -1.0f)
+               ray->time = TIME_INVALID;
+       else
+               ray->time = path_rng_1D(kg, rng, sample, num_samples, PRNG_TIME);
 #endif
 
-       camera_sample(kg, x, y, filter_u, filter_v, lens_u, lens_v, time, ray);
+       camera_sample(kg, x, y, filter_u, filter_v, lens_u, lens_v, ray);
 }
 
 ccl_device void kernel_path_trace(KernelGlobals *kg,