diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2016-10-29 19:54:42 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2016-10-29 20:24:08 +0300 |
commit | 1272ee455e7aeed3f6acb0b8a8366af5ad6aec99 (patch) | |
tree | 1ea02f9f80aea75403d78e898a6d2449d6331036 /intern/cycles/kernel/osl | |
parent | d3b0977a354d91c363d7128f3e0ef2c5eea977e7 (diff) |
Cycles: Implement texture coordinates for Point, Spot and Area Lamps
When using the Normal output of the Texture Coordinate node on Point and Spot lamps, the coordinates now depend on the rotation of the lamp.
On Area lamps, the Parametric output of the Geometry node now returns UV coordinates on the area lamp.
Credit for the Area lamp part goes to Stefan Werner (from D1995).
Diffstat (limited to 'intern/cycles/kernel/osl')
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index 0f3edcb7eaa..26543862b80 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -168,6 +168,12 @@ bool OSLRenderServices::get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result return true; } + else if(sd->type == PRIMITIVE_LAMP) { + Transform tfm = transform_transpose(sd->ob_tfm); + COPY_MATRIX44(&result, &tfm); + + return true; + } } return false; @@ -198,6 +204,12 @@ bool OSLRenderServices::get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 return true; } + else if(sd->type == PRIMITIVE_LAMP) { + Transform tfm = transform_transpose(sd->ob_itfm); + COPY_MATRIX44(&result, &tfm); + + return true; + } } return false; @@ -287,6 +299,12 @@ bool OSLRenderServices::get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result return true; } + else if(sd->type == PRIMITIVE_LAMP) { + Transform tfm = transform_transpose(sd->ob_tfm); + COPY_MATRIX44(&result, &tfm); + + return true; + } } return false; @@ -312,6 +330,12 @@ bool OSLRenderServices::get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 return true; } + else if(sd->type == PRIMITIVE_LAMP) { + Transform tfm = transform_transpose(sd->ob_itfm); + COPY_MATRIX44(&result, &tfm); + + return true; + } } return false; |