Skip to content

Commit

Permalink
Fixed: Flow reports an error in multiple materials (#27302) (#27324)
Browse files Browse the repository at this point in the history
Co-authored-by: shiyanglong <shiyanglong@hixianchang.com>
  • Loading branch information
sheepdragon and shiyanglong committed Dec 6, 2023
1 parent 96ac576 commit 35adaa0
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions examples/jsm/modifiers/CurveModifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

}

}

Expand Down

0 comments on commit 35adaa0

Please sign in to comment.