浏览代码

Sun done!

David Catuhe 7 年之前
父节点
当前提交
9342de120b

文件差异内容过多而无法显示
+ 15295 - 15432
Playground/babylon.d.txt


+ 18 - 3
assets/particles/systems/sun.json

@@ -1,4 +1,16 @@
 {
+  "emitter" : {
+    "kind": "Sphere",
+    "options": {
+      "diameter": 2.01,
+      "segments": 32,
+      "color": [
+      0.3773, 
+      0.0930, 
+      0.0266]
+    },
+    "renderingGroupId": 3
+  },
   "systems": [
     {
       "name": "surfaceParticles",
@@ -9,6 +21,7 @@
       "particleEmitterType": {
         "type": "SphereParticleEmitter",
         "radius": 1,
+        "radiusRange": 0,
         "directionRandomizer": 0
       },
       "textureName": "sun/T_SunSurface.png",
@@ -101,7 +114,7 @@
         1
       ],
       "customShader": null,
-      "preventAutoStart": false,
+      "preventAutoStart": true,
       "startSpriteCellID": 0,
       "endSpriteCellID": 0,
       "spriteCellLoop": true,
@@ -118,6 +131,7 @@
       "particleEmitterType": {
         "type": "SphereParticleEmitter",
         "radius": 1,
+        "radiusRange": 0,
         "directionRandomizer": 0
       },
       "textureName": "sun/T_SunFlare.png",
@@ -211,7 +225,7 @@
         1
       ],
       "customShader": null,
-      "preventAutoStart": false,
+      "preventAutoStart": true,
       "startSpriteCellID": 0,
       "endSpriteCellID": 0,
       "spriteCellLoop": true,
@@ -228,6 +242,7 @@
       "particleEmitterType": {
         "type": "SphereParticleEmitter",
         "radius": 1,
+        "radiusRange": 0,
         "directionRandomizer": 0
       },
       "textureName": "sun/T_Star.png",
@@ -311,7 +326,7 @@
         1
       ],
       "customShader": null,
-      "preventAutoStart": false,
+      "preventAutoStart": true,
       "startSpriteCellID": 0,
       "endSpriteCellID": 0,
       "spriteCellLoop": true,

文件差异内容过多而无法显示
+ 17629 - 17767
dist/preview release/babylon.d.ts


文件差异内容过多而无法显示
+ 54 - 54
dist/preview release/babylon.js


+ 97 - 149
dist/preview release/babylon.max.js

@@ -24208,6 +24208,8 @@ var BABYLON;
             this._doubleClickOccured = false;
             /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */
             this.cameraToUseForPointers = null;
+            this._pointerX = 0;
+            this._pointerY = 0;
             this._startingPointerPosition = new BABYLON.Vector2(0, 0);
             this._previousStartingPointerPosition = new BABYLON.Vector2(0, 0);
             this._startingPointerTime = 0;
@@ -56451,6 +56453,8 @@ var BABYLON;
             // Animations
             BABYLON.Animation.AppendSerializedAnimations(particleSystem, serializationObject);
             // Particle system
+            serializationObject.renderingGroupId = particleSystem.renderingGroupId;
+            serializationObject.isBillboardBased = particleSystem.isBillboardBased;
             serializationObject.minAngularSpeed = particleSystem.minAngularSpeed;
             serializationObject.maxAngularSpeed = particleSystem.maxAngularSpeed;
             serializationObject.minSize = particleSystem.minSize;
@@ -56510,12 +56514,22 @@ var BABYLON;
                 particleSystem.particleTexture.name = parsedParticleSystem.textureName;
             }
             // Emitter
