Vector4Node.js 609 B

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