Shading: Rewrite Mapping node with dynamic inputs.

This patch rewrites the Mapping node to support dynamic inputs. The
Max and Min options have been removed. They can be added as Min and
Max Vector Math nodes manually.

Texture nodes still use the old matrix-based mapping. A new SVM node
`NODE_TEXTURE_MAPPING` has been added to preserve this functionality.
Similarly, in GLSL, a `mapping_mat4` function has been added.

Reviewers: brecht, JacquesLucke
This commit is contained in:
OmarSquircleArt
2019-09-04 23:17:13 +02:00
parent f098f6df76
commit baaa89a0bc
24 changed files with 466 additions and 239 deletions

View File

@@ -162,6 +162,7 @@ CCL_NAMESPACE_END
#include "kernel/svm/svm_color_util.h"
#include "kernel/svm/svm_math_util.h"
#include "kernel/svm/svm_mapping_util.h"
#include "kernel/svm/svm_attribute.h"
#include "kernel/svm/svm_gradient.h"
@@ -405,8 +406,11 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg,
#endif /* NODES_GROUP(NODE_GROUP_LEVEL_1) */
#if NODES_GROUP(NODE_GROUP_LEVEL_2)
case NODE_TEXTURE_MAPPING:
svm_node_texture_mapping(kg, sd, stack, node.y, node.z, &offset);
break;
case NODE_MAPPING:
svm_node_mapping(kg, sd, stack, node.y, node.z, &offset);
svm_node_mapping(kg, sd, stack, node.y, node.z, node.w, &offset);
break;
case NODE_MIN_MAX:
svm_node_min_max(kg, sd, stack, node.y, node.z, &offset);