فهرست منبع

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*
 		// and turn available the use of features like transmission and environment in core
 
+		let value;
+
 		for ( const property in values ) {
 
+			value = values[ property ];
+
 			if ( this[ property ] === undefined ) {
 
-				this[ property ] = values[ property ];
+				if ( value && typeof value.clone === 'function' ) {
+
+					this[ property ] = value.clone();
+
+				} else {
+
+					this[ property ] = value;
+
+				}
 
 			}