Selaa lähdekoodia

Fix shadowmap generation

David Catuhe 7 vuotta sitten
vanhempi
commit
2bafff982c

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6970 - 8549
Playground/babylon.d.txt


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 2533 - 2315
dist/preview release/babylon.d.ts


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 35 - 35
dist/preview release/babylon.js


+ 237 - 25
dist/preview release/babylon.max.js

@@ -15211,6 +15211,7 @@ var BABYLON;
             gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
             gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), width, height, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);
             // Create the framebuffer
+            var currentFrameBuffer = this._currentFramebuffer;
             var framebuffer = gl.createFramebuffer();
             this.bindUnboundFramebuffer(framebuffer);
             gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, 0);
@@ -15221,7 +15222,7 @@ var BABYLON;
             // Unbind
             this._bindTextureDirectly(gl.TEXTURE_2D, null);
             gl.bindRenderbuffer(gl.RENDERBUFFER, null);
-            this.bindUnboundFramebuffer(null);
+            this.bindUnboundFramebuffer(currentFrameBuffer);
             texture._framebuffer = framebuffer;
             texture.baseWidth = width;
             texture.baseHeight = height;
@@ -26249,8 +26250,11 @@ var BABYLON;
         /**
          * Add a mesh to the list of scene's meshes
          * @param newMesh defines the mesh to add
+         * @param recursive if all child meshes should also be added to the scene
          */
-        Scene.prototype.addMesh = function (newMesh) {
+        Scene.prototype.addMesh = function (newMesh, recursive) {
+            var _this = this;
+            if (recursive === void 0) { recursive = false; }
             this.meshes.push(newMesh);
             //notify the collision coordinator
             if (this.collisionCoordinator) {
@@ -26258,6 +26262,11 @@ var BABYLON;
             }
             newMesh._resyncLightSources();
             this.onNewMeshAddedObservable.notifyObservers(newMesh);
+            if (recursive) {
+                newMesh.getChildMeshes().forEach(function (m) {
+                    _this.addMesh(m);
+                });
+            }
         };
         /**
            * Remove a mesh for the list of scene's meshes
@@ -27824,7 +27833,7 @@ var BABYLON;
                 for (var lightIndex = 0; lightIndex < this.lights.length; lightIndex++) {
                     var light = this.lights[lightIndex];
                     var shadowGenerator = light.getShadowGenerator();
-                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator) {
+                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator && shadowGenerator.arePostProcessesReady()) {
                         var shadowMap = (shadowGenerator.getShadowMap());
                         if (this.textures.indexOf(shadowMap) !== -1) {
                             this._renderTargets.push(shadowMap);
@@ -29337,6 +29346,20 @@ var BABYLON;
             this._moveAssets(this.scene.effectLayers, this.effectLayers, keepAssets.effectLayers);
             this.removeAllFromScene();
         };
+        /**
+         * Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.
+         * @returns the root mesh
+         */
+        AssetContainer.prototype.createRootMesh = function () {
+            var rootMesh = new BABYLON.Mesh("assetContainerRootMesh", this.scene);
+            this.meshes.forEach(function (m) {
+                if (!m.parent) {
+                    rootMesh.addChild(m);
+                }
+            });
+            this.meshes.unshift(rootMesh);
+            return rootMesh;
+        };
         return AssetContainer;
     }());
     BABYLON.AssetContainer = AssetContainer;
