ResolutionNode.js 958 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * @author sunag / http://www.sunag.com.br/
  3. */
  4. import { Vector2Node } from '../inputs/Vector2Node.js';
  5. function ResolutionNode() {
  6. Vector2Node.call( this );
  7. };
  8. ResolutionNode.prototype = Object.create( Vector2Node.prototype );
  9. ResolutionNode.prototype.constructor = ResolutionNode;
  10. ResolutionNode.prototype.nodeType = "Resolution";
  11. ResolutionNode.prototype.updateFrame = function ( frame ) {
  12. var size = frame.renderer.getSize(),
  13. pixelRatio = frame.renderer.getPixelRatio();
  14. this.x = size.width * pixelRatio;
  15. this.y = size.height * pixelRatio;
  16. };
  17. ResolutionNode.prototype.copy = function ( source ) {
  18. Vector2Node.prototype.copy.call( this, source );
  19. this.renderer = source.renderer;
  20. };
  21. ResolutionNode.prototype.toJSON = function ( meta ) {
  22. var data = this.getJSONNode( meta );
  23. if ( ! data ) {
  24. data = this.createJSONNode( meta );
  25. data.renderer = this.renderer.uuid;
  26. }
  27. return data;
  28. };
  29. export { ResolutionNode };