From f27c0e8dbbeb0a19f0a40b279834be4976cb8c74 Mon Sep 17 00:00:00 2001 From: Trygve Wastvedt Date: Fri, 10 Sep 2021 08:14:45 -0500 Subject: [PATCH] SAOPass: Fix depthTexture initialization. (#22502) * Fix depthTexture initialization * Don't reassign constructor argument. --- examples/jsm/postprocessing/SAOPass.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/jsm/postprocessing/SAOPass.js b/examples/jsm/postprocessing/SAOPass.js index 7e5327a527..d5ec12d4c9 100644 --- a/examples/jsm/postprocessing/SAOPass.js +++ b/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; -- GitLab