diff options
Diffstat (limited to 'intern/cycles/util/util_transform.h')
-rw-r--r-- | intern/cycles/util/util_transform.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h index e781f85dded..e4cadd3e81a 100644 --- a/intern/cycles/util/util_transform.h +++ b/intern/cycles/util/util_transform.h @@ -424,6 +424,31 @@ ccl_device void transform_motion_array_interpolate(Transform *tfm, #ifndef __KERNEL_GPU__ +#ifdef WITH_EMBREE +ccl_device void transform_motion_array_interpolate_straight(Transform *tfm, + const ccl_global DecomposedTransform *motion, + uint numsteps, + float time) +{ + /* Figure out which steps we need to interpolate. */ + int maxstep = numsteps - 1; + int step = min((int)(time*maxstep), maxstep - 1); + float t = time * maxstep - step; + + const ccl_global DecomposedTransform *a = motion + step; + const ccl_global DecomposedTransform *b = motion + step + 1; + Transform step1, step2; + + transform_compose(&step1, a); + transform_compose(&step2, b); + + /* matrix lerp */ + tfm->x = (1.0f - t) * step1.x + t * step2.x; + tfm->y = (1.0f - t) * step1.y + t * step2.y; + tfm->z = (1.0f - t) * step1.z + t * step2.z; +} +#endif + class BoundBox2D; ccl_device_inline bool operator==(const DecomposedTransform& A, const DecomposedTransform& B) @@ -470,4 +495,4 @@ OPENCL_TRANSFORM_ADDRSPACE_DECLARE(transform_direction_transposed) CCL_NAMESPACE_END -#endif /* __UTIL_TRANSFORM_H__ */ +#endif /* __UTIL_TRANSFORM_H__ */ |