ResolutionNode.js 815 B

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