ResolutionNode.js 972 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 ( frame ) {
  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.copy = function ( source ) {
  18. THREE.GLNode.prototype.copy.call( this, source );
  19. this.renderer = source.renderer;
  20. };
  21. THREE.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. };