Mod.hx 458 B

12345678910111213141516171819202122232425
  1. package hrt.shgraph.nodes;
  2. using hxsl.Ast;
  3. @name("Modulo")
  4. @description("The output is the result of X modulo MOD")
  5. @width(80)
  6. @group("Math")
  7. class Mod extends ShaderFunction {
  8. @input("X") var x = SType.Variant;
  9. @input("Mod", true) var mod = SType.Float;
  10. public function new() {
  11. super(Mod);
  12. }
  13. override public function computeOutputs() {
  14. if (x != null && !x.isEmpty())
  15. addOutput("output", x.getType());
  16. else
  17. removeOutput("output");
  18. }
  19. }