armory/Sources/armory/logicnode/ClampNode.hx

19 lines
344 B
Haxe
Raw Permalink Normal View History

2020-11-06 21:20:28 +01:00
package armory.logicnode;
2021-03-16 22:27:42 +01:00
import kha.FastFloat;
2020-11-06 21:20:28 +01:00
class ClampNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
2021-03-16 22:27:42 +01:00
override function get(from: Int): FastFloat {
var value = inputs[0].get();
var min = inputs[1].get();
var max = inputs[2].get();
2020-11-06 21:20:28 +01:00
2021-03-16 22:27:42 +01:00
return value < min ? min : value > max ? max : value;
2020-11-06 21:20:28 +01:00
}
}