diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-03-17 18:48:00 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-03-18 13:23:05 +0300 |
commit | 006025ead0b89de671363816cd0e962f10d21c50 (patch) | |
tree | 7126736cb18cbfef6239cdaff1894171252a5d44 /intern/cycles/kernel/kernels/cpu | |
parent | fd53b72871e045dfebfb9ddbe2b3c491491aa913 (diff) |
Cycles: support for different 3D transform per volume grid
This is not yet fully supported by automatic volume bounds but works fine in
most cases that will have mostly matching bounds.
Ref T73201
Diffstat (limited to 'intern/cycles/kernel/kernels/cpu')
-rw-r--r-- | intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h index 7eb66b0b4ca..f87501db258 100644 --- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h +++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h @@ -498,28 +498,34 @@ ccl_device float4 kernel_tex_image_interp(KernelGlobals *kg, int id, float x, fl } } -ccl_device float4 kernel_tex_image_interp_3d( - KernelGlobals *kg, int id, float x, float y, float z, InterpolationType interp) +ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, + int id, + float3 P, + InterpolationType interp) { const TextureInfo &info = kernel_tex_fetch(__texture_info, id); + if (info.use_transform_3d) { + P = transform_point(&info.transform_3d, P); + } + switch (info.data_type) { case IMAGE_DATA_TYPE_HALF: - return TextureInterpolator<half>::interp_3d(info, x, y, z, interp); + return TextureInterpolator<half>::interp_3d(info, P.x, P.y, P.z, interp); case IMAGE_DATA_TYPE_BYTE: - return TextureInterpolator<uchar>::interp_3d(info, x, y, z, interp); + return TextureInterpolator<uchar>::interp_3d(info, P.x, P.y, P.z, interp); case IMAGE_DATA_TYPE_USHORT: - return TextureInterpolator<uint16_t>::interp_3d(info, x, y, z, interp); + return TextureInterpolator<uint16_t>::interp_3d(info, P.x, P.y, P.z, interp); case IMAGE_DATA_TYPE_FLOAT: - return TextureInterpolator<float>::interp_3d(info, x, y, z, interp); + return TextureInterpolator<float>::interp_3d(info, P.x, P.y, P.z, interp); case IMAGE_DATA_TYPE_HALF4: - return TextureInterpolator<half4>::interp_3d(info, x, y, z, interp); + return TextureInterpolator<half4>::interp_3d(info, P.x, P.y, P.z, interp); case IMAGE_DATA_TYPE_BYTE4: - return TextureInterpolator<uchar4>::interp_3d(info, x, y, z, interp); + return TextureInterpolator<uchar4>::interp_3d(info, P.x, P.y, P.z, interp); case IMAGE_DATA_TYPE_USHORT4: - return TextureInterpolator<ushort4>::interp_3d(info, x, y, z, interp); + return TextureInterpolator<ushort4>::interp_3d(info, P.x, P.y, P.z, interp); case IMAGE_DATA_TYPE_FLOAT4: - return TextureInterpolator<float4>::interp_3d(info, x, y, z, interp); + return TextureInterpolator<float4>::interp_3d(info, P.x, P.y, P.z, interp); default: assert(0); return make_float4( |