|
@@ -15,10 +15,20 @@ THREE.EffectComposer = function ( renderer, renderTarget ) {
|
|
stencilBuffer: false
|
|
stencilBuffer: false
|
|
};
|
|
};
|
|
|
|
|
|
- var size = renderer.getDrawingBufferSize( new THREE.Vector2() );
|
|
|
|
- renderTarget = new THREE.WebGLRenderTarget( size.width, size.height, parameters );
|
|
|
|
|
|
+ var size = renderer.getSize( new THREE.Vector2() );
|
|
|
|
+ this._pixelRatio = renderer.getPixelRatio();
|
|
|
|
+ this._width = size.width;
|
|
|
|
+ this._height = size.height;
|
|
|
|
+
|
|
|
|
+ renderTarget = new THREE.WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, parameters );
|
|
renderTarget.texture.name = 'EffectComposer.rt1';
|
|
renderTarget.texture.name = 'EffectComposer.rt1';
|
|
|
|
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ this._pixelRatio = 1;
|
|
|
|
+ this._width = renderTarget.width;
|
|
|
|
+ this._height = renderTarget.height;
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
this.renderTarget1 = renderTarget;
|
|
this.renderTarget1 = renderTarget;
|
|
@@ -162,10 +172,13 @@ Object.assign( THREE.EffectComposer.prototype, {
|
|
|
|
|
|
if ( renderTarget === undefined ) {
|
|
if ( renderTarget === undefined ) {
|
|
|
|
|
|
- var size = this.renderer.getDrawingBufferSize( new THREE.Vector2() );
|
|
|
|
|
|
+ var size = this.renderer.getSize( new THREE.Vector2() );
|
|
|
|
+ this._pixelRatio = this.renderer.getPixelRatio();
|
|
|
|
+ this._width = size.width;
|
|
|
|
+ this._height = size.height;
|
|
|
|
|
|
renderTarget = this.renderTarget1.clone();
|
|
renderTarget = this.renderTarget1.clone();
|
|
- renderTarget.setSize( size.width, size.height );
|
|
|
|
|
|
+ renderTarget.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -181,15 +194,29 @@ Object.assign( THREE.EffectComposer.prototype, {
|
|
|
|
|
|
setSize: function ( width, height ) {
|
|
setSize: function ( width, height ) {
|
|
|
|
|
|
- this.renderTarget1.setSize( width, height );
|
|
|
|
- this.renderTarget2.setSize( width, height );
|
|
|
|
|
|
+ this._width = width;
|
|
|
|
+ this._height = height;
|
|
|
|
+
|
|
|
|
+ var effectiveWidth = this._width * this._pixelRatio;
|
|
|
|
+ var effectiveHeight = this._height * this._pixelRatio;
|
|
|
|
+
|
|
|
|
+ this.renderTarget1.setSize( effectiveWidth, effectiveHeight );
|
|
|
|
+ this.renderTarget2.setSize( effectiveWidth, effectiveHeight );
|
|
|
|
|
|
for ( var i = 0; i < this.passes.length; i ++ ) {
|
|
for ( var i = 0; i < this.passes.length; i ++ ) {
|
|
|
|
|
|
- this.passes[ i ].setSize( width, height );
|
|
|
|
|
|
+ this.passes[ i ].setSize( effectiveWidth, effectiveHeight );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ setPixelRatio: function ( pixelRatio ) {
|
|
|
|
+
|
|
|
|
+ this._pixelRatio = pixelRatio;
|
|
|
|
+
|
|
|
|
+ this.setSize( this._width, this._height );
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
} );
|
|
} );
|