Browse Source

Fix Disabling Lights hot swapping.

sebavan 5 năm trước cách đây
mục cha
commit
e53e4b95cb
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      src/Meshes/abstractMesh.ts

+ 3 - 2
src/Meshes/abstractMesh.ts

@@ -785,7 +785,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
         var isIn = light.isEnabled() && light.canAffectMesh(this);
 
         var index = this._lightSources.indexOf(light);
-
+        var removed = false;
         if (index === -1) {
             if (!isIn) {
                 return;
@@ -795,10 +795,11 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
             if (isIn) {
                 return;
             }
+            removed = true;
             this._lightSources.splice(index, 1);
         }
 
-        this._markSubMeshesAsLightDirty();
+        this._markSubMeshesAsLightDirty(removed);
     }
 
     /** @hidden */