Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-08 08:19:17 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 06:54:05 +0300
commit623141f339d5066ed6b96ad70ab45fb294e3e612 (patch)
tree4af00e5d967a66829db1bec4bbf369c0529b9bd7 /intern/cycles/kernel
parent516e82a90012da3911518103829158215d94215f (diff)
Code refactor: add DecomposedTransform.
This is in preparation of making Transform affine only, and also gives us a little extra type safety so we don't accidentally treat it as a regular 4x4 matrix.
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r--intern/cycles/kernel/geom/geom_object.h2
-rw-r--r--intern/cycles/kernel/geom/geom_primitive.h4
-rw-r--r--intern/cycles/kernel/kernel_camera.h6
-rw-r--r--intern/cycles/kernel/kernel_types.h7
4 files changed, 11 insertions, 8 deletions
diff --git a/intern/cycles/kernel/geom/geom_object.h b/intern/cycles/kernel/geom/geom_object.h
index 3fbceded261..cd330308e07 100644
--- a/intern/cycles/kernel/geom/geom_object.h
+++ b/intern/cycles/kernel/geom/geom_object.h
@@ -96,7 +96,7 @@ ccl_device_inline Transform object_fetch_vector_transform(KernelGlobals *kg, int
#ifdef __OBJECT_MOTION__
ccl_device_inline Transform object_fetch_transform_motion(KernelGlobals *kg, int object, float time)
{
- const ccl_global MotionTransform *motion = &kernel_tex_fetch(__objects, object).tfm;
+ const ccl_global DecomposedMotionTransform *motion = &kernel_tex_fetch(__objects, object).tfm;
Transform tfm;
transform_motion_interpolate(&tfm, motion, time);
diff --git a/intern/cycles/kernel/geom/geom_primitive.h b/intern/cycles/kernel/geom/geom_primitive.h
index 6a8ea793ff0..4e84446bae0 100644
--- a/intern/cycles/kernel/geom/geom_primitive.h
+++ b/intern/cycles/kernel/geom/geom_primitive.h
@@ -220,13 +220,13 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals *kg, ShaderData *
motion_center.x *= kernel_data.cam.width;
motion_center.y *= kernel_data.cam.height;
- tfm = kernel_data.cam.motion.pre;
+ tfm = kernel_data.cam.pass_motion.pre;
motion_pre = normalize(transform_point(&tfm, motion_pre));
motion_pre = float2_to_float3(direction_to_panorama(&kernel_data.cam, motion_pre));
motion_pre.x *= kernel_data.cam.width;
motion_pre.y *= kernel_data.cam.height;
- tfm = kernel_data.cam.motion.post;
+ tfm = kernel_data.cam.pass_motion.post;
motion_post = normalize(transform_point(&tfm, motion_post));
motion_post = float2_to_float3(direction_to_panorama(&kernel_data.cam, motion_post));
motion_post.x *= kernel_data.cam.width;
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h
index 5b102eabb93..755c3472072 100644
--- a/intern/cycles/kernel/kernel_camera.h
+++ b/intern/cycles/kernel/kernel_camera.h
@@ -92,7 +92,7 @@ ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, flo
#ifdef __CAMERA_MOTION__
if(kernel_data.cam.have_motion) {
- ccl_constant MotionTransform *motion = &kernel_data.cam.motion;
+ ccl_constant DecomposedMotionTransform *motion = &kernel_data.cam.motion;
transform_motion_interpolate_constant(&cameratoworld,
motion,
ray->time);
@@ -198,7 +198,7 @@ ccl_device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, fl
#ifdef __CAMERA_MOTION__
if(kernel_data.cam.have_motion) {
- ccl_constant MotionTransform *motion = &kernel_data.cam.motion;
+ ccl_constant DecomposedMotionTransform *motion = &kernel_data.cam.motion;
transform_motion_interpolate_constant(&cameratoworld,
motion,
ray->time);
@@ -270,7 +270,7 @@ ccl_device_inline void camera_sample_panorama(ccl_constant KernelCamera *cam,
#ifdef __CAMERA_MOTION__
if(cam->have_motion) {
- ccl_constant MotionTransform *motion = &cam->motion;
+ ccl_constant DecomposedMotionTransform *motion = &cam->motion;
transform_motion_interpolate_constant(&cameratoworld,
motion,
ray->time);
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 87faa0d0e53..5934ff53f57 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -1201,12 +1201,15 @@ typedef struct KernelCamera {
ProjectionTransform worldtondc;
Transform worldtocamera;
- MotionTransform motion;
+ DecomposedMotionTransform motion;
/* Stores changes in the projeciton matrix. Use for camera zoom motion
* blur and motion pass output for perspective camera. */
PerspectiveMotionTransform perspective_motion;
+ /* Transforms for motion pass. */
+ MotionTransform pass_motion;
+
int shutter_table_offset;
/* Rolling shutter */
@@ -1430,7 +1433,7 @@ static_assert_align(KernelData, 16);
/* Kernel data structures. */
typedef struct KernelObject {
- MotionTransform tfm;
+ DecomposedMotionTransform tfm;
float surface_area;
float pass_id;