فهرست منبع

BokehPass: Correctly set `aspect` in `setSize()`. (#27063)

Michael Herzog 1 سال پیش
والد
کامیت
0a94879355
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      examples/jsm/postprocessing/BokehPass.js

+ 3 - 2
examples/jsm/postprocessing/BokehPass.js

@@ -26,7 +26,6 @@ class BokehPass extends Pass {
 		this.camera = camera;
 
 		const focus = ( params.focus !== undefined ) ? params.focus : 1.0;
-		const aspect = ( params.aspect !== undefined ) ? params.aspect : camera.aspect;
 		const aperture = ( params.aperture !== undefined ) ? params.aperture : 0.025;
 		const maxblur = ( params.maxblur !== undefined ) ? params.maxblur : 1.0;
 
@@ -54,7 +53,7 @@ class BokehPass extends Pass {
 		bokehUniforms[ 'tDepth' ].value = this.renderTargetDepth.texture;
 
 		bokehUniforms[ 'focus' ].value = focus;
-		bokehUniforms[ 'aspect' ].value = aspect;
+		bokehUniforms[ 'aspect' ].value = camera.aspect;
 		bokehUniforms[ 'aperture' ].value = aperture;
 		bokehUniforms[ 'maxblur' ].value = maxblur;
 		bokehUniforms[ 'nearClip' ].value = camera.near;
@@ -120,6 +119,8 @@ class BokehPass extends Pass {
 
 	setSize( width, height ) {
 
+		this.materialBokeh.uniforms[ 'aspect' ].value = width / height;
+
 		this.renderTargetDepth.setSize( width, height );
 
 	}