VectorNode.hx 668 B

1234567891011121314151617181920212223242526272829303132
  1. package arm.node.brush;
  2. import iron.math.Vec4;
  3. @:keep
  4. class VectorNode extends LogicNode {
  5. var value = new Vec4();
  6. public function new(tree: LogicTree, x: Null<Float> = null, y: Null<Float> = null, z: Null<Float> = null) {
  7. super(tree);
  8. if (x != null) {
  9. addInput(new FloatNode(tree, x), 0);
  10. addInput(new FloatNode(tree, y), 0);
  11. addInput(new FloatNode(tree, z), 0);
  12. }
  13. }
  14. override function get(from: Int): Dynamic {
  15. value.x = inputs[0].get();
  16. value.y = inputs[1].get();
  17. value.z = inputs[2].get();
  18. return value;
  19. }
  20. override function set(value: Dynamic) {
  21. inputs[0].set(value.x);
  22. inputs[1].set(value.y);
  23. inputs[2].set(value.z);
  24. }
  25. }