Vector3Node.js 574 B

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