Fix T85368: map range node clamps incorrectly in geometry nodes

When clamp is enabled, it should clamp between the output min and max
and not between 0 and 1.

Differential Revision: https://developer.blender.org/D10324
This commit is contained in:
Sam Miller
2021-02-08 13:32:57 +01:00
committed by Jacques Lucke
parent 4402f43b71
commit bb0b250cbd

View File

@@ -122,7 +122,8 @@ class MapRangeFunction : public blender::fn::MultiFunction {
if (clamp_) {
for (int64_t i : mask) {
CLAMP(results[i], 0.0f, 1.0f);
results[i] = (to_min[i] > to_max[i]) ? clamp_f(results[i], to_max[i], to_min[i]) :
clamp_f(results[i], to_min[i], to_max[i]);
}
}
}