Browse Source

Fix memory leak

David Catuhe 6 years ago
parent
commit
cca282764e
2 changed files with 0 additions and 19 deletions
  1. 0 18
      src/Meshes/mesh.ts
  2. 0 1
      src/scene.ts

+ 0 - 18
src/Meshes/mesh.ts

@@ -76,7 +76,6 @@ export class _CreationDataStorage {
  **/
 class _InstanceDataStorage {
     public visibleInstances: any = {};
-    public renderIdForInstances = new Array<number>();
     public batchCache = new _InstancesBatch();
     public instancesBufferSize = 32 * 16 * 4; // let's start with a maximum of 32 instances
     public instancesBuffer: Nullable<Buffer>;
@@ -1382,27 +1381,10 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
             var currentRenderId = scene.getRenderId();
             var defaultRenderId = (scene._isInIntermediateRendering() ? visibleInstances.intermediateDefaultRenderId : visibleInstances.defaultRenderId);
             batchCache.visibleInstances[subMeshId] = visibleInstances[currentRenderId];
-            var selfRenderId = this._renderId;
 
             if (!batchCache.visibleInstances[subMeshId] && defaultRenderId) {
                 batchCache.visibleInstances[subMeshId] = visibleInstances[defaultRenderId];
-                currentRenderId = Math.max(defaultRenderId, currentRenderId);
-                selfRenderId = Math.max(visibleInstances.selfDefaultRenderId, currentRenderId);
             }
-
-            let visibleInstancesForSubMesh = batchCache.visibleInstances[subMeshId];
-            if (visibleInstancesForSubMesh && visibleInstancesForSubMesh.length) {
-                if (this._instanceDataStorage.renderIdForInstances[subMeshId] === currentRenderId) {
-                    batchCache.mustReturn = true;
-                    return batchCache;
-                }
-
-                if (currentRenderId !== selfRenderId) {
-                    batchCache.renderSelf[subMeshId] = false;
-                }
-
-            }
-            this._instanceDataStorage.renderIdForInstances[subMeshId] = currentRenderId;
         }
         batchCache.hardwareInstancedRendering[subMeshId] = this._instanceDataStorage.hardwareInstancedRendering && (batchCache.visibleInstances[subMeshId] !== null) && (batchCache.visibleInstances[subMeshId] !== undefined);
         this._instanceDataStorage._previousBatch = batchCache;

+ 0 - 1
src/scene.ts

@@ -3896,7 +3896,6 @@ export class Scene extends AbstractScene implements IAnimatable {
             for (let i = 0; i < len; i++) {
                 let mesh = this._activeMeshes.data[i];
                 mesh.computeWorldMatrix();
-                mesh._activate(this._renderId);
             }
 
             return;