diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-12-06 13:13:57 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-12-06 13:13:57 +0400 |
commit | c20292f624de7b81353821c2d3eab70b4c17bbd0 (patch) | |
tree | 301d70a000bc1d726dac67528a030c916737c0f9 /intern | |
parent | 8274848fa1fea25beccb0c36f10620150960e9ff (diff) |
Fix mapping node min/max not working OSL.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/shaders/node_mapping.osl | 10 | ||||
-rw-r--r-- | intern/cycles/render/nodes.cpp | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/intern/cycles/kernel/shaders/node_mapping.osl b/intern/cycles/kernel/shaders/node_mapping.osl index 2e720edfc7e..92df043b39d 100644 --- a/intern/cycles/kernel/shaders/node_mapping.osl +++ b/intern/cycles/kernel/shaders/node_mapping.osl @@ -20,9 +20,17 @@ shader node_mapping( matrix Matrix = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + point mapping_min = point(0.0, 0.0, 0.0), + point mapping_max = point(0.0, 0.0, 0.0), + int use_minmax = 0, point VectorIn = point(0.0, 0.0, 0.0), output point VectorOut = point(0.0, 0.0, 0.0)) { - VectorOut = transform(Matrix, VectorIn); + point p = transform(Matrix, VectorIn); + + if(use_minmax) + p = min(max(mapping_min, p), mapping_max); + + VectorOut = p; } diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 55fb9bf8a7e..3f8055b3540 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -1098,6 +1098,9 @@ void MappingNode::compile(OSLCompiler& compiler) { Transform tfm = transform_transpose(tex_mapping.compute_transform()); compiler.parameter("Matrix", tfm); + compiler.parameter_point("mapping_min", tex_mapping.min); + compiler.parameter_point("mapping_max", tex_mapping.max); + compiler.parameter("use_minmax", tex_mapping.use_minmax); compiler.add(this, "node_mapping"); } |