diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-05-06 18:39:28 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-05-06 18:39:50 +0400 |
commit | 80e137e826cac408e66d79d16db44d732e117b01 (patch) | |
tree | 0bf314a3cea1d13e280607b09f2520ba40b53110 /intern | |
parent | 09f5dff244ede0a4797b2949217032aac2b8f564 (diff) |
Fix T39946: OSL + tangent space normal maps not working in Cycles.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.cpp | 13 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.h | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index f33d032b9d3..54894ea19eb 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -59,6 +59,7 @@ CCL_NAMESPACE_BEGIN /* static ustrings */ ustring OSLRenderServices::u_distance("distance"); ustring OSLRenderServices::u_index("index"); +ustring OSLRenderServices::u_world("world"); ustring OSLRenderServices::u_camera("camera"); ustring OSLRenderServices::u_screen("screen"); ustring OSLRenderServices::u_raster("raster"); @@ -209,6 +210,10 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, ustring from, float ti COPY_MATRIX44(&result, &tfm); return true; } + else if (from == u_world) { + result.makeIdentity(); + return true; + } return false; } @@ -237,6 +242,10 @@ bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, ustring to, fl COPY_MATRIX44(&result, &tfm); return true; } + else if (to == u_world) { + result.makeIdentity(); + return true; + } return false; } @@ -781,7 +790,9 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri if (attr.elem != ATTR_ELEMENT_OBJECT) { /* triangle and vertex attributes */ - if(!get_mesh_element_attribute(kg, sd, attr, type, derivatives, val)) + if(get_mesh_element_attribute(kg, sd, attr, type, derivatives, val)) + return true; + else return get_mesh_attribute(kg, sd, attr, type, derivatives, val); } else { diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h index 54ddd7a98b4..069722d81b6 100644 --- a/intern/cycles/kernel/osl/osl_services.h +++ b/intern/cycles/kernel/osl/osl_services.h @@ -116,6 +116,7 @@ public: static ustring u_distance; static ustring u_index; + static ustring u_world; static ustring u_camera; static ustring u_screen; static ustring u_raster; |