|
@@ -56594,9 +56594,11 @@ var BABYLON;
|
|
|
emitterType = new BABYLON.SphereDirectedParticleEmitter();
|
|
|
break;
|
|
|
case "ConeEmitter":
|
|
|
+ case "ConeParticleEmitter":
|
|
|
emitterType = new BABYLON.ConeParticleEmitter();
|
|
|
break;
|
|
|
case "BoxEmitter":
|
|
|
+ case "BoxParticleEmitter":
|
|
|
default:
|
|
|
emitterType = new BABYLON.BoxParticleEmitter();
|
|
|
break;
|
|
@@ -56749,11 +56751,11 @@ var BABYLON;
|
|
|
return "#define BOXEMITTER";
|
|
|
};
|
|
|
/**
|
|
|
- * Returns the string "BoxEmitter"
|
|
|
+ * Returns the string "BoxParticleEmitter"
|
|
|
* @returns a string containing the class name
|
|
|
*/
|
|
|
BoxParticleEmitter.prototype.getClassName = function () {
|
|
|
- return "BoxEmitter";
|
|
|
+ return "BoxParticleEmitter";
|
|
|
};
|
|
|
/**
|
|
|
* Serializes the particle system to a JSON object.
|
|
@@ -56913,11 +56915,11 @@ var BABYLON;
|
|
|
return "#define CONEEMITTER";
|
|
|
};
|
|
|
/**
|
|
|
- * Returns the string "ConeEmitter"
|
|
|
+ * Returns the string "ConeParticleEmitter"
|
|
|
* @returns a string containing the class name
|
|
|
*/
|
|
|
ConeParticleEmitter.prototype.getClassName = function () {
|
|
|
- return "ConeEmitter";
|
|
|
+ return "ConeParticleEmitter";
|
|
|
};
|
|
|
/**
|
|
|
* Serializes the particle system to a JSON object.
|
|
@@ -102576,6 +102578,12 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
+ /** Internal class used to store shapes for emitters */
|
|
|
+ var ParticleSystemSetEmitterCreationOptions = /** @class */ (function () {
|
|
|
+ function ParticleSystemSetEmitterCreationOptions() {
|
|
|
+ }
|
|
|
+ return ParticleSystemSetEmitterCreationOptions;
|
|
|
+ }());
|
|
|
/**
|
|
|
* Represents a set of particle systems working together to create a specific effect
|
|
|
*/
|
|
@@ -102586,6 +102594,41 @@ var BABYLON;
|
|
|
*/
|
|
|
this.systems = new Array();
|
|
|
}
|
|
|
+ Object.defineProperty(ParticleSystemSet.prototype, "emitterMesh", {
|
|
|
+ /**
|
|
|
+ * Gets or set the emitter mesh used with this set
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ return this._emitterMesh;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ /**
|
|
|
+ * 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
|
|
|
+ */
|
|
|
+ ParticleSystemSet.prototype.setEmitterAsSphere = function (options, renderingGroupId, scene) {
|
|
|
+ if (this._emitterMesh) {
|
|
|
+ this._emitterMesh.dispose();
|
|
|
+ }
|
|
|
+ this._emitterCreationOptions = {
|
|
|
+ kind: "Sphere",
|
|
|
+ options: options,
|
|
|
+ renderingGroupId: renderingGroupId
|
|
|
+ };
|
|
|
+ this._emitterMesh = BABYLON.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 _i = 0, _a = this.systems; _i < _a.length; _i++) {
|
|
|
+ var system = _a[_i];
|
|
|
+ system.emitter = this._emitterMesh;
|
|
|
+ }
|
|
|
+ };
|
|
|
/**
|
|
|
* Starts all particle systems of the set
|
|
|
* @param emitter defines an optional mesh to use as emitter for the particle systems
|
|
@@ -102600,6 +102643,20 @@ var BABYLON;
|
|
|
}
|
|
|
};
|
|
|
/**
|
|
|
+ * Release all associated resources
|
|
|
+ */
|
|
|
+ ParticleSystemSet.prototype.dispose = function () {
|
|
|
+ for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {
|
|
|
+ var system = _a[_i];
|
|
|
+ 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
|
|
|
*/
|
|
@@ -102610,6 +102667,9 @@ var BABYLON;
|
|
|
var system = _a[_i];
|
|
|
result.systems.push(system.serialize());
|
|
|
}
|
|
|
+ if (this._emitterMesh) {
|
|
|
+ result.emitter = this._emitterCreationOptions;
|
|
|
+ }
|
|
|
return result;
|
|
|
};
|
|
|
/**
|
|
@@ -102627,6 +102687,18 @@ var BABYLON;
|
|
|
var system = _a[_i];
|
|
|
result.systems.push(gpu ? BABYLON.GPUParticleSystem.Parse(system, scene, rootUrl) : BABYLON.ParticleSystem.Parse(system, scene, rootUrl));
|
|
|
}
|
|
|
+ if (data.emitter) {
|
|
|
+ var options = data.emitter.options;
|
|
|
+ switch (data.emitter.kind) {
|
|
|
+ case "Sphere":
|
|
|
+ result.setEmitterAsSphere({
|
|
|
+ diameter: options.diameter,
|
|
|
+ segments: options.segments,
|
|
|
+ color: BABYLON.Color3.FromArray(options.color)
|
|
|
+ }, data.emitter.renderingGroupId, scene);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
return result;
|
|
|
};
|
|
|
return ParticleSystemSet;
|
|
@@ -102671,9 +102743,9 @@ var 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
|
|
|
*/
|
|
|
ParticleHelper.ExportSet = function (systems) {
|
|
|
var set = new BABYLON.ParticleSystemSet();
|