Sfoglia il codice sorgente

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

# Conflicts:
#	dist/preview release/babylon.core.js
#	dist/preview release/babylon.d.ts
#	dist/preview release/babylon.js
#	dist/preview release/babylon.module.d.ts
#	dist/preview release/babylon.noworker.js
davrous 8 anni fa
parent
commit
917b5d4a6e

File diff suppressed because it is too large
+ 33 - 1
dist/preview release/babylon.core.js


File diff suppressed because it is too large
+ 3584 - 3124
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 44 - 1
dist/preview release/babylon.js


+ 21 - 1
dist/preview release/babylon.max.js

@@ -7827,6 +7827,9 @@ var BABYLON;
     var prepareWebGLTexture = function (texture, gl, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode) {
         if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
         var engine = scene.getEngine();
+        if (!engine) {
+            return;
+        }
         var potWidth = BABYLON.Tools.GetExponentOfTwo(width, engine.getCaps().maxTextureSize);
         var potHeight = BABYLON.Tools.GetExponentOfTwo(height, engine.getCaps().maxTextureSize);
         engine._bindTextureDirectly(gl.TEXTURE_2D, texture);
@@ -21697,6 +21700,9 @@ var BABYLON;
             }
         };
         Scene.prototype.render = function () {
+            if (this.isDisposed) {
+                return;
+            }
             this._lastFrameDuration.beginMonitoring();
             this._particlesDuration.fetchNewFrame();
             this._spritesDuration.fetchNewFrame();
@@ -22058,7 +22064,15 @@ var BABYLON;
                 this._engine.scenes.splice(index, 1);
             }
             this._engine.wipeCaches();
+            this._engine = null;
         };
+        Object.defineProperty(Scene.prototype, "isDisposed", {
+            get: function () {
+                return !this._engine;
+            },
+            enumerable: true,
+            configurable: true
+        });
         // Release sounds & sounds tracks
         Scene.prototype.disposeSounds = function () {
             this.mainSoundTrack.dispose();
@@ -31320,6 +31334,12 @@ var BABYLON;
                     var meshes = [];
                     var particleSystems = [];
                     var skeletons = [];
+                    if (scene.isDisposed) {
+                        if (onerror) {
+                            onerror(scene, 'Scene was disposed before being able to load ' + rootUrl + sceneFilename);
+                        }
+                        return;
+                    }
                     try {
                         if (plugin.importMesh) {
                             var syncedPlugin = plugin;
@@ -57190,7 +57210,7 @@ var BABYLON;
     })(Internals = BABYLON.Internals || (BABYLON.Internals = {}));
 })(BABYLON || (BABYLON = {}));
 
-//# sourceMappingURL=babylon.tools.pmremgenerator.js.map
+//# sourceMappingURL=babylon.tools.pmremGenerator.js.map
 
 
 

File diff suppressed because it is too large
+ 3584 - 3124
dist/preview release/babylon.module.d.ts


File diff suppressed because it is too large
+ 43 - 1
dist/preview release/babylon.noworker.js


+ 8 - 1
src/Loading/babylon.sceneLoader.ts

@@ -135,7 +135,7 @@
             }
         }
 
-        public static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, message: string, exception?: any) => void): void {
+        public static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, message: string, exception?: any) => void): void {            
             if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
                 Tools.Error("Wrong sceneFilename parameter");
                 return;
@@ -163,6 +163,13 @@
                     var particleSystems = [];
                     var skeletons = [];
 
+                    if (scene.isDisposed) {
+                        if (onerror) {
+                            onerror(scene, 'Scene was disposed before being able to load ' + rootUrl + sceneFilename);
+                        }
+                        return;
+                    }
+
                     try {
                         if ((<any>plugin).importMesh) {
                             var syncedPlugin = <ISceneLoaderPlugin>plugin;

+ 3 - 0
src/babylon.engine.ts

@@ -46,6 +46,9 @@
     var prepareWebGLTexture = (texture: WebGLTexture, gl: WebGLRenderingContext, scene: Scene, width: number, height: number, invertY: boolean, noMipmap: boolean, isCompressed: boolean,
         processFunction: (width: number, height: number) => void, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) => {
         var engine = scene.getEngine();
+        if (!engine) {
+            return;
+        }
         var potWidth = Tools.GetExponentOfTwo(width, engine.getCaps().maxTextureSize);
         var potHeight = Tools.GetExponentOfTwo(height, engine.getCaps().maxTextureSize);
 

+ 9 - 0
src/babylon.scene.ts

@@ -2613,6 +2613,10 @@
         }
 
         public render(): void {
+            if (this.isDisposed) {
+                return;
+            }
+
             this._lastFrameDuration.beginMonitoring();
             this._particlesDuration.fetchNewFrame();
             this._spritesDuration.fetchNewFrame();
@@ -3040,6 +3044,11 @@
             }
 
             this._engine.wipeCaches();
+            this._engine = null;
+        }
+
+        public get isDisposed(): boolean {
+            return !this._engine;
         }
 
         // Release sounds & sounds tracks