浏览代码

WebGPURenderer: correct shadows on material rebuilding. (#28889)

* preserve  color node for objects receiving shadow.

* dispose of colorNode copy

---------

Co-authored-by: aardgoose <[email protected]>
aardgoose 1 年之前
父节点
当前提交
b7b3859890
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/nodes/lighting/AnalyticLightNode.js

+ 7 - 0
src/nodes/lighting/AnalyticLightNode.js

@@ -31,6 +31,7 @@ class AnalyticLightNode extends LightingNode {
 
 		this.color = new Color();
 		this._defaultColorNode = uniform( this.color );
+		this._shadowColorNode = null;
 
 		this.colorNode = this._defaultColorNode;
 
@@ -168,6 +169,7 @@ class AnalyticLightNode extends LightingNode {
 
 			this.rtt = rtt;
 			this.colorNode = this.colorNode.mul( mix( 1, shadowMaskNode, shadowIntensity ) );
+			this._shadowColorNode = this.colorNode;
 
 			this.shadowNode = shadowNode;
 			this.shadowMaskNode = shadowMaskNode;
@@ -176,6 +178,10 @@ class AnalyticLightNode extends LightingNode {
 
 			this.updateBeforeType = NodeUpdateType.RENDER;
 
+		} else {
+
+			this.colorNode = this._shadowColorNode;
+
 		}
 
 	}
@@ -235,6 +241,7 @@ class AnalyticLightNode extends LightingNode {
 
 		this.shadowNode = null;
 		this.shadowMaskNode = null;
+		this._shadowColorNode = null;
 		this.rtt = null;
 
 		this.colorNode = this._defaultColorNode;