-            if (parsedParticleSystem.emitterId) {
+            if (parsedParticleSystem.emitterId === undefined) {
+                particleSystem.emitter = BABYLON.Vector3.Zero();
+            }
+            else if (parsedParticleSystem.emitterId) {
                 particleSystem.emitter = scene.getLastMeshByID(parsedParticleSystem.emitterId);
             }
             else {
                 particleSystem.emitter = BABYLON.Vector3.FromArray(parsedParticleSystem.emitter);
             }
+            // Misc.
+            if (parsedParticleSystem.renderingGroupId !== undefined) {
+                particleSystem.renderingGroupId = parsedParticleSystem.renderingGroupId;
+            }
+            if (parsedParticleSystem.isBillboardBased !== undefined) {
+                particleSystem.isBillboardBased = parsedParticleSystem.isBillboardBased;
+            }
             // Animations
             if (parsedParticleSystem.animations) {
                 for (var animationIndex = 0; animationIndex < parsedParticleSystem.animations.length; animationIndex++) {
@@ -56573,7 +56587,7 @@ var BABYLON;
             var emitterType;
             if (parsedParticleSystem.particleEmitterType) {
                 switch (parsedParticleSystem.particleEmitterType.type) {
-                    case "SphereEmitter":
+                    case "SphereParticleEmitter":
                         emitterType = new BABYLON.SphereParticleEmitter();
                         break;
                     case "SphereDirectedParticleEmitter":
@@ -56899,7 +56913,7 @@ var BABYLON;
             return "#define CONEEMITTER";
         };
         /**
-         * Returns the string "BoxEmitter"
+         * Returns the string "ConeEmitter"
          * @returns a string containing the class name
          */
         ConeParticleEmitter.prototype.getClassName = function () {
@@ -57037,6 +57051,7 @@ var BABYLON;
             var serializationObject = {};
             serializationObject.type = this.getClassName();
             serializationObject.radius = this.radius;
+            serializationObject.radiusRange = this.radiusRange;
             serializationObject.directionRandomizer = this.directionRandomizer;
             return serializationObject;
         };
@@ -57046,6 +57061,7 @@ var BABYLON;
          */
         SphereParticleEmitter.prototype.parse = function (serializationObject) {
             this.radius = serializationObject.radius;
+            this.radiusRange = serializationObject.radiusRange;
             this.directionRandomizer = serializationObject.directionRandomizer;
         };
         return SphereParticleEmitter;
@@ -102561,20 +102577,81 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     /**
-     * This class is made for on one-liner static method to help creating particle systems.
+     * Represents a set of particle systems working together to create a specific effect
+     */
+    var ParticleSystemSet = /** @class */ (function () {
+        function ParticleSystemSet() {
+            /**
+             * Gets or sets the particle system list
+             */
+            this.systems = new Array();
+        }
+        /**
+         * Starts all particle systems of the set
+         * @param emitter defines an optional mesh to use as emitter for the particle systems
+         */
+        ParticleSystemSet.prototype.start = function (emitter) {
+            for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {
+                var system = _a[_i];
+                if (emitter) {
+                    system.emitter = emitter;
+                }
+                system.start();
+            }
+        };
+        /**
+         * Serialize the set into a JSON compatible object
+         * @returns a JSON compatible representation of the set
+         */
+        ParticleSystemSet.prototype.serialize = function () {
+            var result = {};
+            result.systems = [];
+            for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {
+                var system = _a[_i];
+                result.systems.push(system.serialize());
+            }
+            return result;
+        };
+        /**
+         * Parse a new ParticleSystemSet from a serialized source
+         * @param data defines a JSON compatible representation of the set
+         * @param scene defines the hosting scene
+         * @param gpu defines if we want GPU particles or CPU particles
+         * @returns a new ParticleSystemSet
+         */
+        ParticleSystemSet.Parse = function (data, scene, gpu) {
+            if (gpu === void 0) { gpu = false; }
+            var result = new ParticleSystemSet();
+            var rootUrl = BABYLON.ParticleHelper.BaseAssetsUrl + "/textures/";
+            for (var _i = 0, _a = data.systems; _i < _a.length; _i++) {
+                var system = _a[_i];
+                result.systems.push(gpu ? BABYLON.GPUParticleSystem.Parse(system, scene, rootUrl) : BABYLON.ParticleSystem.Parse(system, scene, rootUrl));
+            }
+            return result;
+        };
+        return ParticleSystemSet;
+    }());
+    BABYLON.ParticleSystemSet = ParticleSystemSet;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.particleSystemSet.js.map
+
+var BABYLON;
+(function (BABYLON) {
+    /**
+     * This class is made for on one-liner static method to help creating particle system set.
      */
     var ParticleHelper = /** @class */ (function () {
         function ParticleHelper() {
         }
         /**
-         * This is the main static method (one-liner) of this helper to create different particle systems.
+         * 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.
+         * @param scene The scene where the particle system should live
+         * @param gpu If the system will use gpu
+         * @returns the ParticleSystemSet created
          */
-        ParticleHelper.CreateAsync = function (type, emitter, scene, gpu) {
+        ParticleHelper.CreateAsync = function (type, scene, gpu) {
             if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (gpu === void 0) { gpu = false; }
             return new Promise(function (resolve, reject) {
@@ -102585,160 +102662,31 @@ var BABYLON;
                 if (gpu && !BABYLON.GPUParticleSystem.IsSupported) {
                     return reject("Particle system with GPU is not supported.");
                 }
-                BABYLON.Tools.LoadFile(ParticleHelper._baseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
+                BABYLON.Tools.LoadFile(ParticleHelper.BaseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
                     var newData = JSON.parse(data.toString());
-                    return resolve(ParticleHelper.CreateSystem(newData, scene, emitter));
+                    return resolve(BABYLON.ParticleSystemSet.Parse(newData, scene, gpu));
                 }, undefined, undefined, undefined, function (req, exception) {
                     return reject("An error occured while the creation of your particle system. Check if your type '" + type + "' exists.");
                 });
             });
         };
         /**
-         * Static function used to create a new particle system from a IParticleSystemData
-         * @param data defines the source data
-         * @param scene defines the hosting scene
-         * @param emitter defines the particle emitter
-         * @returns a new ParticleSystem based on referenced data
-         */
-        ParticleHelper.CreateSystem = function (data, scene, emitter) {
-            // Create a particle system
-            var system = new BABYLON.ParticleSystem(data.type, data.capacity, scene);
-            // Where the particles come from
-            system.emitter = emitter; // the starting object, the emitter            
-            ParticleHelper.UpdateSystem(system, data, scene);
-            return system;
-        };
-        /**
-         * Static function used to update a particle system from a IParticleSystemData
-         * @param system defines the particle system to update
-         * @param data defines the source data
-         * @param scene defines the hosting scene
-         */
-        ParticleHelper.UpdateSystem = function (system, data, scene) {
-            // Texture of each particle
-            if (data.textureFile) {
-                system.particleTexture = new BABYLON.Texture(ParticleHelper._baseAssetsUrl + "/textures/" + data.textureFile, scene);
-            }
-            // 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;
-            system.minScaleX = data.minScaleX;
-            system.maxScaleX = data.maxScaleX;
-            system.minScaleY = data.minScaleY;
-            system.maxScaleY = data.maxScaleY;
-            // 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;
-            }
-        };
-        /**
          * Static function used to export a particle system to a IParticleSystemData variable.
          * Please note that texture file name is not exported and must be added manually
          * @param system defines the particle system to export
          */
-        ParticleHelper.ExportSystem = function (system) {
-            var outData = {};
-            // Colors of all particles
-            outData.color1 = { r: system.color1.r, g: system.color1.g, b: system.color1.b, a: system.color1.a };
-            outData.color2 = { r: system.color2.r, g: system.color2.g, b: system.color2.b, a: system.color2.a };
-            outData.colorDead = { r: system.colorDead.r, g: system.colorDead.g, b: system.colorDead.b, a: system.colorDead.a };
-            // Size of each particle (random between...
-            outData.minSize = system.minSize;
-            outData.maxSize = system.maxSize;
-            outData.minScaleX = system.minScaleX;
-            outData.maxScaleX = system.maxScaleX;
-            outData.minScaleY = system.minScaleY;
-            outData.maxScaleY = system.maxScaleY;
-            // Life time of each particle (random between...
-            outData.minLifeTime = system.minLifeTime;
-            outData.maxLifeTime = system.maxLifeTime;
-            // Emission rate
-            outData.emitRate = system.emitRate;
-            // Blend mode : BLENDMODE_ONEONE, or BLENDMODE_STANDARD
-            outData.blendMode = system.blendMode;
-            // Set the gravity of all particles
-            outData.gravity = { x: system.gravity.x, y: system.gravity.y, z: system.gravity.z };
-            // Angular speed, in radians
-            outData.minAngularSpeed = system.minAngularSpeed;
-            outData.maxAngularSpeed = system.maxAngularSpeed;
-            // Speed
-            outData.minEmitPower = system.minEmitPower;
-            outData.maxEmitPower = system.maxEmitPower;
-            outData.updateSpeed = system.updateSpeed;
-            switch (system.particleEmitterType.getClassName()) {
-                case "BoxEmitter":
-                    outData.emitterType = "box";
-                    outData.direction1 = { x: system.direction1.x, y: system.direction1.y, z: system.direction1.z };
-                    outData.direction2 = { x: system.direction2.x, y: system.direction2.y, z: system.direction2.z };
-                    outData.minEmitBox = { x: system.minEmitBox.x, y: system.minEmitBox.y, z: system.minEmitBox.z };
-                    outData.maxEmitBox = { x: system.maxEmitBox.x, y: system.maxEmitBox.y, z: system.maxEmitBox.z };
-                    break;
-                case "SphereParticleEmitter":
-                    outData.emitterType = "sphere";
-                    outData.radius = system.particleEmitterType.radius;
-                    break;
-                case "SphereDirectedParticleEmitter":
-                    outData.emitterType = "directed_sphere";
-                    var sphereDirectedParticleEmitter = system.particleEmitterType;
-                    outData.radius = sphereDirectedParticleEmitter.radius;
-                    outData.direction1 = { x: sphereDirectedParticleEmitter.direction1.x, y: sphereDirectedParticleEmitter.direction1.y, z: sphereDirectedParticleEmitter.direction1.z };
-                    outData.direction2 = { x: sphereDirectedParticleEmitter.direction2.x, y: sphereDirectedParticleEmitter.direction2.y, z: sphereDirectedParticleEmitter.direction2.z };
-                    break;
-                case "ConeEmitter":
-                    outData.emitterType = "cone";
-                    outData.radius = system.particleEmitterType.radius;
-                    outData.angle = system.particleEmitterType.angle;
-                    break;
-                default:
-                    break;
+        ParticleHelper.ExportSet = function (systems) {
+            var set = new BABYLON.ParticleSystemSet();
+            for (var _i = 0, systems_1 = systems; _i < systems_1.length; _i++) {
+                var system = systems_1[_i];
+                set.systems.push(system);
             }
-            return outData;
+            return set;
         };
         /**
-         * Base Assets URL.
+         * Gets or sets base Assets URL
          */
-        ParticleHelper._baseAssetsUrl = "https://assets.babylonjs.com/particles";
+        ParticleHelper.BaseAssetsUrl = "https://assets.babylonjs.com/particles";
         return ParticleHelper;
     }());
     BABYLON.ParticleHelper = ParticleHelper;

+ 97 - 149
dist/preview release/babylon.no-module.max.js

@@ -24175,6 +24175,8 @@ var BABYLON;
             this._doubleClickOccured = false;
             /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */
             this.cameraToUseForPointers = null;
+            this._pointerX = 0;
+            this._pointerY = 0;
             this._startingPointerPosition = new BABYLON.Vector2(0, 0);
             this._previousStartingPointerPosition = new BABYLON.Vector2(0, 0);
             this._startingPointerTime = 0;
@@ -56418,6 +56420,8 @@ var BABYLON;
             // Animations
             BABYLON.Animation.AppendSerializedAnimations(particleSystem, serializationObject);
             // Particle system
+            serializationObject.renderingGroupId = particleSystem.renderingGroupId;
+            serializationObject.isBillboardBased = particleSystem.isBillboardBased;
             serializationObject.minAngularSpeed = particleSystem.minAngularSpeed;
             serializationObject.maxAngularSpeed = particleSystem.maxAngularSpeed;
             serializationObject.minSize = particleSystem.minSize;
@@ -56477,12 +56481,22 @@ var BABYLON;
                 particleSystem.particleTexture.name = parsedParticleSystem.textureName;
             }
             // Emitter
-            if (parsedParticleSystem.emitterId) {
+            if (parsedParticleSystem.emitterId === undefined) {
+                particleSystem.emitter = BABYLON.Vector3.Zero();
+            }
+            else if (parsedParticleSystem.emitterId) {
                 particleSystem.emitter = scene.getLastMeshByID(parsedParticleSystem.emitterId);
             }
             else {
                 particleSystem.emitter = BABYLON.Vector3.FromArray(parsedParticleSystem.emitter);
             }
+            // Misc.
+            if (parsedParticleSystem.renderingGroupId !== undefined) {
+                particleSystem.renderingGroupId = parsedParticleSystem.renderingGroupId;
+            }
+            if (parsedParticleSystem.isBillboardBased !== undefined) {
+                particleSystem.isBillboardBased = parsedParticleSystem.isBillboardBased;
+            }
             // Animations
             if (parsedParticleSystem.animations) {
                 for (var animationIndex = 0; animationIndex < parsedParticleSystem.animations.length; animationIndex++) {
@@ -56540,7 +56554,7 @@ var BABYLON;
             var emitterType;
             if (parsedParticleSystem.particleEmitterType) {
                 switch (parsedParticleSystem.particleEmitterType.type) {
-                    case "SphereEmitter":
+                    case "SphereParticleEmitter":
                         emitterType = new BABYLON.SphereParticleEmitter();
                         break;
                     case "SphereDirectedParticleEmitter":
@@ -56866,7 +56880,7 @@ var BABYLON;
             return "#define CONEEMITTER";
         };
         /**
-         * Returns the string "BoxEmitter"
+         * Returns the string "ConeEmitter"
          * @returns a string containing the class name
          */
         ConeParticleEmitter.prototype.getClassName = function () {
@@ -57004,6 +57018,7 @@ var BABYLON;
             var serializationObject = {};
             serializationObject.type = this.getClassName();
             serializationObject.radius = this.radius;
+            serializationObject.radiusRange = this.radiusRange;
             serializationObject.directionRandomizer = this.directionRandomizer;
             return serializationObject;
         };
@@ -57013,6 +57028,7 @@ var BABYLON;
          */
         SphereParticleEmitter.prototype.parse = function (serializationObject) {
             this.radius = serializationObject.radius;
+            this.radiusRange = serializationObject.radiusRange;
             this.directionRandomizer = serializationObject.directionRandomizer;
         };
         return SphereParticleEmitter;
@@ -102528,20 +102544,81 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     /**
-     * This class is made for on one-liner static method to help creating particle systems.
+     * Represents a set of particle systems working together to create a specific effect
+     */
+    var ParticleSystemSet = /** @class */ (function () {
+        function ParticleSystemSet() {
+            /**
+             * Gets or sets the particle system list
+             */
+            this.systems = new Array();
+        }
+        /**
+         * Starts all particle systems of the set
+         * @param emitter defines an optional mesh to use as emitter for the particle systems
+         */
+        ParticleSystemSet.prototype.start = function (emitter) {
+            for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {
+                var system = _a[_i];
+                if (emitter) {
+                    system.emitter = emitter;
+                }
+                system.start();
+            }
+        };
+        /**
+         * Serialize the set into a JSON compatible object
+         * @returns a JSON compatible representation of the set
+         */
+        ParticleSystemSet.prototype.serialize = function () {
+            var result = {};
+            result.systems = [];
+            for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {
+                var system = _a[_i];
+                result.systems.push(system.serialize());
+            }
+            return result;
+        };
+        /**
+         * Parse a new ParticleSystemSet from a serialized source
+         * @param data defines a JSON compatible representation of the set
+         * @param scene defines the hosting scene
+         * @param gpu defines if we want GPU particles or CPU particles
+         * @returns a new ParticleSystemSet
+         */
+        ParticleSystemSet.Parse = function (data, scene, gpu) {
+            if (gpu === void 0) { gpu = false; }
+            var result = new ParticleSystemSet();
+            var rootUrl = BABYLON.ParticleHelper.BaseAssetsUrl + "/textures/";
+            for (var _i = 0, _a = data.systems; _i < _a.length; _i++) {
+                var system = _a[_i];
+                result.systems.push(gpu ? BABYLON.GPUParticleSystem.Parse(system, scene, rootUrl) : BABYLON.ParticleSystem.Parse(system, scene, rootUrl));
+            }
+            return result;
+        };
+        return ParticleSystemSet;
+    }());
+    BABYLON.ParticleSystemSet = ParticleSystemSet;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.particleSystemSet.js.map
+
+var BABYLON;
+(function (BABYLON) {
+    /**
+     * This class is made for on one-liner static method to help creating particle system set.
      */
     var ParticleHelper = /** @class */ (function () {
         function ParticleHelper() {
         }
         /**
-         * This is the main static method (one-liner) of this helper to create different particle systems.
+         * 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.
+         * @param scene The scene where the particle system should live
+         * @param gpu If the system will use gpu
+         * @returns the ParticleSystemSet created
          */
-        ParticleHelper.CreateAsync = function (type, emitter, scene, gpu) {
+        ParticleHelper.CreateAsync = function (type, scene, gpu) {
             if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (gpu === void 0) { gpu = false; }
             return new Promise(function (resolve, reject) {
@@ -102552,160 +102629,31 @@ var BABYLON;
                 if (gpu && !BABYLON.GPUParticleSystem.IsSupported) {
                     return reject("Particle system with GPU is not supported.");
                 }
-                BABYLON.Tools.LoadFile(ParticleHelper._baseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
+                BABYLON.Tools.LoadFile(ParticleHelper.BaseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
                     var newData = JSON.parse(data.toString());
-                    return resolve(ParticleHelper.CreateSystem(newData, scene, emitter));
+                    return resolve(BABYLON.ParticleSystemSet.Parse(newData, scene, gpu));
                 }, undefined, undefined, undefined, function (req, exception) {
                     return reject("An error occured while the creation of your particle system. Check if your type '" + type + "' exists.");
                 });
             });
         };
         /**
-         * Static function used to create a new particle system from a IParticleSystemData
-         * @param data defines the source data
-         * @param scene defines the hosting scene
-         * @param emitter defines the particle emitter
-         * @returns a new ParticleSystem based on referenced data
-         */
-        ParticleHelper.CreateSystem = function (data, scene, emitter) {
-            // Create a particle system
-            var system = new BABYLON.ParticleSystem(data.type, data.capacity, scene);
-            // Where the particles come from
-            system.emitter = emitter; // the starting object, the emitter            
-            ParticleHelper.UpdateSystem(system, data, scene);
-            return system;
-        };
-        /**
-         * Static function used to update a particle system from a IParticleSystemData
-         * @param system defines the particle system to update
-         * @param data defines the source data
-         * @param scene defines the hosting scene
-         */
-        ParticleHelper.UpdateSystem = function (system, data, scene) {
-            // Texture of each particle
-            if (data.textureFile) {
-                system.particleTexture = new BABYLON.Texture(ParticleHelper._baseAssetsUrl + "/textures/" + data.textureFile, scene);
-            }
-            // 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;
-            system.minScaleX = data.minScaleX;
-            system.maxScaleX = data.maxScaleX;
-            system.minScaleY = data.minScaleY;
-            system.maxScaleY = data.maxScaleY;
-            // 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;
-            }
-        };
-        /**
          * Static function used to export a particle system to a IParticleSystemData variable.
          * Please note that texture file name is not exported and must be added manually
          * @param system defines the particle system to export
          */
-        ParticleHelper.ExportSystem = function (system) {
-            var outData = {};
-            // Colors of all particles
-            outData.color1 = { r: system.color1.r, g: system.color1.g, b: system.color1.b, a: system.color1.a };
-            outData.color2 = { r: system.color2.r, g: system.color2.g, b: system.color2.b, a: system.color2.a };
-            outData.colorDead = { r: system.colorDead.r, g: system.colorDead.g, b: system.colorDead.b, a: system.colorDead.a };
-            // Size of each particle (random between...
-            outData.minSize = system.minSize;
-            outData.maxSize = system.maxSize;
-            outData.minScaleX = system.minScaleX;
-            outData.maxScaleX = system.maxScaleX;
-            outData.minScaleY = system.minScaleY;
-            outData.maxScaleY = system.maxScaleY;
-            // Life time of each particle (random between...
-            outData.minLifeTime = system.minLifeTime;
-            outData.maxLifeTime = system.maxLifeTime;
-            // Emission rate
-            outData.emitRate = system.emitRate;
-            // Blend mode : BLENDMODE_ONEONE, or BLENDMODE_STANDARD
-            outData.blendMode = system.blendMode;
-            // Set the gravity of all particles
-            outData.gravity = { x: system.gravity.x, y: system.gravity.y, z: system.gravity.z };
-            // Angular speed, in radians
-            outData.minAngularSpeed = system.minAngularSpeed;
-            outData.maxAngularSpeed = system.maxAngularSpeed;
-            // Speed
-            outData.minEmitPower = system.minEmitPower;
-            outData.maxEmitPower = system.maxEmitPower;
-            outData.updateSpeed = system.updateSpeed;
-            switch (system.particleEmitterType.getClassName()) {
-                case "BoxEmitter":
-                    outData.emitterType = "box";
-                    outData.direction1 = { x: system.direction1.x, y: system.direction1.y, z: system.direction1.z };
-                    outData.direction2 = { x: system.direction2.x, y: system.direction2.y, z: system.direction2.z };
-                    outData.minEmitBox = { x: system.minEmitBox.x, y: system.minEmitBox.y, z: system.minEmitBox.z };
-                    outData.maxEmitBox = { x: system.maxEmitBox.x, y: system.maxEmitBox.y, z: system.maxEmitBox.z };
-                    break;
-                case "SphereParticleEmitter":
-                    outData.emitterType = "sphere";
-                    outData.radius = system.particleEmitterType.radius;
-                    break;
-                case "SphereDirectedParticleEmitter":
-                    outData.emitterType = "directed_sphere";
-                    var sphereDirectedParticleEmitter = system.particleEmitterType;
-                    outData.radius = sphereDirectedParticleEmitter.radius;
-                    outData.direction1 = { x: sphereDirectedParticleEmitter.direction1.x, y: sphereDirectedParticleEmitter.direction1.y, z: sphereDirectedParticleEmitter.direction1.z };
-                    outData.direction2 = { x: sphereDirectedParticleEmitter.direction2.x, y: sphereDirectedParticleEmitter.direction2.y, z: sphereDirectedParticleEmitter.direction2.z };
-                    break;
-                case "ConeEmitter":
-                    outData.emitterType = "cone";
-                    outData.radius = system.particleEmitterType.radius;
-                    outData.angle = system.particleEmitterType.angle;
-                    break;
-                default:
-                    break;
+        ParticleHelper.ExportSet = function (systems) {
+            var set = new BABYLON.ParticleSystemSet();
+            for (var _i = 0, systems_1 = systems; _i < systems_1.length; _i++) {
+                var system = systems_1[_i];
+                set.systems.push(system);
             }
-            return outData;
+            return set;
         };
         /**
-         * Base Assets URL.
+         * Gets or sets base Assets URL
          */
-        ParticleHelper._baseAssetsUrl = "https://assets.babylonjs.com/particles";
+        ParticleHelper.BaseAssetsUrl = "https://assets.babylonjs.com/particles";
         return ParticleHelper;
     }());
     BABYLON.ParticleHelper = ParticleHelper;

文件差异内容过多而无法显示
+ 14 - 14
dist/preview release/babylon.worker.js


文件差异内容过多而无法显示
+ 99 - 151
dist/preview release/es6.js


文件差异内容过多而无法显示
+ 2 - 2
dist/preview release/inspector/babylon.inspector.bundle.js


文件差异内容过多而无法显示
+ 66 - 66
dist/preview release/viewer/babylon.viewer.js


+ 97 - 149
dist/preview release/viewer/babylon.viewer.max.js

@@ -24296,6 +24296,8 @@ var BABYLON;
             this._doubleClickOccured = false;
             /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */
             this.cameraToUseForPointers = null;
+            this._pointerX = 0;
+            this._pointerY = 0;
             this._startingPointerPosition = new BABYLON.Vector2(0, 0);
             this._previousStartingPointerPosition = new BABYLON.Vector2(0, 0);
             this._startingPointerTime = 0;
@@ -56539,6 +56541,8 @@ var BABYLON;
             // Animations
             BABYLON.Animation.AppendSerializedAnimations(particleSystem, serializationObject);
             // Particle system
+            serializationObject.renderingGroupId = particleSystem.renderingGroupId;
+            serializationObject.isBillboardBased = particleSystem.isBillboardBased;
             serializationObject.minAngularSpeed = particleSystem.minAngularSpeed;
             serializationObject.maxAngularSpeed = particleSystem.maxAngularSpeed;
             serializationObject.minSize = particleSystem.minSize;
@@ -56598,12 +56602,22 @@ var BABYLON;
                 particleSystem.particleTexture.name = parsedParticleSystem.textureName;
             }
             // Emitter
-            if (parsedParticleSystem.emitterId) {
+            if (parsedParticleSystem.emitterId === undefined) {
+                particleSystem.emitter = BABYLON.Vector3.Zero();
+            }
+            else if (parsedParticleSystem.emitterId) {
                 particleSystem.emitter = scene.getLastMeshByID(parsedParticleSystem.emitterId);
             }
             else {
                 particleSystem.emitter = BABYLON.Vector3.FromArray(parsedParticleSystem.emitter);
             }
+            // Misc.
+            if (parsedParticleSystem.renderingGroupId !== undefined) {
+                particleSystem.renderingGroupId = parsedParticleSystem.renderingGroupId;
+            }
+            if (parsedParticleSystem.isBillboardBased !== undefined) {
+                particleSystem.isBillboardBased = parsedParticleSystem.isBillboardBased;
+            }
             // Animations
             if (parsedParticleSystem.animations) {
                 for (var animationIndex = 0; animationIndex < parsedParticleSystem.animations.length; animationIndex++) {
@@ -56661,7 +56675,7 @@ var BABYLON;
             var emitterType;
             if (parsedParticleSystem.particleEmitterType) {
                 switch (parsedParticleSystem.particleEmitterType.type) {
-                    case "SphereEmitter":
+                    case "SphereParticleEmitter":
                         emitterType = new BABYLON.SphereParticleEmitter();
                         break;
                     case "SphereDirectedParticleEmitter":
@@ -56987,7 +57001,7 @@ var BABYLON;
             return "#define CONEEMITTER";
         };
         /**
-         * Returns the string "BoxEmitter"
+         * Returns the string "ConeEmitter"
          * @returns a string containing the class name
          */
         ConeParticleEmitter.prototype.getClassName = function () {
@@ -57125,6 +57139,7 @@ var BABYLON;
             var serializationObject = {};
             serializationObject.type = this.getClassName();
             serializationObject.radius = this.radius;
+            serializationObject.radiusRange = this.radiusRange;
             serializationObject.directionRandomizer = this.directionRandomizer;
             return serializationObject;
         };
@@ -57134,6 +57149,7 @@ var BABYLON;
          */
         SphereParticleEmitter.prototype.parse = function (serializationObject) {
             this.radius = serializationObject.radius;
+            this.radiusRange = serializationObject.radiusRange;
             this.directionRandomizer = serializationObject.directionRandomizer;
         };
         return SphereParticleEmitter;
@@ -102649,20 +102665,81 @@ var BABYLON;
 var BABYLON;
 (function (BABYLON) {
     /**
-     * This class is made for on one-liner static method to help creating particle systems.
+     * Represents a set of particle systems working together to create a specific effect
+     */
+    var ParticleSystemSet = /** @class */ (function () {
+        function ParticleSystemSet() {
+            /**
+             * Gets or sets the particle system list
+             */
+            this.systems = new Array();
+        }
+        /**
+         * Starts all particle systems of the set
+         * @param emitter defines an optional mesh to use as emitter for the particle systems
+         */
+        ParticleSystemSet.prototype.start = function (emitter) {
+            for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {
+                var system = _a[_i];
+                if (emitter) {
+                    system.emitter = emitter;
+                }
+                system.start();
+            }
+        };
+        /**
+         * Serialize the set into a JSON compatible object
+         * @returns a JSON compatible representation of the set
+         */
+        ParticleSystemSet.prototype.serialize = function () {
+            var result = {};
+            result.systems = [];
+            for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {
+                var system = _a[_i];
+                result.systems.push(system.serialize());
+            }
+            return result;
+        };
+        /**
+         * Parse a new ParticleSystemSet from a serialized source
+         * @param data defines a JSON compatible representation of the set
+         * @param scene defines the hosting scene
+         * @param gpu defines if we want GPU particles or CPU particles
+         * @returns a new ParticleSystemSet
+         */
+        ParticleSystemSet.Parse = function (data, scene, gpu) {
+            if (gpu === void 0) { gpu = false; }
+            var result = new ParticleSystemSet();
+            var rootUrl = BABYLON.ParticleHelper.BaseAssetsUrl + "/textures/";
+            for (var _i = 0, _a = data.systems; _i < _a.length; _i++) {
+                var system = _a[_i];
+                result.systems.push(gpu ? BABYLON.GPUParticleSystem.Parse(system, scene, rootUrl) : BABYLON.ParticleSystem.Parse(system, scene, rootUrl));
+            }
+            return result;
+        };
+        return ParticleSystemSet;
+    }());
+    BABYLON.ParticleSystemSet = ParticleSystemSet;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.particleSystemSet.js.map
+
+var BABYLON;
+(function (BABYLON) {
+    /**
+     * This class is made for on one-liner static method to help creating particle system set.
      */
     var ParticleHelper = /** @class */ (function () {
         function ParticleHelper() {
         }
         /**
-         * This is the main static method (one-liner) of this helper to create different particle systems.
+         * 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.
+         * @param scene The scene where the particle system should live
+         * @param gpu If the system will use gpu
+         * @returns the ParticleSystemSet created
          */
-        ParticleHelper.CreateAsync = function (type, emitter, scene, gpu) {
+        ParticleHelper.CreateAsync = function (type, scene, gpu) {
             if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (gpu === void 0) { gpu = false; }
             return new Promise(function (resolve, reject) {
@@ -102673,160 +102750,31 @@ var BABYLON;
                 if (gpu && !BABYLON.GPUParticleSystem.IsSupported) {
                     return reject("Particle system with GPU is not supported.");
                 }
-                BABYLON.Tools.LoadFile(ParticleHelper._baseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
+                BABYLON.Tools.LoadFile(ParticleHelper.BaseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
                     var newData = JSON.parse(data.toString());
-                    return resolve(ParticleHelper.CreateSystem(newData, scene, emitter));
+                    return resolve(BABYLON.ParticleSystemSet.Parse(newData, scene, gpu));
                 }, undefined, undefined, undefined, function (req, exception) {
                     return reject("An error occured while the creation of your particle system. Check if your type '" + type + "' exists.");
                 });
             });
         };
         /**
-         * Static function used to create a new particle system from a IParticleSystemData
-         * @param data defines the source data
-         * @param scene defines the hosting scene
-         * @param emitter defines the particle emitter
-         * @returns a new ParticleSystem based on referenced data
-         */
-        ParticleHelper.CreateSystem = function (data, scene, emitter) {
-            // Create a particle system
-            var system = new BABYLON.ParticleSystem(data.type, data.capacity, scene);
-            // Where the particles come from
-            system.emitter = emitter; // the starting object, the emitter            
-            ParticleHelper.UpdateSystem(system, data, scene);
-            return system;
-        };
-        /**
-         * Static function used to update a particle system from a IParticleSystemData
-         * @param system defines the particle system to update
-         * @param data defines the source data
-         * @param scene defines the hosting scene
-         */
-        ParticleHelper.UpdateSystem = function (system, data, scene) {
-            // Texture of each particle
-            if (data.textureFile) {
-                system.particleTexture = new BABYLON.Texture(ParticleHelper._baseAssetsUrl + "/textures/" + data.textureFile, scene);
-            }
-            // 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;
-            system.minScaleX = data.minScaleX;
-            system.maxScaleX = data.maxScaleX;
-            system.minScaleY = data.minScaleY;
-            system.maxScaleY = data.maxScaleY;
-            // 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;
-            }
-        };
-        /**
          * Static function used to export a particle system to a IParticleSystemData variable.
          * Please note that texture file name is not exported and must be added manually
          * @param system defines the particle system to export
          */
-        ParticleHelper.ExportSystem = function (system) {
-            var outData = {};
-            // Colors of all particles
-            outData.color1 = { r: system.color1.r, g: system.color1.g, b: system.color1.b, a: system.color1.a };
-            outData.color2 = { r: system.color2.r, g: system.color2.g, b: system.color2.b, a: system.color2.a };
-            outData.colorDead = { r: system.colorDead.r, g: system.colorDead.g, b: system.colorDead.b, a: system.colorDead.a };
-            // Size of each particle (random between...
-            outData.minSize = system.minSize;
-            outData.maxSize = system.maxSize;
-            outData.minScaleX = system.minScaleX;
-            outData.maxScaleX = system.maxScaleX;
-            outData.minScaleY = system.minScaleY;
-            outData.maxScaleY = system.maxScaleY;
-            // Life time of each particle (random between...
-            outData.minLifeTime = system.minLifeTime;
-            outData.maxLifeTime = system.maxLifeTime;
-            // Emission rate
-            outData.emitRate = system.emitRate;
-            // Blend mode : BLENDMODE_ONEONE, or BLENDMODE_STANDARD
-            outData.blendMode = system.blendMode;
-            // Set the gravity of all particles
-            outData.gravity = { x: system.gravity.x, y: system.gravity.y, z: system.gravity.z };
-            // Angular speed, in radians
-            outData.minAngularSpeed = system.minAngularSpeed;
-            outData.maxAngularSpeed = system.maxAngularSpeed;
-            // Speed
-            outData.minEmitPower = system.minEmitPower;
-            outData.maxEmitPower = system.maxEmitPower;
-            outData.updateSpeed = system.updateSpeed;
-            switch (system.particleEmitterType.getClassName()) {
-                case "BoxEmitter":
-                    outData.emitterType = "box";
-                    outData.direction1 = { x: system.direction1.x, y: system.direction1.y, z: system.direction1.z };
-                    outData.direction2 = { x: system.direction2.x, y: system.direction2.y, z: system.direction2.z };
-                    outData.minEmitBox = { x: system.minEmitBox.x, y: system.minEmitBox.y, z: system.minEmitBox.z };
-                    outData.maxEmitBox = { x: system.maxEmitBox.x, y: system.maxEmitBox.y, z: system.maxEmitBox.z };
-                    break;
-                case "SphereParticleEmitter":
-                    outData.emitterType = "sphere";
-                    outData.radius = system.particleEmitterType.radius;
-                    break;
-                case "SphereDirectedParticleEmitter":
-                    outData.emitterType = "directed_sphere";
-                    var sphereDirectedParticleEmitter = system.particleEmitterType;
-                    outData.radius = sphereDirectedParticleEmitter.radius;
-                    outData.direction1 = { x: sphereDirectedParticleEmitter.direction1.x, y: sphereDirectedParticleEmitter.direction1.y, z: sphereDirectedParticleEmitter.direction1.z };
-                    outData.direction2 = { x: sphereDirectedParticleEmitter.direction2.x, y: sphereDirectedParticleEmitter.direction2.y, z: sphereDirectedParticleEmitter.direction2.z };
-                    break;
-                case "ConeEmitter":
-                    outData.emitterType = "cone";
-                    outData.radius = system.particleEmitterType.radius;
-                    outData.angle = system.particleEmitterType.angle;
-                    break;
-                default:
-                    break;
+        ParticleHelper.ExportSet = function (systems) {
+            var set = new BABYLON.ParticleSystemSet();
+            for (var _i = 0, systems_1 = systems; _i < systems_1.length; _i++) {
+                var system = systems_1[_i];
+                set.systems.push(system);
             }
-            return outData;
+            return set;
         };
         /**
-         * Base Assets URL.
+         * Gets or sets base Assets URL
          */
-        ParticleHelper._baseAssetsUrl = "https://assets.babylonjs.com/particles";
+        ParticleHelper.BaseAssetsUrl = "https://assets.babylonjs.com/particles";
         return ParticleHelper;
     }());
     BABYLON.ParticleHelper = ParticleHelper;

+ 2 - 2
src/Particles/EmitterTypes/babylon.boxParticleEmitter.ts

@@ -91,11 +91,11 @@ module BABYLON {
         }
 
         /**
-         * Returns the string "BoxEmitter"
+         * Returns the string "BoxParticleEmitter"
          * @returns a string containing the class name
          */
         public getClassName(): string {
-            return "BoxEmitter";
+            return "BoxParticleEmitter";
         }   
         
         /**

+ 2 - 2
src/Particles/EmitterTypes/babylon.coneParticleEmitter.ts

@@ -133,11 +133,11 @@ module BABYLON {
         }     
         
         /**
-         * Returns the string "ConeEmitter"
+         * Returns the string "ConeParticleEmitter"
          * @returns a string containing the class name
          */
         public getClassName(): string {
-            return "ConeEmitter";
+            return "ConeParticleEmitter";
         }  
         
         /**

+ 2 - 0
src/Particles/EmitterTypes/babylon.sphereParticleEmitter.ts

@@ -108,6 +108,7 @@ module BABYLON {
             var serializationObject: any = {};
             serializationObject.type = this.getClassName();
             serializationObject.radius = this.radius;
+            serializationObject.radiusRange = this.radiusRange;
             serializationObject.directionRandomizer = this.directionRandomizer;
 
             return serializationObject;
@@ -119,6 +120,7 @@ module BABYLON {
          */
         public parse(serializationObject: any): void {
             this.radius = serializationObject.radius;
+            this.radiusRange = serializationObject.radiusRange;
             this.directionRandomizer = serializationObject.directionRandomizer;
         }          
     }

+ 3 - 3
src/Particles/babylon.particleHelper.ts

@@ -37,9 +37,9 @@ module BABYLON {
         }
 
         /**
-         * Static function used to export a particle system to a IParticleSystemData variable.
-         * Please note that texture file name is not exported and must be added manually
-         * @param system defines the particle system to export
+         * Static function used to export a particle system to a ParticleSystemSet variable.
+         * Please note that the emitter shape is not exported
+         * @param system defines the particle systems to export
          */
         public static ExportSet(systems: ParticleSystem[]): ParticleSystemSet {
             var set = new ParticleSystemSet();

+ 2 - 0
src/Particles/babylon.particleSystem.ts

@@ -1572,9 +1572,11 @@
                         emitterType = new SphereDirectedParticleEmitter();
                         break;
                     case "ConeEmitter":
+                    case "ConeParticleEmitter":
                         emitterType = new ConeParticleEmitter();
                         break;
                     case "BoxEmitter":
+                    case "BoxParticleEmitter":
                     default:
                         emitterType = new BoxParticleEmitter();
                         break;                                                

+ 85 - 4
src/Particles/babylon.particleSystemSet.ts

@@ -1,26 +1,90 @@
 module BABYLON {
 
+    /** Internal class used to store shapes for emitters */
+    class ParticleSystemSetEmitterCreationOptions {
+        public kind: string;
+        public options: any;
+        public renderingGroupId: number;
+    }
+
     /**
      * Represents a set of particle systems working together to create a specific effect
      */
-    export class ParticleSystemSet {
+    export class ParticleSystemSet implements IDisposable {
+        private _emitterCreationOptions: ParticleSystemSetEmitterCreationOptions;
+        private _emitterMesh: Nullable<Mesh>;
+
         /**
          * Gets or sets the particle system list
          */
         public systems = new Array<IParticleSystem>();
 
         /**
+         * Gets or set the emitter mesh used with this set
+         */
+        public get emitterMesh(): Nullable<Mesh> {
+            return this._emitterMesh;
+        }
+
+        /**
+         * Creates a new emitter mesh as a sphere
+         * @param options defines the options used to create the sphere
+         * @param renderingGroupId defines the renderingGroupId to use for the sphere
+         * @param scene defines the hosting scene
+         */
+        public setEmitterAsSphere(options: {diameter: number, segments: number, color: Color3} , renderingGroupId: number, scene: Scene) {
+            if (this._emitterMesh) {
+                this._emitterMesh.dispose();
+            }
+
+            this._emitterCreationOptions = {
+                kind: "Sphere",
+                options: options,
+                renderingGroupId: renderingGroupId
+            }
+
+            this._emitterMesh = MeshBuilder.CreateSphere("emitterSphere", {diameter: options.diameter, segments: options.segments}, scene);
+            this._emitterMesh.renderingGroupId = renderingGroupId;
+
+            var material = new BABYLON.StandardMaterial("emitterSphereMaterial", scene)
+            material.emissiveColor = options.color;    
+            this._emitterMesh.material = material;     
+            
+            for (var system of this.systems) {
+                system.emitter = this._emitterMesh;
+            }
+        }
+
+        /**
          * Starts all particle systems of the set
-         * @param emitter defines the mesh to use as emitter for the particle systems
+         * @param emitter defines an optional mesh to use as emitter for the particle systems
          */
-        public start(emitter: AbstractMesh): void {
+        public start(emitter?: AbstractMesh): void {
             for (var system of this.systems) {
-                system.emitter = emitter;
+                if (emitter) {
+                    system.emitter = emitter;
+                }
                 system.start();
             }
         }
 
         /**
+         * Release all associated resources
+         */
+        public dispose(): void {
+            for (var system of this.systems) {
+                system.dispose();
+            }
+
+            this.systems = [];
+
+            if (this._emitterMesh) {
+                this._emitterMesh.dispose();
+                this._emitterMesh = null;
+            }
+        }
+
+        /**
          * Serialize the set into a JSON compatible object
          * @returns a JSON compatible representation of the set
          */
@@ -32,6 +96,10 @@ module BABYLON {
                 result.systems.push(system.serialize());
             }
 
+            if (this._emitterMesh) {
+                result.emitter = this._emitterCreationOptions;
+            }
+
             return result;
         }
 
@@ -50,6 +118,19 @@ module BABYLON {
                 result.systems.push(gpu ? GPUParticleSystem.Parse(system, scene, rootUrl) : ParticleSystem.Parse(system, scene, rootUrl));
             }
 
+            if (data.emitter) {
+                let options = data.emitter.options;
+                switch (data.emitter.kind) {                    
+                    case "Sphere":
+                        result.setEmitterAsSphere({
+                            diameter: options.diameter, 
+                            segments: options.segments,
+                            color: Color3.FromArray(options.color)
+                        }, data.emitter.renderingGroupId, scene);
+                        break;
+                }
+            }
+
             return result;
         }
     }

+ 3 - 14
tests/unit/babylon/src/Helpers/babylon.particleHelper.tests.ts

@@ -33,15 +33,13 @@ describe('Babylon Particle Helper', function () {
 
   describe('#ParticleHelper.CreateAsync', () => {
       let scene: BABYLON.Scene;
-      let emitter: BABYLON.Mesh;
 
       beforeEach(() => {
         scene = new BABYLON.Scene(subject);
-        emitter = BABYLON.Mesh.CreateSphere("sphere", 10, 5, scene);
       });
 
-      it('creates a fire particle system', (done) => {
-        BABYLON.ParticleHelper.CreateAsync("fire", emitter, scene)
+      it('creates a sun particle system set', (done) => {
+        BABYLON.ParticleHelper.CreateAsync("fire", scene)
             .then((system) => {
                 expect(system).to.be.instanceof(BABYLON.ParticleSystem);
                 done();
@@ -49,17 +47,8 @@ describe('Babylon Particle Helper', function () {
             .catch((error) => { throw new Error("was not supposed to fail"); });
       });
 
-      it('creates a smoke particle system', (done) => {
-        BABYLON.ParticleHelper.CreateAsync("smoke", emitter, scene)
-            .then((system) => {
-                expect(system).to.be.instanceof(BABYLON.ParticleSystem);
-                done();
-            })
-            .catch((error) => { throw new Error("was not supposed to fail"); });
-    });
-
       it('rejects the creation of the particle system', (done) => {
-        BABYLON.ParticleHelper.CreateAsync("test", emitter, scene)
+        BABYLON.ParticleHelper.CreateAsync("test", scene)
             .then(() => { throw new Error("was not supposed to succeed"); })
             .catch((error) => {
                 expect(error).to.equals("An error occured while the creation of your particle system. Check if your type 'test' exists.");