David Catuhe 7 jaren geleden
bovenliggende
commit
d1b5bdba32

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


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


+ 22 - 6
dist/preview release/babylon.max.js

@@ -75,21 +75,37 @@ var __extends = (this && this.__extends) || (function () {
         });
         /**
          * Removes the defines that shoould be removed when falling back.
-         * @param currentDefines The current define statements for the shader.
+         * @param currentDefines defines the current define statements for the shader.
+         * @param effect defines the current effect we try to compile
          * @returns The resulting defines with defines of the current rank removed.
          */
-        EffectFallbacks.prototype.reduce = function (currentDefines) {
+        EffectFallbacks.prototype.reduce = function (currentDefines, effect) {
             // First we try to switch to CPU skinning
-            if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0) {
+            if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0 && this._mesh.material) {
                 this._mesh.computeBonesUsingShaders = false;
                 currentDefines = currentDefines.replace("#define NUM_BONE_INFLUENCERS " + this._mesh.numBoneInfluencers, "#define NUM_BONE_INFLUENCERS 0");
-                BABYLON.Tools.Log("Falling back to CPU skinning for " + this._mesh.name);
                 var scene = this._mesh.getScene();
                 for (var index = 0; index < scene.meshes.length; index++) {
                     var otherMesh = scene.meshes[index];
-                    if (otherMesh.material === this._mesh.material && otherMesh.computeBonesUsingShaders && otherMesh.numBoneInfluencers > 0) {
+                    if (!otherMesh.material) {
+                        continue;
+                    }
+                    if (!otherMesh.computeBonesUsingShaders || otherMesh.numBoneInfluencers === 0) {
+                        continue;
+                    }
+                    if (otherMesh.material.getEffect() === effect) {
                         otherMesh.computeBonesUsingShaders = false;
                     }
+                    else {
+                        for (var _i = 0, _a = otherMesh.subMeshes; _i < _a.length; _i++) {
+                            var subMesh = _a[_i];
+                            var subMeshEffect = subMesh.effect;
+                            if (subMeshEffect === effect) {
+                                otherMesh.computeBonesUsingShaders = false;
+                                break;
+                            }
+                        }
+                    }
                 }
             }
             else {
@@ -665,7 +681,7 @@ var __extends = (this && this.__extends) || (function () {
                 }
                 if (fallbacks && fallbacks.isMoreFallbacks) {
                     BABYLON.Tools.Error("Trying next fallback.");
-                    this.defines = fallbacks.reduce(this.defines);
+                    this.defines = fallbacks.reduce(this.defines, this);
                     this._prepareEffect();
                 }
                 else {

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


File diff suppressed because it is too large
+ 5340 - 5339
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


File diff suppressed because it is too large
+ 10 - 10
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 22 - 6
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -75,21 +75,37 @@ var __extends = (this && this.__extends) || (function () {
         });
         /**
          * Removes the defines that shoould be removed when falling back.
-         * @param currentDefines The current define statements for the shader.
+         * @param currentDefines defines the current define statements for the shader.
+         * @param effect defines the current effect we try to compile
          * @returns The resulting defines with defines of the current rank removed.
          */
-        EffectFallbacks.prototype.reduce = function (currentDefines) {
+        EffectFallbacks.prototype.reduce = function (currentDefines, effect) {
             // First we try to switch to CPU skinning
-            if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0) {
+            if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0 && this._mesh.material) {
                 this._mesh.computeBonesUsingShaders = false;
                 currentDefines = currentDefines.replace("#define NUM_BONE_INFLUENCERS " + this._mesh.numBoneInfluencers, "#define NUM_BONE_INFLUENCERS 0");
-                BABYLON.Tools.Log("Falling back to CPU skinning for " + this._mesh.name);
                 var scene = this._mesh.getScene();
                 for (var index = 0; index < scene.meshes.length; index++) {
                     var otherMesh = scene.meshes[index];
-                    if (otherMesh.material === this._mesh.material && otherMesh.computeBonesUsingShaders && otherMesh.numBoneInfluencers > 0) {
+                    if (!otherMesh.material) {
+                        continue;
+                    }
+                    if (!otherMesh.computeBonesUsingShaders || otherMesh.numBoneInfluencers === 0) {
+                        continue;
+                    }
+                    if (otherMesh.material.getEffect() === effect) {
                         otherMesh.computeBonesUsingShaders = false;
                     }
+                    else {
+                        for (var _i = 0, _a = otherMesh.subMeshes; _i < _a.length; _i++) {
+                            var subMesh = _a[_i];
+                            var subMeshEffect = subMesh.effect;
+                            if (subMeshEffect === effect) {
+                                otherMesh.computeBonesUsingShaders = false;
+                                break;
+                            }
+                        }
+                    }
                 }
             }
             else {
@@ -665,7 +681,7 @@ var __extends = (this && this.__extends) || (function () {
                 }
                 if (fallbacks && fallbacks.isMoreFallbacks) {
                     BABYLON.Tools.Error("Trying next fallback.");
-                    this.defines = fallbacks.reduce(this.defines);
+                    this.defines = fallbacks.reduce(this.defines, this);
                     this._prepareEffect();
                 }
                 else {

+ 22 - 6
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -61,21 +61,37 @@ var BABYLON;
         });
         /**
          * Removes the defines that shoould be removed when falling back.
-         * @param currentDefines The current define statements for the shader.
+         * @param currentDefines defines the current define statements for the shader.
+         * @param effect defines the current effect we try to compile
          * @returns The resulting defines with defines of the current rank removed.
          */
-        EffectFallbacks.prototype.reduce = function (currentDefines) {
+        EffectFallbacks.prototype.reduce = function (currentDefines, effect) {
             // First we try to switch to CPU skinning
-            if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0) {
+            if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0 && this._mesh.material) {
                 this._mesh.computeBonesUsingShaders = false;
                 currentDefines = currentDefines.replace("#define NUM_BONE_INFLUENCERS " + this._mesh.numBoneInfluencers, "#define NUM_BONE_INFLUENCERS 0");
-                BABYLON.Tools.Log("Falling back to CPU skinning for " + this._mesh.name);
                 var scene = this._mesh.getScene();
                 for (var index = 0; index < scene.meshes.length; index++) {
                     var otherMesh = scene.meshes[index];
-                    if (otherMesh.material === this._mesh.material && otherMesh.computeBonesUsingShaders && otherMesh.numBoneInfluencers > 0) {
+                    if (!otherMesh.material) {
+                        continue;
+                    }
+                    if (!otherMesh.computeBonesUsingShaders || otherMesh.numBoneInfluencers === 0) {
+                        continue;
+                    }
+                    if (otherMesh.material.getEffect() === effect) {
                         otherMesh.computeBonesUsingShaders = false;
                     }
+                    else {
+                        for (var _i = 0, _a = otherMesh.subMeshes; _i < _a.length; _i++) {
+                            var subMesh = _a[_i];
+                            var subMeshEffect = subMesh.effect;
+                            if (subMeshEffect === effect) {
+                                otherMesh.computeBonesUsingShaders = false;
+                                break;
+                            }
+                        }
+                    }
                 }
             }
             else {
@@ -651,7 +667,7 @@ var BABYLON;
                 }
                 if (fallbacks && fallbacks.isMoreFallbacks) {
                     BABYLON.Tools.Error("Trying next fallback.");
-                    this.defines = fallbacks.reduce(this.defines);
+                    this.defines = fallbacks.reduce(this.defines, this);
                     this._prepareEffect();
                 }
                 else {

+ 22 - 6
dist/preview release/es6.js

@@ -61,21 +61,37 @@ var BABYLON;
         });
         /**
          * Removes the defines that shoould be removed when falling back.
-         * @param currentDefines The current define statements for the shader.
+         * @param currentDefines defines the current define statements for the shader.
+         * @param effect defines the current effect we try to compile
          * @returns The resulting defines with defines of the current rank removed.
          */
-        EffectFallbacks.prototype.reduce = function (currentDefines) {
+        EffectFallbacks.prototype.reduce = function (currentDefines, effect) {
             // First we try to switch to CPU skinning
-            if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0) {
+            if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0 && this._mesh.material) {
                 this._mesh.computeBonesUsingShaders = false;
                 currentDefines = currentDefines.replace("#define NUM_BONE_INFLUENCERS " + this._mesh.numBoneInfluencers, "#define NUM_BONE_INFLUENCERS 0");
-                BABYLON.Tools.Log("Falling back to CPU skinning for " + this._mesh.name);
                 var scene = this._mesh.getScene();
                 for (var index = 0; index < scene.meshes.length; index++) {
                     var otherMesh = scene.meshes[index];
-                    if (otherMesh.material === this._mesh.material && otherMesh.computeBonesUsingShaders && otherMesh.numBoneInfluencers > 0) {
+                    if (!otherMesh.material) {
+                        continue;
+                    }
+                    if (!otherMesh.computeBonesUsingShaders || otherMesh.numBoneInfluencers === 0) {
+                        continue;
+                    }
+                    if (otherMesh.material.getEffect() === effect) {
                         otherMesh.computeBonesUsingShaders = false;
                     }
+                    else {
+                        for (var _i = 0, _a = otherMesh.subMeshes; _i < _a.length; _i++) {
+                            var subMesh = _a[_i];
+                            var subMeshEffect = subMesh.effect;
+                            if (subMeshEffect === effect) {
+                                otherMesh.computeBonesUsingShaders = false;
+                                break;
+                            }
+                        }
+                    }
                 }
             }
             else {
@@ -651,7 +667,7 @@ var BABYLON;
                 }
                 if (fallbacks && fallbacks.isMoreFallbacks) {
                     BABYLON.Tools.Error("Trying next fallback.");
-                    this.defines = fallbacks.reduce(this.defines);
+                    this.defines = fallbacks.reduce(this.defines, this);
                     this._prepareEffect();
                 }
                 else {

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


+ 0 - 28
sandbox/index.js

@@ -20,7 +20,6 @@ if (BABYLON.Engine.isSupported()) {
     var currentSkybox;
     var enableDebugLayer = false;
     var currentPluginName;
-    var toExecuteAfterSceneCreation;
 
     canvas.addEventListener("contextmenu", function (evt) {
         evt.preventDefault();
@@ -129,10 +128,6 @@ if (BABYLON.Engine.isSupported()) {
             }
         }
 
-        if (toExecuteAfterSceneCreation) {
-            toExecuteAfterSceneCreation();
-        }
-
     };
 
     var sceneError = function (sceneFile, babylonScene, message) {
@@ -152,29 +147,6 @@ if (BABYLON.Engine.isSupported()) {
     };
 
     filesInput = new BABYLON.FilesInput(engine, null, sceneLoaded, null, null, null, function () { BABYLON.Tools.ClearLogCache() }, null, sceneError);
-    filesInput.onProcessFileCallback = (function (file, name, extension) {
-        if (extension === "dds") {
-            BABYLON.FilesInput.FilesToLoad[name] = file;
-            var loadTexture = () => {
-                if (currentPluginName === "gltf") { // currentPluginName is updated only once scene is loaded
-                    var newHdrTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("file:" + file.correctName, currentScene);
-                    if (currentSkybox) {
-                        currentSkybox.dispose();
-                    }
-                    currentSkybox = currentScene.createDefaultSkybox(newHdrTexture, true, (currentScene.activeCamera.maxZ - currentScene.activeCamera.minZ) / 2, 0.3);
-                }
-            }
-            if (currentScene) {
-                loadTexture();
-            }
-            else {
-                // Postpone texture loading until scene is loaded
-                toExecuteAfterSceneCreation = loadTexture;
-            }
-            return false;
-        }
-        return true;
-    }).bind(this);
     filesInput.monitorElementForDragNDrop(canvas);
 
     window.addEventListener("keydown", function (evt) {

+ 23 - 6
src/Materials/babylon.effect.ts

@@ -64,22 +64,39 @@
 
         /**
          * Removes the defines that shoould be removed when falling back.
-         * @param currentDefines The current define statements for the shader.
+         * @param currentDefines defines the current define statements for the shader.
+         * @param effect defines the current effect we try to compile
          * @returns The resulting defines with defines of the current rank removed.
          */
-        public reduce(currentDefines: string): string {
+        public reduce(currentDefines: string, effect: Effect): string {
             // First we try to switch to CPU skinning
-            if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0) {
+            if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0 && this._mesh.material) {
                 this._mesh.computeBonesUsingShaders = false;
                 currentDefines = currentDefines.replace("#define NUM_BONE_INFLUENCERS " + this._mesh.numBoneInfluencers, "#define NUM_BONE_INFLUENCERS 0");
-                Tools.Log("Falling back to CPU skinning for " + this._mesh.name);
 
                 var scene = this._mesh.getScene();
                 for (var index = 0; index < scene.meshes.length; index++) {
                     var otherMesh = scene.meshes[index];
 
-                    if (otherMesh.material === this._mesh.material && otherMesh.computeBonesUsingShaders && otherMesh.numBoneInfluencers > 0) {
+                    if (!otherMesh.material) {
+                        continue;
+                    }
+
+                    if (!otherMesh.computeBonesUsingShaders || otherMesh.numBoneInfluencers === 0) {
+                        continue;
+                    }
+
+                    if (otherMesh.material.getEffect() === effect) {
                         otherMesh.computeBonesUsingShaders = false;
+                    } else {
+                        for (var subMesh of otherMesh.subMeshes) {
+                            let subMeshEffect = subMesh.effect;
+
+                            if (subMeshEffect === effect) {
+                                otherMesh.computeBonesUsingShaders = false;
+                                break;
+                            }
+                        }
                     }
                 }
             }
@@ -808,7 +825,7 @@
 
                 if (fallbacks && fallbacks.isMoreFallbacks) {
                     Tools.Error("Trying next fallback.");
-                    this.defines = fallbacks.reduce(this.defines);
+                    this.defines = fallbacks.reduce(this.defines, this);
                     this._prepareEffect();
                 } else { // Sorry we did everything we can