Pārlūkot izejas kodu

More CheckReady protection

Sebastien Vandenberghe 8 gadi atpakaļ
vecāks
revīzija
2abd0c332a

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 5514 - 5514
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 5 - 5
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


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

@@ -24903,6 +24903,9 @@ var BABYLON;
             var scene = this.getScene();
             var engine = scene.getEngine();
             var checkReady = function () {
+                if (!_this._scene || !_this._scene.getEngine()) {
+                    return;
+                }
                 if (subMesh._materialDefines) {
                     subMesh._materialDefines._renderId = -1;
                 }
@@ -34929,8 +34932,11 @@ var BABYLON;
                 subMeshes.push.apply(subMeshes, mesh.subMeshes);
             }
             var checkReady = function () {
+                if (!_this._scene || !_this._scene.getEngine()) {
+                    return;
+                }
                 var subMesh = subMeshes[currentIndex];
-                if (_this._scene && _this._scene.getEngine() && _this.isReady(subMesh, options ? options.useInstances : false)) {
+                if (_this.isReady(subMesh, options ? options.useInstances : false)) {
                     currentIndex++;
                     if (currentIndex >= subMeshes.length) {
                         if (onCompiled) {

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 5514 - 5514
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 6 - 3
src/Lights/Shadows/babylon.shadowGenerator.ts

@@ -520,15 +520,18 @@
             var subMeshes = new Array<SubMesh>();
             var currentIndex = 0;
 
-
             for(var mesh of this.getShadowMap().renderList) {
                 subMeshes.push(...mesh.subMeshes);
             }
 
             var checkReady = () => {
+                if (!this._scene || !this._scene.getEngine()) {
+                    return;
+                }
+
                 let subMesh = subMeshes[currentIndex];
 
-                if (this._scene && this._scene.getEngine() && this.isReady(subMesh, options ? options.useInstances : false)) {
+                if (this.isReady(subMesh, options ? options.useInstances : false)) {
                     currentIndex++;
                     if (currentIndex >= subMeshes.length) {
                         if (onCompiled) {
@@ -541,7 +544,7 @@
             };
 
             if (subMeshes.length > 0) {
-                checkReady();            
+                checkReady();
             }
         }
 

+ 5 - 1
src/Materials/babylon.material.ts

@@ -525,6 +525,10 @@
             var engine = scene.getEngine();
 
             var checkReady = () => {
+                if (!this._scene || !this._scene.getEngine()) {
+                    return;
+                }
+
                 if (subMesh._materialDefines) {
                     subMesh._materialDefines._renderId = -1;
                 }
@@ -555,7 +559,7 @@
                     }
                     else {
                         setTimeout(checkReady, 16);
-                    }                    
+                    }
                 }
 
                 engine.setAlphaTesting(alphaTestState);