Vector2Node.js 667 B

12345678910111213141516171819202122232425262728293031323334
  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.toJSON = function ( meta ) {
  13. var data = this.getJSONNode( meta );
  14. if ( ! data ) {
  15. data = this.createJSONNode( meta );
  16. data.x = this.x;
  17. data.y = this.y;
  18. }
  19. return data;
  20. };