Procházet zdrojové kódy

Fix stupid bug with mat.dispose()

David Catuhe před 8 roky
rodič
revize
2e3fe889bc

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2 - 2
dist/preview release/babylon.core.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 566 - 566
dist/preview release/babylon.d.ts


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2 - 2
dist/preview release/babylon.js


+ 13 - 10
dist/preview release/babylon.max.js

@@ -31606,17 +31606,17 @@ var BABYLON;
                 var mesh = this._scene.meshes[index];
                 if (mesh.material === this) {
                     mesh.material = null;
-                }
-                if (mesh.geometry) {
-                    var geometry = mesh.geometry;
-                    if (this.storeEffectOnSubMeshes) {
-                        for (var _i = 0, _a = mesh.subMeshes; _i < _a.length; _i++) {
-                            var subMesh = _a[_i];
-                            geometry._releaseVertexArrayObject(subMesh._materialEffect);
+                    if (mesh.geometry) {
+                        var geometry = mesh.geometry;
+                        if (this.storeEffectOnSubMeshes) {
+                            for (var _i = 0, _a = mesh.subMeshes; _i < _a.length; _i++) {
+                                var subMesh = _a[_i];
+                                geometry._releaseVertexArrayObject(subMesh._materialEffect);
+                            }
+                        }
+                        else {
+                            geometry._releaseVertexArrayObject(this._effect);
                         }
-                    }
-                    else {
-                        geometry._releaseVertexArrayObject(this._effect);
                     }
                 }
             }
@@ -43036,6 +43036,9 @@ var BABYLON;
             return this._indexBuffer;
         };
         Geometry.prototype._releaseVertexArrayObject = function (effect) {
+            if (!effect) {
+                return;
+            }
             if (this._vertexArrayObjects[effect.key]) {
                 this._engine.releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);
                 delete this._vertexArrayObjects[effect.key];

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 566 - 566
dist/preview release/babylon.module.d.ts


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2 - 2
dist/preview release/babylon.noworker.js


+ 2 - 2
dist/preview release/inspector/babylon.inspector.bundle.js

@@ -65,8 +65,8 @@ var INSPECTOR =
 	if(false) {
 		// When the styles change, update the <style> tags
 		if(!content.locals) {
-			module.hot.accept("!!./../../../Tools/Gulp/node_modules/css-loader/index.js!./babylon.inspector.css", function() {
-				var newContent = require("!!./../../../Tools/Gulp/node_modules/css-loader/index.js!./babylon.inspector.css");
+			module.hot.accept("!!../../../Tools/Gulp/node_modules/css-loader/index.js!./babylon.inspector.css", function() {
+				var newContent = require("!!../../../Tools/Gulp/node_modules/css-loader/index.js!./babylon.inspector.css");
 				if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
 				update(newContent);
 			});

+ 6 - 4
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -986,10 +986,12 @@ var BABYLON;
                 runtime.babylonScene.beginAnimation(skeleton, 0, Number.MAX_VALUE, true, 1.0);
             }
             // Revoke object urls created during load
-            for (var i = 0; i < runtime.gltf.textures.length; i++) {
-                var texture = runtime.gltf.textures[i];
-                if (texture.blobURL) {
-                    URL.revokeObjectURL(texture.blobURL);
+            if (runtime.gltf.textures) {
+                for (var i = 0; i < runtime.gltf.textures.length; i++) {
+                    var texture = runtime.gltf.textures[i];
+                    if (texture.blobURL) {
+                        URL.revokeObjectURL(texture.blobURL);
+                    }
                 }
             }
         };

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 6 - 4
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -3136,10 +3136,12 @@ var BABYLON;
                 runtime.babylonScene.beginAnimation(skeleton, 0, Number.MAX_VALUE, true, 1.0);
             }
             // Revoke object urls created during load
-            for (var i = 0; i < runtime.gltf.textures.length; i++) {
-                var texture = runtime.gltf.textures[i];
-                if (texture.blobURL) {
-                    URL.revokeObjectURL(texture.blobURL);
+            if (runtime.gltf.textures) {
+                for (var i = 0; i < runtime.gltf.textures.length; i++) {
+                    var texture = runtime.gltf.textures[i];
+                    if (texture.blobURL) {
+                        URL.revokeObjectURL(texture.blobURL);
+                    }
                 }
             }
         };

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 10 - 10
src/Materials/babylon.material.ts

@@ -494,17 +494,17 @@
 
                 if (mesh.material === this) {
                     mesh.material = null;
-                }
-
-                if ((<Mesh>mesh).geometry) {
-                    var geometry = (<Mesh>mesh).geometry;
-
-                    if (this.storeEffectOnSubMeshes) {
-                        for (var subMesh of mesh.subMeshes) {
-                            geometry._releaseVertexArrayObject(subMesh._materialEffect);
+                
+                    if ((<Mesh>mesh).geometry) {
+                        var geometry = (<Mesh>mesh).geometry;
+
+                        if (this.storeEffectOnSubMeshes) {
+                            for (var subMesh of mesh.subMeshes) {
+                                geometry._releaseVertexArrayObject(subMesh._materialEffect);
+                            }
+                        } else {
+                            geometry._releaseVertexArrayObject(this._effect)
                         }
-                    } else {
-                        geometry._releaseVertexArrayObject(this._effect)
                     }
                 }
             }

+ 4 - 0
src/Mesh/babylon.geometry.ts

@@ -349,6 +349,10 @@
         }
 
         public _releaseVertexArrayObject(effect: Effect) {
+            if (!effect) {
+                return;
+            }
+            
             if (this._vertexArrayObjects[effect.key]) {
                 this._engine.releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);
                 delete this._vertexArrayObjects[effect.key];