Max.hx 522 B

12345678910111213141516171819202122232425262728
  1. package hrt.shgraph.nodes;
  2. using hxsl.Ast;
  3. @name("Max")
  4. @description("The output is the maximum between A and B")
  5. @width(80)
  6. @group("Math")
  7. class Max extends ShaderFunction {
  8. @input("A") var a = SType.Number;
  9. @input("B") var b = SType.Number;
  10. public function new() {
  11. super(Max);
  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. }