浏览代码

Fix shared props across instances of NodeMaterial (#23706)

William McMurray 3 年之前
父节点
当前提交
a825851e07
共有 1 个文件被更改,包括 13 次插入1 次删除
  1. 13 1
      examples/jsm/nodes/materials/NodeMaterial.js

+ 13 - 1
examples/jsm/nodes/materials/NodeMaterial.js

@@ -18,11 +18,23 @@ class NodeMaterial extends ShaderMaterial {
 		// This approach is to reuse the native refreshUniforms*
 		// This approach is to reuse the native refreshUniforms*
 		// and turn available the use of features like transmission and environment in core
 		// and turn available the use of features like transmission and environment in core
 
 
+		let value;
+
 		for ( const property in values ) {
 		for ( const property in values ) {
 
 
+			value = values[ property ];
+
 			if ( this[ property ] === undefined ) {
 			if ( this[ property ] === undefined ) {
 
 
-				this[ property ] = values[ property ];
+				if ( value && typeof value.clone === 'function' ) {
+
+					this[ property ] = value.clone();
+
+				} else {
+
+					this[ property ] = value;
+
+				}
 
 
 			}
 			}