瀏覽代碼

Nightly Custom Configurations

Sebastien Vandenberghe 7 年之前
父節點
當前提交
51fbb90622

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


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


+ 33 - 18
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -14712,8 +14712,9 @@ var BABYLON;
          * By default, all the mesh children are also disposed unless the parameter `doNotRecurse` is set to `true`.
          * Returns nothing.
          */
-        AbstractMesh.prototype.dispose = function (doNotRecurse) {
+        AbstractMesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {
             var _this = this;
+            if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }
             var index;
             // Action manager
             if (this.actionManager) {
@@ -14786,6 +14787,12 @@ var BABYLON;
             engine.wipeCaches();
             // Remove from scene
             this.getScene().removeMesh(this);
+            this._cache = null;
+            if (disposeMaterialAndTextures) {
+                if (this.material) {
+                    this.material.dispose(false, true);
+                }
+            }
             if (!doNotRecurse) {
                 // Particles
                 for (index = 0; index < this.getScene().particleSystems.length; index++) {
@@ -17285,7 +17292,7 @@ var BABYLON;
             if (!material) {
                 return;
             }
-            if (material.needAlphaBlending() || material.needAlphaBlendingForMesh(mesh)) {
+            if (material.needAlphaBlendingForMesh(mesh)) {
                 this._transparentSubMeshes.push(subMesh);
             }
             else if (material.needAlphaTesting()) {
@@ -23952,8 +23959,9 @@ var BABYLON;
          * Disposes the mesh.
          * This also frees the memory allocated under the hood to all the buffers used by WebGL.
          */
-        Mesh.prototype.dispose = function (doNotRecurse) {
+        Mesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {
             var _this = this;
+            if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }
             this.morphTargetManager = null;
             if (this._geometry) {
                 this._geometry.releaseForMesh(this, true);
@@ -23983,7 +23991,7 @@ var BABYLON;
                     highlightLayer.removeExcludedMesh(this);
                 }
             }
-            _super.prototype.dispose.call(this, doNotRecurse);
+            _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);
         };
         /**
          * Modifies the mesh geometry according to a displacement map.
@@ -27402,7 +27410,7 @@ var BABYLON;
             return (this.alpha < 1.0);
         };
         Material.prototype.needAlphaBlendingForMesh = function (mesh) {
-            return (mesh.visibility < 1.0) || mesh.hasVertexAlpha;
+            return this.needAlphaBlending() || (mesh.visibility < 1.0) || mesh.hasVertexAlpha;
         };
         Material.prototype.needAlphaTesting = function () {
             return false;
@@ -35317,31 +35325,38 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(PBRBaseMaterial.prototype, "_disableAlphaBlending", {
+            /**
+             * Returns true if alpha blending should be disabled.
+             */
+            get: function () {
+                return (this._linkRefractionWithTransparency ||
+                    this._transparencyMode === BABYLON.PBRMaterial.PBRMATERIAL_OPAQUE ||
+                    this._transparencyMode === BABYLON.PBRMaterial.PBRMATERIAL_ALPHATEST);
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
-         * Specifies whether or not the meshes using this material should be rendered in alpha blend mode.
+         * Specifies whether or not this material should be rendered in alpha blend mode.
          */
         PBRBaseMaterial.prototype.needAlphaBlending = function () {
-            if (this._transparencyMode === BABYLON.PBRMaterial.PBRMATERIAL_OPAQUE ||
-                this._transparencyMode === BABYLON.PBRMaterial.PBRMATERIAL_ALPHATEST) {
+            if (this._disableAlphaBlending) {
                 return false;
             }
-            return _super.prototype.needAlphaBlending.call(this);
+            return (this.alpha < 1.0) || (this._opacityTexture != null) || this._shouldUseAlphaFromAlbedoTexture();
         };
         /**
-         * Specifies whether or not the meshes using this material should be rendered in alpha blend mode.
+         * Specifies whether or not this material should be rendered in alpha blend mode for the given mesh.
          */
         PBRBaseMaterial.prototype.needAlphaBlendingForMesh = function (mesh) {
-            if (this._linkRefractionWithTransparency) {
-                return false;
-            }
-            if (this._transparencyMode === BABYLON.PBRMaterial.PBRMATERIAL_OPAQUE ||
-                this._transparencyMode === BABYLON.PBRMaterial.PBRMATERIAL_ALPHATEST) {
+            if (this._disableAlphaBlending) {
                 return false;
             }
-            return _super.prototype.needAlphaBlendingForMesh.call(this, mesh) || (this._opacityTexture != null) || this._shouldUseAlphaFromAlbedoTexture();
+            return _super.prototype.needAlphaBlendingForMesh.call(this, mesh);
         };
         /**
-         * Specifies whether or not the meshes using this material should be rendered in alpha test mode.
+         * Specifies whether or not this material should be rendered in alpha test mode.
          */
         PBRBaseMaterial.prototype.needAlphaTesting = function () {
             if (this._forceAlphaTest) {
@@ -36094,7 +36109,7 @@ var BABYLON;
                 if (this._reflectionTexture) {
                     this._reflectionTexture.dispose();
                 }
-                if (this._environmentBRDFTexture) {
+                if (this._environmentBRDFTexture && this.getScene()._environmentBRDFTexture !== this._environmentBRDFTexture) {
                     this._environmentBRDFTexture.dispose();
                 }
                 if (this._emissiveTexture) {

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


+ 1 - 1
src/Materials/PBR/babylon.pbrBaseMaterial.ts

@@ -1468,7 +1468,7 @@
                     this._reflectionTexture.dispose();
                 }
 
-                if (this._environmentBRDFTexture) {
+                if (this._environmentBRDFTexture && this.getScene()._environmentBRDFTexture !== this._environmentBRDFTexture) {
                     this._environmentBRDFTexture.dispose();
                 }
 

+ 8 - 1
src/Mesh/babylon.abstractMesh.ts

@@ -1888,7 +1888,7 @@
          * By default, all the mesh children are also disposed unless the parameter `doNotRecurse` is set to `true`.  
          * Returns nothing.  
          */
-        public dispose(doNotRecurse?: boolean): void {
+        public dispose(doNotRecurse?: boolean, disposeMaterialAndTextures: boolean = false): void {
             var index: number;
 
             // Action manager
@@ -1984,6 +1984,13 @@
             // Remove from scene
             this.getScene().removeMesh(this);
 
+            this._cache = null;
+            if (disposeMaterialAndTextures) {
+                if (this.material) {
+                    this.material.dispose(false, true);
+                }
+            }
+
             if (!doNotRecurse) {
                 // Particles
                 for (index = 0; index < this.getScene().particleSystems.length; index++) {

+ 2 - 2
src/Mesh/babylon.mesh.ts

@@ -1588,7 +1588,7 @@
          * Disposes the mesh.
          * This also frees the memory allocated under the hood to all the buffers used by WebGL.
          */
-        public dispose(doNotRecurse?: boolean): void {
+        public dispose(doNotRecurse?: boolean, disposeMaterialAndTextures: boolean = false): void {
             this.morphTargetManager = null;
 
             if (this._geometry) {
@@ -1623,7 +1623,7 @@
                     highlightLayer.removeExcludedMesh(this);
                 }
             }
-            super.dispose(doNotRecurse);
+            super.dispose(doNotRecurse, disposeMaterialAndTextures);
         }
 
         /**

+ 14 - 0
src/babylon.scene.ts

@@ -2028,6 +2028,18 @@
             }
         }
 
+        /**
+         * Stops and removes all animations that have been applied to the scene
+         */
+        public stopAllAnimations(): void {
+            if (this._activeAnimatables) {
+                for (let i = 0; i < this._activeAnimatables.length; i++) {
+                    this._activeAnimatables[i].stop();
+                }
+                this._activeAnimatables = [];
+            }
+        }
+
         private _animate(): void {
             if (!this.animationsEnabled || this._activeAnimatables.length === 0) {
                 return;
@@ -3674,6 +3686,8 @@
 
             this.importedMeshesFiles = new Array<string>();
 
+            this.stopAllAnimations();
+
             this.resetCachedMaterial();
 
             if (this._depthRenderer) {