|
@@ -170,19 +170,33 @@ Object.assign( EffectComposer.prototype, {
|
|
|
|
|
|
this.writeBuffer = this.renderTarget1;
|
|
|
this.readBuffer = this.renderTarget2;
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
|
|
|
setSize: function ( width, height, scaleRatio ) {
|
|
|
-
|
|
|
+
|
|
|
scaleRatio = scaleRatio || this.scaleRatio || 1;
|
|
|
//console.log('setSize', width * scaleRatio, height * scaleRatio)
|
|
|
- this.renderTarget1.setSize( width * scaleRatio , height * scaleRatio );
|
|
|
- this.renderTarget2.setSize( width * scaleRatio, height * scaleRatio );
|
|
|
+ let maxTexWidth = 8192
|
|
|
+ let w = width * scaleRatio
|
|
|
+ let h = height * scaleRatio
|
|
|
+ if(w > maxTexWidth || h > maxTexWidth){ //超出会崩溃
|
|
|
+ if(w>h){
|
|
|
+ scaleRatio = maxTexWidth / width
|
|
|
+ }else{
|
|
|
+ scaleRatio = maxTexWidth / height
|
|
|
+ }
|
|
|
+ }
|
|
|
+ w = width * scaleRatio
|
|
|
+ h = height * scaleRatio
|
|
|
+
|
|
|
+
|
|
|
+ this.renderTarget1.setSize( w, h );
|
|
|
+ this.renderTarget2.setSize( w, h );
|
|
|
|
|
|
for ( var i = 0; i < this.passes.length; i ++ ) {
|
|
|
|
|
|
- this.passes[ i ].setSize( width * scaleRatio, height * scaleRatio );
|
|
|
+ this.passes[ i ].setSize( w, h );
|
|
|
|
|
|
}
|
|
|
|