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@pandora.be>2012-11-29 04:43:50 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-29 04:43:50 +0400
commit0d6976ad0ce4570e286ca33b852ee3b6a07a09ab (patch)
treebd8ec57a4c4454db097d06b5c1eea4328863753e /intern/cycles/util/util_transform.h
parentbb0195e0396a66c40a03e9f9c6a87c9b8a5ecc47 (diff)
Fix #32900: object motion blur not working on the GPU. To make this work I disabled motion
blurring of scale animation, probably not a big loss in practice since it's not so common to animate this, can be added back later.
Diffstat (limited to 'intern/cycles/util/util_transform.h')
-rw-r--r--intern/cycles/util/util_transform.h37
1 files changed, 22 insertions, 15 deletions
diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h
index 65162ebf4e6..dbf88cb67a0 100644
--- a/intern/cycles/util/util_transform.h
+++ b/intern/cycles/util/util_transform.h
@@ -41,7 +41,9 @@ typedef struct Transform {
/* transform decomposed in rotation/translation/scale. we use the same data
* structure as Transform, and tightly pack decomposition into it. first the
- * rotation (4), then translation (3), then 3x3 scale matrix (9) */
+ * rotation (4), then translation (3), then 3x3 scale matrix (9).
+ *
+ * For the DecompMotionTransform we drop scale from pre/post. */
typedef struct MotionTransform {
Transform pre;
@@ -49,6 +51,12 @@ typedef struct MotionTransform {
Transform post;
} MotionTransform;
+typedef struct DecompMotionTransform {
+ Transform mid;
+ float4 pre_x, pre_y;
+ float4 post_x, post_y;
+} DecompMotionTransform;
+
/* Functions */
__device_inline float3 transform_perspective(const Transform *t, const float3 a)
@@ -384,7 +392,7 @@ __device_inline void transform_compose(Transform *tfm, const Transform *decomp)
/* Disabled for now, need arc-length parametrization for constant speed motion.
* #define CURVED_MOTION_INTERPOLATE */
-__device void transform_motion_interpolate(Transform *tfm, const MotionTransform *motion, float t)
+__device void transform_motion_interpolate(Transform *tfm, const DecompMotionTransform *motion, float t)
{
/* possible optimization: is it worth it adding a check to skip scaling?
* it's probably quite uncommon to have scaling objects. or can we skip
@@ -393,9 +401,9 @@ __device void transform_motion_interpolate(Transform *tfm, const MotionTransform
#ifdef CURVED_MOTION_INTERPOLATE
/* 3 point bezier curve interpolation for position */
- float3 Ppre = float4_to_float3(motion->pre.y);
+ float3 Ppre = float4_to_float3(motion->pre_y);
float3 Pmid = float4_to_float3(motion->mid.y);
- float3 Ppost = float4_to_float3(motion->post.y);
+ float3 Ppost = float4_to_float3(motion->post_y);
float3 Pcontrol = 2.0f*Pmid - 0.5f*(Ppre + Ppost);
float3 P = Ppre*t*t + Pcontrol*2.0f*t*(1.0f - t) + Ppost*(1.0f - t)*(1.0f - t);
@@ -409,28 +417,27 @@ __device void transform_motion_interpolate(Transform *tfm, const MotionTransform
if(t < 0.5f) {
t *= 2.0f;
- decomp.x = quat_interpolate(motion->pre.x, motion->mid.x, t);
+ decomp.x = quat_interpolate(motion->pre_x, motion->mid.x, t);
#ifdef CURVED_MOTION_INTERPOLATE
- decomp.y.w = (1.0f - t)*motion->pre.y.w + t*motion->mid.y.w;
+ decomp.y.w = (1.0f - t)*motion->pre_y.w + t*motion->mid.y.w;
#else
- decomp.y = (1.0f - t)*motion->pre.y + t*motion->mid.y;
+ decomp.y = (1.0f - t)*motion->pre_y + t*motion->mid.y;
#endif
- decomp.z = (1.0f - t)*motion->pre.z + t*motion->mid.z;
- decomp.w = (1.0f - t)*motion->pre.w + t*motion->mid.w;
}
else {
t = (t - 0.5f)*2.0f;
- decomp.x = quat_interpolate(motion->mid.x, motion->post.x, t);
+ decomp.x = quat_interpolate(motion->mid.x, motion->post_x, t);
#ifdef CURVED_MOTION_INTERPOLATE
- decomp.y.w = (1.0f - t)*motion->mid.y.w + t*motion->post.y.w;
+ decomp.y.w = (1.0f - t)*motion->mid.y.w + t*motion->post_y.w;
#else
- decomp.y = (1.0f - t)*motion->mid.y + t*motion->post.y;
+ decomp.y = (1.0f - t)*motion->mid.y + t*motion->post_y;
#endif
- decomp.z = (1.0f - t)*motion->mid.z + t*motion->post.z;
- decomp.w = (1.0f - t)*motion->mid.w + t*motion->post.w;
}
+ decomp.z = motion->mid.z;
+ decomp.w = motion->mid.w;
+
/* compose rotation, translation, scale into matrix */
transform_compose(tfm, &decomp);
}
@@ -442,7 +449,7 @@ __device_inline bool operator==(const MotionTransform& A, const MotionTransform&
return (A.pre == B.pre && A.post == B.post);
}
-void transform_motion_decompose(MotionTransform *decomp, const MotionTransform *motion, const Transform *mid);
+void transform_motion_decompose(DecompMotionTransform *decomp, const MotionTransform *motion, const Transform *mid);
#endif