Sebastien Vandenberghe 8 年之前
父節點
當前提交
000dcd621d

文件差異過大導致無法顯示
+ 6385 - 6382
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


文件差異過大導致無法顯示
+ 27 - 27
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 54 - 1
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -5344,7 +5344,10 @@ var BABYLON;
         };
         SmartArray.prototype.dispose = function () {
             this.reset();
-            this.data.length = 0;
+            if (this.data) {
+                this.data.length = 0;
+                this.data = null;
+            }
         };
         SmartArray.prototype.concat = function (array) {
             if (array.length === 0) {
@@ -10716,6 +10719,14 @@ var BABYLON;
             if (index >= 0) {
                 Engine.Instances.splice(index, 1);
             }
+            this._workingCanvas = null;
+            this._workingContext = null;
+            this._currentBufferPointers = null;
+            this._renderingCanvas = null;
+            this._currentProgram = null;
+            this.onResizeObservable.clear();
+            this.onCanvasBlurObservable.clear();
+            BABYLON.Effect.ResetCache();
         };
         // Loading screen
         Engine.prototype.displayLoadingUI = function () {
@@ -14807,6 +14818,14 @@ var BABYLON;
             while (--i >= 0) {
                 this._postProcesses[i].dispose(this);
             }
+            // Render targets
+            var i = this.customRenderTargets.length;
+            while (--i >= 0) {
+                this.customRenderTargets[i].dispose();
+            }
+            this.customRenderTargets = [];
+            // Active Meshes
+            this._activeMeshes.dispose();
             _super.prototype.dispose.call(this);
         };
         Object.defineProperty(Camera.prototype, "leftCamera", {
@@ -18502,6 +18521,7 @@ var BABYLON;
             this._activeParticleSystems.dispose();
             this._activeSkeletons.dispose();
             this._softwareSkinnedMeshes.dispose();
+            this._renderTargets.dispose();
             if (this._boundingBoxRenderer) {
                 this._boundingBoxRenderer.dispose();
             }
@@ -18540,6 +18560,12 @@ var BABYLON;
                 this.cameras[0].dispose();
             }
             // Release materials
+            if (this.defaultMaterial) {
+                this.defaultMaterial.dispose();
+            }
+            while (this.multiMaterials.length) {
+                this.multiMaterials[0].dispose();
+            }
             while (this.materials.length) {
                 this.materials[0].dispose();
             }
@@ -18577,6 +18603,9 @@ var BABYLON;
             }
             this._engine.wipeCaches();
             this._engine = null;
+            this.defaultMaterial = null;
+            this.multiMaterials = null;
+            this.materials = null;
         };
         Object.defineProperty(Scene.prototype, "isDisposed", {
             get: function () {
@@ -20030,6 +20059,15 @@ var BABYLON;
         Texture.prototype.getClassName = function () {
             return "Texture";
         };
+        Texture.prototype.dispose = function () {
+            _super.prototype.dispose.call(this);
+            if (this.onLoadObservable) {
+                this.onLoadObservable.clear();
+                this._onLoadObservable = null;
+            }
+            this._delayedOnLoad = null;
+            this._delayedOnError = null;
+        };
         // Statics
         Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError, format) {
             if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
@@ -24077,6 +24115,9 @@ var BABYLON;
             // Recombine
             return this._recombineShader(root);
         };
+        Effect.ResetCache = function () {
+            Effect._baseCache = {};
+        };
         return Effect;
     }());
     Effect._uniqueIdSeed = 0;
@@ -31392,6 +31433,7 @@ var BABYLON;
             BABYLON.Tools.UnregisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
             ]);
+            this.camera = null;
         };
         ArcRotateCameraPointersInput.prototype.getClassName = function () {
             return "ArcRotateCameraPointersInput";
@@ -35991,6 +36033,17 @@ var BABYLON;
             }
             return serializationObject;
         };
+        MultiMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
+            var scene = this.getScene();
+            if (!scene) {
+                return;
+            }
+            var index = scene.multiMaterials.indexOf(this);
+            if (index >= 0) {
+                scene.multiMaterials.splice(index, 1);
+            }
+            _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);
+        };
         return MultiMaterial;
     }(BABYLON.Material));
     BABYLON.MultiMaterial = MultiMaterial;

