Vector4Node.js 1009 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * @author sunag / http://www.sunag.com.br/
  3. */
  4. THREE.Vector4Node = function ( x, y, z, w ) {
  5. THREE.InputNode.call( this, 'v4' );
  6. this.value = new THREE.Vector4( x, y, z, w );
  7. };
  8. THREE.Vector4Node.prototype = Object.create( THREE.InputNode.prototype );
  9. THREE.Vector4Node.prototype.constructor = THREE.Vector4Node;
  10. THREE.Vector4Node.prototype.nodeType = "Vector4";
  11. THREE.NodeMaterial.addShortcuts( THREE.Vector4Node.prototype, 'value', [ 'x', 'y', 'z', 'w' ] );
  12. THREE.Vector4Node.prototype.generateReadonly = function ( builder, output, uuid, type, ns, needsUpdate ) {
  13. return builder.format( "vec4( " + this.x + ", " + this.y + ", " + this.z + ", " + this.w + " )", type, output );
  14. };
  15. THREE.Vector4Node.prototype.toJSON = function ( meta ) {
  16. var data = this.getJSONNode( meta );
  17. if ( ! data ) {
  18. data = this.createJSONNode( meta );
  19. data.x = this.x;
  20. data.y = this.y;
  21. data.z = this.z;
  22. data.w = this.w;
  23. if ( this.readonly === true ) data.readonly = true;
  24. }
  25. return data;
  26. };