Min.hx 521 B

123456789101112131415161718192021222324252627
  1. package hrt.shgraph.nodes;
  2. using hxsl.Ast;
  3. @name("Min")
  4. @description("The output is the minimum between A and B")
  5. @width(80)
  6. @group("Math")
  7. class Min extends ShaderFunction {
  8. @input("A") var a = SType.Number;
  9. @input("B") var b = SType.Number;
  10. public function new() {
  11. super(Min);
  12. }
  13. override public function computeOutputs() {
  14. if (a != null && !a.isEmpty())
  15. addOutput("output", a.getType());
  16. else if (b != null && !b.isEmpty())
  17. addOutput("output", b.getType());
  18. else
  19. removeOutput("output");
  20. }
  21. }