文件差異過大導致無法顯示
+ 6385 - 6382
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 2 - 0
src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts

@@ -229,6 +229,8 @@ module BABYLON {
             Tools.UnregisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
             ]);
+
+            this.camera = null;
         }
 
         getClassName(): string {

+ 10 - 0
src/Cameras/babylon.camera.ts

@@ -564,6 +564,16 @@
                 this._postProcesses[i].dispose(this);
             }
 
+            // Render targets
+            var i = this.customRenderTargets.length;
+            while (--i >= 0) {
+                this.customRenderTargets[i].dispose();
+            }
+            this.customRenderTargets = [];
+
+            // Active Meshes
+            this._activeMeshes.dispose();
+
             super.dispose();
         }
 

+ 13 - 1
src/Materials/Textures/babylon.texture.ts

@@ -339,7 +339,19 @@
 
         public getClassName(): string {
             return "Texture";
-        }     
+        }
+
+        public dispose(): void {
+            super.dispose();
+
+            if (this.onLoadObservable) {
+                this.onLoadObservable.clear();
+                this._onLoadObservable = null;
+            }
+
+            this._delayedOnLoad = null;
+            this._delayedOnError = null;
+        }
 
         // Statics
         public static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: () => void = null, onError: () => void = null, format: number = Engine.TEXTUREFORMAT_RGBA): Texture {

+ 4 - 0
src/Materials/babylon.effect.ts

@@ -1014,5 +1014,9 @@
         // Statics
         public static ShadersStore = {};
         public static IncludesShadersStore = {};
+
+        public static ResetCache() {
+            Effect._baseCache = {};
+        }
     }
 } 

+ 13 - 0
src/Materials/babylon.multiMaterial.ts

@@ -116,5 +116,18 @@
             return serializationObject;
         }
 
+        public dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void {
+            var scene = this.getScene();
+            if (!scene) {
+                return;
+            }
+
+            var index = scene.multiMaterials.indexOf(this);
+            if (index >= 0) {
+                scene.multiMaterials.splice(index, 1);
+            }
+
+            super.dispose(forceDisposeEffect, forceDisposeTextures);
+        }
     }
 } 

+ 5 - 1
src/Tools/babylon.smartArray.ts

@@ -50,7 +50,11 @@
 
         public dispose(): void {
             this.reset();
-            this.data.length = 0;
+
+            if (this.data) {
+                this.data.length = 0;
+                this.data = null;
+            }
         }
 
         public concat(array: any): void {

+ 11 - 0
src/babylon.engine.ts

@@ -4087,6 +4087,17 @@
             if (index >= 0) {
                 Engine.Instances.splice(index, 1);
             }
+
+            this._workingCanvas = null;
+            this._workingContext = null;
+            this._currentBufferPointers = null;
+            this._renderingCanvas = null;
+            this._currentProgram = null;
+
+            this.onResizeObservable.clear();
+            this.onCanvasBlurObservable.clear();
+
+            BABYLON.Effect.ResetCache();
         }
 
         // Loading screen

+ 12 - 0
src/babylon.scene.ts

@@ -3277,6 +3277,8 @@
             this._activeParticleSystems.dispose();
             this._activeSkeletons.dispose();
             this._softwareSkinnedMeshes.dispose();
+            this._renderTargets.dispose();
+
             if (this._boundingBoxRenderer) {
                 this._boundingBoxRenderer.dispose();
             }
@@ -3325,6 +3327,12 @@
             }
 
             // Release materials
+            if (this.defaultMaterial) {
+                this.defaultMaterial.dispose()
+            }
+            while (this.multiMaterials.length) {
+                this.multiMaterials[0].dispose();
+            }
             while (this.materials.length) {
                 this.materials[0].dispose();
             }
@@ -3372,6 +3380,10 @@
 
             this._engine.wipeCaches();
             this._engine = null;
+
+            this.defaultMaterial = null;
+            this.multiMaterials = null;
+            this.materials = null;
         }
 
         public get isDisposed(): boolean {