Browse Source

WebGLRenderTarget: Clone depthTexture in copy(). (#23462)

mrdoob 3 years ago
parent
commit
1b184ae086
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/renderers/WebGLRenderTarget.js

+ 3 - 1
src/renderers/WebGLRenderTarget.js

@@ -34,6 +34,7 @@ class WebGLRenderTarget extends EventDispatcher {
 
 
 		this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
 		this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
 		this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
 		this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
+
 		this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
 		this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
 
 
 	}
 	}
@@ -93,7 +94,8 @@ class WebGLRenderTarget extends EventDispatcher {
 
 
 		this.depthBuffer = source.depthBuffer;
 		this.depthBuffer = source.depthBuffer;
 		this.stencilBuffer = source.stencilBuffer;
 		this.stencilBuffer = source.stencilBuffer;
-		this.depthTexture = source.depthTexture;
+
+		if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
 
 
 		return this;
 		return this;