소스 검색

Fix morph target sync issue

David Catuhe 4 년 전
부모
커밋
6fe94ed9a1
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      src/Materials/Node/Blocks/Vertex/morphTargetsBlock.ts

+ 9 - 0
src/Materials/Node/Blocks/Vertex/morphTargetsBlock.ts

@@ -146,9 +146,18 @@ export class MorphTargetsBlock extends NodeMaterialBlock {
     }
 
     public prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {
+        if ((<Mesh>mesh).morphTargetManager) {
+            const morphTargetManager = (<Mesh>mesh).morphTargetManager;
+            
+            if (morphTargetManager?.isUsingTextureForTargets && morphTargetManager.numInfluencers !== defines["NUM_MORPH_INFLUENCERS"]) {
+                defines.markAsAttributesDirty();
+            }
+        }
+
         if (!defines._areAttributesDirty) {
             return;
         }
+
         MaterialHelper.PrepareDefinesForMorphTargets(mesh, defines);
     }