|
@@ -7346,6 +7346,7 @@ var BABYLON;
|
|
|
};
|
|
|
Observable.prototype._deferUnregister = function (observer) {
|
|
|
var _this = this;
|
|
|
+ observer.unregisterOnNextCall = false;
|
|
|
BABYLON.Tools.SetImmediate(function () {
|
|
|
_this.remove(observer);
|
|
|
});
|
|
@@ -51067,7 +51068,7 @@ var BABYLON;
|
|
|
|
|
|
|
|
|
|
|
|
-//# sourceMappingURL=babylon.IParticleEmitterType.js.map
|
|
|
+//# sourceMappingURL=babylon.iParticleEmitterType.js.map
|
|
|
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
@@ -51328,6 +51329,12 @@ var BABYLON;
|
|
|
*/
|
|
|
this.pivot = BABYLON.Vector3.Zero();
|
|
|
/**
|
|
|
+ * Must the particle be translated from its pivot point in its local space ?
|
|
|
+ * In this case, the pivot point is set at the origin of the particle local space and the particle is translated.
|
|
|
+ * Default : false
|
|
|
+ */
|
|
|
+ this.translateFromPivot = false;
|
|
|
+ /**
|
|
|
* Is the particle active or not ?
|
|
|
*/
|
|
|
this.alive = true;
|
|
@@ -51586,6 +51593,7 @@ var BABYLON;
|
|
|
return (p2.sqDistance - p1.sqDistance);
|
|
|
};
|
|
|
this._needs32Bits = false;
|
|
|
+ this._pivotBackTranslation = BABYLON.Vector3.Zero();
|
|
|
this.name = name;
|
|
|
this._scene = scene || BABYLON.Engine.LastCreatedScene;
|
|
|
this._camera = scene.activeCamera;
|
|
@@ -51797,6 +51805,7 @@ var BABYLON;
|
|
|
this._copy.uvs.z = 1.0;
|
|
|
this._copy.uvs.w = 1.0;
|
|
|
this._copy.color = null;
|
|
|
+ this._copy.translateFromPivot = false;
|
|
|
};
|
|
|
// _meshBuilder : inserts the shape model in the global SPS mesh
|
|
|
SolidParticleSystem.prototype._meshBuilder = function (p, shape, positions, meshInd, indices, meshUV, uvs, meshCol, colors, meshNor, normals, idx, idxInShape, options) {
|
|
@@ -51819,6 +51828,12 @@ var BABYLON;
|
|
|
this._quaternionRotationYPR();
|
|
|
}
|
|
|
this._quaternionToRotationMatrix();
|
|
|
+ if (this._copy.translateFromPivot) {
|
|
|
+ this._pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this._pivotBackTranslation.copyFrom(this._copy.pivot);
|
|
|
+ }
|
|
|
for (i = 0; i < shape.length; i++) {
|
|
|
this._vertex.x = shape[i].x;
|
|
|
this._vertex.y = shape[i].y;
|
|
@@ -51829,10 +51844,11 @@ var BABYLON;
|
|
|
this._vertex.x *= this._copy.scaling.x;
|
|
|
this._vertex.y *= this._copy.scaling.y;
|
|
|
this._vertex.z *= this._copy.scaling.z;
|
|
|
- this._vertex.x += this._copy.pivot.x;
|
|
|
- this._vertex.y += this._copy.pivot.y;
|
|
|
- this._vertex.z += this._copy.pivot.z;
|
|
|
+ this._vertex.x -= this._copy.pivot.x;
|
|
|
+ this._vertex.y -= this._copy.pivot.y;
|
|
|
+ this._vertex.z -= this._copy.pivot.z;
|
|
|
BABYLON.Vector3.TransformCoordinatesToRef(this._vertex, this._rotMatrix, this._rotated);
|
|
|
+ this._rotated.addInPlace(this._pivotBackTranslation);
|
|
|
positions.push(this._copy.position.x + this._rotated.x, this._copy.position.y + this._rotated.y, this._copy.position.z + this._rotated.z);
|
|
|
if (meshUV) {
|
|
|
uvs.push((this._copy.uvs.z - this._copy.uvs.x) * meshUV[u] + this._copy.uvs.x, (this._copy.uvs.w - this._copy.uvs.y) * meshUV[u + 1] + this._copy.uvs.y);
|
|
@@ -51974,6 +51990,12 @@ var BABYLON;
|
|
|
this._quaternionRotationYPR();
|
|
|
}
|
|
|
this._quaternionToRotationMatrix();
|
|
|
+ if (this._copy.translateFromPivot) {
|
|
|
+ this._pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this._pivotBackTranslation.copyFrom(this._copy.pivot);
|
|
|
+ }
|
|
|
this._shape = particle._model._shape;
|
|
|
for (var pt = 0; pt < this._shape.length; pt++) {
|
|
|
this._vertex.x = this._shape[pt].x;
|
|
@@ -51985,10 +52007,11 @@ var BABYLON;
|
|
|
this._vertex.x *= this._copy.scaling.x;
|
|
|
this._vertex.y *= this._copy.scaling.y;
|
|
|
this._vertex.z *= this._copy.scaling.z;
|
|
|
- this._vertex.x += this._copy.pivot.x;
|
|
|
- this._vertex.y += this._copy.pivot.y;
|
|
|
- this._vertex.z += this._copy.pivot.z;
|
|
|
+ this._vertex.x -= this._copy.pivot.x;
|
|
|
+ this._vertex.y -= this._copy.pivot.y;
|
|
|
+ this._vertex.z -= this._copy.pivot.z;
|
|
|
BABYLON.Vector3.TransformCoordinatesToRef(this._vertex, this._rotMatrix, this._rotated);
|
|
|
+ this._rotated.addInPlace(this._pivotBackTranslation);
|
|
|
this._positions32[particle._pos + pt * 3] = this._copy.position.x + this._rotated.x;
|
|
|
this._positions32[particle._pos + pt * 3 + 1] = this._copy.position.y + this._rotated.y;
|
|
|
this._positions32[particle._pos + pt * 3 + 2] = this._copy.position.z + this._rotated.z;
|
|
@@ -52143,6 +52166,16 @@ var BABYLON;
|
|
|
this._particle._rotationMatrix[7] = this._rotMatrix.m[9];
|
|
|
this._particle._rotationMatrix[8] = this._rotMatrix.m[10];
|
|
|
}
|
|
|
+ if (this._particle.translateFromPivot) {
|
|
|
+ this._pivotBackTranslation.x = 0.0;
|
|
|
+ this._pivotBackTranslation.y = 0.0;
|
|
|
+ this._pivotBackTranslation.z = 0.0;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this._pivotBackTranslation.x = this._particle.pivot.x;
|
|
|
+ this._pivotBackTranslation.y = this._particle.pivot.y;
|
|
|
+ this._pivotBackTranslation.z = this._particle.pivot.z;
|
|
|
+ }
|
|
|
// particle vertex loop
|
|
|
for (pt = 0; pt < this._shape.length; pt++) {
|
|
|
idx = index + pt * 3;
|
|
@@ -52158,12 +52191,15 @@ var BABYLON;
|
|
|
this._vertex.x *= this._particle.scaling.x;
|
|
|
this._vertex.y *= this._particle.scaling.y;
|
|
|
this._vertex.z *= this._particle.scaling.z;
|
|
|
- this._vertex.x += this._particle.pivot.x;
|
|
|
- this._vertex.y += this._particle.pivot.y;
|
|
|
- this._vertex.z += this._particle.pivot.z;
|
|
|
+ this._vertex.x -= this._particle.pivot.x;
|
|
|
+ this._vertex.y -= this._particle.pivot.y;
|
|
|
+ this._vertex.z -= this._particle.pivot.z;
|
|
|
this._rotated.x = this._vertex.x * this._particle._rotationMatrix[0] + this._vertex.y * this._particle._rotationMatrix[3] + this._vertex.z * this._particle._rotationMatrix[6];
|
|
|
this._rotated.y = this._vertex.x * this._particle._rotationMatrix[1] + this._vertex.y * this._particle._rotationMatrix[4] + this._vertex.z * this._particle._rotationMatrix[7];
|
|
|
this._rotated.z = this._vertex.x * this._particle._rotationMatrix[2] + this._vertex.y * this._particle._rotationMatrix[5] + this._vertex.z * this._particle._rotationMatrix[8];
|
|
|
+ this._rotated.x += this._pivotBackTranslation.x;
|
|
|
+ this._rotated.y += this._pivotBackTranslation.y;
|
|
|
+ this._rotated.z += this._pivotBackTranslation.z;
|
|
|
this._positions32[idx] = this._particle.position.x + this._cam_axisX.x * this._rotated.x + this._cam_axisY.x * this._rotated.y + this._cam_axisZ.x * this._rotated.z;
|
|
|
this._positions32[idx + 1] = this._particle.position.y + this._cam_axisX.y * this._rotated.x + this._cam_axisY.y * this._rotated.y + this._cam_axisZ.y * this._rotated.z;
|
|
|
this._positions32[idx + 2] = this._particle.position.z + this._cam_axisX.z * this._rotated.x + this._cam_axisY.z * this._rotated.y + this._cam_axisZ.z * this._rotated.z;
|