Vector3Node.js 982 B

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