|
@@ -56558,7 +56558,20 @@ var BABYLON;
|
|
|
this.onDisposeObservable.clear();
|
|
|
};
|
|
|
/**
|
|
|
- * Creates a Sphere Emitter for the particle system. (emits along the sphere radius)
|
|
|
+ * Creates a Point Emitter for the particle system (emits directly from the emitter position)
|
|
|
+ * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
|
|
|
+ * @param direction2 Particles are emitted between the direction1 and direction2 from within the box
|
|
|
+ * @returns the emitter
|
|
|
+ */
|
|
|
+ ParticleSystem.prototype.createPointEmitter = function (direction1, direction2) {
|
|
|
+ var particleEmitter = new BABYLON.PointParticleEmitter();
|
|
|
+ particleEmitter.direction1 = direction1;
|
|
|
+ particleEmitter.direction2 = direction2;
|
|
|
+ this.particleEmitterType = particleEmitter;
|
|
|
+ return particleEmitter;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Creates a Sphere Emitter for the particle system (emits along the sphere radius)
|
|
|
* @param radius The radius of the sphere to emit from
|
|
|
* @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
|
|
|
* @returns the emitter
|
|
@@ -56571,7 +56584,7 @@ var BABYLON;
|
|
|
return particleEmitter;
|
|
|
};
|
|
|
/**
|
|
|
- * Creates a Directed Sphere Emitter for the particle system. (emits between direction1 and direction2)
|
|
|
+ * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)
|
|
|
* @param radius The radius of the sphere to emit from
|
|
|
* @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere
|
|
|
* @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere
|
|
@@ -56586,7 +56599,7 @@ var BABYLON;
|
|
|
return particleEmitter;
|
|
|
};
|
|
|
/**
|
|
|
- * Creates a Cone Emitter for the particle system. (emits from the cone to the particle position)
|
|
|
+ * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)
|
|
|
* @param radius The radius of the cone to emit from
|
|
|
* @param angle The base angle of the cone
|
|
|
* @returns the emitter
|
|
@@ -56598,7 +56611,6 @@ var BABYLON;
|
|
|
this.particleEmitterType = particleEmitter;
|
|
|
return particleEmitter;
|
|
|
};
|
|
|
- // this method needs to be changed when breaking changes will be allowed to match the sphere and cone methods and properties direction1,2 and minEmitBox,maxEmitBox to be removed from the system.
|
|
|
/**
|
|
|
* Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)
|
|
|
* @param direction1 Particles are emitted between the direction1 and direction2 from within the box
|
|
@@ -57025,7 +57037,7 @@ var BABYLON;
|
|
|
return newOne;
|
|
|
};
|
|
|
/**
|
|
|
- * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
|
|
|
+ * Called by the GPUParticleSystem to setup the update shader
|
|
|
* @param effect defines the update shader
|
|
|
*/
|
|
|
BoxParticleEmitter.prototype.applyToShader = function (effect) {
|
|
@@ -57197,7 +57209,7 @@ var BABYLON;
|
|
|
return newOne;
|
|
|
};
|
|
|
/**
|
|
|
- * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
|
|
|
+ * Called by the GPUParticleSystem to setup the update shader
|
|
|
* @param effect defines the update shader
|
|
|
*/
|
|
|
ConeParticleEmitter.prototype.applyToShader = function (effect) {
|
|
@@ -57422,7 +57434,7 @@ var BABYLON;
|
|
|
return newOne;
|
|
|
};
|
|
|
/**
|
|
|
- * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
|
|
|
+ * Called by the GPUParticleSystem to setup the update shader
|
|
|
* @param effect defines the update shader
|
|
|
*/
|
|
|
SphereDirectedParticleEmitter.prototype.applyToShader = function (effect) {
|
|
@@ -57473,6 +57485,104 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
+ /**
|
|
|
+ * Particle emitter emitting particles from a point.
|
|
|
+ * It emits the particles randomly between 2 given directions.
|
|
|
+ */
|
|
|
+ var PointParticleEmitter = /** @class */ (function () {
|
|
|
+ /**
|
|
|
+ * Creates a new instance PointParticleEmitter
|
|
|
+ */
|
|
|
+ function PointParticleEmitter() {
|
|
|
+ /**
|
|
|
+ * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.
|
|
|
+ */
|
|
|
+ this.direction1 = new BABYLON.Vector3(0, 1.0, 0);
|
|
|
+ /**
|
|
|
+ * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.
|
|
|
+ */
|
|
|
+ this.direction2 = new BABYLON.Vector3(0, 1.0, 0);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * Called by the particle System when the direction is computed for the created particle.
|
|
|
+ * @param worldMatrix is the world matrix of the particle system
|
|
|
+ * @param directionToUpdate is the direction vector to update with the result
|
|
|
+ * @param particle is the particle we are computed the direction for
|
|
|
+ */
|
|
|
+ PointParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {
|
|
|
+ var randX = BABYLON.Scalar.RandomRange(this.direction1.x, this.direction2.x);
|
|
|
+ var randY = BABYLON.Scalar.RandomRange(this.direction1.y, this.direction2.y);
|
|
|
+ var randZ = BABYLON.Scalar.RandomRange(this.direction1.z, this.direction2.z);
|
|
|
+ BABYLON.Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Called by the particle System when the position is computed for the created particle.
|
|
|
+ * @param worldMatrix is the world matrix of the particle system
|
|
|
+ * @param positionToUpdate is the position vector to update with the result
|
|
|
+ * @param particle is the particle we are computed the position for
|
|
|
+ */
|
|
|
+ PointParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {
|
|
|
+ BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(0, 0, 0, worldMatrix, positionToUpdate);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Clones the current emitter and returns a copy of it
|
|
|
+ * @returns the new emitter
|
|
|
+ */
|
|
|
+ PointParticleEmitter.prototype.clone = function () {
|
|
|
+ var newOne = new PointParticleEmitter();
|
|
|
+ BABYLON.Tools.DeepCopy(this, newOne);
|
|
|
+ return newOne;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Called by the GPUParticleSystem to setup the update shader
|
|
|
+ * @param effect defines the update shader
|
|
|
+ */
|
|
|
+ PointParticleEmitter.prototype.applyToShader = function (effect) {
|
|
|
+ effect.setVector3("direction1", this.direction1);
|
|
|
+ effect.setVector3("direction2", this.direction2);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Returns a string to use to update the GPU particles update shader
|
|
|
+ * @returns a string containng the defines string
|
|
|
+ */
|
|
|
+ PointParticleEmitter.prototype.getEffectDefines = function () {
|
|
|
+ return "#define POINTEMITTER";
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Returns the string "PointParticleEmitter"
|
|
|
+ * @returns a string containing the class name
|
|
|
+ */
|
|
|
+ PointParticleEmitter.prototype.getClassName = function () {
|
|
|
+ return "PointParticleEmitter";
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Serializes the particle system to a JSON object.
|
|
|
+ * @returns the JSON object
|
|
|
+ */
|
|
|
+ PointParticleEmitter.prototype.serialize = function () {
|
|
|
+ var serializationObject = {};
|
|
|
+ serializationObject.type = this.getClassName();
|
|
|
+ serializationObject.direction1 = this.direction1.asArray();
|
|
|
+ serializationObject.direction2 = this.direction2.asArray();
|
|
|
+ return serializationObject;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Parse properties from a JSON object
|
|
|
+ * @param serializationObject defines the JSON object
|
|
|
+ */
|
|
|
+ PointParticleEmitter.prototype.parse = function (serializationObject) {
|
|
|
+ BABYLON.Vector3.FromArrayToRef(serializationObject.direction1, 0, this.direction1);
|
|
|
+ BABYLON.Vector3.FromArrayToRef(serializationObject.direction2, 0, this.direction2);
|
|
|
+ };
|
|
|
+ return PointParticleEmitter;
|
|
|
+ }());
|
|
|
+ BABYLON.PointParticleEmitter = PointParticleEmitter;
|
|
|
+})(BABYLON || (BABYLON = {}));
|
|
|
+
|
|
|
+//# sourceMappingURL=babylon.pointParticleEmitter.js.map
|
|
|
+
|
|
|
+var BABYLON;
|
|
|
+(function (BABYLON) {
|
|
|
// Adds the parsers to the scene parsers.
|
|
|
BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM, function (parsedData, scene, container, rootUrl) {
|
|
|
var individualParser = BABYLON.AbstractScene.GetIndividualParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM);
|