Răsfoiți Sursa

SAOPass: Fix depthTexture initialization. (#22502)

* Fix depthTexture initialization

* Don't reassign constructor argument.
Trygve Wastvedt 3 ani în urmă
părinte
comite
f27c0e8dbb
1 a modificat fișierele cu 5 adăugiri și 3 ștergeri
  1. 5 3
      examples/jsm/postprocessing/SAOPass.js

+ 5 - 3
examples/jsm/postprocessing/SAOPass.js

@@ -32,7 +32,7 @@ import { UnpackDepthRGBAShader } from '../shaders/UnpackDepthRGBAShader.js';
 
 class SAOPass extends Pass {
 
-	constructor( scene, camera, depthTexture, useNormals, resolution ) {
+	constructor( scene, camera, useDepthTexture, useNormals, resolution ) {
 
 		super();
 
@@ -42,7 +42,7 @@ class SAOPass extends Pass {
 		this.clear = true;
 		this.needsSwap = false;
 
-		this.supportsDepthTextureExtension = ( depthTexture !== undefined ) ? depthTexture : false;
+		this.supportsDepthTextureExtension = ( useDepthTexture !== undefined ) ? useDepthTexture : false;
 		this.supportsNormalTexture = ( useNormals !== undefined ) ? useNormals : false;
 
 		this.originalClearColor = new Color();
@@ -78,10 +78,12 @@ class SAOPass extends Pass {
 			format: RGBAFormat
 		} );
 		this.depthRenderTarget = this.normalRenderTarget.clone();
+		
+		let depthTexture;
 
 		if ( this.supportsDepthTextureExtension ) {
 
-			const depthTexture = new DepthTexture();
+			depthTexture = new DepthTexture();
 			depthTexture.type = UnsignedShortType;
 
 			this.beautyRenderTarget.depthTexture = depthTexture;