Vector2Node.js 539 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import InputNode from '../core/InputNode.js';
  2. import { Vector2 } from 'three';
  3. class Vector2Node extends InputNode {
  4. constructor( value = new Vector2() ) {
  5. super( 'vec2' );
  6. this.value = value;
  7. }
  8. serialize( data ) {
  9. super.serialize( data );
  10. const { x, y } = this.value;
  11. data.x = x;
  12. data.y = y;
  13. }
  14. deserialize( data ) {
  15. super.serialize( data );
  16. const { x, y } = data;
  17. const value = this.value;
  18. value.x = x;
  19. value.y = y;
  20. }
  21. }
  22. Vector2Node.prototype.isVector2Node = true;
  23. export default Vector2Node;