|
@@ -58587,7 +58587,7 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* The SPS is a single updatable mesh. The solid particles are simply separate parts or faces fo this big mesh.
|
|
* The SPS is a single updatable mesh. The solid particles are simply separate parts or faces fo this big mesh.
|
|
*As it is just a mesh, the SPS has all the same properties than any other BJS mesh : not more, not less. It can be scaled, rotated, translated, enlighted, textured, moved, etc.
|
|
*As it is just a mesh, the SPS has all the same properties than any other BJS mesh : not more, not less. It can be scaled, rotated, translated, enlighted, textured, moved, etc.
|
|
-
|
|
|
|
|
|
+
|
|
* The SPS is also a particle system. It provides some methods to manage the particles.
|
|
* The SPS is also a particle system. It provides some methods to manage the particles.
|
|
* However it is behavior agnostic. This means it has no emitter, no particle physics, no particle recycler. You have to implement your own behavior.
|
|
* However it is behavior agnostic. This means it has no emitter, no particle physics, no particle recycler. You have to implement your own behavior.
|
|
*
|
|
*
|
|
@@ -98594,150 +98594,6 @@ var BABYLON;
|
|
|
|
|
|
//# sourceMappingURL=babylon.environmentHelper.js.map
|
|
//# sourceMappingURL=babylon.environmentHelper.js.map
|
|
|
|
|
|
-var BABYLON;
|
|
|
|
-(function (BABYLON) {
|
|
|
|
- /**
|
|
|
|
- * ParticleSystemType
|
|
|
|
- */
|
|
|
|
- var ParticleSystemType;
|
|
|
|
- (function (ParticleSystemType) {
|
|
|
|
- /**
|
|
|
|
- * None is to represents an error in parsing the type string in the create method.
|
|
|
|
- */
|
|
|
|
- ParticleSystemType[ParticleSystemType["None"] = 0] = "None";
|
|
|
|
- /**
|
|
|
|
- * Fire particle system.
|
|
|
|
- */
|
|
|
|
- ParticleSystemType[ParticleSystemType["Fire"] = 1] = "Fire";
|
|
|
|
- /**
|
|
|
|
- * Smoke particle system.
|
|
|
|
- */
|
|
|
|
- ParticleSystemType[ParticleSystemType["Smoke"] = 2] = "Smoke";
|
|
|
|
- })(ParticleSystemType = BABYLON.ParticleSystemType || (BABYLON.ParticleSystemType = {}));
|
|
|
|
- /**
|
|
|
|
- * 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 will be parsed to a ParticleSystemType
|
|
|
|
- * @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.Create = function (type, emitter, scene, gpu) {
|
|
|
|
- if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
|
|
|
|
- if (gpu === void 0) { gpu = false; }
|
|
|
|
- var typeParsed = this._parseType(type);
|
|
|
|
- if (typeParsed === ParticleSystemType.None) {
|
|
|
|
- throw new Error("This particle system type doesn't exist.");
|
|
|
|
- }
|
|
|
|
- if (scene) {
|
|
|
|
- this._scene = scene;
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- throw new Error("A particle system need a scene.");
|
|
|
|
- }
|
|
|
|
- this._emitter = emitter;
|
|
|
|
- switch (typeParsed) {
|
|
|
|
- case ParticleSystemType.Fire:
|
|
|
|
- return this._createFire();
|
|
|
|
- case ParticleSystemType.Smoke:
|
|
|
|
- return this._createSmoke();
|
|
|
|
- default:
|
|
|
|
- throw new Error("Not yet implemented.");
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- ParticleHelper._parseType = function (type) {
|
|
|
|
- switch (type) {
|
|
|
|
- case "fire":
|
|
|
|
- case "Fire":
|
|
|
|
- case "FIRE":
|
|
|
|
- return ParticleSystemType.Fire;
|
|
|
|
- case "smoke":
|
|
|
|
- case "Smoke":
|
|
|
|
- case "SMOKE":
|
|
|
|
- return ParticleSystemType.Smoke;
|
|
|
|
- default:
|
|
|
|
- return ParticleSystemType.None;
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- ParticleHelper._createFire = function () {
|
|
|
|
- // Create a particle system
|
|
|
|
- var fireSystem = new BABYLON.ParticleSystem("particles", 2000, this._scene);
|
|
|
|
- // Texture of each particle
|
|
|
|
- fireSystem.particleTexture = new BABYLON.Texture(this._baseAssetsUrl + "textures/flare.png", this._scene);
|
|
|
|
- // Where the particles come from
|
|
|
|
- fireSystem.emitter = this._emitter; // the starting object, the emitter
|
|
|
|
- fireSystem.minEmitBox = new BABYLON.Vector3(-0.5, 1, -0.5); // Starting all from
|
|
|
|
- fireSystem.maxEmitBox = new BABYLON.Vector3(0.5, 1, 0.5); // To...
|
|
|
|
- // Colors of all particles
|
|
|
|
- fireSystem.color1 = new BABYLON.Color4(1, 0.5, 0, 1.0);
|
|
|
|
- fireSystem.color2 = new BABYLON.Color4(1, 0.5, 0, 1.0);
|
|
|
|
- fireSystem.colorDead = new BABYLON.Color4(0, 0, 0, 0.0);
|
|
|
|
- // Size of each particle (random between...
|
|
|
|
- fireSystem.minSize = 0.3;
|
|
|
|
- fireSystem.maxSize = 1;
|
|
|
|
- // Life time of each particle (random between...
|
|
|
|
- fireSystem.minLifeTime = 0.2;
|
|
|
|
- fireSystem.maxLifeTime = 0.4;
|
|
|
|
- // Emission rate
|
|
|
|
- fireSystem.emitRate = 600;
|
|
|
|
- // Blend mode : BLENDMODE_ONEONE, or BLENDMODE_STANDARD
|
|
|
|
- fireSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_ONEONE;
|
|
|
|
- // Set the gravity of all particles
|
|
|
|
- fireSystem.gravity = new BABYLON.Vector3(0, 0, 0);
|
|
|
|
- // Direction of each particle after it has been emitted
|
|
|
|
- fireSystem.direction1 = new BABYLON.Vector3(0, 4, 0);
|
|
|
|
- fireSystem.direction2 = new BABYLON.Vector3(0, 4, 0);
|
|
|
|
- // Angular speed, in radians
|
|
|
|
- fireSystem.minAngularSpeed = 0;
|
|
|
|
- fireSystem.maxAngularSpeed = Math.PI;
|
|
|
|
- // Speed
|
|
|
|
- fireSystem.minEmitPower = 1;
|
|
|
|
- fireSystem.maxEmitPower = 3;
|
|
|
|
- fireSystem.updateSpeed = 0.007;
|
|
|
|
- return fireSystem;
|
|
|
|
- };
|
|
|
|
- ParticleHelper._createSmoke = function () {
|
|
|
|
- var smokeSystem = new BABYLON.ParticleSystem("smoke", 1000, this._scene);
|
|
|
|
- smokeSystem.particleTexture = new BABYLON.Texture(this._baseAssetsUrl + "textures/flare.png", this._scene);
|
|
|
|
- smokeSystem.emitter = this._emitter;
|
|
|
|
- smokeSystem.minEmitBox = new BABYLON.Vector3(-0.5, 1, -0.5);
|
|
|
|
- smokeSystem.maxEmitBox = new BABYLON.Vector3(0.5, 1, 0.5);
|
|
|
|
- smokeSystem.color1 = new BABYLON.Color4(0.1, 0.1, 0.1, 1.0);
|
|
|
|
- smokeSystem.color2 = new BABYLON.Color4(0.1, 0.1, 0.1, 1.0);
|
|
|
|
- smokeSystem.colorDead = new BABYLON.Color4(0, 0, 0, 0.0);
|
|
|
|
- smokeSystem.minSize = 0.3;
|
|
|
|
- smokeSystem.maxSize = 1;
|
|
|
|
- smokeSystem.minLifeTime = 0.3;
|
|
|
|
- smokeSystem.maxLifeTime = 1.5;
|
|
|
|
- smokeSystem.emitRate = 350;
|
|
|
|
- smokeSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_ONEONE;
|
|
|
|
- smokeSystem.gravity = new BABYLON.Vector3(0, 0, 0);
|
|
|
|
- smokeSystem.direction1 = new BABYLON.Vector3(-1.5, 8, -1.5);
|
|
|
|
- smokeSystem.direction2 = new BABYLON.Vector3(1.5, 8, 1.5);
|
|
|
|
- smokeSystem.minAngularSpeed = 0;
|
|
|
|
- smokeSystem.maxAngularSpeed = Math.PI;
|
|
|
|
- smokeSystem.minEmitPower = 0.5;
|
|
|
|
- smokeSystem.maxEmitPower = 1.5;
|
|
|
|
- smokeSystem.updateSpeed = 0.005;
|
|
|
|
- return smokeSystem;
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
- * Base Assets URL.
|
|
|
|
- */
|
|
|
|
- ParticleHelper._baseAssetsUrl = "https://assets.babylonjs.com/particles/";
|
|
|
|
- return ParticleHelper;
|
|
|
|
- }());
|
|
|
|
- BABYLON.ParticleHelper = ParticleHelper;
|
|
|
|
-})(BABYLON || (BABYLON = {}));
|
|
|
|
-
|
|
|
|
-//# sourceMappingURL=babylon.particleHelper.js.map
|
|
|
|
-
|
|
|
|
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|