Fix T39946: OSL + tangent space normal maps not working in Cycles.

This commit is contained in:
Brecht Van Lommel 2014-05-06 16:39:28 +02:00
parent 09f5dff244
commit 80e137e826
Notes: blender-bot 2023-02-14 10:43:47 +01:00
Referenced by issue #39946, Tangent space normals maps are black when using OSL
2 changed files with 13 additions and 1 deletions

View File

@ -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 {

View File

@ -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;