David Catuhe 7 năm trước cách đây
mục cha
commit
e1f9fd5885

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1685 - 1631
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/babylon.js


+ 120 - 35
dist/preview release/babylon.max.js

@@ -23697,6 +23697,7 @@ var BABYLON;
         SceneComponentConstants.NAME_SPRITE = "Sprite";
         SceneComponentConstants.NAME_SPRITE = "Sprite";
         SceneComponentConstants.NAME_OUTLINERENDERER = "Outline";
         SceneComponentConstants.NAME_OUTLINERENDERER = "Outline";
         SceneComponentConstants.NAME_PROCEDURALTEXTURE = "ProceduralTexture";
         SceneComponentConstants.NAME_PROCEDURALTEXTURE = "ProceduralTexture";
+        SceneComponentConstants.NAME_SHADOWGENERATOR = "ShadowGenerator";
         SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;
         SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;
         SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;
         SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;
         SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;
         SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;
@@ -23715,9 +23716,10 @@ var BABYLON;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_BOUNDINGBOXRENDERER = 2;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_BOUNDINGBOXRENDERER = 2;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 3;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 3;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER = 4;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER = 4;
-        SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 0;
-        SceneComponentConstants.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 1;
-        SceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 2;
+        SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 0;
+        SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1;
+        SceneComponentConstants.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 2;
+        SceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3;
         SceneComponentConstants.STEP_REBUILDGEOMETRY_POSTPROCESSRENDERPIPELINEMANAGER = 0;
         SceneComponentConstants.STEP_REBUILDGEOMETRY_POSTPROCESSRENDERPIPELINEMANAGER = 0;
         SceneComponentConstants.STEP_POINTERMOVE_SPRITE = 0;
         SceneComponentConstants.STEP_POINTERMOVE_SPRITE = 0;
         SceneComponentConstants.STEP_POINTERDOWN_SPRITE = 0;
         SceneComponentConstants.STEP_POINTERDOWN_SPRITE = 0;
@@ -27864,19 +27866,6 @@ var BABYLON;
             if (this.autoClearDepthAndStencil || this.autoClear) {
             if (this.autoClearDepthAndStencil || this.autoClear) {
                 this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);
                 this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);
             }
             }
