浏览代码

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

mrdoob 3 年之前
父节点
当前提交
1b184ae086
共有 1 个文件被更改,包括 3 次插入1 次删除
  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.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
+
 		this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
 
 	}
@@ -93,7 +94,8 @@ class WebGLRenderTarget extends EventDispatcher {
 
 		this.depthBuffer = source.depthBuffer;
 		this.stencilBuffer = source.stencilBuffer;
-		this.depthTexture = source.depthTexture;
+
+		if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
 
 		return this;