@@ -50940,7 +50963,7 @@ var BABYLON;
             return node.getScene().beginAnimation(node, 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);
         };
         /**
-         * Transition property of the Camera to the target Value
+         * Transition property of an host to the target Value
          * @param property The property to transition
          * @param targetValue The target Value of the property
          * @param host The object where the property to animate belongs
@@ -62321,6 +62344,41 @@ var BABYLON;
 (function (BABYLON) {
     /**
      * Draco compression (https://google.github.io/draco/)
+     *
+     * This class wraps the Draco module.
+     *
+     * **Encoder**
+     *
+     * The encoder is not currently implemented.
+     *
+     * **Decoder**
+     *
+     * By default, the configuration points to a copy of the Draco decoder files for glTF from https://preview.babylonjs.com.
+     *
+     * To update the configuration, use the following code:
+     * ```javascript
+     *     BABYLON.DracoCompression.Configuration = {
+     *         decoder: {
+     *             wasmUrl: "<url to the WebAssembly library>",
+     *             wasmBinaryUrl: "<url to the WebAssembly binary>",
+     *             fallbackUrl: "<url to the fallback JavaScript library>",
+     *         }
+     *     };
+     * ```
+     *
+     * Draco has two versions, one for WebAssembly and one for JavaScript. The decoder configuration can be set to only support Webssembly or only support the JavaScript version.
+     * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.
+     * Use `BABYLON.DracoCompression.DecoderAvailable` to determine if the decoder is available for the current session.
+     *
+     * To decode Draco compressed data, create a DracoCompression object and call decodeMeshAsync:
+     * ```javascript
+     *     var dracoCompression = new BABYLON.DracoCompression();
+     *     var vertexData = await dracoCompression.decodeMeshAsync(data, {
+     *         [BABYLON.VertexBuffer.PositionKind]: 0
+     *     });
+     * ```
+     *
+     * @see https://www.babylonjs-playground.com/#N3EK4B#0
      */
     var DracoCompression = /** @class */ (function () {
         /**
@@ -62357,16 +62415,17 @@ var BABYLON;
         };
         /**
          * Decode Draco compressed mesh data to vertex data.
-         * @param data The array buffer view for the Draco compression data
+         * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data
          * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids
          * @returns A promise that resolves with the decoded vertex data
          */
         DracoCompression.prototype.decodeMeshAsync = function (data, attributes) {
+            var dataView = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
             return DracoCompression._GetDecoderModule().then(function (wrappedModule) {
                 var module = wrappedModule.module;
                 var vertexData = new BABYLON.VertexData();
                 var buffer = new module.DecoderBuffer();
-                buffer.Init(data, data.byteLength);
+                buffer.Init(dataView, dataView.byteLength);
                 var decoder = new module.Decoder();
                 var geometry;
                 var status;
@@ -62490,7 +62549,10 @@ var BABYLON;
             });
         };
         /**
-         * The configuration.
+         * The configuration. Defaults to the following urls:
+         * - wasmUrl: "https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js"
+         * - wasmBinaryUrl: "https://preview.babylonjs.com/draco_decoder_gltf.wasm"
+         * - fallbackUrl: "https://preview.babylonjs.com/draco_decoder_gltf.js"
          */
         DracoCompression.Configuration = {
             decoder: {
@@ -66917,6 +66979,13 @@ var BABYLON;
                     this._initializeBlurRTTAndPostProcesses();
                 }
             }
+            return this.arePostProcessesReady();
+        };
+        /**
+         * Returns true if all post processes required to render the shadow map are ready
+         * @returns true if the shadow map can be rendered with all post-processes
+         */
+        ShadowGenerator.prototype.arePostProcessesReady = function () {
             if (this._kernelBlurXPostprocess && !this._kernelBlurXPostprocess.isReady()) {
                 return false;
             }
@@ -67525,7 +67594,7 @@ var BABYLON;
             if (registeredPlugin) {
                 return registeredPlugin;
             }
-            BABYLON.Tools.Warn("Unable to find a plugin to load " + extension + " files. Trying to use .babylon default plugin.");
+            BABYLON.Tools.Warn("Unable to find a plugin to load " + extension + " files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: http://doc.babylonjs.com/how_to/load_from_any_file_type");
             return SceneLoader._getDefaultPlugin();
         };
         SceneLoader._getPluginForDirectLoad = function (data) {
@@ -67671,8 +67740,8 @@ var BABYLON;
         /**
          * Import meshes into a scene
          * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
-         * @param rootUrl a string that defines the root url for scene and resources
-         * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+         * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+         * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
          * @param scene the instance of BABYLON.Scene to append to
          * @param onSuccess a callback with a list of imported meshes, particleSystems, and skeletons when import succeeds
          * @param onProgress a callback with a progress event for each file being loaded
@@ -67681,10 +67750,20 @@ var BABYLON;
          * @returns The loaded plugin
          */
         SceneLoader.ImportMesh = function (meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
+            if (!scene) {
+                BABYLON.Tools.Error("No scene available to import mesh to");
+                return null;
+            }
+            if (!sceneFilename) {
+                sceneFilename = BABYLON.Tools.GetFilename(rootUrl);
+                rootUrl = BABYLON.Tools.GetFolderPath(rootUrl);
+            }
             if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
                 BABYLON.Tools.Error("Wrong sceneFilename parameter");
                 return null;
@@ -67759,14 +67838,16 @@ var BABYLON;
         /**
         * Import meshes into a scene
         * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene the instance of BABYLON.Scene to append to
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
         * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups
         */
         SceneLoader.ImportMeshAsync = function (meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onProgress === void 0) { onProgress = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
             return new Promise(function (resolve, reject) {
@@ -67784,8 +67865,8 @@ var BABYLON;
         };
         /**
         * Load a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param engine is the instance of BABYLON.Engine to use to create the scene
         * @param onSuccess a callback with the scene when import succeeds
         * @param onProgress a callback with a progress event for each file being loaded
@@ -67802,8 +67883,8 @@ var BABYLON;
         };
         /**
         * Load a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param engine is the instance of BABYLON.Engine to use to create the scene
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
@@ -67822,8 +67903,8 @@ var BABYLON;
         };
         /**
         * Append a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene is the instance of BABYLON.Scene to append to
         * @param onSuccess a callback with the scene when import succeeds
         * @param onProgress a callback with a progress event for each file being loaded
@@ -67832,10 +67913,20 @@ var BABYLON;
         * @returns The loaded plugin
         */
         SceneLoader.Append = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
+            if (!scene) {
+                BABYLON.Tools.Error("No scene available to append to");
+                return null;
+            }
+            if (!sceneFilename) {
+                sceneFilename = BABYLON.Tools.GetFilename(rootUrl);
+                rootUrl = BABYLON.Tools.GetFolderPath(rootUrl);
+            }
             if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
                 BABYLON.Tools.Error("Wrong sceneFilename parameter");
                 return null;
@@ -67909,14 +68000,16 @@ var BABYLON;
         };
         /**
         * Append a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene is the instance of BABYLON.Scene to append to
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
         * @returns The given scene
         */
         SceneLoader.AppendAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onProgress === void 0) { onProgress = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
             return new Promise(function (resolve, reject) {
@@ -67929,9 +68022,9 @@ var BABYLON;
         };
         /**
         * Load a scene into an asset container
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param scene is the instance of BABYLON.Scene to append to
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
+        * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
         * @param onSuccess a callback with the scene when import succeeds
         * @param onProgress a callback with a progress event for each file being loaded
         * @param onError a callback with the scene, a message, and possibly an exception when import fails
@@ -67939,10 +68032,20 @@ var BABYLON;
         * @returns The loaded plugin
         */
         SceneLoader.LoadAssetContainer = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
+            if (!scene) {
+                BABYLON.Tools.Error("No scene available to load asset container to");
+                return null;
+            }
+            if (!sceneFilename) {
+                sceneFilename = BABYLON.Tools.GetFilename(rootUrl);
+                rootUrl = BABYLON.Tools.GetFolderPath(rootUrl);
+            }
             if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
                 BABYLON.Tools.Error("Wrong sceneFilename parameter");
                 return null;
@@ -68013,14 +68116,16 @@ var BABYLON;
         };
         /**
         * Load a scene into an asset container
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene is the instance of BABYLON.Scene to append to
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
         * @returns The loaded asset container
         */
         SceneLoader.LoadAssetContainerAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onProgress === void 0) { onProgress = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
             return new Promise(function (resolve, reject) {
@@ -98641,6 +98746,113 @@ var BABYLON;
 
 //# sourceMappingURL=babylon.environmentHelper.js.map
 
+var BABYLON;
+(function (BABYLON) {
+    /**
+     * This class is made for on one-liner static method to help creating particle systems.
+     */
+    var ParticleHelper = /** @class */ (function () {
+        function ParticleHelper() {
+        }
+        /**
+         * This is the main static method (one-liner) of this helper to create different particle systems.
+         * @param type This string represents the type to the particle system to create
+         * @param emitter The object where the particle system will start to emit from.
+         * @param scene The scene where the particle system should live.
+         * @param gpu If the system will use gpu.
+         * @returns the ParticleSystem created.
+         */
+        ParticleHelper.CreateAsync = function (type, emitter, scene, gpu) {
+            var _this = this;
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
+            if (gpu === void 0) { gpu = false; }
+            return new Promise(function (resolve, reject) {
+                if (scene) {
+                    _this._scene = scene;
+                }
+                else {
+                    return reject("A particle system need a scene.");
+                }
+                if (gpu && !BABYLON.GPUParticleSystem.IsSupported) {
+                    return reject("Particle system with GPU is not supported.");
+                }
+                _this._emitter = emitter;
+                BABYLON.Tools.LoadFile(_this._baseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
+                    var newData = JSON.parse(data.toString());
+                    return resolve(_this._createSystem(newData));
+                }, undefined, undefined, undefined, function (req, exception) {
+                    return reject("An error occured while the creation of your particle system. Check if your type '" + type + "' exists.");
+                });
+            });
+        };
+        ParticleHelper._createSystem = function (data) {
+            // Create a particle system
+            var system = new BABYLON.ParticleSystem(data.type, data.capacity, this._scene);
+            // Texture of each particle
+            system.particleTexture = new BABYLON.Texture(this._baseAssetsUrl + "/textures/" + data.textureFile, this._scene);
+            // Where the particles come from
+            system.emitter = this._emitter; // the starting object, the emitter
+            // Colors of all particles
+            system.color1 = new BABYLON.Color4(data.color1.r, data.color1.g, data.color1.b, data.color1.a);
+            system.color2 = new BABYLON.Color4(data.color2.r, data.color2.g, data.color2.b, data.color2.a);
+            system.colorDead = new BABYLON.Color4(data.colorDead.r, data.colorDead.g, data.colorDead.b, data.colorDead.a);
+            // Size of each particle (random between...
+            system.minSize = data.minSize;
+            system.maxSize = data.maxSize;
+            // Life time of each particle (random between...
+            system.minLifeTime = data.minLifeTime;
+            system.maxLifeTime = data.maxLifeTime;
+            // Emission rate
+            system.emitRate = data.emitRate;
+            // Blend mode : BLENDMODE_ONEONE, or BLENDMODE_STANDARD
+            system.blendMode = data.blendMode;
+            // Set the gravity of all particles
+            system.gravity = new BABYLON.Vector3(data.gravity.x, data.gravity.y, data.gravity.z);
+            // Angular speed, in radians
+            system.minAngularSpeed = data.minAngularSpeed;
+            system.maxAngularSpeed = data.maxAngularSpeed;
+            // Speed
+            system.minEmitPower = data.minEmitPower;
+            system.maxEmitPower = data.maxEmitPower;
+            system.updateSpeed = data.updateSpeed;
+            switch (data.emitterType) {
+                case "box":
+                    if (!data.direction1 || !data.direction2) {
+                        throw new Error("Directions are missing in this particle system.");
+                    }
+                    if (!data.minEmitBox || !data.maxEmitBox) {
+                        throw new Error("EmitBox is missing in this particle system.");
+                    }
+                    system.createBoxEmitter(new BABYLON.Vector3(data.direction1.x, data.direction1.y, data.direction1.z), new BABYLON.Vector3(data.direction2.x, data.direction2.y, data.direction2.z), new BABYLON.Vector3(data.minEmitBox.x, data.minEmitBox.y, data.minEmitBox.z), new BABYLON.Vector3(data.maxEmitBox.x, data.maxEmitBox.y, data.maxEmitBox.z));
+                    break;
+                case "sphere":
+                    system.createSphereEmitter(data.radius);
+                    break;
+                case "directed_sphere":
+                    if (!data.direction1 || !data.direction2) {
+                        throw new Error("Directions are missing in this particle system.");
+                    }
+                    system.createDirectedSphereEmitter(data.radius, new BABYLON.Vector3(data.direction1.x, data.direction1.y, data.direction1.z), new BABYLON.Vector3(data.direction2.x, data.direction2.y, data.direction2.z));
+                    break;
+                case "cone":
+                    system.createConeEmitter(data.radius, data.angle);
+                    break;
+                default:
+                    break;
+            }
+            return system;
+        };
+        /**
+         * Base Assets URL.
+         */
+        ParticleHelper._baseAssetsUrl = "https://assets.babylonjs.com/particles";
+        return ParticleHelper;
+    }());
+    BABYLON.ParticleHelper = ParticleHelper;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.particleHelper.js.map
+
 
 var BABYLON;
 (function (BABYLON) {

+ 237 - 25
dist/preview release/babylon.no-module.max.js

@@ -15178,6 +15178,7 @@ var BABYLON;
             gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
             gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), width, height, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);
             // Create the framebuffer
+            var currentFrameBuffer = this._currentFramebuffer;
             var framebuffer = gl.createFramebuffer();
             this.bindUnboundFramebuffer(framebuffer);
             gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, 0);
@@ -15188,7 +15189,7 @@ var BABYLON;
             // Unbind
             this._bindTextureDirectly(gl.TEXTURE_2D, null);
             gl.bindRenderbuffer(gl.RENDERBUFFER, null);
-            this.bindUnboundFramebuffer(null);
+            this.bindUnboundFramebuffer(currentFrameBuffer);
             texture._framebuffer = framebuffer;
             texture.baseWidth = width;
             texture.baseHeight = height;
@@ -26216,8 +26217,11 @@ var BABYLON;
         /**
          * Add a mesh to the list of scene's meshes
          * @param newMesh defines the mesh to add
+         * @param recursive if all child meshes should also be added to the scene
          */
-        Scene.prototype.addMesh = function (newMesh) {
+        Scene.prototype.addMesh = function (newMesh, recursive) {
+            var _this = this;
+            if (recursive === void 0) { recursive = false; }
             this.meshes.push(newMesh);
             //notify the collision coordinator
             if (this.collisionCoordinator) {
@@ -26225,6 +26229,11 @@ var BABYLON;
             }
             newMesh._resyncLightSources();
             this.onNewMeshAddedObservable.notifyObservers(newMesh);
+            if (recursive) {
+                newMesh.getChildMeshes().forEach(function (m) {
+                    _this.addMesh(m);
+                });
+            }
         };
         /**
            * Remove a mesh for the list of scene's meshes
@@ -27791,7 +27800,7 @@ var BABYLON;
                 for (var lightIndex = 0; lightIndex < this.lights.length; lightIndex++) {
                     var light = this.lights[lightIndex];
                     var shadowGenerator = light.getShadowGenerator();
-                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator) {
+                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator && shadowGenerator.arePostProcessesReady()) {
                         var shadowMap = (shadowGenerator.getShadowMap());
                         if (this.textures.indexOf(shadowMap) !== -1) {
                             this._renderTargets.push(shadowMap);
@@ -29304,6 +29313,20 @@ var BABYLON;
             this._moveAssets(this.scene.effectLayers, this.effectLayers, keepAssets.effectLayers);
             this.removeAllFromScene();
         };
+        /**
+         * Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.
+         * @returns the root mesh
+         */
+        AssetContainer.prototype.createRootMesh = function () {
+            var rootMesh = new BABYLON.Mesh("assetContainerRootMesh", this.scene);
+            this.meshes.forEach(function (m) {
+                if (!m.parent) {
+                    rootMesh.addChild(m);
+                }
+            });
+            this.meshes.unshift(rootMesh);
+            return rootMesh;
+        };
         return AssetContainer;
     }());
     BABYLON.AssetContainer = AssetContainer;
@@ -50907,7 +50930,7 @@ var BABYLON;
             return node.getScene().beginAnimation(node, 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);
         };
         /**
-         * Transition property of the Camera to the target Value
+         * Transition property of an host to the target Value
          * @param property The property to transition
          * @param targetValue The target Value of the property
          * @param host The object where the property to animate belongs
@@ -62288,6 +62311,41 @@ var BABYLON;
 (function (BABYLON) {
     /**
      * Draco compression (https://google.github.io/draco/)
+     *
+     * This class wraps the Draco module.
+     *
+     * **Encoder**
+     *
+     * The encoder is not currently implemented.
+     *
+     * **Decoder**
+     *
+     * By default, the configuration points to a copy of the Draco decoder files for glTF from https://preview.babylonjs.com.
+     *
+     * To update the configuration, use the following code:
+     * ```javascript
+     *     BABYLON.DracoCompression.Configuration = {
+     *         decoder: {
+     *             wasmUrl: "<url to the WebAssembly library>",
+     *             wasmBinaryUrl: "<url to the WebAssembly binary>",
+     *             fallbackUrl: "<url to the fallback JavaScript library>",
+     *         }
+     *     };
+     * ```
+     *
+     * Draco has two versions, one for WebAssembly and one for JavaScript. The decoder configuration can be set to only support Webssembly or only support the JavaScript version.
+     * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.
+     * Use `BABYLON.DracoCompression.DecoderAvailable` to determine if the decoder is available for the current session.
+     *
+     * To decode Draco compressed data, create a DracoCompression object and call decodeMeshAsync:
+     * ```javascript
+     *     var dracoCompression = new BABYLON.DracoCompression();
+     *     var vertexData = await dracoCompression.decodeMeshAsync(data, {
+     *         [BABYLON.VertexBuffer.PositionKind]: 0
+     *     });
+     * ```
+     *
+     * @see https://www.babylonjs-playground.com/#N3EK4B#0
      */
     var DracoCompression = /** @class */ (function () {
         /**
@@ -62324,16 +62382,17 @@ var BABYLON;
         };
         /**
          * Decode Draco compressed mesh data to vertex data.
-         * @param data The array buffer view for the Draco compression data
+         * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data
          * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids
          * @returns A promise that resolves with the decoded vertex data
          */
         DracoCompression.prototype.decodeMeshAsync = function (data, attributes) {
+            var dataView = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
             return DracoCompression._GetDecoderModule().then(function (wrappedModule) {
                 var module = wrappedModule.module;
                 var vertexData = new BABYLON.VertexData();
                 var buffer = new module.DecoderBuffer();
-                buffer.Init(data, data.byteLength);
+                buffer.Init(dataView, dataView.byteLength);
                 var decoder = new module.Decoder();
                 var geometry;
                 var status;
@@ -62457,7 +62516,10 @@ var BABYLON;
             });
         };
         /**
-         * The configuration.
+         * The configuration. Defaults to the following urls:
+         * - wasmUrl: "https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js"
+         * - wasmBinaryUrl: "https://preview.babylonjs.com/draco_decoder_gltf.wasm"
+         * - fallbackUrl: "https://preview.babylonjs.com/draco_decoder_gltf.js"
          */
         DracoCompression.Configuration = {
             decoder: {
@@ -66884,6 +66946,13 @@ var BABYLON;
                     this._initializeBlurRTTAndPostProcesses();
                 }
             }
+            return this.arePostProcessesReady();
+        };
+        /**
+         * Returns true if all post processes required to render the shadow map are ready
+         * @returns true if the shadow map can be rendered with all post-processes
+         */
+        ShadowGenerator.prototype.arePostProcessesReady = function () {
             if (this._kernelBlurXPostprocess && !this._kernelBlurXPostprocess.isReady()) {
                 return false;
             }
@@ -67492,7 +67561,7 @@ var BABYLON;
             if (registeredPlugin) {
                 return registeredPlugin;
             }
-            BABYLON.Tools.Warn("Unable to find a plugin to load " + extension + " files. Trying to use .babylon default plugin.");
+            BABYLON.Tools.Warn("Unable to find a plugin to load " + extension + " files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: http://doc.babylonjs.com/how_to/load_from_any_file_type");
             return SceneLoader._getDefaultPlugin();
         };
         SceneLoader._getPluginForDirectLoad = function (data) {
@@ -67638,8 +67707,8 @@ var BABYLON;
         /**
          * Import meshes into a scene
          * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
-         * @param rootUrl a string that defines the root url for scene and resources
-         * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+         * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+         * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
          * @param scene the instance of BABYLON.Scene to append to
          * @param onSuccess a callback with a list of imported meshes, particleSystems, and skeletons when import succeeds
          * @param onProgress a callback with a progress event for each file being loaded
@@ -67648,10 +67717,20 @@ var BABYLON;
          * @returns The loaded plugin
          */
         SceneLoader.ImportMesh = function (meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
+            if (!scene) {
+                BABYLON.Tools.Error("No scene available to import mesh to");
+                return null;
+            }
+            if (!sceneFilename) {
+                sceneFilename = BABYLON.Tools.GetFilename(rootUrl);
+                rootUrl = BABYLON.Tools.GetFolderPath(rootUrl);
+            }
             if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
                 BABYLON.Tools.Error("Wrong sceneFilename parameter");
                 return null;
@@ -67726,14 +67805,16 @@ var BABYLON;
         /**
         * Import meshes into a scene
         * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene the instance of BABYLON.Scene to append to
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
         * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups
         */
         SceneLoader.ImportMeshAsync = function (meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onProgress === void 0) { onProgress = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
             return new Promise(function (resolve, reject) {
@@ -67751,8 +67832,8 @@ var BABYLON;
         };
         /**
         * Load a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param engine is the instance of BABYLON.Engine to use to create the scene
         * @param onSuccess a callback with the scene when import succeeds
         * @param onProgress a callback with a progress event for each file being loaded
@@ -67769,8 +67850,8 @@ var BABYLON;
         };
         /**
         * Load a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param engine is the instance of BABYLON.Engine to use to create the scene
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
@@ -67789,8 +67870,8 @@ var BABYLON;
         };
         /**
         * Append a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene is the instance of BABYLON.Scene to append to
         * @param onSuccess a callback with the scene when import succeeds
         * @param onProgress a callback with a progress event for each file being loaded
@@ -67799,10 +67880,20 @@ var BABYLON;
         * @returns The loaded plugin
         */
         SceneLoader.Append = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
+            if (!scene) {
+                BABYLON.Tools.Error("No scene available to append to");
+                return null;
+            }
+            if (!sceneFilename) {
+                sceneFilename = BABYLON.Tools.GetFilename(rootUrl);
+                rootUrl = BABYLON.Tools.GetFolderPath(rootUrl);
+            }
             if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
                 BABYLON.Tools.Error("Wrong sceneFilename parameter");
                 return null;
@@ -67876,14 +67967,16 @@ var BABYLON;
         };
         /**
         * Append a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene is the instance of BABYLON.Scene to append to
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
         * @returns The given scene
         */
         SceneLoader.AppendAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onProgress === void 0) { onProgress = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
             return new Promise(function (resolve, reject) {
@@ -67896,9 +67989,9 @@ var BABYLON;
         };
         /**
         * Load a scene into an asset container
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param scene is the instance of BABYLON.Scene to append to
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
+        * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
         * @param onSuccess a callback with the scene when import succeeds
         * @param onProgress a callback with a progress event for each file being loaded
         * @param onError a callback with the scene, a message, and possibly an exception when import fails
@@ -67906,10 +67999,20 @@ var BABYLON;
         * @returns The loaded plugin
         */
         SceneLoader.LoadAssetContainer = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
+            if (!scene) {
+                BABYLON.Tools.Error("No scene available to load asset container to");
+                return null;
+            }
+            if (!sceneFilename) {
+                sceneFilename = BABYLON.Tools.GetFilename(rootUrl);
+                rootUrl = BABYLON.Tools.GetFolderPath(rootUrl);
+            }
             if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
                 BABYLON.Tools.Error("Wrong sceneFilename parameter");
                 return null;
@@ -67980,14 +68083,16 @@ var BABYLON;
         };
         /**
         * Load a scene into an asset container
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene is the instance of BABYLON.Scene to append to
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
         * @returns The loaded asset container
         */
         SceneLoader.LoadAssetContainerAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onProgress === void 0) { onProgress = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
             return new Promise(function (resolve, reject) {
@@ -98608,6 +98713,113 @@ var BABYLON;
 
 //# sourceMappingURL=babylon.environmentHelper.js.map
 
+var BABYLON;
+(function (BABYLON) {
+    /**
+     * This class is made for on one-liner static method to help creating particle systems.
+     */
+    var ParticleHelper = /** @class */ (function () {
+        function ParticleHelper() {
+        }
+        /**
+         * This is the main static method (one-liner) of this helper to create different particle systems.
+         * @param type This string represents the type to the particle system to create
+         * @param emitter The object where the particle system will start to emit from.
+         * @param scene The scene where the particle system should live.
+         * @param gpu If the system will use gpu.
+         * @returns the ParticleSystem created.
+         */
+        ParticleHelper.CreateAsync = function (type, emitter, scene, gpu) {
+            var _this = this;
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
+            if (gpu === void 0) { gpu = false; }
+            return new Promise(function (resolve, reject) {
+                if (scene) {
+                    _this._scene = scene;
+                }
+                else {
+                    return reject("A particle system need a scene.");
+                }
+                if (gpu && !BABYLON.GPUParticleSystem.IsSupported) {
+                    return reject("Particle system with GPU is not supported.");
+                }
+                _this._emitter = emitter;
+                BABYLON.Tools.LoadFile(_this._baseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
+                    var newData = JSON.parse(data.toString());
+                    return resolve(_this._createSystem(newData));
+                }, undefined, undefined, undefined, function (req, exception) {
+                    return reject("An error occured while the creation of your particle system. Check if your type '" + type + "' exists.");
+                });
+            });
+        };
+        ParticleHelper._createSystem = function (data) {
+            // Create a particle system
+            var system = new BABYLON.ParticleSystem(data.type, data.capacity, this._scene);
+            // Texture of each particle
+            system.particleTexture = new BABYLON.Texture(this._baseAssetsUrl + "/textures/" + data.textureFile, this._scene);
+            // Where the particles come from
+            system.emitter = this._emitter; // the starting object, the emitter
+            // Colors of all particles
+            system.color1 = new BABYLON.Color4(data.color1.r, data.color1.g, data.color1.b, data.color1.a);
+            system.color2 = new BABYLON.Color4(data.color2.r, data.color2.g, data.color2.b, data.color2.a);
+            system.colorDead = new BABYLON.Color4(data.colorDead.r, data.colorDead.g, data.colorDead.b, data.colorDead.a);
+            // Size of each particle (random between...
+            system.minSize = data.minSize;
+            system.maxSize = data.maxSize;
+            // Life time of each particle (random between...
+            system.minLifeTime = data.minLifeTime;
+            system.maxLifeTime = data.maxLifeTime;
+            // Emission rate
+            system.emitRate = data.emitRate;
+            // Blend mode : BLENDMODE_ONEONE, or BLENDMODE_STANDARD
+            system.blendMode = data.blendMode;
+            // Set the gravity of all particles
+            system.gravity = new BABYLON.Vector3(data.gravity.x, data.gravity.y, data.gravity.z);
+            // Angular speed, in radians
+            system.minAngularSpeed = data.minAngularSpeed;
+            system.maxAngularSpeed = data.maxAngularSpeed;
+            // Speed
+            system.minEmitPower = data.minEmitPower;
+            system.maxEmitPower = data.maxEmitPower;
+            system.updateSpeed = data.updateSpeed;
+            switch (data.emitterType) {
+                case "box":
+                    if (!data.direction1 || !data.direction2) {
+                        throw new Error("Directions are missing in this particle system.");
+                    }
+                    if (!data.minEmitBox || !data.maxEmitBox) {
+                        throw new Error("EmitBox is missing in this particle system.");
+                    }
+                    system.createBoxEmitter(new BABYLON.Vector3(data.direction1.x, data.direction1.y, data.direction1.z), new BABYLON.Vector3(data.direction2.x, data.direction2.y, data.direction2.z), new BABYLON.Vector3(data.minEmitBox.x, data.minEmitBox.y, data.minEmitBox.z), new BABYLON.Vector3(data.maxEmitBox.x, data.maxEmitBox.y, data.maxEmitBox.z));
+                    break;
+                case "sphere":
+                    system.createSphereEmitter(data.radius);
+                    break;
+                case "directed_sphere":
+                    if (!data.direction1 || !data.direction2) {
+                        throw new Error("Directions are missing in this particle system.");
+                    }
+                    system.createDirectedSphereEmitter(data.radius, new BABYLON.Vector3(data.direction1.x, data.direction1.y, data.direction1.z), new BABYLON.Vector3(data.direction2.x, data.direction2.y, data.direction2.z));
+                    break;
+                case "cone":
+                    system.createConeEmitter(data.radius, data.angle);
+                    break;
+                default:
+                    break;
+            }
+            return system;
+        };
+        /**
+         * Base Assets URL.
+         */
+        ParticleHelper._baseAssetsUrl = "https://assets.babylonjs.com/particles";
+        return ParticleHelper;
+    }());
+    BABYLON.ParticleHelper = ParticleHelper;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.particleHelper.js.map
+
 
 var BABYLON;
 (function (BABYLON) {

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 35 - 35
dist/preview release/babylon.worker.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 239 - 27
dist/preview release/es6.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 3 - 3
dist/preview release/inspector/babylon.inspector.bundle.js


+ 3 - 0
dist/preview release/inspector/babylon.inspector.d.ts

@@ -1011,8 +1011,11 @@ declare module INSPECTOR {
         private _engine;
         private _glInfo;
         private _updateLoopHandler;
+        private _refreshRateCounter;
+        private refreshRate;
         private _sceneInstrumentation;
         private _engineInstrumentation;
+        private _inputElement;
         private _connectToInstrumentation();
         constructor(tabbar: TabBar, insp: Inspector);
         private _createStatLabel(content, parent);

+ 25 - 4
dist/preview release/inspector/babylon.inspector.js

@@ -3723,6 +3723,8 @@ var INSPECTOR;
             title.appendChild(versionSpan);
             title.appendChild(fpsSpan);
             _this._updateLoopHandler = _this._update.bind(_this);
+            _this._refreshRateCounter = 0;
+            _this.refreshRate = 4;
             // Count block
             title = INSPECTOR.Helpers.CreateDiv('stat-title2', _this._panel);
             title.textContent = "Count";
@@ -3797,8 +3799,16 @@ var INSPECTOR;
             title = INSPECTOR.Helpers.CreateDiv('stat-title2', _this._panel);
             title.textContent = "Duration";
             {
-                _this._createStatLabel("Meshes selection", _this._panel);
+                _this._createStatLabel("Refresh rate (refresh by second)", _this._panel);
                 var elemValue = INSPECTOR.Helpers.CreateDiv('stat-value', _this._panel);
+                _this._inputElement = INSPECTOR.Inspector.DOCUMENT.createElement('input');
+                _this._inputElement.value = _this.refreshRate;
+                elemValue.appendChild(_this._inputElement);
+                _this._inputElement.addEventListener('keyup', function (evt) {
+                    _this.refreshRate = _this._inputElement.value;
+                });
+                _this._createStatLabel("Meshes selection", _this._panel);
+                elemValue = INSPECTOR.Helpers.CreateDiv('stat-value', _this._panel);
                 _this._updatableProperties.push({
                     elem: elemValue,
                     updateFct: function () { return BABYLON.Tools.Format(_this._sceneInstrumentation.activeMeshesEvaluationTimeCounter.current); }
@@ -4003,9 +4013,20 @@ var INSPECTOR;
         };
         /** Update each properties of the stats panel */
         StatsTab.prototype._update = function () {
-            for (var _i = 0, _a = this._updatableProperties; _i < _a.length; _i++) {
-                var prop = _a[_i];
-                prop.elem.textContent = prop.updateFct();
+            if (this._refreshRateCounter > 1) {
+                this._refreshRateCounter--;
+            }
+            else {
+                for (var _i = 0, _a = this._updatableProperties; _i < _a.length; _i++) {
+                    var prop = _a[_i];
+                    prop.elem.textContent = prop.updateFct();
+                }
+                if (this._inspector.scene.getEngine().getFps() / this.refreshRate == Infinity) {
+                    this._refreshRateCounter = 1;
+                }
+                else {
+                    this._refreshRateCounter = this._inspector.scene.getEngine().getFps() / this.refreshRate;
+                }
             }
         };
         StatsTab.prototype.dispose = function () {

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 2 - 2
dist/preview release/inspector/babylon.inspector.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 45 - 45
dist/preview release/viewer/babylon.viewer.js


+ 237 - 25
dist/preview release/viewer/babylon.viewer.max.js

@@ -15299,6 +15299,7 @@ var BABYLON;
             gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
             gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), width, height, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);
             // Create the framebuffer
+            var currentFrameBuffer = this._currentFramebuffer;
             var framebuffer = gl.createFramebuffer();
             this.bindUnboundFramebuffer(framebuffer);
             gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, 0);
@@ -15309,7 +15310,7 @@ var BABYLON;
             // Unbind
             this._bindTextureDirectly(gl.TEXTURE_2D, null);
             gl.bindRenderbuffer(gl.RENDERBUFFER, null);
-            this.bindUnboundFramebuffer(null);
+            this.bindUnboundFramebuffer(currentFrameBuffer);
             texture._framebuffer = framebuffer;
             texture.baseWidth = width;
             texture.baseHeight = height;
@@ -26337,8 +26338,11 @@ var BABYLON;
         /**
          * Add a mesh to the list of scene's meshes
          * @param newMesh defines the mesh to add
+         * @param recursive if all child meshes should also be added to the scene
          */
-        Scene.prototype.addMesh = function (newMesh) {
+        Scene.prototype.addMesh = function (newMesh, recursive) {
+            var _this = this;
+            if (recursive === void 0) { recursive = false; }
             this.meshes.push(newMesh);
             //notify the collision coordinator
             if (this.collisionCoordinator) {
@@ -26346,6 +26350,11 @@ var BABYLON;
             }
             newMesh._resyncLightSources();
             this.onNewMeshAddedObservable.notifyObservers(newMesh);
+            if (recursive) {
+                newMesh.getChildMeshes().forEach(function (m) {
+                    _this.addMesh(m);
+                });
+            }
         };
         /**
            * Remove a mesh for the list of scene's meshes
@@ -27912,7 +27921,7 @@ var BABYLON;
                 for (var lightIndex = 0; lightIndex < this.lights.length; lightIndex++) {
                     var light = this.lights[lightIndex];
                     var shadowGenerator = light.getShadowGenerator();
-                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator) {
+                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator && shadowGenerator.arePostProcessesReady()) {
                         var shadowMap = (shadowGenerator.getShadowMap());
                         if (this.textures.indexOf(shadowMap) !== -1) {
                             this._renderTargets.push(shadowMap);
@@ -29425,6 +29434,20 @@ var BABYLON;
             this._moveAssets(this.scene.effectLayers, this.effectLayers, keepAssets.effectLayers);
             this.removeAllFromScene();
         };
+        /**
+         * Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.
+         * @returns the root mesh
+         */
+        AssetContainer.prototype.createRootMesh = function () {
+            var rootMesh = new BABYLON.Mesh("assetContainerRootMesh", this.scene);
+            this.meshes.forEach(function (m) {
+                if (!m.parent) {
+                    rootMesh.addChild(m);
+                }
+            });
+            this.meshes.unshift(rootMesh);
+            return rootMesh;
+        };
         return AssetContainer;
     }());
     BABYLON.AssetContainer = AssetContainer;
@@ -51028,7 +51051,7 @@ var BABYLON;
             return node.getScene().beginAnimation(node, 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);
         };
         /**
-         * Transition property of the Camera to the target Value
+         * Transition property of an host to the target Value
          * @param property The property to transition
          * @param targetValue The target Value of the property
          * @param host The object where the property to animate belongs
@@ -62409,6 +62432,41 @@ var BABYLON;
 (function (BABYLON) {
     /**
      * Draco compression (https://google.github.io/draco/)
+     *
+     * This class wraps the Draco module.
+     *
+     * **Encoder**
+     *
+     * The encoder is not currently implemented.
+     *
+     * **Decoder**
+     *
+     * By default, the configuration points to a copy of the Draco decoder files for glTF from https://preview.babylonjs.com.
+     *
+     * To update the configuration, use the following code:
+     * ```javascript
+     *     BABYLON.DracoCompression.Configuration = {
+     *         decoder: {
+     *             wasmUrl: "<url to the WebAssembly library>",
+     *             wasmBinaryUrl: "<url to the WebAssembly binary>",
+     *             fallbackUrl: "<url to the fallback JavaScript library>",
+     *         }
+     *     };
+     * ```
+     *
+     * Draco has two versions, one for WebAssembly and one for JavaScript. The decoder configuration can be set to only support Webssembly or only support the JavaScript version.
+     * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.
+     * Use `BABYLON.DracoCompression.DecoderAvailable` to determine if the decoder is available for the current session.
+     *
+     * To decode Draco compressed data, create a DracoCompression object and call decodeMeshAsync:
+     * ```javascript
+     *     var dracoCompression = new BABYLON.DracoCompression();
+     *     var vertexData = await dracoCompression.decodeMeshAsync(data, {
+     *         [BABYLON.VertexBuffer.PositionKind]: 0
+     *     });
+     * ```
+     *
+     * @see https://www.babylonjs-playground.com/#N3EK4B#0
      */
     var DracoCompression = /** @class */ (function () {
         /**
@@ -62445,16 +62503,17 @@ var BABYLON;
         };
         /**
          * Decode Draco compressed mesh data to vertex data.
-         * @param data The array buffer view for the Draco compression data
+         * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data
          * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids
          * @returns A promise that resolves with the decoded vertex data
          */
         DracoCompression.prototype.decodeMeshAsync = function (data, attributes) {
+            var dataView = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
             return DracoCompression._GetDecoderModule().then(function (wrappedModule) {
                 var module = wrappedModule.module;
                 var vertexData = new BABYLON.VertexData();
                 var buffer = new module.DecoderBuffer();
-                buffer.Init(data, data.byteLength);
+                buffer.Init(dataView, dataView.byteLength);
                 var decoder = new module.Decoder();
                 var geometry;
                 var status;
@@ -62578,7 +62637,10 @@ var BABYLON;
             });
         };
         /**
-         * The configuration.
+         * The configuration. Defaults to the following urls:
+         * - wasmUrl: "https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js"
+         * - wasmBinaryUrl: "https://preview.babylonjs.com/draco_decoder_gltf.wasm"
+         * - fallbackUrl: "https://preview.babylonjs.com/draco_decoder_gltf.js"
          */
         DracoCompression.Configuration = {
             decoder: {
@@ -67005,6 +67067,13 @@ var BABYLON;
                     this._initializeBlurRTTAndPostProcesses();
                 }
             }
+            return this.arePostProcessesReady();
+        };
+        /**
+         * Returns true if all post processes required to render the shadow map are ready
+         * @returns true if the shadow map can be rendered with all post-processes
+         */
+        ShadowGenerator.prototype.arePostProcessesReady = function () {
             if (this._kernelBlurXPostprocess && !this._kernelBlurXPostprocess.isReady()) {
                 return false;
             }
@@ -67613,7 +67682,7 @@ var BABYLON;
             if (registeredPlugin) {
                 return registeredPlugin;
             }
-            BABYLON.Tools.Warn("Unable to find a plugin to load " + extension + " files. Trying to use .babylon default plugin.");
+            BABYLON.Tools.Warn("Unable to find a plugin to load " + extension + " files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: http://doc.babylonjs.com/how_to/load_from_any_file_type");
             return SceneLoader._getDefaultPlugin();
         };
         SceneLoader._getPluginForDirectLoad = function (data) {
@@ -67759,8 +67828,8 @@ var BABYLON;
         /**
          * Import meshes into a scene
          * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
-         * @param rootUrl a string that defines the root url for scene and resources
-         * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+         * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+         * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
          * @param scene the instance of BABYLON.Scene to append to
          * @param onSuccess a callback with a list of imported meshes, particleSystems, and skeletons when import succeeds
          * @param onProgress a callback with a progress event for each file being loaded
@@ -67769,10 +67838,20 @@ var BABYLON;
          * @returns The loaded plugin
          */
         SceneLoader.ImportMesh = function (meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
+            if (!scene) {
+                BABYLON.Tools.Error("No scene available to import mesh to");
+                return null;
+            }
+            if (!sceneFilename) {
+                sceneFilename = BABYLON.Tools.GetFilename(rootUrl);
+                rootUrl = BABYLON.Tools.GetFolderPath(rootUrl);
+            }
             if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
                 BABYLON.Tools.Error("Wrong sceneFilename parameter");
                 return null;
@@ -67847,14 +67926,16 @@ var BABYLON;
         /**
         * Import meshes into a scene
         * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene the instance of BABYLON.Scene to append to
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
         * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups
         */
         SceneLoader.ImportMeshAsync = function (meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onProgress === void 0) { onProgress = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
             return new Promise(function (resolve, reject) {
@@ -67872,8 +67953,8 @@ var BABYLON;
         };
         /**
         * Load a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param engine is the instance of BABYLON.Engine to use to create the scene
         * @param onSuccess a callback with the scene when import succeeds
         * @param onProgress a callback with a progress event for each file being loaded
@@ -67890,8 +67971,8 @@ var BABYLON;
         };
         /**
         * Load a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param engine is the instance of BABYLON.Engine to use to create the scene
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
@@ -67910,8 +67991,8 @@ var BABYLON;
         };
         /**
         * Append a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene is the instance of BABYLON.Scene to append to
         * @param onSuccess a callback with the scene when import succeeds
         * @param onProgress a callback with a progress event for each file being loaded
@@ -67920,10 +68001,20 @@ var BABYLON;
         * @returns The loaded plugin
         */
         SceneLoader.Append = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
+            if (!scene) {
+                BABYLON.Tools.Error("No scene available to append to");
+                return null;
+            }
+            if (!sceneFilename) {
+                sceneFilename = BABYLON.Tools.GetFilename(rootUrl);
+                rootUrl = BABYLON.Tools.GetFolderPath(rootUrl);
+            }
             if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
                 BABYLON.Tools.Error("Wrong sceneFilename parameter");
                 return null;
@@ -67997,14 +68088,16 @@ var BABYLON;
         };
         /**
         * Append a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene is the instance of BABYLON.Scene to append to
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
         * @returns The given scene
         */
         SceneLoader.AppendAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onProgress === void 0) { onProgress = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
             return new Promise(function (resolve, reject) {
@@ -68017,9 +68110,9 @@ var BABYLON;
         };
         /**
         * Load a scene into an asset container
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param scene is the instance of BABYLON.Scene to append to
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
+        * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
         * @param onSuccess a callback with the scene when import succeeds
         * @param onProgress a callback with a progress event for each file being loaded
         * @param onError a callback with the scene, a message, and possibly an exception when import fails
@@ -68027,10 +68120,20 @@ var BABYLON;
         * @returns The loaded plugin
         */
         SceneLoader.LoadAssetContainer = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
+            if (!scene) {
+                BABYLON.Tools.Error("No scene available to load asset container to");
+                return null;
+            }
+            if (!sceneFilename) {
+                sceneFilename = BABYLON.Tools.GetFilename(rootUrl);
+                rootUrl = BABYLON.Tools.GetFolderPath(rootUrl);
+            }
             if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
                 BABYLON.Tools.Error("Wrong sceneFilename parameter");
                 return null;
@@ -68101,14 +68204,16 @@ var BABYLON;
         };
         /**
         * Load a scene into an asset container
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param rootUrl a string that defines the root url for scene and resources OR the concatenation of rootURL and filename (eg. http://example.com/test.glb)
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene (default: empty string)
         * @param scene is the instance of BABYLON.Scene to append to
         * @param onProgress a callback with a progress event for each file being loaded
         * @param pluginExtension the extension used to determine the plugin
         * @returns The loaded asset container
         */
         SceneLoader.LoadAssetContainerAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {
+            if (sceneFilename === void 0) { sceneFilename = ""; }
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (onProgress === void 0) { onProgress = null; }
             if (pluginExtension === void 0) { pluginExtension = null; }
             return new Promise(function (resolve, reject) {
@@ -98729,6 +98834,113 @@ var BABYLON;
 
 //# sourceMappingURL=babylon.environmentHelper.js.map
 
+var BABYLON;
+(function (BABYLON) {
+    /**
+     * This class is made for on one-liner static method to help creating particle systems.
+     */
+    var ParticleHelper = /** @class */ (function () {
+        function ParticleHelper() {
+        }
+        /**
+         * This is the main static method (one-liner) of this helper to create different particle systems.
+         * @param type This string represents the type to the particle system to create
+         * @param emitter The object where the particle system will start to emit from.
+         * @param scene The scene where the particle system should live.
+         * @param gpu If the system will use gpu.
+         * @returns the ParticleSystem created.
+         */
+        ParticleHelper.CreateAsync = function (type, emitter, scene, gpu) {
+            var _this = this;
+            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
+            if (gpu === void 0) { gpu = false; }
+            return new Promise(function (resolve, reject) {
+                if (scene) {
+                    _this._scene = scene;
+                }
+                else {
+                    return reject("A particle system need a scene.");
+                }
+                if (gpu && !BABYLON.GPUParticleSystem.IsSupported) {
+                    return reject("Particle system with GPU is not supported.");
+                }
+                _this._emitter = emitter;
+                BABYLON.Tools.LoadFile(_this._baseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
+                    var newData = JSON.parse(data.toString());
+                    return resolve(_this._createSystem(newData));
+                }, undefined, undefined, undefined, function (req, exception) {
+                    return reject("An error occured while the creation of your particle system. Check if your type '" + type + "' exists.");
+                });
+            });
+        };
+        ParticleHelper._createSystem = function (data) {
+            // Create a particle system
+            var system = new BABYLON.ParticleSystem(data.type, data.capacity, this._scene);
+            // Texture of each particle
+            system.particleTexture = new BABYLON.Texture(this._baseAssetsUrl + "/textures/" + data.textureFile, this._scene);
+            // Where the particles come from
+            system.emitter = this._emitter; // the starting object, the emitter
+            // Colors of all particles
+            system.color1 = new BABYLON.Color4(data.color1.r, data.color1.g, data.color1.b, data.color1.a);
+            system.color2 = new BABYLON.Color4(data.color2.r, data.color2.g, data.color2.b, data.color2.a);
+            system.colorDead = new BABYLON.Color4(data.colorDead.r, data.colorDead.g, data.colorDead.b, data.colorDead.a);
+            // Size of each particle (random between...
+            system.minSize = data.minSize;
+            system.maxSize = data.maxSize;
+            // Life time of each particle (random between...
+            system.minLifeTime = data.minLifeTime;
+            system.maxLifeTime = data.maxLifeTime;
+            // Emission rate
+            system.emitRate = data.emitRate;
+            // Blend mode : BLENDMODE_ONEONE, or BLENDMODE_STANDARD
+            system.blendMode = data.blendMode;
+            // Set the gravity of all particles
+            system.gravity = new BABYLON.Vector3(data.gravity.x, data.gravity.y, data.gravity.z);
+            // Angular speed, in radians
+            system.minAngularSpeed = data.minAngularSpeed;
+            system.maxAngularSpeed = data.maxAngularSpeed;
+            // Speed
+            system.minEmitPower = data.minEmitPower;
+            system.maxEmitPower = data.maxEmitPower;
+            system.updateSpeed = data.updateSpeed;
+            switch (data.emitterType) {
+                case "box":
+                    if (!data.direction1 || !data.direction2) {
+                        throw new Error("Directions are missing in this particle system.");
+                    }
+                    if (!data.minEmitBox || !data.maxEmitBox) {
+                        throw new Error("EmitBox is missing in this particle system.");
+                    }
+                    system.createBoxEmitter(new BABYLON.Vector3(data.direction1.x, data.direction1.y, data.direction1.z), new BABYLON.Vector3(data.direction2.x, data.direction2.y, data.direction2.z), new BABYLON.Vector3(data.minEmitBox.x, data.minEmitBox.y, data.minEmitBox.z), new BABYLON.Vector3(data.maxEmitBox.x, data.maxEmitBox.y, data.maxEmitBox.z));
+                    break;
+                case "sphere":
+                    system.createSphereEmitter(data.radius);
+                    break;
+                case "directed_sphere":
+                    if (!data.direction1 || !data.direction2) {
+                        throw new Error("Directions are missing in this particle system.");
+                    }
+                    system.createDirectedSphereEmitter(data.radius, new BABYLON.Vector3(data.direction1.x, data.direction1.y, data.direction1.z), new BABYLON.Vector3(data.direction2.x, data.direction2.y, data.direction2.z));
+                    break;
+                case "cone":
+                    system.createConeEmitter(data.radius, data.angle);
+                    break;
+                default:
+                    break;
+            }
+            return system;
+        };
+        /**
+         * Base Assets URL.
+         */
+        ParticleHelper._baseAssetsUrl = "https://assets.babylonjs.com/particles";
+        return ParticleHelper;
+    }());
+    BABYLON.ParticleHelper = ParticleHelper;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.particleHelper.js.map
+
 
 var BABYLON;
 (function (BABYLON) {

+ 1 - 1
src/Animations/babylon.animation.ts

@@ -399,7 +399,7 @@
         }
 
         /**
-		 * Transition property of the Camera to the target Value
+		 * Transition property of an host to the target Value
 		 * @param property The property to transition
 		 * @param targetValue The target Value of the property
          * @param host The object where the property to animate belongs

+ 2 - 1
src/Engine/babylon.engine.ts

@@ -4864,6 +4864,7 @@
             gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), width, height, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);
 
             // Create the framebuffer
+            var currentFrameBuffer = this._currentFramebuffer;
             var framebuffer = gl.createFramebuffer();
             this.bindUnboundFramebuffer(framebuffer);
             gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, 0);
@@ -4877,7 +4878,7 @@
             // Unbind
             this._bindTextureDirectly(gl.TEXTURE_2D, null);
             gl.bindRenderbuffer(gl.RENDERBUFFER, null);
-            this.bindUnboundFramebuffer(null);
+            this.bindUnboundFramebuffer(currentFrameBuffer);
 
             texture._framebuffer = framebuffer;
             texture.baseWidth = width;