Normalize.hx 427 B

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