|
@@ -23377,26 +23377,150 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
|
|
+ /**
|
|
|
|
+ * Set of assets to keep when moving a scene into an asset container.
|
|
|
|
+ */
|
|
|
|
+ var KeepAssets = /** @class */ (function () {
|
|
|
|
+ function KeepAssets() {
|
|
|
|
+ /**
|
|
|
|
+ * Cameras to keep.
|
|
|
|
+ */
|
|
|
|
+ this.cameras = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Lights to keep.
|
|
|
|
+ */
|
|
|
|
+ this.lights = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Meshes to keep.
|
|
|
|
+ */
|
|
|
|
+ this.meshes = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Skeletons to keep.
|
|
|
|
+ */
|
|
|
|
+ this.skeletons = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * ParticleSystems to keep.
|
|
|
|
+ */
|
|
|
|
+ this.particleSystems = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Animations to keep.
|
|
|
|
+ */
|
|
|
|
+ this.animations = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * MultiMaterials to keep.
|
|
|
|
+ */
|
|
|
|
+ this.multiMaterials = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Materials to keep.
|
|
|
|
+ */
|
|
|
|
+ this.materials = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * MorphTargetManagers to keep.
|
|
|
|
+ */
|
|
|
|
+ this.morphTargetManagers = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Geometries to keep.
|
|
|
|
+ */
|
|
|
|
+ this.geometries = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * TransformNodes to keep.
|
|
|
|
+ */
|
|
|
|
+ this.transformNodes = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * LensFlareSystems to keep.
|
|
|
|
+ */
|
|
|
|
+ this.lensFlareSystems = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * ShadowGenerators to keep.
|
|
|
|
+ */
|
|
|
|
+ this.shadowGenerators = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * ActionManagers to keep.
|
|
|
|
+ */
|
|
|
|
+ this.actionManagers = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Sounds to keep.
|
|
|
|
+ */
|
|
|
|
+ this.sounds = new Array();
|
|
|
|
+ }
|
|
|
|
+ return KeepAssets;
|
|
|
|
+ }());
|
|
|
|
+ BABYLON.KeepAssets = KeepAssets;
|
|
|
|
+ /**
|
|
|
|
+ * Container with a set of assets that can be added or removed from a scene.
|
|
|
|
+ */
|
|
var AssetContainer = /** @class */ (function () {
|
|
var AssetContainer = /** @class */ (function () {
|
|
|
|
+ /**
|
|
|
|
+ * Instantiates an AssetContainer.
|
|
|
|
+ * @param scene The scene the AssetContainer belongs to.
|
|
|
|
+ */
|
|
function AssetContainer(scene) {
|
|
function AssetContainer(scene) {
|
|
// Objects
|
|
// Objects
|
|
|
|
+ /**
|
|
|
|
+ * Cameras populated in the container.
|
|
|
|
+ */
|
|
this.cameras = new Array();
|
|
this.cameras = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Lights populated in the container.
|
|
|
|
+ */
|
|
this.lights = new Array();
|
|
this.lights = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Meshes populated in the container.
|
|
|
|
+ */
|
|
this.meshes = new Array();
|
|
this.meshes = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Skeletons populated in the container.
|
|
|
|
+ */
|
|
this.skeletons = new Array();
|
|
this.skeletons = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * ParticleSystems populated in the container.
|
|
|
|
+ */
|
|
this.particleSystems = new Array();
|
|
this.particleSystems = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Animations populated in the container.
|
|
|
|
+ */
|
|
this.animations = new Array();
|
|
this.animations = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * MultiMaterials populated in the container.
|
|
|
|
+ */
|
|
this.multiMaterials = new Array();
|
|
this.multiMaterials = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Materials populated in the container.
|
|
|
|
+ */
|
|
this.materials = new Array();
|
|
this.materials = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * MorphTargetManagers populated in the container.
|
|
|
|
+ */
|
|
this.morphTargetManagers = new Array();
|
|
this.morphTargetManagers = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Geometries populated in the container.
|
|
|
|
+ */
|
|
this.geometries = new Array();
|
|
this.geometries = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * TransformNodes populated in the container.
|
|
|
|
+ */
|
|
this.transformNodes = new Array();
|
|
this.transformNodes = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * LensFlareSystems populated in the container.
|
|
|
|
+ */
|
|
this.lensFlareSystems = new Array();
|
|
this.lensFlareSystems = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * ShadowGenerators populated in the container.
|
|
|
|
+ */
|
|
this.shadowGenerators = new Array();
|
|
this.shadowGenerators = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * ActionManagers populated in the container.
|
|
|
|
+ */
|
|
this.actionManagers = new Array();
|
|
this.actionManagers = new Array();
|
|
|
|
+ /**
|
|
|
|
+ * Sounds populated in the container.
|
|
|
|
+ */
|
|
this.sounds = new Array();
|
|
this.sounds = new Array();
|
|
this.scene = scene;
|
|
this.scene = scene;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Adds all the assets from the container to the scene.
|
|
|
|
+ */
|
|
AssetContainer.prototype.addAllToScene = function () {
|
|
AssetContainer.prototype.addAllToScene = function () {
|
|
var _this = this;
|
|
var _this = this;
|
|
this.cameras.forEach(function (o) {
|
|
this.cameras.forEach(function (o) {
|
|
@@ -23444,6 +23568,9 @@ var BABYLON;
|
|
_this.scene.mainSoundTrack.AddSound(o);
|
|
_this.scene.mainSoundTrack.AddSound(o);
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Removes all the assets in the container from the scene
|
|
|
|
+ */
|
|
AssetContainer.prototype.removeAllFromScene = function () {
|
|
AssetContainer.prototype.removeAllFromScene = function () {
|
|
var _this = this;
|
|
var _this = this;
|
|
this.cameras.forEach(function (o) {
|
|
this.cameras.forEach(function (o) {
|
|
@@ -23491,6 +23618,46 @@ var BABYLON;
|
|
_this.scene.mainSoundTrack.RemoveSound(o);
|
|
_this.scene.mainSoundTrack.RemoveSound(o);
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+ AssetContainer.prototype._moveAssets = function (sourceAssets, targetAssets, keepAssets) {
|
|
|
|
+ for (var _i = 0, sourceAssets_1 = sourceAssets; _i < sourceAssets_1.length; _i++) {
|
|
|
|
+ var asset = sourceAssets_1[_i];
|
|
|
|
+ var move = true;
|
|
|
|
+ for (var _a = 0, keepAssets_1 = keepAssets; _a < keepAssets_1.length; _a++) {
|
|
|
|
+ var keepAsset = keepAssets_1[_a];
|
|
|
|
+ if (asset === keepAsset) {
|
|
|
|
+ move = false;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (move) {
|
|
|
|
+ targetAssets.push(asset);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Removes all the assets contained in the scene and adds them to the container.
|
|
|
|
+ * @param keepAssets Set of assets to keep in the scene. (default: empty)
|
|
|
|
+ */
|
|
|
|
+ AssetContainer.prototype.moveAllFromScene = function (keepAssets) {
|
|
|
|
+ if (keepAssets === undefined) {
|
|
|
|
+ keepAssets = new KeepAssets();
|
|
|
|
+ }
|
|
|
|
+ this._moveAssets(this.scene.cameras, this.cameras, keepAssets.cameras);
|
|
|
|
+ this._moveAssets(this.scene.meshes, this.meshes, keepAssets.meshes);
|
|
|
|
+ this._moveAssets(this.scene.getGeometries(), this.geometries, keepAssets.geometries);
|
|
|
|
+ this._moveAssets(this.scene.materials, this.materials, keepAssets.materials);
|
|
|
|
+ Array.prototype.push.apply(this.actionManagers, this.scene._actionManagers);
|
|
|
|
+ Array.prototype.push.apply(this.animations, this.scene.animations);
|
|
|
|
+ Array.prototype.push.apply(this.lensFlareSystems, this.scene.lensFlareSystems);
|
|
|
|
+ Array.prototype.push.apply(this.lights, this.scene.lights);
|
|
|
|
+ Array.prototype.push.apply(this.morphTargetManagers, this.scene.morphTargetManagers);
|
|
|
|
+ Array.prototype.push.apply(this.multiMaterials, this.scene.multiMaterials);
|
|
|
|
+ Array.prototype.push.apply(this.skeletons, this.scene.skeletons);
|
|
|
|
+ Array.prototype.push.apply(this.particleSystems, this.scene.particleSystems);
|
|
|
|
+ Array.prototype.push.apply(this.sounds, this.scene.mainSoundTrack.soundCollection);
|
|
|
|
+ Array.prototype.push.apply(this.transformNodes, this.scene.transformNodes);
|
|
|
|
+ this.removeAllFromScene();
|
|
|
|
+ };
|
|
return AssetContainer;
|
|
return AssetContainer;
|
|
}());
|
|
}());
|
|
BABYLON.AssetContainer = AssetContainer;
|
|
BABYLON.AssetContainer = AssetContainer;
|
|
@@ -47132,10 +47299,12 @@ var BABYLON;
|
|
* Creates a new instance of @see Particle
|
|
* Creates a new instance of @see Particle
|
|
* @param particleSystem the particle system the particle belongs to
|
|
* @param particleSystem the particle system the particle belongs to
|
|
*/
|
|
*/
|
|
- function Particle(particleSystem, generation) {
|
|
|
|
- if (generation === void 0) { generation = 0; }
|
|
|
|
|
|
+ function Particle(
|
|
|
|
+ /**
|
|
|
|
+ * particleSystem the particle system the particle belongs to.
|
|
|
|
+ */
|
|
|
|
+ particleSystem) {
|
|
this.particleSystem = particleSystem;
|
|
this.particleSystem = particleSystem;
|
|
- this.generation = generation;
|
|
|
|
/**
|
|
/**
|
|
* The world position of the particle in the scene.
|
|
* The world position of the particle in the scene.
|
|
*/
|
|
*/
|
|
@@ -47180,9 +47349,12 @@ var BABYLON;
|
|
if (!this.particleSystem.isAnimationSheetEnabled) {
|
|
if (!this.particleSystem.isAnimationSheetEnabled) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.setCellInfoFromSystem();
|
|
|
|
|
|
+ this.updateCellInfoFromSystem();
|
|
}
|
|
}
|
|
- Particle.prototype.setCellInfoFromSystem = function () {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * This method update the current particle cell info from the particle system.
|
|
|
|
+ */
|
|
|
|
+ Particle.prototype.updateCellInfoFromSystem = function () {
|
|
this.cellIndex = this.particleSystem.startSpriteCellID;
|
|
this.cellIndex = this.particleSystem.startSpriteCellID;
|
|
if (this.particleSystem.spriteCellChangeSpeed == 0) {
|
|
if (this.particleSystem.spriteCellChangeSpeed == 0) {
|
|
this.updateCellIndex = this.updateCellIndexWithSpeedCalculated;
|
|
this.updateCellIndex = this.updateCellIndexWithSpeedCalculated;
|
|
@@ -47253,7 +47425,7 @@ var BABYLON;
|
|
* @example https://doc.babylonjs.com/babylon101/particles
|
|
* @example https://doc.babylonjs.com/babylon101/particles
|
|
*/
|
|
*/
|
|
var ParticleSystem = /** @class */ (function () {
|
|
var ParticleSystem = /** @class */ (function () {
|
|
- //end of sub emitter
|
|
|
|
|
|
+ //end of Sub-emitter
|
|
/**
|
|
/**
|
|
* Instantiates a particle system.
|
|
* Instantiates a particle system.
|
|
* Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.
|
|
* Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.
|
|
@@ -47437,7 +47609,29 @@ var BABYLON;
|
|
this._stopped = false;
|
|
this._stopped = false;
|
|
this._actualFrame = 0;
|
|
this._actualFrame = 0;
|
|
this._vertexBufferSize = 11;
|
|
this._vertexBufferSize = 11;
|
|
|
|
+ /**
|
|
|
|
+ * This property is used to set the max number of sub emits. if this property is used the particle system everytime will pick a random template from the subEmitters property.
|
|
|
|
+ If this value is not set the ParticleSystem will pick the next emitter template based on order, this property is used by the root particle system only.
|
|
|
|
+ */
|
|
|
|
+ this.maxNumberOfSubEmits = 0;
|
|
this._isEmitting = false;
|
|
this._isEmitting = false;
|
|
|
|
+ // start of sub system methods
|
|
|
|
+ /**
|
|
|
|
+ * "Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list.
|
|
|
|
+ * Its lifetime will start back at 0.
|
|
|
|
+ */
|
|
|
|
+ this.recycleParticle = function (particle) {
|
|
|
|
+ _this._recycleParticleUsingSystem(_this, _this, particle);
|
|
|
|
+ };
|
|
|
|
+ this._createParticle = function () {
|
|
|
|
+ return _this._createParticleUsingSystem(_this, _this);
|
|
|
|
+ };
|
|
|
|
+ // to be overriden by subSystems
|
|
|
|
+ this._stoppedEmitting = function () {
|
|
|
|
+ };
|
|
|
|
+ this._emitFromParticle = function (particle) {
|
|
|
|
+ _this._emitFromGenerationUsingSystem(_this, particle, 0);
|
|
|
|
+ };
|
|
this._appendParticleVertexes = null;
|
|
this._appendParticleVertexes = null;
|
|
this.count = 0;
|
|
this.count = 0;
|
|
this.id = name;
|
|
this.id = name;
|
|
@@ -47474,7 +47668,7 @@ var BABYLON;
|
|
if (particle.age >= particle.lifeTime) {
|
|
if (particle.age >= particle.lifeTime) {
|
|
_this.recycleParticle(particle);
|
|
_this.recycleParticle(particle);
|
|
index--;
|
|
index--;
|
|
- _this.emitFromParticle(particle);
|
|
|
|
|
|
+ _this._emitFromParticle(particle);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -47532,14 +47726,6 @@ var BABYLON;
|
|
this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);
|
|
this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * "Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list.
|
|
|
|
- * Its lifetime will start back at 0.
|
|
|
|
- * @param particle The particle to recycle
|
|
|
|
- */
|
|
|
|
- ParticleSystem.prototype.recycleParticle = function (particle) {
|
|
|
|
- ParticleSystem.recycleParticle(this, this, particle);
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
* Gets the maximum number of particles active at the same time.
|
|
* Gets the maximum number of particles active at the same time.
|
|
* @returns The max number of active particles.
|
|
* @returns The max number of active particles.
|
|
*/
|
|
*/
|
|
@@ -47574,48 +47760,13 @@ var BABYLON;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Stops the particle system.
|
|
* Stops the particle system.
|
|
|
|
+ * @param stopSubEmitters if true it will stop the current system and all created sub-Systems if false it will stop the current root system only, this param is used by the root particle system only. the default value is true.
|
|
*/
|
|
*/
|
|
- ParticleSystem.prototype.stop = function () {
|
|
|
|
|
|
+ ParticleSystem.prototype.stop = function (stopSubEmitters) {
|
|
|
|
+ if (stopSubEmitters === void 0) { stopSubEmitters = true; }
|
|
this._stopped = true;
|
|
this._stopped = true;
|
|
|
|
+ this._stopSubEmitters();
|
|
};
|
|
};
|
|
- ParticleSystem.prototype.stopSubEmitters = function () {
|
|
|
|
- var _this = this;
|
|
|
|
- if (this.activeSubSystems.count === 0)
|
|
|
|
- return;
|
|
|
|
- this.stockSubSystems.forEach(function (generation) {
|
|
|
|
- _this.stockSubSystems.get(generation).forEach(function (subSystem) {
|
|
|
|
- subSystem.stop();
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- this.activeSubSystems.forEach(function (subSystemName) {
|
|
|
|
- var subSystem = _this.activeSubSystems.get(subSystemName);
|
|
|
|
- subSystem.stop();
|
|
|
|
- subSystem.stoppedEmitting(true);
|
|
|
|
- });
|
|
|
|
- this.activeSubSystems = new BABYLON.StringDictionary();
|
|
|
|
- };
|
|
|
|
- ParticleSystem.emitFromGeneration = function (system, particle, generation) {
|
|
|
|
- if (!system.subEmitters || system.subEmitters.length === 0 || generation >= system.subEmitters.length) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- var generationString = generation.toString();
|
|
|
|
- if (!system.stockSubSystems.contains(generationString) || system.stockSubSystems.get(generationString).length === 0) {
|
|
|
|
- // get the current generation template and clone it to subSystem
|
|
|
|
- var subSystem = system.subEmitters[generation].cloneToSubSystem(system.name, particle.position, generation, system);
|
|
|
|
- system.activeSubSystems.add(subSystem.name, subSystem);
|
|
|
|
- subSystem.start();
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- var stockSubSystem = (system.stockSubSystems.get(generationString)).pop();
|
|
|
|
- stockSubSystem.emitter = particle.position;
|
|
|
|
- system.activeSubSystems.add(stockSubSystem.name, stockSubSystem);
|
|
|
|
- // reset the manual emit count
|
|
|
|
- if (system.subEmitters[generation].manualEmitCount != -1)
|
|
|
|
- stockSubSystem.manualEmitCount = system.subEmitters[generation].manualEmitCount;
|
|
|
|
- stockSubSystem.start();
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- // end of sub emitter
|
|
|
|
// animation sheet
|
|
// animation sheet
|
|
/**
|
|
/**
|
|
* @ignore (for internal use only)
|
|
* @ignore (for internal use only)
|
|
@@ -47660,7 +47811,71 @@ var BABYLON;
|
|
this._vertexData[offset + 10] = offsetY;
|
|
this._vertexData[offset + 10] = offsetY;
|
|
this._vertexData[offset + 11] = particle.cellIndex;
|
|
this._vertexData[offset + 11] = particle.cellIndex;
|
|
};
|
|
};
|
|
- ParticleSystem.createParticle = function (rootSystem, currentSystem) {
|
|
|
|
|
|
+ ParticleSystem.prototype._stopSubEmitters = function () {
|
|
|
|
+ var _this = this;
|
|
|
|
+ this.stockSubSystems.forEach(function (generation) {
|
|
|
|
+ _this.stockSubSystems.get(generation).forEach(function (subSystem) {
|
|
|
|
+ subSystem.stop();
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ this.activeSubSystems.forEach(function (subSystemName) {
|
|
|
|
+ var subSystem = _this.activeSubSystems.get(subSystemName);
|
|
|
|
+ subSystem.stop();
|
|
|
|
+ subSystem._stoppedEmitting(true);
|
|
|
|
+ });
|
|
|
|
+ this.activeSubSystems = new BABYLON.StringDictionary();
|
|
|
|
+ };
|
|
|
|
+ ParticleSystem.prototype._emitFromGenerationUsingSystem = function (rootSystem, particle, generation) {
|
|
|
|
+ if (!rootSystem.subEmitters || rootSystem.subEmitters.length === 0 || (generation >= rootSystem.subEmitters.length && rootSystem.maxNumberOfSubEmits === 0) || (rootSystem.maxNumberOfSubEmits <= generation && rootSystem.maxNumberOfSubEmits !== 0)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ var generationString = generation.toString();
|
|
|
|
+ if (!rootSystem.stockSubSystems.contains(generationString) || rootSystem.stockSubSystems.get(generationString).length === 0) {
|
|
|
|
+ // get the current generation template and clone it to subSystem
|
|
|
|
+ var templateIndex = rootSystem.maxNumberOfSubEmits === 0 ? generation : Math.floor(Math.random() * rootSystem.subEmitters.length);
|
|
|
|
+ var subSystem = rootSystem.subEmitters[templateIndex]._cloneToSubSystem(rootSystem.name, particle.position, generation, rootSystem);
|
|
|
|
+ rootSystem.activeSubSystems.add(subSystem.name, subSystem);
|
|
|
|
+ subSystem.start();
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ var stockSubSystem = (rootSystem.stockSubSystems.get(generationString)).pop();
|
|
|
|
+ stockSubSystem.emitter = particle.position;
|
|
|
|
+ rootSystem.activeSubSystems.add(stockSubSystem.name, stockSubSystem);
|
|
|
|
+ // reset the manual emit count
|
|
|
|
+ if (rootSystem.subEmitters[generation].manualEmitCount != -1)
|
|
|
|
+ stockSubSystem.manualEmitCount = rootSystem.subEmitters[generation].manualEmitCount;
|
|
|
|
+ stockSubSystem.start();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ ParticleSystem.prototype._initSubSystem = function (rootParticleSystem, generation) {
|
|
|
|
+ var _this = this;
|
|
|
|
+ this._rootParticleSystem = rootParticleSystem;
|
|
|
|
+ this._generation = generation;
|
|
|
|
+ this._generationString = this._generation.toString();
|
|
|
|
+ this._stoppedEmitting = function (overrideRemove) {
|
|
|
|
+ if (overrideRemove === void 0) { overrideRemove = false; }
|
|
|
|
+ if (overrideRemove)
|
|
|
|
+ _this._rootParticleSystem.activeSubSystems.remove(_this.name);
|
|
|
|
+ if (_this._rootParticleSystem.stockSubSystems.contains(_this._generationString)) {
|
|
|
|
+ (_this._rootParticleSystem.stockSubSystems.get(_this._generationString)).push(_this);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ var subSysArray = new Array();
|
|
|
|
+ subSysArray.push(_this);
|
|
|
|
+ _this._rootParticleSystem.stockSubSystems.add(_this._generationString, subSysArray);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ this._emitFromParticle = function (particle) {
|
|
|
|
+ _this._emitFromGenerationUsingSystem(_this._rootParticleSystem, particle, _this._generation + 1);
|
|
|
|
+ };
|
|
|
|
+ this.recycleParticle = function (particle) {
|
|
|
|
+ _this._recycleParticleUsingSystem(_this._rootParticleSystem, _this, particle);
|
|
|
|
+ };
|
|
|
|
+ this._createParticle = function () {
|
|
|
|
+ return _this._createParticleUsingSystem(_this._rootParticleSystem, _this);
|
|
|
|
+ };
|
|
|
|
+ };
|
|
|
|
+ ParticleSystem.prototype._createParticleUsingSystem = function (rootSystem, currentSystem) {
|
|
var particle;
|
|
var particle;
|
|
if (rootSystem._stockParticles.length !== 0) {
|
|
if (rootSystem._stockParticles.length !== 0) {
|
|
particle = rootSystem._stockParticles.pop();
|
|
particle = rootSystem._stockParticles.pop();
|
|
@@ -47668,7 +47883,7 @@ var BABYLON;
|
|
particle.cellIndex = currentSystem.startSpriteCellID;
|
|
particle.cellIndex = currentSystem.startSpriteCellID;
|
|
if (currentSystem !== particle.particleSystem) {
|
|
if (currentSystem !== particle.particleSystem) {
|
|
particle.particleSystem = currentSystem;
|
|
particle.particleSystem = currentSystem;
|
|
- particle.setCellInfoFromSystem();
|
|
|
|
|
|
+ particle.updateCellInfoFromSystem();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -47676,17 +47891,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
return particle;
|
|
return particle;
|
|
};
|
|
};
|
|
- // end of sub system methods
|
|
|
|
- ParticleSystem.prototype.createParticle = function () {
|
|
|
|
- return ParticleSystem.createParticle(this, this);
|
|
|
|
- };
|
|
|
|
- // to be overriden by subSystems
|
|
|
|
- ParticleSystem.prototype.stoppedEmitting = function () {
|
|
|
|
- };
|
|
|
|
- ParticleSystem.prototype.emitFromParticle = function (particle) {
|
|
|
|
- ParticleSystem.emitFromGeneration(this, particle, 0);
|
|
|
|
- };
|
|
|
|
- ParticleSystem.recycleParticle = function (rootSystem, currentSystem, particle) {
|
|
|
|
|
|
+ ParticleSystem.prototype._recycleParticleUsingSystem = function (rootSystem, currentSystem, particle) {
|
|
var lastParticle = currentSystem._particles.pop();
|
|
var lastParticle = currentSystem._particles.pop();
|
|
if (lastParticle !== particle) {
|
|
if (lastParticle !== particle) {
|
|
lastParticle.copyTo(particle);
|
|
lastParticle.copyTo(particle);
|
|
@@ -47702,7 +47907,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
if (!this._alive && this._isEmitting) {
|
|
if (!this._alive && this._isEmitting) {
|
|
this._isEmitting = false;
|
|
this._isEmitting = false;
|
|
- this.stoppedEmitting();
|
|
|
|
|
|
+ this._stoppedEmitting(false);
|
|
}
|
|
}
|
|
this.updateFunction(this._particles);
|
|
this.updateFunction(this._particles);
|
|
// Add new ones
|
|
// Add new ones
|
|
@@ -47720,7 +47925,7 @@ var BABYLON;
|
|
if (this._particles.length === this._capacity) {
|
|
if (this._particles.length === this._capacity) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- particle = this.createParticle();
|
|
|
|
|
|
+ particle = this._createParticle();
|
|
this._particles.push(particle);
|
|
this._particles.push(particle);
|
|
var emitPower = BABYLON.Scalar.RandomRange(this.minEmitPower, this.maxEmitPower);
|
|
var emitPower = BABYLON.Scalar.RandomRange(this.minEmitPower, this.maxEmitPower);
|
|
if (this.startPositionFunction) {
|
|
if (this.startPositionFunction) {
|
|
@@ -48010,7 +48215,7 @@ var BABYLON;
|
|
this.particleEmitterType = particleEmitter;
|
|
this.particleEmitterType = particleEmitter;
|
|
return particleEmitter;
|
|
return particleEmitter;
|
|
};
|
|
};
|
|
- ParticleSystem.prototype.cloneToSubSystem = function (name, newEmitter, generation, root) {
|
|
|
|
|
|
+ ParticleSystem.prototype._cloneToSubSystem = function (name, newEmitter, generation, root) {
|
|
var custom = null;
|
|
var custom = null;
|
|
var program = null;
|
|
var program = null;
|
|
if (this.customShader != null) {
|
|
if (this.customShader != null) {
|
|
@@ -48018,13 +48223,14 @@ var BABYLON;
|
|
var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
|
|
var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
|
|
custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
|
|
custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
|
|
}
|
|
}
|
|
- var result = new BABYLON.SubParticleSystem(name, this._capacity, this._scene, generation, root, custom);
|
|
|
|
|
|
+ var result = new ParticleSystem(name, this._capacity, this._scene, custom);
|
|
result.customShader = program;
|
|
result.customShader = program;
|
|
BABYLON.Tools.DeepCopy(this, result, ["customShader"]);
|
|
BABYLON.Tools.DeepCopy(this, result, ["customShader"]);
|
|
result.name = name + "_Child_" + root.count++ + "_" + generation;
|
|
result.name = name + "_Child_" + root.count++ + "_" + generation;
|
|
result.id = result.name;
|
|
result.id = result.name;
|
|
result.emitter = newEmitter;
|
|
result.emitter = newEmitter;
|
|
result.particleEmitterType = this.particleEmitterType;
|
|
result.particleEmitterType = this.particleEmitterType;
|
|
|
|
+ result._initSubSystem(root, generation);
|
|
if (this.particleTexture) {
|
|
if (this.particleTexture) {
|
|
result.particleTexture = new BABYLON.Texture(this.particleTexture.url, this._scene);
|
|
result.particleTexture = new BABYLON.Texture(this.particleTexture.url, this._scene);
|
|
}
|
|
}
|
|
@@ -48211,50 +48417,6 @@ var BABYLON;
|
|
|
|
|
|
//# sourceMappingURL=babylon.particleSystem.js.map
|
|
//# sourceMappingURL=babylon.particleSystem.js.map
|
|
|
|
|
|
-
|
|
|
|
-var BABYLON;
|
|
|
|
-(function (BABYLON) {
|
|
|
|
- var SubParticleSystem = /** @class */ (function (_super) {
|
|
|
|
- __extends(SubParticleSystem, _super);
|
|
|
|
- function SubParticleSystem(name, capacity, scene, _generation, _rootParticleSystem, customEffect, _isAnimationSheetEnabled, epsilon) {
|
|
|
|
- if (customEffect === void 0) { customEffect = null; }
|
|
|
|
- if (_isAnimationSheetEnabled === void 0) { _isAnimationSheetEnabled = false; }
|
|
|
|
- if (epsilon === void 0) { epsilon = 0.01; }
|
|
|
|
- var _this = _super.call(this, name, capacity, scene, customEffect, _isAnimationSheetEnabled, epsilon) || this;
|
|
|
|
- _this._generation = _generation;
|
|
|
|
- _this._rootParticleSystem = _rootParticleSystem;
|
|
|
|
- _this.generationString = _this._generation.toString();
|
|
|
|
- return _this;
|
|
|
|
- }
|
|
|
|
- SubParticleSystem.prototype.stoppedEmitting = function (overrideRemove) {
|
|
|
|
- if (overrideRemove === void 0) { overrideRemove = false; }
|
|
|
|
- if (overrideRemove)
|
|
|
|
- this._rootParticleSystem.activeSubSystems.remove(this.name);
|
|
|
|
- if (this._rootParticleSystem.stockSubSystems.contains(this.generationString)) {
|
|
|
|
- (this._rootParticleSystem.stockSubSystems.get(this.generationString)).push(this);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- var subSysArray = new Array();
|
|
|
|
- subSysArray.push(this);
|
|
|
|
- this._rootParticleSystem.stockSubSystems.add(this.generationString, subSysArray);
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- SubParticleSystem.prototype.emitFromParticle = function (particle) {
|
|
|
|
- BABYLON.ParticleSystem.emitFromGeneration(this._rootParticleSystem, particle, this._generation + 1);
|
|
|
|
- };
|
|
|
|
- SubParticleSystem.prototype.recycleParticle = function (particle) {
|
|
|
|
- BABYLON.ParticleSystem.recycleParticle(this._rootParticleSystem, this, particle);
|
|
|
|
- };
|
|
|
|
- SubParticleSystem.prototype.createParticle = function () {
|
|
|
|
- return BABYLON.ParticleSystem.createParticle(this._rootParticleSystem, this);
|
|
|
|
- };
|
|
|
|
- return SubParticleSystem;
|
|
|
|
- }(BABYLON.ParticleSystem));
|
|
|
|
- BABYLON.SubParticleSystem = SubParticleSystem;
|
|
|
|
-})(BABYLON || (BABYLON = {}));
|
|
|
|
-
|
|
|
|
-//# sourceMappingURL=babylon.subParticleSystem.js.map
|
|
|
|
-
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
/**
|
|
/**
|