Просмотр исходного кода

Fixed: Flow reports an error in multiple materials (#27302) (#27324)

Co-authored-by: shiyanglong <[email protected]>
Anser 1 год назад
Родитель
Сommit
35adaa03aa
1 измененных файлов с 20 добавлено и 2 удалено
  1. 20 2
      examples/jsm/modifiers/CurveModifier.js

+ 20 - 2
examples/jsm/modifiers/CurveModifier.js

@@ -214,8 +214,26 @@ export class Flow {
 				child instanceof InstancedMesh
 			) {
 
-				child.material = child.material.clone();
-				modifyShader( child.material, uniforms, numberOfCurves );
+				if ( Array.isArray( child.material ) ) {
+
+					const materials = [];
+
+					for ( const material of child.material ) {
+
+						const newMaterial = material.clone();
+						modifyShader( newMaterial, uniforms, numberOfCurves );
+						materials.push( newMaterial );
+
+					}
+
+					child.material = materials;
+
+				} else {
+
+					child.material = child.material.clone();
+					modifyShader( child.material, uniforms, numberOfCurves );
+
+				}
 
 			}