瀏覽代碼

fix postprocessing ratio

sunag 5 年之前
父節點
當前提交
48dd3dd763
共有 1 個文件被更改,包括 13 次插入1 次删除
  1. 13 1
      examples/jsm/nodes/postprocessing/NodePostProcessing.js

+ 13 - 1
examples/jsm/nodes/postprocessing/NodePostProcessing.js

@@ -85,9 +85,21 @@ NodePostProcessing.prototype = {
 
 	},
 
+	setPixelRatio: function ( value ) {
+
+		this.renderer.setPixelRatio( value );
+
+		var size = this.renderer.getSize( new Vector2() );
+
+		this.setSize( size.width, size.height );
+
+	},
+
 	setSize: function ( width, height ) {
 
-		this.renderTarget.setSize( width, height );
+		var pixelRatio = this.renderer.getPixelRatio();
+
+		this.renderTarget.setSize( width * pixelRatio, height * pixelRatio );
 
 		this.renderer.setSize( width, height );