-            // Shadows
-            if (this.shadowsEnabled) {
-                for (var lightIndex = 0; lightIndex < this.lights.length; lightIndex++) {
-                    var light = this.lights[lightIndex];
-                    var shadowGenerator = light.getShadowGenerator();
-                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator) {
-                        var shadowMap = (shadowGenerator.getShadowMap());
-                        if (this.textures.indexOf(shadowMap) !== -1) {
-                            this._renderTargets.push(shadowMap);
-                        }
-                    }
-                }
-            }
             // Collects render targets from external components.
             // Collects render targets from external components.
             for (var _d = 0, _e = this._gatherRenderTargetsStage; _d < _e.length; _d++) {
             for (var _d = 0, _e = this._gatherRenderTargetsStage; _d < _e.length; _d++) {
                 var step = _e[_d];
                 var step = _e[_d];
@@ -69775,6 +69764,11 @@ var BABYLON;
             this._light = light;
             this._light = light;
             this._scene = light.getScene();
             this._scene = light.getScene();
             light._shadowGenerator = this;
             light._shadowGenerator = this;
+            var component = this._scene._getComponent(BABYLON.SceneComponentConstants.NAME_SHADOWGENERATOR);
+            if (!component) {
+                component = new BABYLON.ShadowGeneratorSceneComponent(this._scene);
+                this._scene._addComponent(component);
+            }
             // Texture type fallback from float to int if not supported.
             // Texture type fallback from float to int if not supported.
             var caps = this._scene.getEngine().getCaps();
             var caps = this._scene.getEngine().getCaps();
             if (!useFullFloatFirst) {
             if (!useFullFloatFirst) {
@@ -71053,6 +71047,108 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
+    // Adds the parser to the scene parsers.
+    BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_SHADOWGENERATOR, function (parsedData, scene, container, rootUrl) {
+        // Shadows
+        if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {
+            for (var index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {
+                var parsedShadowGenerator = parsedData.shadowGenerators[index];
+                BABYLON.ShadowGenerator.Parse(parsedShadowGenerator, scene);
+                // SG would be available on their associated lights
+            }
+        }
+    });
+    /**
+     * Defines the shadow generator component responsible to manage any shadow generators
+     * in a given scene.
+     */
+    var ShadowGeneratorSceneComponent = /** @class */ (function () {
+        /**
+         * Creates a new instance of the component for the given scene
+         * @param scene Defines the scene to register the component in
+         */
+        function ShadowGeneratorSceneComponent(scene) {
+            /**
+             * The component name helpfull to identify the component in the list of scene components.
+             */
+            this.name = BABYLON.SceneComponentConstants.NAME_SHADOWGENERATOR;
+            this.scene = scene;
+        }
+        /**
+         * Registers the component in a given scene
+         */
+        ShadowGeneratorSceneComponent.prototype.register = function () {
+            this.scene._gatherRenderTargetsStage.registerStep(BABYLON.SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR, this, this._gatherRenderTargets);
+        };
+        /**
+         * Rebuilds the elements related to this component in case of
+         * context lost for instance.
+         */
+        ShadowGeneratorSceneComponent.prototype.rebuild = function () {
+            // Nothing To Do Here.
+        };
+        /**
+         * Serializes the component data to the specified json object
+         * @param serializationObject The object to serialize to
+         */
+        ShadowGeneratorSceneComponent.prototype.serialize = function (serializationObject) {
+            // Shadows
+            serializationObject.shadowGenerators = [];
+            var lights = this.scene.lights;
+            for (var _i = 0, lights_1 = lights; _i < lights_1.length; _i++) {
+                var light = lights_1[_i];
+                var shadowGenerator = light.getShadowGenerator();
+                if (shadowGenerator) {
+                    serializationObject.shadowGenerators.push(shadowGenerator.serialize());
+                }
+            }
+        };
+        /**
+         * Adds all the element from the container to the scene
+         * @param container the container holding the elements
+         */
+        ShadowGeneratorSceneComponent.prototype.addFromContainer = function (container) {
+            // Nothing To Do Here. (directly attached to a light)
+        };
+        /**
+         * Removes all the elements in the container from the scene
+         * @param container contains the elements to remove
+         */
+        ShadowGeneratorSceneComponent.prototype.removeFromContainer = function (container) {
+            // Nothing To Do Here. (directly attached to a light)
+        };
+        /**
+         * Rebuilds the elements related to this component in case of
+         * context lost for instance.
+         */
+        ShadowGeneratorSceneComponent.prototype.dispose = function () {
+            // Nothing To Do Here.
+        };
+        ShadowGeneratorSceneComponent.prototype._gatherRenderTargets = function (renderTargets) {
+            // Shadows
+            var scene = this.scene;
+            if (this.scene.shadowsEnabled) {
+                for (var lightIndex = 0; lightIndex < scene.lights.length; lightIndex++) {
+                    var light = scene.lights[lightIndex];
+                    var shadowGenerator = light.getShadowGenerator();
+                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator) {
+                        var shadowMap = (shadowGenerator.getShadowMap());
+                        if (scene.textures.indexOf(shadowMap) !== -1) {
+                            renderTargets.push(shadowMap);
+                        }
+                    }
+                }
+            }
+        };
+        return ShadowGeneratorSceneComponent;
+    }());
+    BABYLON.ShadowGeneratorSceneComponent = ShadowGeneratorSceneComponent;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.shadowGeneratorSceneComponent.js.map
+
+var BABYLON;
+(function (BABYLON) {
     var DefaultLoadingScreen = /** @class */ (function () {
     var DefaultLoadingScreen = /** @class */ (function () {
         function DefaultLoadingScreen(_renderingCanvas, _loadingText, _loadingDivBackgroundColor) {
         function DefaultLoadingScreen(_renderingCanvas, _loadingText, _loadingDivBackgroundColor) {
             if (_loadingText === void 0) { _loadingText = ""; }
             if (_loadingText === void 0) { _loadingText = ""; }
@@ -72096,14 +72192,6 @@ var BABYLON;
                     currentMesh.computeWorldMatrix(true);
                     currentMesh.computeWorldMatrix(true);
                 }
                 }
             }
             }
-            // Shadows
-            if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {
-                for (index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {
-                    var parsedShadowGenerator = parsedData.shadowGenerators[index];
-                    BABYLON.ShadowGenerator.Parse(parsedShadowGenerator, scene);
-                    // SG would be available on their associated lights
-                }
-            }
             // Lights exclusions / inclusions
             // Lights exclusions / inclusions
             for (index = 0, cache = scene.lights.length; index < cache; index++) {
             for (index = 0, cache = scene.lights.length; index < cache; index++) {
                 var light_2 = scene.lights[index];
                 var light_2 = scene.lights[index];
@@ -79308,8 +79396,8 @@ var BABYLON;
                     effect.setMatrix("shadowViewProjection", generator.getTransformMatrix());
                     effect.setMatrix("shadowViewProjection", generator.getTransformMatrix());
                     effect.setFloat("scatteringCoefficient", _this.volumetricLightCoefficient);
                     effect.setFloat("scatteringCoefficient", _this.volumetricLightCoefficient);
                     effect.setFloat("scatteringPower", _this.volumetricLightPower);
                     effect.setFloat("scatteringPower", _this.volumetricLightPower);
-                    depthValues.x = generator.getLight().getDepthMinZ(_this._scene.activeCamera);
-                    depthValues.y = generator.getLight().getDepthMaxZ(_this._scene.activeCamera);
+                    depthValues.x = _this.sourceLight.getDepthMinZ(_this._scene.activeCamera);
+                    depthValues.y = _this.sourceLight.getDepthMaxZ(_this._scene.activeCamera);
                     effect.setVector2("depthValues", depthValues);
                     effect.setVector2("depthValues", depthValues);
                 }
                 }
             };
             };
@@ -87518,6 +87606,9 @@ var BABYLON;
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_LENSFLARESYSTEM, function (parsedData, scene, container, rootUrl) {
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_LENSFLARESYSTEM, function (parsedData, scene, container, rootUrl) {
         // Lens flares
         // Lens flares
         if (parsedData.lensFlareSystems !== undefined && parsedData.lensFlareSystems !== null) {
         if (parsedData.lensFlareSystems !== undefined && parsedData.lensFlareSystems !== null) {
+            if (!container.lensFlareSystems) {
+                container.lensFlareSystems = new Array();
+            }
             for (var index = 0, cache = parsedData.lensFlareSystems.length; index < cache; index++) {
             for (var index = 0, cache = parsedData.lensFlareSystems.length; index < cache; index++) {
                 var parsedLensFlareSystem = parsedData.lensFlareSystems[index];
                 var parsedLensFlareSystem = parsedData.lensFlareSystems[index];
                 var lf = BABYLON.LensFlareSystem.Parse(parsedLensFlareSystem, scene, rootUrl);
                 var lf = BABYLON.LensFlareSystem.Parse(parsedLensFlareSystem, scene, rootUrl);
@@ -101254,6 +101345,9 @@ var BABYLON;
     // Adds the parser to the scene parsers.
     // Adds the parser to the scene parsers.
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_EFFECTLAYER, function (parsedData, scene, container, rootUrl) {
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_EFFECTLAYER, function (parsedData, scene, container, rootUrl) {
         if (parsedData.effectLayers) {
         if (parsedData.effectLayers) {
+            if (!container.effectLayers) {
+                container.effectLayers = new Array();
+            }
             for (var index = 0; index < parsedData.effectLayers.length; index++) {
             for (var index = 0; index < parsedData.effectLayers.length; index++) {
                 var effectLayer = BABYLON.EffectLayer.Parse(parsedData.effectLayers[index], scene, rootUrl);
                 var effectLayer = BABYLON.EffectLayer.Parse(parsedData.effectLayers[index], scene, rootUrl);
                 container.effectLayers.push(effectLayer);
                 container.effectLayers.push(effectLayer);
@@ -104048,15 +104142,6 @@ var BABYLON;
             for (index = 0; index < scene.particleSystems.length; index++) {
             for (index = 0; index < scene.particleSystems.length; index++) {
                 serializationObject.particleSystems.push(scene.particleSystems[index].serialize());
                 serializationObject.particleSystems.push(scene.particleSystems[index].serialize());
             }
             }
-            // Shadows
-            serializationObject.shadowGenerators = [];
-            for (index = 0; index < scene.lights.length; index++) {
-                light = scene.lights[index];
-                var shadowGenerator = light.getShadowGenerator();
-                if (shadowGenerator) {
-                    serializationObject.shadowGenerators.push(shadowGenerator.serialize());
-                }
-            }
             // Action Manager
             // Action Manager
             if (scene.actionManager) {
             if (scene.actionManager) {
                 serializationObject.actions = scene.actionManager.serialize("scene");
                 serializationObject.actions = scene.actionManager.serialize("scene");

+ 120 - 35
dist/preview release/babylon.no-module.max.js

@@ -23664,6 +23664,7 @@ var BABYLON;
         SceneComponentConstants.NAME_SPRITE = "Sprite";
         SceneComponentConstants.NAME_SPRITE = "Sprite";
         SceneComponentConstants.NAME_OUTLINERENDERER = "Outline";
         SceneComponentConstants.NAME_OUTLINERENDERER = "Outline";
         SceneComponentConstants.NAME_PROCEDURALTEXTURE = "ProceduralTexture";
         SceneComponentConstants.NAME_PROCEDURALTEXTURE = "ProceduralTexture";
+        SceneComponentConstants.NAME_SHADOWGENERATOR = "ShadowGenerator";
         SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;
         SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;
         SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;
         SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;
         SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;
         SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;
@@ -23682,9 +23683,10 @@ var BABYLON;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_BOUNDINGBOXRENDERER = 2;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_BOUNDINGBOXRENDERER = 2;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 3;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 3;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER = 4;
         SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER = 4;
-        SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 0;
-        SceneComponentConstants.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 1;
-        SceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 2;
+        SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 0;
+        SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1;
+        SceneComponentConstants.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 2;
+        SceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3;
         SceneComponentConstants.STEP_REBUILDGEOMETRY_POSTPROCESSRENDERPIPELINEMANAGER = 0;
         SceneComponentConstants.STEP_REBUILDGEOMETRY_POSTPROCESSRENDERPIPELINEMANAGER = 0;
         SceneComponentConstants.STEP_POINTERMOVE_SPRITE = 0;
         SceneComponentConstants.STEP_POINTERMOVE_SPRITE = 0;
         SceneComponentConstants.STEP_POINTERDOWN_SPRITE = 0;
         SceneComponentConstants.STEP_POINTERDOWN_SPRITE = 0;
@@ -27831,19 +27833,6 @@ var BABYLON;
             if (this.autoClearDepthAndStencil || this.autoClear) {
             if (this.autoClearDepthAndStencil || this.autoClear) {
                 this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);
                 this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);
             }
             }
-            // Shadows
-            if (this.shadowsEnabled) {
-                for (var lightIndex = 0; lightIndex < this.lights.length; lightIndex++) {
-                    var light = this.lights[lightIndex];
-                    var shadowGenerator = light.getShadowGenerator();
-                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator) {
-                        var shadowMap = (shadowGenerator.getShadowMap());
-                        if (this.textures.indexOf(shadowMap) !== -1) {
-                            this._renderTargets.push(shadowMap);
-                        }
-                    }
-                }
-            }
             // Collects render targets from external components.
             // Collects render targets from external components.
             for (var _d = 0, _e = this._gatherRenderTargetsStage; _d < _e.length; _d++) {
             for (var _d = 0, _e = this._gatherRenderTargetsStage; _d < _e.length; _d++) {
                 var step = _e[_d];
                 var step = _e[_d];
@@ -69742,6 +69731,11 @@ var BABYLON;
             this._light = light;
             this._light = light;
             this._scene = light.getScene();
             this._scene = light.getScene();
             light._shadowGenerator = this;
             light._shadowGenerator = this;
+            var component = this._scene._getComponent(BABYLON.SceneComponentConstants.NAME_SHADOWGENERATOR);
+            if (!component) {
+                component = new BABYLON.ShadowGeneratorSceneComponent(this._scene);
+                this._scene._addComponent(component);
+            }
             // Texture type fallback from float to int if not supported.
             // Texture type fallback from float to int if not supported.
             var caps = this._scene.getEngine().getCaps();
             var caps = this._scene.getEngine().getCaps();
             if (!useFullFloatFirst) {
             if (!useFullFloatFirst) {
@@ -71020,6 +71014,108 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
+    // Adds the parser to the scene parsers.
+    BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_SHADOWGENERATOR, function (parsedData, scene, container, rootUrl) {
+        // Shadows
+        if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {
+            for (var index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {
+                var parsedShadowGenerator = parsedData.shadowGenerators[index];
+                BABYLON.ShadowGenerator.Parse(parsedShadowGenerator, scene);
+                // SG would be available on their associated lights
+            }
+        }
+    });
+    /**
+     * Defines the shadow generator component responsible to manage any shadow generators
+     * in a given scene.
+     */
+    var ShadowGeneratorSceneComponent = /** @class */ (function () {
+        /**
+         * Creates a new instance of the component for the given scene
+         * @param scene Defines the scene to register the component in
+         */
+        function ShadowGeneratorSceneComponent(scene) {
+            /**
+             * The component name helpfull to identify the component in the list of scene components.
+             */
+            this.name = BABYLON.SceneComponentConstants.NAME_SHADOWGENERATOR;
+            this.scene = scene;
+        }
+        /**
+         * Registers the component in a given scene
+         */
+        ShadowGeneratorSceneComponent.prototype.register = function () {
+            this.scene._gatherRenderTargetsStage.registerStep(BABYLON.SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR, this, this._gatherRenderTargets);
+        };
+        /**
+         * Rebuilds the elements related to this component in case of
+         * context lost for instance.
+         */
+        ShadowGeneratorSceneComponent.prototype.rebuild = function () {
+            // Nothing To Do Here.
+        };
+        /**
+         * Serializes the component data to the specified json object
+         * @param serializationObject The object to serialize to
+         */
+        ShadowGeneratorSceneComponent.prototype.serialize = function (serializationObject) {
+            // Shadows
+            serializationObject.shadowGenerators = [];
+            var lights = this.scene.lights;
+            for (var _i = 0, lights_1 = lights; _i < lights_1.length; _i++) {
+                var light = lights_1[_i];
+                var shadowGenerator = light.getShadowGenerator();
+                if (shadowGenerator) {
+                    serializationObject.shadowGenerators.push(shadowGenerator.serialize());
+                }
+            }
+        };
+        /**
+         * Adds all the element from the container to the scene
+         * @param container the container holding the elements
+         */
+        ShadowGeneratorSceneComponent.prototype.addFromContainer = function (container) {
+            // Nothing To Do Here. (directly attached to a light)
+        };
+        /**
+         * Removes all the elements in the container from the scene
+         * @param container contains the elements to remove
+         */
+        ShadowGeneratorSceneComponent.prototype.removeFromContainer = function (container) {
+            // Nothing To Do Here. (directly attached to a light)
+        };
+        /**
+         * Rebuilds the elements related to this component in case of
+         * context lost for instance.
+         */
+        ShadowGeneratorSceneComponent.prototype.dispose = function () {
+            // Nothing To Do Here.
+        };
+        ShadowGeneratorSceneComponent.prototype._gatherRenderTargets = function (renderTargets) {
+            // Shadows
+            var scene = this.scene;
+            if (this.scene.shadowsEnabled) {
+                for (var lightIndex = 0; lightIndex < scene.lights.length; lightIndex++) {
+                    var light = scene.lights[lightIndex];
+                    var shadowGenerator = light.getShadowGenerator();
+                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator) {
+                        var shadowMap = (shadowGenerator.getShadowMap());
+                        if (scene.textures.indexOf(shadowMap) !== -1) {
+                            renderTargets.push(shadowMap);
+                        }
+                    }
+                }
+            }
+        };
+        return ShadowGeneratorSceneComponent;
+    }());
+    BABYLON.ShadowGeneratorSceneComponent = ShadowGeneratorSceneComponent;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.shadowGeneratorSceneComponent.js.map
+
+var BABYLON;
+(function (BABYLON) {
     var DefaultLoadingScreen = /** @class */ (function () {
     var DefaultLoadingScreen = /** @class */ (function () {
         function DefaultLoadingScreen(_renderingCanvas, _loadingText, _loadingDivBackgroundColor) {
         function DefaultLoadingScreen(_renderingCanvas, _loadingText, _loadingDivBackgroundColor) {
             if (_loadingText === void 0) { _loadingText = ""; }
             if (_loadingText === void 0) { _loadingText = ""; }
@@ -72063,14 +72159,6 @@ var BABYLON;
                     currentMesh.computeWorldMatrix(true);
                     currentMesh.computeWorldMatrix(true);
                 }
                 }
             }
             }
-            // Shadows
-            if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {
-                for (index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {
-                    var parsedShadowGenerator = parsedData.shadowGenerators[index];
-                    BABYLON.ShadowGenerator.Parse(parsedShadowGenerator, scene);
-                    // SG would be available on their associated lights
-                }
-            }
             // Lights exclusions / inclusions
             // Lights exclusions / inclusions
             for (index = 0, cache = scene.lights.length; index < cache; index++) {
             for (index = 0, cache = scene.lights.length; index < cache; index++) {
                 var light_2 = scene.lights[index];
                 var light_2 = scene.lights[index];
@@ -79275,8 +79363,8 @@ var BABYLON;
                     effect.setMatrix("shadowViewProjection", generator.getTransformMatrix());
                     effect.setMatrix("shadowViewProjection", generator.getTransformMatrix());
                     effect.setFloat("scatteringCoefficient", _this.volumetricLightCoefficient);
                     effect.setFloat("scatteringCoefficient", _this.volumetricLightCoefficient);
                     effect.setFloat("scatteringPower", _this.volumetricLightPower);
                     effect.setFloat("scatteringPower", _this.volumetricLightPower);
-                    depthValues.x = generator.getLight().getDepthMinZ(_this._scene.activeCamera);
-                    depthValues.y = generator.getLight().getDepthMaxZ(_this._scene.activeCamera);
+                    depthValues.x = _this.sourceLight.getDepthMinZ(_this._scene.activeCamera);
+                    depthValues.y = _this.sourceLight.getDepthMaxZ(_this._scene.activeCamera);
                     effect.setVector2("depthValues", depthValues);
                     effect.setVector2("depthValues", depthValues);
                 }
                 }
             };
             };
@@ -87485,6 +87573,9 @@ var BABYLON;
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_LENSFLARESYSTEM, function (parsedData, scene, container, rootUrl) {
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_LENSFLARESYSTEM, function (parsedData, scene, container, rootUrl) {
         // Lens flares
         // Lens flares
         if (parsedData.lensFlareSystems !== undefined && parsedData.lensFlareSystems !== null) {
         if (parsedData.lensFlareSystems !== undefined && parsedData.lensFlareSystems !== null) {
+            if (!container.lensFlareSystems) {
+                container.lensFlareSystems = new Array();
+            }
             for (var index = 0, cache = parsedData.lensFlareSystems.length; index < cache; index++) {
             for (var index = 0, cache = parsedData.lensFlareSystems.length; index < cache; index++) {
                 var parsedLensFlareSystem = parsedData.lensFlareSystems[index];
                 var parsedLensFlareSystem = parsedData.lensFlareSystems[index];
                 var lf = BABYLON.LensFlareSystem.Parse(parsedLensFlareSystem, scene, rootUrl);
                 var lf = BABYLON.LensFlareSystem.Parse(parsedLensFlareSystem, scene, rootUrl);
@@ -101221,6 +101312,9 @@ var BABYLON;
     // Adds the parser to the scene parsers.
     // Adds the parser to the scene parsers.
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_EFFECTLAYER, function (parsedData, scene, container, rootUrl) {
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_EFFECTLAYER, function (parsedData, scene, container, rootUrl) {
         if (parsedData.effectLayers) {
         if (parsedData.effectLayers) {
+            if (!container.effectLayers) {
+                container.effectLayers = new Array();
+            }
             for (var index = 0; index < parsedData.effectLayers.length; index++) {
             for (var index = 0; index < parsedData.effectLayers.length; index++) {
                 var effectLayer = BABYLON.EffectLayer.Parse(parsedData.effectLayers[index], scene, rootUrl);
                 var effectLayer = BABYLON.EffectLayer.Parse(parsedData.effectLayers[index], scene, rootUrl);
                 container.effectLayers.push(effectLayer);
                 container.effectLayers.push(effectLayer);
@@ -104015,15 +104109,6 @@ var BABYLON;
             for (index = 0; index < scene.particleSystems.length; index++) {
             for (index = 0; index < scene.particleSystems.length; index++) {
                 serializationObject.particleSystems.push(scene.particleSystems[index].serialize());
                 serializationObject.particleSystems.push(scene.particleSystems[index].serialize());
             }
             }
-            // Shadows
-            serializationObject.shadowGenerators = [];
-            for (index = 0; index < scene.lights.length; index++) {
-                light = scene.lights[index];
-                var shadowGenerator = light.getShadowGenerator();
-                if (shadowGenerator) {
-                    serializationObject.shadowGenerators.push(shadowGenerator.serialize());
-                }
-            }
             // Action Manager
             // Action Manager
             if (scene.actionManager) {
             if (scene.actionManager) {
                 serializationObject.actions = scene.actionManager.serialize("scene");
                 serializationObject.actions = scene.actionManager.serialize("scene");

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/babylon.worker.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 122 - 37
dist/preview release/es6.js


+ 4 - 4
dist/preview release/viewer/babylon.viewer.d.ts

@@ -168,11 +168,11 @@ declare module BabylonViewer {
                 * Mainly used for help and errors
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
                 */
-            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
             /**
                 * Hide the overlay screen.
                 * Hide the overlay screen.
                 */
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
             /**
                 * show the viewer (in case it was hidden)
                 * show the viewer (in case it was hidden)
                 *
                 *
@@ -189,11 +189,11 @@ declare module BabylonViewer {
                 * Show the loading screen.
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 * The loading screen can be configured using the configuration object
                 */
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
             /**
                 * Hide the loading screen
                 * Hide the loading screen
                 */
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
     }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 4 - 4
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -200,11 +200,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Mainly used for help and errors
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
                 */
-            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
             /**
                 * Hide the overlay screen.
                 * Hide the overlay screen.
                 */
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
             /**
                 * show the viewer (in case it was hidden)
                 * show the viewer (in case it was hidden)
                 *
                 *
@@ -221,11 +221,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Show the loading screen.
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 * The loading screen can be configured using the configuration object
                 */
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
             /**
                 * Hide the loading screen
                 * Hide the loading screen
                 */
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
     }