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:
authorOmarSquircleArt <omar.squircleart@gmail.com>2019-09-05 00:17:13 +0300
committerOmarSquircleArt <omar.squircleart@gmail.com>2019-09-05 00:17:13 +0300
commitbaaa89a0bc54a659f9ddbc34cce21d6920c0f6a6 (patch)
treef5337407abc1e1e832612cc7643d508ed021eb37 /intern/cycles/render/constant_fold.cpp
parentf098f6df767aa62ffe0a7db6635ead058770d92f (diff)
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
Diffstat (limited to 'intern/cycles/render/constant_fold.cpp')
-rw-r--r--intern/cycles/render/constant_fold.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/intern/cycles/render/constant_fold.cpp b/intern/cycles/render/constant_fold.cpp
index 851d4b71df8..f3809ee8d80 100644
--- a/intern/cycles/render/constant_fold.cpp
+++ b/intern/cycles/render/constant_fold.cpp
@@ -429,4 +429,21 @@ void ConstantFolder::fold_vector_math(NodeVectorMathType type) const
}
}
+void ConstantFolder::fold_mapping(NodeMappingType type) const
+{
+ ShaderInput *vector_in = node->input("Vector");
+ ShaderInput *location_in = node->input("Location");
+ ShaderInput *rotation_in = node->input("Rotation");
+ ShaderInput *scale_in = node->input("Scale");
+
+ if (is_zero(scale_in)) {
+ make_zero();
+ }
+ else if ((is_zero(location_in) || type == NODE_MAPPING_TYPE_VECTOR ||
+ type == NODE_MAPPING_TYPE_NORMAL) &&
+ is_zero(rotation_in) && is_one(scale_in)) {
+ try_bypass_or_make_constant(vector_in);
+ }
+}
+
CCL_NAMESPACE_END