|
@@ -55777,6 +55777,10 @@ var BABYLON;
|
|
this._currentLimitVelocity1 = 0;
|
|
this._currentLimitVelocity1 = 0;
|
|
/** @hidden */
|
|
/** @hidden */
|
|
this._currentLimitVelocity2 = 0;
|
|
this._currentLimitVelocity2 = 0;
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this._currentDrag1 = 0;
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this._currentDrag2 = 0;
|
|
if (!this.particleSystem.isAnimationSheetEnabled) {
|
|
if (!this.particleSystem.isAnimationSheetEnabled) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -55846,6 +55850,11 @@ var BABYLON;
|
|
other._currentLimitVelocity1 = this._currentLimitVelocity1;
|
|
other._currentLimitVelocity1 = this._currentLimitVelocity1;
|
|
other._currentLimitVelocity2 = this._currentLimitVelocity2;
|
|
other._currentLimitVelocity2 = this._currentLimitVelocity2;
|
|
}
|
|
}
|
|
|
|
+ if (this._currentDragGradient) {
|
|
|
|
+ other._currentDragGradient = this._currentDragGradient;
|
|
|
|
+ other._currentDrag1 = this._currentDrag1;
|
|
|
|
+ other._currentDrag2 = this._currentDrag2;
|
|
|
|
+ }
|
|
if (this.particleSystem.isAnimationSheetEnabled) {
|
|
if (this.particleSystem.isAnimationSheetEnabled) {
|
|
other._initialStartSpriteCellID = this._initialStartSpriteCellID;
|
|
other._initialStartSpriteCellID = this._initialStartSpriteCellID;
|
|
other._initialEndSpriteCellID = this._initialEndSpriteCellID;
|
|
other._initialEndSpriteCellID = this._initialEndSpriteCellID;
|
|
@@ -56026,6 +56035,7 @@ var BABYLON;
|
|
this._angularSpeedGradients = null;
|
|
this._angularSpeedGradients = null;
|
|
this._velocityGradients = null;
|
|
this._velocityGradients = null;
|
|
this._limitVelocityGradients = null;
|
|
this._limitVelocityGradients = null;
|
|
|
|
+ this._dragGradients = null;
|
|
/** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */
|
|
/** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */
|
|
this.limitVelocityDamping = 0.4;
|
|
this.limitVelocityDamping = 0.4;
|
|
/**
|
|
/**
|
|
@@ -56075,6 +56085,14 @@ var BABYLON;
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
/**
|
|
/**
|
|
|
|
+ * Gets the current list of drag gradients.
|
|
|
|
+ * You must use addDragGradient and removeDragGradient to udpate this list
|
|
|
|
+ * @returns the list of drag gradients
|
|
|
|
+ */
|
|
|
|
+ BaseParticleSystem.prototype.getDragGradients = function () {
|
|
|
|
+ return this._dragGradients;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
* Gets the current list of limit velocity gradients.
|
|
* Gets the current list of limit velocity gradients.
|
|
* You must use addLimitVelocityGradient and removeLimitVelocityGradient to udpate this list
|
|
* You must use addLimitVelocityGradient and removeLimitVelocityGradient to udpate this list
|
|
* @returns the list of limit velocity gradients
|
|
* @returns the list of limit velocity gradients
|
|
@@ -56542,6 +56560,20 @@ var BABYLON;
|
|
// Gravity
|
|
// Gravity
|
|
_this.gravity.scaleToRef(_this._scaledUpdateSpeed, _this._scaledGravity);
|
|
_this.gravity.scaleToRef(_this._scaledUpdateSpeed, _this._scaledGravity);
|
|
particle.direction.addInPlace(_this._scaledGravity);
|
|
particle.direction.addInPlace(_this._scaledGravity);
|
|
|
|
+ /// Drag
|
|
|
|
+ if (_this._dragGradients && _this._dragGradients.length > 0) {
|
|
|
|
+ BABYLON.Tools.GetCurrentGradient(ratio, _this._dragGradients, function (currentGradient, nextGradient, scale) {
|
|
|
|
+ if (currentGradient !== particle._currentDragGradient) {
|
|
|
|
+ particle._currentDrag1 = particle._currentDrag2;
|
|
|
|
+ particle._currentDrag2 = nextGradient.getFactor();
|
|
|
|
+ particle._currentDragGradient = currentGradient;
|
|
|
|
+ }
|
|
|
|
+ var drag = BABYLON.Scalar.Lerp(particle._currentDrag1, particle._currentDrag2, scale);
|
|
|
|
+ var dragValue = BABYLON.Tmp.Vector3[0];
|
|
|
|
+ particle.direction.scaleToRef(1.0 - drag, dragValue);
|
|
|
|
+ particle.direction.subtractInPlace(dragValue);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
// Size
|
|
// Size
|
|
if (_this._sizeGradients && _this._sizeGradients.length > 0) {
|
|
if (_this._sizeGradients && _this._sizeGradients.length > 0) {
|
|
BABYLON.Tools.GetCurrentGradient(ratio, _this._sizeGradients, function (currentGradient, nextGradient, scale) {
|
|
BABYLON.Tools.GetCurrentGradient(ratio, _this._sizeGradients, function (currentGradient, nextGradient, scale) {
|
|
@@ -56749,6 +56781,29 @@ var BABYLON;
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
|
|
+ * Adds a new drag gradient
|
|
|
|
+ * @param gradient defines the gradient to use (between 0 and 1)
|
|
|
|
+ * @param factor defines the drag value to affect to the specified gradient
|
|
|
|
+ * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
|
|
|
|
+ * @returns the current particle system
|
|
|
|
+ */
|
|
|
|
+ ParticleSystem.prototype.addDragGradient = function (gradient, factor, factor2) {
|
|
|
|
+ if (!this._dragGradients) {
|
|
|
|
+ this._dragGradients = [];
|
|
|
|
+ }
|
|
|
|
+ this._addFactorGradient(this._dragGradients, gradient, factor, factor2);
|
|
|
|
+ return this;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Remove a specific drag gradient
|
|
|
|
+ * @param gradient defines the gradient to remove
|
|
|
|
+ * @returns the current particle system
|
|
|
|
+ */
|
|
|
|
+ ParticleSystem.prototype.removeDragGradient = function (gradient) {
|
|
|
|
+ this._removeFactorGradient(this._dragGradients, gradient);
|
|
|
|
+ return this;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
* Adds a new color gradient
|
|
* Adds a new color gradient
|
|
* @param gradient defines the gradient to use (between 0 and 1)
|
|
* @param gradient defines the gradient to use (between 0 and 1)
|
|
* @param color defines the color to affect to the specified gradient
|
|
* @param color defines the color to affect to the specified gradient
|
|
@@ -57123,6 +57178,17 @@ var BABYLON;
|
|
particle._currentLimitVelocity2 = particle._currentLimitVelocity1;
|
|
particle._currentLimitVelocity2 = particle._currentLimitVelocity1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // Drag
|
|
|
|
+ if (this_1._dragGradients && this_1._dragGradients.length > 0) {
|
|
|
|
+ particle._currentDragGradient = this_1._dragGradients[0];
|
|
|
|
+ particle._currentDrag1 = particle._currentDragGradient.getFactor();
|
|
|
|
+ if (this_1._dragGradients.length > 1) {
|
|
|
|
+ particle._currentDrag2 = this_1._dragGradients[1].getFactor();
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ particle._currentDrag2 = particle._currentDrag1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// Color
|
|
// Color
|
|
if (!this_1._colorGradients || this_1._colorGradients.length === 0) {
|
|
if (!this_1._colorGradients || this_1._colorGradients.length === 0) {
|
|
step = BABYLON.Scalar.RandomRange(0, 1.0);
|
|
step = BABYLON.Scalar.RandomRange(0, 1.0);
|
|
@@ -61435,6 +61501,34 @@ var BABYLON;
|
|
this._limitVelocityGradientsTexture = null;
|
|
this._limitVelocityGradientsTexture = null;
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Adds a new drag gradient
|
|
|
|
+ * @param gradient defines the gradient to use (between 0 and 1)
|
|
|
|
+ * @param factor defines the drag value to affect to the specified gradient
|
|
|
|
+ * @returns the current particle system
|
|
|
|
+ */
|
|
|
|
+ GPUParticleSystem.prototype.addDragGradient = function (gradient, factor) {
|
|
|
|
+ if (!this._dragGradients) {
|
|
|
|
+ this._dragGradients = [];
|
|
|
|
+ }
|
|
|
|
+ this._addFactorGradient(this._dragGradients, gradient, factor);
|
|
|
|
+ if (this._dragGradientsTexture) {
|
|
|
|
+ this._dragGradientsTexture.dispose();
|
|
|
|
+ this._dragGradientsTexture = null;
|
|
|
|
+ }
|
|
|
|
+ this._releaseBuffers();
|
|
|
|
+ return this;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Remove a specific drag gradient
|
|
|
|
+ * @param gradient defines the gradient to remove
|
|
|
|
+ * @returns the current particle system
|
|
|
|
+ */
|
|
|
|
+ GPUParticleSystem.prototype.removeDragGradient = function (gradient) {
|
|
|
|
+ this._removeGradient(gradient, this._dragGradients, this._dragGradientsTexture);
|
|
|
|
+ this._dragGradientsTexture = null;
|
|
|
|
+ return this;
|
|
|
|
+ };
|
|
GPUParticleSystem.prototype._reset = function () {
|
|
GPUParticleSystem.prototype._reset = function () {
|
|
this._releaseBuffers();
|
|
this._releaseBuffers();
|
|
};
|
|
};
|