Fix mapping node min/max not working OSL.
This commit is contained in:
@@ -20,9 +20,17 @@
|
|||||||
|
|
||||||
shader node_mapping(
|
shader node_mapping(
|
||||||
matrix Matrix = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
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),
|
point VectorIn = point(0.0, 0.0, 0.0),
|
||||||
output point VectorOut = 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1098,6 +1098,9 @@ void MappingNode::compile(OSLCompiler& compiler)
|
|||||||
{
|
{
|
||||||
Transform tfm = transform_transpose(tex_mapping.compute_transform());
|
Transform tfm = transform_transpose(tex_mapping.compute_transform());
|
||||||
compiler.parameter("Matrix", tfm);
|
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");
|
compiler.add(this, "node_mapping");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user