Parcourir la source

Reset materialDefines when assigning a new material or subMaterial

Nicolas Buecher il y a 8 ans
Parent
commit
793cb52269
1 fichiers modifiés avec 4 ajouts et 3 suppressions
  1. 4 3
      src/Mesh/babylon.subMesh.ts

+ 4 - 3
src/Mesh/babylon.subMesh.ts

@@ -9,6 +9,9 @@
 
         public setEffect(effect: Effect, defines?: MaterialDefines) {
             if (this._materialEffect === effect) {
+                if (!effect) {
+                    this._materialDefines = undefined;
+                }
                 return;
             }
             this._materialDefines = defines;
@@ -100,9 +103,7 @@
 
                 if (this._currentMaterial !== effectiveMaterial) {
                     this._currentMaterial = effectiveMaterial;
-                    if (this._materialDefines) {
-                        this._materialDefines.markAllAsDirty();
-                    }
+                    this._materialDefines = undefined;
                 }
 
                 return effectiveMaterial;