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:
Diffstat (limited to 'intern/cycles/kernel/svm/svm_tex_coord.h')
-rw-r--r--intern/cycles/kernel/svm/svm_tex_coord.h78
1 files changed, 66 insertions, 12 deletions
diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h b/intern/cycles/kernel/svm/svm_tex_coord.h
index a17e4a25efe..a399acf3c0f 100644
--- a/intern/cycles/kernel/svm/svm_tex_coord.h
+++ b/intern/cycles/kernel/svm/svm_tex_coord.h
@@ -11,22 +11,40 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License
+ * limitations under the License.
*/
CCL_NAMESPACE_BEGIN
/* Texture Coordinate Node */
-ccl_device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, int path_flag, float *stack, uint type, uint out_offset)
+ccl_device void svm_node_tex_coord(KernelGlobals *kg,
+ ShaderData *sd,
+ int path_flag,
+ float *stack,
+ uint4 node,
+ int *offset)
{
float3 data;
+ uint type = node.y;
+ uint out_offset = node.z;
switch(type) {
case NODE_TEXCO_OBJECT: {
data = sd->P;
- if(sd->object != OBJECT_NONE)
- object_inverse_position_transform(kg, sd, &data);
+ if(node.w == 0) {
+ if(sd->object != OBJECT_NONE) {
+ object_inverse_position_transform(kg, sd, &data);
+ }
+ }
+ else {
+ Transform tfm;
+ tfm.x = read_node_float(kg, offset);
+ tfm.y = read_node_float(kg, offset);
+ tfm.z = read_node_float(kg, offset);
+ tfm.w = read_node_float(kg, offset);
+ data = transform_point(&tfm, data);
+ }
break;
}
case NODE_TEXCO_NORMAL: {
@@ -81,16 +99,34 @@ ccl_device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, int path_f
stack_store_float3(stack, out_offset, data);
}
-ccl_device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, int path_flag, float *stack, uint type, uint out_offset)
+ccl_device void svm_node_tex_coord_bump_dx(KernelGlobals *kg,
+ ShaderData *sd,
+ int path_flag,
+ float *stack,
+ uint4 node,
+ int *offset)
{
#ifdef __RAY_DIFFERENTIALS__
float3 data;
+ uint type = node.y;
+ uint out_offset = node.z;
switch(type) {
case NODE_TEXCO_OBJECT: {
data = sd->P + sd->dP.dx;
- if(sd->object != OBJECT_NONE)
- object_inverse_position_transform(kg, sd, &data);
+ if(node.w == 0) {
+ if(sd->object != OBJECT_NONE) {
+ object_inverse_position_transform(kg, sd, &data);
+ }
+ }
+ else {
+ Transform tfm;
+ tfm.x = read_node_float(kg, offset);
+ tfm.y = read_node_float(kg, offset);
+ tfm.z = read_node_float(kg, offset);
+ tfm.w = read_node_float(kg, offset);
+ data = transform_point(&tfm, data);
+ }
break;
}
case NODE_TEXCO_NORMAL: {
@@ -144,20 +180,38 @@ ccl_device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, in
stack_store_float3(stack, out_offset, data);
#else
- svm_node_tex_coord(kg, sd, stack, type, out_offset);
+ svm_node_tex_coord(kg, sd, path_flag, stack, node, offset);
#endif
}
-ccl_device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, int path_flag, float *stack, uint type, uint out_offset)
+ccl_device void svm_node_tex_coord_bump_dy(KernelGlobals *kg,
+ ShaderData *sd,
+ int path_flag,
+ float *stack,
+ uint4 node,
+ int *offset)
{
#ifdef __RAY_DIFFERENTIALS__
float3 data;
+ uint type = node.y;
+ uint out_offset = node.z;
switch(type) {
case NODE_TEXCO_OBJECT: {
data = sd->P + sd->dP.dy;
- if(sd->object != OBJECT_NONE)
- object_inverse_position_transform(kg, sd, &data);
+ if(node.w == 0) {
+ if(sd->object != OBJECT_NONE) {
+ object_inverse_position_transform(kg, sd, &data);
+ }
+ }
+ else {
+ Transform tfm;
+ tfm.x = read_node_float(kg, offset);
+ tfm.y = read_node_float(kg, offset);
+ tfm.z = read_node_float(kg, offset);
+ tfm.w = read_node_float(kg, offset);
+ data = transform_point(&tfm, data);
+ }
break;
}
case NODE_TEXCO_NORMAL: {
@@ -211,7 +265,7 @@ ccl_device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, in
stack_store_float3(stack, out_offset, data);
#else
- svm_node_tex_coord(kg, sd, stack, type, out_offset);
+ svm_node_tex_coord(kg, sd, path_flag, stack, node, offset);
#endif
}