2
0

Vector2Node.js 917 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @author sunag / http://www.sunag.com.br/
  3. */
  4. THREE.Vector2Node = function ( x, y ) {
  5. THREE.InputNode.call( this, 'v2' );
  6. this.value = new THREE.Vector2( x, y );
  7. };
  8. THREE.Vector2Node.prototype = Object.create( THREE.InputNode.prototype );
  9. THREE.Vector2Node.prototype.constructor = THREE.Vector2Node;
  10. THREE.Vector2Node.prototype.nodeType = "Vector2";
  11. THREE.NodeMaterial.addShortcuts( THREE.Vector2Node.prototype, 'value', [ 'x', 'y' ] );
  12. THREE.Vector2Node.prototype.generateReadonly = function ( builder, output, uuid, type, ns, needsUpdate ) {
  13. return builder.format( "vec2( " + this.x + ", " + this.y + " )", type, output );
  14. };
  15. THREE.Vector2Node.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. if ( this.readonly === true ) data.readonly = true;
  22. }
  23. return data;
  24. };