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:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-01-15 11:23:33 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-01-22 12:12:22 +0300
commita1ffb49e494deac6cf6d3bcca45c046d9acdfad1 (patch)
tree0ed795eff77b24e1b04d7f33eca661a717476bac /intern/cycles/util
parent1aa8f0d3c02f65c4e70a5e87dd45f44a135a66a2 (diff)
Fix T43120: Cycles mapping node rotation order is different from viewport
Root of the issue goes to the fact that since the very beginning Cycles was using ZYX euler rotation for mapping shader node but blender was always using XYZ euler rotation. This commit switches Cycles to use XYZ euler order and adds versioning code to preserve backward compatibility. There was no really nice solution here because either we're ending up with versioning code or we'll need to deal with all sort of exceptions from blender side in order to support ZYX order for the mapping node. The latest one is also creepy from the other render engines points of view -- that might break compatibility with existing bindings or introduce some extra headache for them in the future. This could also become a PITA for us with need of supporting all sort of weird and wonderful exceptions in the refactored viewport project. NOTE: This commit breaks forward compatibility, meaning opening new files in older blender might not give proper result if Mapping node was used. Also, libraries are to be re-saved separately from the scene file, otherwise versioning code for them wouldn't run if scene file was re-saved with new version of blender. Reviewers: brecht, juicyfruit, campbellbarton Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D973
Diffstat (limited to 'intern/cycles/util')
-rw-r--r--intern/cycles/util/util_transform.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h
index 453d44bdcce..ac97fa53084 100644
--- a/intern/cycles/util/util_transform.h
+++ b/intern/cycles/util/util_transform.h
@@ -216,12 +216,13 @@ ccl_device_inline Transform transform_rotate(float angle, float3 axis)
0.0f, 0.0f, 0.0f, 1.0f);
}
+/* Euler is assumed to be in XYZ order. */
ccl_device_inline Transform transform_euler(float3 euler)
{
return
- transform_rotate(euler.x, make_float3(1.0f, 0.0f, 0.0f)) *
+ transform_rotate(euler.z, make_float3(0.0f, 0.0f, 1.0f)) *
transform_rotate(euler.y, make_float3(0.0f, 1.0f, 0.0f)) *
- transform_rotate(euler.z, make_float3(0.0f, 0.0f, 1.0f));
+ transform_rotate(euler.x, make_float3(1.0f, 0.0f, 0.0f));
}
ccl_device_inline Transform transform_orthographic(float znear, float zfar)