浏览代码

Add reset to PS + nightly

David Catuhe 7 年之前
父节点
当前提交
b9fe4bab67
共有 30 个文件被更改,包括 20492 次插入20163 次删除
  1. 3572 3556
      Playground/babylon.d.txt
  2. 5221 5205
      dist/preview release/babylon.d.ts
  3. 49 49
      dist/preview release/babylon.js
  4. 98 30
      dist/preview release/babylon.max.js
  5. 50 50
      dist/preview release/babylon.worker.js
  6. 11057 11041
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  7. 51 51
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  8. 98 30
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  9. 98 30
      dist/preview release/customConfigurations/minimalGLTFViewer/es6.js
  10. 98 30
      dist/preview release/es6.js
  11. 3 3
      dist/preview release/gui/babylon.gui.min.js
  12. 4 4
      dist/preview release/inspector/babylon.inspector.bundle.js
  13. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  14. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  15. 2 2
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  16. 3 3
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  17. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  18. 3 3
      dist/preview release/loaders/babylonjs.loaders.min.js
  19. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  20. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  21. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  22. 3 3
      dist/preview release/materialsLibrary/babylonjs.materials.min.js
  23. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  24. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  25. 1 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js
  26. 1 1
      dist/preview release/serializers/babylon.glTF2Serializer.min.js
  27. 1 1
      dist/preview release/serializers/babylonjs.serializers.min.js
  28. 59 59
      dist/preview release/viewer/babylon.viewer.js
  29. 1 0
      dist/preview release/what's new.md
  30. 8 0
      src/Particles/babylon.particleSystem.ts

文件差异内容过多而无法显示
+ 3572 - 3556
Playground/babylon.d.txt


文件差异内容过多而无法显示
+ 5221 - 5205
dist/preview release/babylon.d.ts


文件差异内容过多而无法显示
+ 49 - 49
dist/preview release/babylon.js


+ 98 - 30
dist/preview release/babylon.max.js

@@ -50533,6 +50533,13 @@ var BABYLON;
             this._stopped = true;
         };
         /**
+         * Remove all active particles
+         */
+        ParticleSystem.prototype.reset = function () {
+            this._stockParticles = [];
+            this._particles = [];
+        };
+        /**
          * @ignore (for internal use only)
          */
         ParticleSystem.prototype._appendParticleVertex = function (index, particle, offsetX, offsetY) {
@@ -51409,7 +51416,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.IParticleEmitterType.js.map
+//# sourceMappingURL=babylon.iParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {
@@ -51707,6 +51714,15 @@ var BABYLON;
              * Last computed particle rotation matrix
              */
             this._rotationMatrix = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0];
+            /**
+             * Parent particle Id, if any.
+             * Default null.
+             */
+            this.parentId = null;
+            /**
+             * Internal global position in the SPS.
+             */
+            this._globalPosition = BABYLON.Vector3.Zero();
             this.idx = particleIndex;
             this._pos = positionIndex;
             this._ind = indiceIndex;
@@ -51935,6 +51951,8 @@ var BABYLON;
             };
             this._needs32Bits = false;
             this._pivotBackTranslation = BABYLON.Vector3.Zero();
+            this._scaledPivot = BABYLON.Vector3.Zero();
+            this._particleHasParent = false;
             this.name = name;
             this._scene = scene || BABYLON.Engine.LastCreatedScene;
             this._camera = scene.activeCamera;
@@ -52169,11 +52187,14 @@ var BABYLON;
                 this._quaternionRotationYPR();
             }
             this._quaternionToRotationMatrix();
+            this._scaledPivot.x = this._copy.pivot.x * this._copy.scaling.x;
+            this._scaledPivot.y = this._copy.pivot.y * this._copy.scaling.y;
+            this._scaledPivot.z = this._copy.pivot.z * this._copy.scaling.z;
             if (this._copy.translateFromPivot) {
                 this._pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);
             }
             else {
-                this._pivotBackTranslation.copyFrom(this._copy.pivot);
+                this._pivotBackTranslation.copyFrom(this._scaledPivot);
             }
             for (i = 0; i < shape.length; i++) {
                 this._vertex.x = shape[i].x;
@@ -52185,9 +52206,9 @@ 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._scaledPivot.x;
+                this._vertex.y -= this._scaledPivot.y;
+                this._vertex.z -= this._scaledPivot.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);
@@ -52331,11 +52352,14 @@ var BABYLON;
                 this._quaternionRotationYPR();
             }
             this._quaternionToRotationMatrix();
+            this._scaledPivot.x = this._particle.pivot.x * this._particle.scaling.x;
+            this._scaledPivot.y = this._particle.pivot.y * this._particle.scaling.y;
+            this._scaledPivot.z = this._particle.pivot.z * this._particle.scaling.z;
             if (this._copy.translateFromPivot) {
                 this._pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);
             }
             else {
-                this._pivotBackTranslation.copyFrom(this._copy.pivot);
+                this._pivotBackTranslation.copyFrom(this._scaledPivot);
             }
             this._shape = particle._model._shape;
             for (var pt = 0; pt < this._shape.length; pt++) {
@@ -52348,9 +52372,9 @@ 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._scaledPivot.x;
+                this._vertex.y -= this._scaledPivot.y;
+                this._vertex.z -= this._scaledPivot.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;
@@ -52367,6 +52391,15 @@ var BABYLON;
             particle.scaling.x = 1.0;
             particle.scaling.y = 1.0;
             particle.scaling.z = 1.0;
+            particle.uvs.x = 0.0;
+            particle.uvs.y = 0.0;
+            particle.uvs.z = 1.0;
+            particle.uvs.w = 1.0;
+            particle.pivot.x = 0.0;
+            particle.pivot.y = 0.0;
+            particle.pivot.z = 0.0;
+            particle.translateFromPivot = false;
+            particle.parentId = null;
         };
         /**
          * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
@@ -52481,6 +52514,10 @@ var BABYLON;
                 }
                 if (this._particle.isVisible) {
                     this._particle._stillInvisible = false; // un-mark permanent invisibility
+                    this._particleHasParent = (this._particle.parentId !== null);
+                    this._scaledPivot.x = this._particle.pivot.x * this._particle.scaling.x;
+                    this._scaledPivot.y = this._particle.pivot.y * this._particle.scaling.y;
+                    this._scaledPivot.z = this._particle.pivot.z * this._particle.scaling.z;
                     // particle rotation matrix
                     if (this.billboard) {
                         this._particle.rotation.x = 0.0;
@@ -52497,15 +52534,42 @@ var BABYLON;
                             this._quaternionRotationYPR();
                         }
                         this._quaternionToRotationMatrix();
-                        this._particle._rotationMatrix[0] = this._rotMatrix.m[0];
-                        this._particle._rotationMatrix[1] = this._rotMatrix.m[1];
-                        this._particle._rotationMatrix[2] = this._rotMatrix.m[2];
-                        this._particle._rotationMatrix[3] = this._rotMatrix.m[4];
-                        this._particle._rotationMatrix[4] = this._rotMatrix.m[5];
-                        this._particle._rotationMatrix[5] = this._rotMatrix.m[6];
-                        this._particle._rotationMatrix[6] = this._rotMatrix.m[8];
-                        this._particle._rotationMatrix[7] = this._rotMatrix.m[9];
-                        this._particle._rotationMatrix[8] = this._rotMatrix.m[10];
+                    }
+                    if (this._particleHasParent) {
+                        this._parent = this.particles[this._particle.parentId];
+                        this._rotated.x = this._particle.position.x * this._parent._rotationMatrix[0] + this._particle.position.y * this._parent._rotationMatrix[3] + this._particle.position.z * this._parent._rotationMatrix[6];
+                        this._rotated.y = this._particle.position.x * this._parent._rotationMatrix[1] + this._particle.position.y * this._parent._rotationMatrix[4] + this._particle.position.z * this._parent._rotationMatrix[7];
+                        this._rotated.z = this._particle.position.x * this._parent._rotationMatrix[2] + this._particle.position.y * this._parent._rotationMatrix[5] + this._particle.position.z * this._parent._rotationMatrix[8];
+                        this._particle._globalPosition.x = this._parent._globalPosition.x + this._rotated.x;
+                        this._particle._globalPosition.y = this._parent._globalPosition.y + this._rotated.y;
+                        this._particle._globalPosition.z = this._parent._globalPosition.z + this._rotated.z;
+                        if (this._computeParticleRotation || this.billboard) {
+                            this._particle._rotationMatrix[0] = this._rotMatrix.m[0] * this._parent._rotationMatrix[0] + this._rotMatrix.m[1] * this._parent._rotationMatrix[3] + this._rotMatrix.m[2] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[1] = this._rotMatrix.m[0] * this._parent._rotationMatrix[1] + this._rotMatrix.m[1] * this._parent._rotationMatrix[4] + this._rotMatrix.m[2] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[2] = this._rotMatrix.m[0] * this._parent._rotationMatrix[2] + this._rotMatrix.m[1] * this._parent._rotationMatrix[5] + this._rotMatrix.m[2] * this._parent._rotationMatrix[8];
+                            this._particle._rotationMatrix[3] = this._rotMatrix.m[4] * this._parent._rotationMatrix[0] + this._rotMatrix.m[5] * this._parent._rotationMatrix[3] + this._rotMatrix.m[6] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[4] = this._rotMatrix.m[4] * this._parent._rotationMatrix[1] + this._rotMatrix.m[5] * this._parent._rotationMatrix[4] + this._rotMatrix.m[6] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[5] = this._rotMatrix.m[4] * this._parent._rotationMatrix[2] + this._rotMatrix.m[5] * this._parent._rotationMatrix[5] + this._rotMatrix.m[6] * this._parent._rotationMatrix[8];
+                            this._particle._rotationMatrix[6] = this._rotMatrix.m[8] * this._parent._rotationMatrix[0] + this._rotMatrix.m[9] * this._parent._rotationMatrix[3] + this._rotMatrix.m[10] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[7] = this._rotMatrix.m[8] * this._parent._rotationMatrix[1] + this._rotMatrix.m[9] * this._parent._rotationMatrix[4] + this._rotMatrix.m[10] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[8] = this._rotMatrix.m[8] * this._parent._rotationMatrix[2] + this._rotMatrix.m[9] * this._parent._rotationMatrix[5] + this._rotMatrix.m[10] * this._parent._rotationMatrix[8];
+                        }
+                    }
+                    else {
+                        this._particle._globalPosition.x = this._particle.position.x;
+                        this._particle._globalPosition.y = this._particle.position.y;
+                        this._particle._globalPosition.z = this._particle.position.z;
+                        if (this._computeParticleRotation || this.billboard) {
+                            this._particle._rotationMatrix[0] = this._rotMatrix.m[0];
+                            this._particle._rotationMatrix[1] = this._rotMatrix.m[1];
+                            this._particle._rotationMatrix[2] = this._rotMatrix.m[2];
+                            this._particle._rotationMatrix[3] = this._rotMatrix.m[4];
+                            this._particle._rotationMatrix[4] = this._rotMatrix.m[5];
+                            this._particle._rotationMatrix[5] = this._rotMatrix.m[6];
+                            this._particle._rotationMatrix[6] = this._rotMatrix.m[8];
+                            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;
@@ -52513,9 +52577,9 @@ var BABYLON;
                         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;
+                        this._pivotBackTranslation.x = this._scaledPivot.x;
+                        this._pivotBackTranslation.y = this._scaledPivot.y;
+                        this._pivotBackTranslation.z = this._scaledPivot.z;
                     }
                     // particle vertex loop
                     for (pt = 0; pt < this._shape.length; pt++) {
@@ -52532,18 +52596,18 @@ 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._scaledPivot.x;
+                        this._vertex.y -= this._scaledPivot.y;
+                        this._vertex.z -= this._scaledPivot.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;
+                        this._positions32[idx] = this._particle._globalPosition.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._globalPosition.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._globalPosition.z + this._cam_axisX.z * this._rotated.x + this._cam_axisY.z * this._rotated.y + this._cam_axisZ.z * this._rotated.z;
                         if (this._computeBoundingBox) {
                             if (this._positions32[idx] < this._minimum.x) {
                                 this._minimum.x = this._positions32[idx];
@@ -52639,9 +52703,9 @@ var BABYLON;
                     this._maxBbox.x = this._particle._modelBoundingInfo.maximum.x * this._particle.scaling.x;
                     this._maxBbox.y = this._particle._modelBoundingInfo.maximum.y * this._particle.scaling.y;
                     this._maxBbox.z = this._particle._modelBoundingInfo.maximum.z * this._particle.scaling.z;
-                    bSphere.center.x = this._particle.position.x + (this._minBbox.x + this._maxBbox.x) * 0.5;
-                    bSphere.center.y = this._particle.position.y + (this._minBbox.y + this._maxBbox.y) * 0.5;
-                    bSphere.center.z = this._particle.position.z + (this._minBbox.z + this._maxBbox.z) * 0.5;
+                    bSphere.center.x = this._particle._globalPosition.x + (this._minBbox.x + this._maxBbox.x) * 0.5;
+                    bSphere.center.y = this._particle._globalPosition.y + (this._minBbox.y + this._maxBbox.y) * 0.5;
+                    bSphere.center.z = this._particle._globalPosition.z + (this._minBbox.z + this._maxBbox.z) * 0.5;
                     bSphere.radius = this._bSphereRadiusFactor * 0.5 * Math.sqrt((this._maxBbox.x - this._minBbox.x) * (this._maxBbox.x - this._minBbox.x) + (this._maxBbox.y - this._minBbox.y) * (this._maxBbox.y - this._minBbox.y) + (this._maxBbox.z - this._minBbox.z) * (this._maxBbox.z - this._minBbox.z));
                     bSphere._update(this.mesh._worldMatrix);
                 }
@@ -83634,6 +83698,8 @@ var BABYLON;
                 mainTextureFixedSize: _this._options.mainTextureFixedSize,
                 mainTextureRatio: _this._options.mainTextureRatio
             });
+            // Do not render as long as no meshes have been added
+            _this._shouldRender = false;
             return _this;
         }
         Object.defineProperty(HighlightLayer.prototype, "blurHorizontalSize", {
@@ -83786,6 +83852,7 @@ var BABYLON;
             var previousStencilOperationPass = engine.getStencilOperationPass();
             var previousStencilOperationFail = engine.getStencilOperationFail();
             var previousStencilOperationDepthFail = engine.getStencilOperationDepthFail();
+            var previousStencilReference = engine.getStencilFunctionReference();
             // Stencil operations
             engine.setStencilOperationPass(BABYLON.Engine.REPLACE);
             engine.setStencilOperationFail(BABYLON.Engine.KEEP);
@@ -83812,6 +83879,7 @@ var BABYLON;
             engine.setStencilOperationPass(previousStencilOperationPass);
             engine.setStencilOperationFail(previousStencilOperationFail);
             engine.setStencilOperationDepthFail(previousStencilOperationDepthFail);
+            engine.setStencilFunctionReference(previousStencilReference);
         };
         /**
          * Returns true if the layer contains information to display, otherwise false.

文件差异内容过多而无法显示
+ 50 - 50
dist/preview release/babylon.worker.js


文件差异内容过多而无法显示
+ 11057 - 11041
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


文件差异内容过多而无法显示
+ 51 - 51
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 98 - 30
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -50533,6 +50533,13 @@ var BABYLON;
             this._stopped = true;
         };
         /**
+         * Remove all active particles
+         */
+        ParticleSystem.prototype.reset = function () {
+            this._stockParticles = [];
+            this._particles = [];
+        };
+        /**
          * @ignore (for internal use only)
          */
         ParticleSystem.prototype._appendParticleVertex = function (index, particle, offsetX, offsetY) {
@@ -51409,7 +51416,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.IParticleEmitterType.js.map
+//# sourceMappingURL=babylon.iParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {
@@ -51501,6 +51508,15 @@ var BABYLON;
              * Last computed particle rotation matrix
              */
             this._rotationMatrix = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0];
+            /**
+             * Parent particle Id, if any.
+             * Default null.
+             */
+            this.parentId = null;
+            /**
+             * Internal global position in the SPS.
+             */
+            this._globalPosition = BABYLON.Vector3.Zero();
             this.idx = particleIndex;
             this._pos = positionIndex;
             this._ind = indiceIndex;
@@ -51729,6 +51745,8 @@ var BABYLON;
             };
             this._needs32Bits = false;
             this._pivotBackTranslation = BABYLON.Vector3.Zero();
+            this._scaledPivot = BABYLON.Vector3.Zero();
+            this._particleHasParent = false;
             this.name = name;
             this._scene = scene || BABYLON.Engine.LastCreatedScene;
             this._camera = scene.activeCamera;
@@ -51963,11 +51981,14 @@ var BABYLON;
                 this._quaternionRotationYPR();
             }
             this._quaternionToRotationMatrix();
+            this._scaledPivot.x = this._copy.pivot.x * this._copy.scaling.x;
+            this._scaledPivot.y = this._copy.pivot.y * this._copy.scaling.y;
+            this._scaledPivot.z = this._copy.pivot.z * this._copy.scaling.z;
             if (this._copy.translateFromPivot) {
                 this._pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);
             }
             else {
-                this._pivotBackTranslation.copyFrom(this._copy.pivot);
+                this._pivotBackTranslation.copyFrom(this._scaledPivot);
             }
             for (i = 0; i < shape.length; i++) {
                 this._vertex.x = shape[i].x;
@@ -51979,9 +52000,9 @@ 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._scaledPivot.x;
+                this._vertex.y -= this._scaledPivot.y;
+                this._vertex.z -= this._scaledPivot.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);
@@ -52125,11 +52146,14 @@ var BABYLON;
                 this._quaternionRotationYPR();
             }
             this._quaternionToRotationMatrix();
+            this._scaledPivot.x = this._particle.pivot.x * this._particle.scaling.x;
+            this._scaledPivot.y = this._particle.pivot.y * this._particle.scaling.y;
+            this._scaledPivot.z = this._particle.pivot.z * this._particle.scaling.z;
             if (this._copy.translateFromPivot) {
                 this._pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);
             }
             else {
-                this._pivotBackTranslation.copyFrom(this._copy.pivot);
+                this._pivotBackTranslation.copyFrom(this._scaledPivot);
             }
             this._shape = particle._model._shape;
             for (var pt = 0; pt < this._shape.length; pt++) {
@@ -52142,9 +52166,9 @@ 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._scaledPivot.x;
+                this._vertex.y -= this._scaledPivot.y;
+                this._vertex.z -= this._scaledPivot.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;
@@ -52161,6 +52185,15 @@ var BABYLON;
             particle.scaling.x = 1.0;
             particle.scaling.y = 1.0;
             particle.scaling.z = 1.0;
+            particle.uvs.x = 0.0;
+            particle.uvs.y = 0.0;
+            particle.uvs.z = 1.0;
+            particle.uvs.w = 1.0;
+            particle.pivot.x = 0.0;
+            particle.pivot.y = 0.0;
+            particle.pivot.z = 0.0;
+            particle.translateFromPivot = false;
+            particle.parentId = null;
         };
         /**
          * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
@@ -52275,6 +52308,10 @@ var BABYLON;
                 }
                 if (this._particle.isVisible) {
                     this._particle._stillInvisible = false; // un-mark permanent invisibility
+                    this._particleHasParent = (this._particle.parentId !== null);
+                    this._scaledPivot.x = this._particle.pivot.x * this._particle.scaling.x;
+                    this._scaledPivot.y = this._particle.pivot.y * this._particle.scaling.y;
+                    this._scaledPivot.z = this._particle.pivot.z * this._particle.scaling.z;
                     // particle rotation matrix
                     if (this.billboard) {
                         this._particle.rotation.x = 0.0;
@@ -52291,15 +52328,42 @@ var BABYLON;
                             this._quaternionRotationYPR();
                         }
                         this._quaternionToRotationMatrix();
-                        this._particle._rotationMatrix[0] = this._rotMatrix.m[0];
-                        this._particle._rotationMatrix[1] = this._rotMatrix.m[1];
-                        this._particle._rotationMatrix[2] = this._rotMatrix.m[2];
-                        this._particle._rotationMatrix[3] = this._rotMatrix.m[4];
-                        this._particle._rotationMatrix[4] = this._rotMatrix.m[5];
-                        this._particle._rotationMatrix[5] = this._rotMatrix.m[6];
-                        this._particle._rotationMatrix[6] = this._rotMatrix.m[8];
-                        this._particle._rotationMatrix[7] = this._rotMatrix.m[9];
-                        this._particle._rotationMatrix[8] = this._rotMatrix.m[10];
+                    }
+                    if (this._particleHasParent) {
+                        this._parent = this.particles[this._particle.parentId];
+                        this._rotated.x = this._particle.position.x * this._parent._rotationMatrix[0] + this._particle.position.y * this._parent._rotationMatrix[3] + this._particle.position.z * this._parent._rotationMatrix[6];
+                        this._rotated.y = this._particle.position.x * this._parent._rotationMatrix[1] + this._particle.position.y * this._parent._rotationMatrix[4] + this._particle.position.z * this._parent._rotationMatrix[7];
+                        this._rotated.z = this._particle.position.x * this._parent._rotationMatrix[2] + this._particle.position.y * this._parent._rotationMatrix[5] + this._particle.position.z * this._parent._rotationMatrix[8];
+                        this._particle._globalPosition.x = this._parent._globalPosition.x + this._rotated.x;
+                        this._particle._globalPosition.y = this._parent._globalPosition.y + this._rotated.y;
+                        this._particle._globalPosition.z = this._parent._globalPosition.z + this._rotated.z;
+                        if (this._computeParticleRotation || this.billboard) {
+                            this._particle._rotationMatrix[0] = this._rotMatrix.m[0] * this._parent._rotationMatrix[0] + this._rotMatrix.m[1] * this._parent._rotationMatrix[3] + this._rotMatrix.m[2] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[1] = this._rotMatrix.m[0] * this._parent._rotationMatrix[1] + this._rotMatrix.m[1] * this._parent._rotationMatrix[4] + this._rotMatrix.m[2] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[2] = this._rotMatrix.m[0] * this._parent._rotationMatrix[2] + this._rotMatrix.m[1] * this._parent._rotationMatrix[5] + this._rotMatrix.m[2] * this._parent._rotationMatrix[8];
+                            this._particle._rotationMatrix[3] = this._rotMatrix.m[4] * this._parent._rotationMatrix[0] + this._rotMatrix.m[5] * this._parent._rotationMatrix[3] + this._rotMatrix.m[6] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[4] = this._rotMatrix.m[4] * this._parent._rotationMatrix[1] + this._rotMatrix.m[5] * this._parent._rotationMatrix[4] + this._rotMatrix.m[6] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[5] = this._rotMatrix.m[4] * this._parent._rotationMatrix[2] + this._rotMatrix.m[5] * this._parent._rotationMatrix[5] + this._rotMatrix.m[6] * this._parent._rotationMatrix[8];
+                            this._particle._rotationMatrix[6] = this._rotMatrix.m[8] * this._parent._rotationMatrix[0] + this._rotMatrix.m[9] * this._parent._rotationMatrix[3] + this._rotMatrix.m[10] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[7] = this._rotMatrix.m[8] * this._parent._rotationMatrix[1] + this._rotMatrix.m[9] * this._parent._rotationMatrix[4] + this._rotMatrix.m[10] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[8] = this._rotMatrix.m[8] * this._parent._rotationMatrix[2] + this._rotMatrix.m[9] * this._parent._rotationMatrix[5] + this._rotMatrix.m[10] * this._parent._rotationMatrix[8];
+                        }
+                    }
+                    else {
+                        this._particle._globalPosition.x = this._particle.position.x;
+                        this._particle._globalPosition.y = this._particle.position.y;
+                        this._particle._globalPosition.z = this._particle.position.z;
+                        if (this._computeParticleRotation || this.billboard) {
+                            this._particle._rotationMatrix[0] = this._rotMatrix.m[0];
+                            this._particle._rotationMatrix[1] = this._rotMatrix.m[1];
+                            this._particle._rotationMatrix[2] = this._rotMatrix.m[2];
+                            this._particle._rotationMatrix[3] = this._rotMatrix.m[4];
+                            this._particle._rotationMatrix[4] = this._rotMatrix.m[5];
+                            this._particle._rotationMatrix[5] = this._rotMatrix.m[6];
+                            this._particle._rotationMatrix[6] = this._rotMatrix.m[8];
+                            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;
@@ -52307,9 +52371,9 @@ var BABYLON;
                         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;
+                        this._pivotBackTranslation.x = this._scaledPivot.x;
+                        this._pivotBackTranslation.y = this._scaledPivot.y;
+                        this._pivotBackTranslation.z = this._scaledPivot.z;
                     }
                     // particle vertex loop
                     for (pt = 0; pt < this._shape.length; pt++) {
@@ -52326,18 +52390,18 @@ 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._scaledPivot.x;
+                        this._vertex.y -= this._scaledPivot.y;
+                        this._vertex.z -= this._scaledPivot.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;
+                        this._positions32[idx] = this._particle._globalPosition.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._globalPosition.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._globalPosition.z + this._cam_axisX.z * this._rotated.x + this._cam_axisY.z * this._rotated.y + this._cam_axisZ.z * this._rotated.z;
                         if (this._computeBoundingBox) {
                             if (this._positions32[idx] < this._minimum.x) {
                                 this._minimum.x = this._positions32[idx];
@@ -52433,9 +52497,9 @@ var BABYLON;
                     this._maxBbox.x = this._particle._modelBoundingInfo.maximum.x * this._particle.scaling.x;
                     this._maxBbox.y = this._particle._modelBoundingInfo.maximum.y * this._particle.scaling.y;
                     this._maxBbox.z = this._particle._modelBoundingInfo.maximum.z * this._particle.scaling.z;
-                    bSphere.center.x = this._particle.position.x + (this._minBbox.x + this._maxBbox.x) * 0.5;
-                    bSphere.center.y = this._particle.position.y + (this._minBbox.y + this._maxBbox.y) * 0.5;
-                    bSphere.center.z = this._particle.position.z + (this._minBbox.z + this._maxBbox.z) * 0.5;
+                    bSphere.center.x = this._particle._globalPosition.x + (this._minBbox.x + this._maxBbox.x) * 0.5;
+                    bSphere.center.y = this._particle._globalPosition.y + (this._minBbox.y + this._maxBbox.y) * 0.5;
+                    bSphere.center.z = this._particle._globalPosition.z + (this._minBbox.z + this._maxBbox.z) * 0.5;
                     bSphere.radius = this._bSphereRadiusFactor * 0.5 * Math.sqrt((this._maxBbox.x - this._minBbox.x) * (this._maxBbox.x - this._minBbox.x) + (this._maxBbox.y - this._minBbox.y) * (this._maxBbox.y - this._minBbox.y) + (this._maxBbox.z - this._minBbox.z) * (this._maxBbox.z - this._minBbox.z));
                     bSphere._update(this.mesh._worldMatrix);
                 }
@@ -83378,6 +83442,8 @@ var BABYLON;
                 mainTextureFixedSize: _this._options.mainTextureFixedSize,
                 mainTextureRatio: _this._options.mainTextureRatio
             });
+            // Do not render as long as no meshes have been added
+            _this._shouldRender = false;
             return _this;
         }
         Object.defineProperty(HighlightLayer.prototype, "blurHorizontalSize", {
@@ -83530,6 +83596,7 @@ var BABYLON;
             var previousStencilOperationPass = engine.getStencilOperationPass();
             var previousStencilOperationFail = engine.getStencilOperationFail();
             var previousStencilOperationDepthFail = engine.getStencilOperationDepthFail();
+            var previousStencilReference = engine.getStencilFunctionReference();
             // Stencil operations
             engine.setStencilOperationPass(BABYLON.Engine.REPLACE);
             engine.setStencilOperationFail(BABYLON.Engine.KEEP);
@@ -83556,6 +83623,7 @@ var BABYLON;
             engine.setStencilOperationPass(previousStencilOperationPass);
             engine.setStencilOperationFail(previousStencilOperationFail);
             engine.setStencilOperationDepthFail(previousStencilOperationDepthFail);
+            engine.setStencilFunctionReference(previousStencilReference);
         };
         /**
          * Returns true if the layer contains information to display, otherwise false.

+ 98 - 30
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -50519,6 +50519,13 @@ var BABYLON;
             this._stopped = true;
         };
         /**
+         * Remove all active particles
+         */
+        ParticleSystem.prototype.reset = function () {
+            this._stockParticles = [];
+            this._particles = [];
+        };
+        /**
          * @ignore (for internal use only)
          */
         ParticleSystem.prototype._appendParticleVertex = function (index, particle, offsetX, offsetY) {
@@ -51395,7 +51402,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.IParticleEmitterType.js.map
+//# sourceMappingURL=babylon.iParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {
@@ -51487,6 +51494,15 @@ var BABYLON;
              * Last computed particle rotation matrix
              */
             this._rotationMatrix = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0];
+            /**
+             * Parent particle Id, if any.
+             * Default null.
+             */
+            this.parentId = null;
+            /**
+             * Internal global position in the SPS.
+             */
+            this._globalPosition = BABYLON.Vector3.Zero();
             this.idx = particleIndex;
             this._pos = positionIndex;
             this._ind = indiceIndex;
@@ -51715,6 +51731,8 @@ var BABYLON;
             };
             this._needs32Bits = false;
             this._pivotBackTranslation = BABYLON.Vector3.Zero();
+            this._scaledPivot = BABYLON.Vector3.Zero();
+            this._particleHasParent = false;
             this.name = name;
             this._scene = scene || BABYLON.Engine.LastCreatedScene;
             this._camera = scene.activeCamera;
@@ -51949,11 +51967,14 @@ var BABYLON;
                 this._quaternionRotationYPR();
             }
             this._quaternionToRotationMatrix();
+            this._scaledPivot.x = this._copy.pivot.x * this._copy.scaling.x;
+            this._scaledPivot.y = this._copy.pivot.y * this._copy.scaling.y;
+            this._scaledPivot.z = this._copy.pivot.z * this._copy.scaling.z;
             if (this._copy.translateFromPivot) {
                 this._pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);
             }
             else {
-                this._pivotBackTranslation.copyFrom(this._copy.pivot);
+                this._pivotBackTranslation.copyFrom(this._scaledPivot);
             }
             for (i = 0; i < shape.length; i++) {
                 this._vertex.x = shape[i].x;
@@ -51965,9 +51986,9 @@ 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._scaledPivot.x;
+                this._vertex.y -= this._scaledPivot.y;
+                this._vertex.z -= this._scaledPivot.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);
@@ -52111,11 +52132,14 @@ var BABYLON;
                 this._quaternionRotationYPR();
             }
             this._quaternionToRotationMatrix();
+            this._scaledPivot.x = this._particle.pivot.x * this._particle.scaling.x;
+            this._scaledPivot.y = this._particle.pivot.y * this._particle.scaling.y;
+            this._scaledPivot.z = this._particle.pivot.z * this._particle.scaling.z;
             if (this._copy.translateFromPivot) {
                 this._pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);
             }
             else {
-                this._pivotBackTranslation.copyFrom(this._copy.pivot);
+                this._pivotBackTranslation.copyFrom(this._scaledPivot);
             }
             this._shape = particle._model._shape;
             for (var pt = 0; pt < this._shape.length; pt++) {
@@ -52128,9 +52152,9 @@ 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._scaledPivot.x;
+                this._vertex.y -= this._scaledPivot.y;
+                this._vertex.z -= this._scaledPivot.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;
@@ -52147,6 +52171,15 @@ var BABYLON;
             particle.scaling.x = 1.0;
             particle.scaling.y = 1.0;
             particle.scaling.z = 1.0;
+            particle.uvs.x = 0.0;
+            particle.uvs.y = 0.0;
+            particle.uvs.z = 1.0;
+            particle.uvs.w = 1.0;
+            particle.pivot.x = 0.0;
+            particle.pivot.y = 0.0;
+            particle.pivot.z = 0.0;
+            particle.translateFromPivot = false;
+            particle.parentId = null;
         };
         /**
          * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
@@ -52261,6 +52294,10 @@ var BABYLON;
                 }
                 if (this._particle.isVisible) {
                     this._particle._stillInvisible = false; // un-mark permanent invisibility
+                    this._particleHasParent = (this._particle.parentId !== null);
+                    this._scaledPivot.x = this._particle.pivot.x * this._particle.scaling.x;
+                    this._scaledPivot.y = this._particle.pivot.y * this._particle.scaling.y;
+                    this._scaledPivot.z = this._particle.pivot.z * this._particle.scaling.z;
                     // particle rotation matrix
                     if (this.billboard) {
                         this._particle.rotation.x = 0.0;
@@ -52277,15 +52314,42 @@ var BABYLON;
                             this._quaternionRotationYPR();
                         }
                         this._quaternionToRotationMatrix();
-                        this._particle._rotationMatrix[0] = this._rotMatrix.m[0];
-                        this._particle._rotationMatrix[1] = this._rotMatrix.m[1];
-                        this._particle._rotationMatrix[2] = this._rotMatrix.m[2];
-                        this._particle._rotationMatrix[3] = this._rotMatrix.m[4];
-                        this._particle._rotationMatrix[4] = this._rotMatrix.m[5];
-                        this._particle._rotationMatrix[5] = this._rotMatrix.m[6];
-                        this._particle._rotationMatrix[6] = this._rotMatrix.m[8];
-                        this._particle._rotationMatrix[7] = this._rotMatrix.m[9];
-                        this._particle._rotationMatrix[8] = this._rotMatrix.m[10];
+                    }
+                    if (this._particleHasParent) {
+                        this._parent = this.particles[this._particle.parentId];
+                        this._rotated.x = this._particle.position.x * this._parent._rotationMatrix[0] + this._particle.position.y * this._parent._rotationMatrix[3] + this._particle.position.z * this._parent._rotationMatrix[6];
+                        this._rotated.y = this._particle.position.x * this._parent._rotationMatrix[1] + this._particle.position.y * this._parent._rotationMatrix[4] + this._particle.position.z * this._parent._rotationMatrix[7];
+                        this._rotated.z = this._particle.position.x * this._parent._rotationMatrix[2] + this._particle.position.y * this._parent._rotationMatrix[5] + this._particle.position.z * this._parent._rotationMatrix[8];
+                        this._particle._globalPosition.x = this._parent._globalPosition.x + this._rotated.x;
+                        this._particle._globalPosition.y = this._parent._globalPosition.y + this._rotated.y;
+                        this._particle._globalPosition.z = this._parent._globalPosition.z + this._rotated.z;
+                        if (this._computeParticleRotation || this.billboard) {
+                            this._particle._rotationMatrix[0] = this._rotMatrix.m[0] * this._parent._rotationMatrix[0] + this._rotMatrix.m[1] * this._parent._rotationMatrix[3] + this._rotMatrix.m[2] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[1] = this._rotMatrix.m[0] * this._parent._rotationMatrix[1] + this._rotMatrix.m[1] * this._parent._rotationMatrix[4] + this._rotMatrix.m[2] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[2] = this._rotMatrix.m[0] * this._parent._rotationMatrix[2] + this._rotMatrix.m[1] * this._parent._rotationMatrix[5] + this._rotMatrix.m[2] * this._parent._rotationMatrix[8];
+                            this._particle._rotationMatrix[3] = this._rotMatrix.m[4] * this._parent._rotationMatrix[0] + this._rotMatrix.m[5] * this._parent._rotationMatrix[3] + this._rotMatrix.m[6] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[4] = this._rotMatrix.m[4] * this._parent._rotationMatrix[1] + this._rotMatrix.m[5] * this._parent._rotationMatrix[4] + this._rotMatrix.m[6] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[5] = this._rotMatrix.m[4] * this._parent._rotationMatrix[2] + this._rotMatrix.m[5] * this._parent._rotationMatrix[5] + this._rotMatrix.m[6] * this._parent._rotationMatrix[8];
+                            this._particle._rotationMatrix[6] = this._rotMatrix.m[8] * this._parent._rotationMatrix[0] + this._rotMatrix.m[9] * this._parent._rotationMatrix[3] + this._rotMatrix.m[10] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[7] = this._rotMatrix.m[8] * this._parent._rotationMatrix[1] + this._rotMatrix.m[9] * this._parent._rotationMatrix[4] + this._rotMatrix.m[10] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[8] = this._rotMatrix.m[8] * this._parent._rotationMatrix[2] + this._rotMatrix.m[9] * this._parent._rotationMatrix[5] + this._rotMatrix.m[10] * this._parent._rotationMatrix[8];
+                        }
+                    }
+                    else {
+                        this._particle._globalPosition.x = this._particle.position.x;
+                        this._particle._globalPosition.y = this._particle.position.y;
+                        this._particle._globalPosition.z = this._particle.position.z;
+                        if (this._computeParticleRotation || this.billboard) {
+                            this._particle._rotationMatrix[0] = this._rotMatrix.m[0];
+                            this._particle._rotationMatrix[1] = this._rotMatrix.m[1];
+                            this._particle._rotationMatrix[2] = this._rotMatrix.m[2];
+                            this._particle._rotationMatrix[3] = this._rotMatrix.m[4];
+                            this._particle._rotationMatrix[4] = this._rotMatrix.m[5];
+                            this._particle._rotationMatrix[5] = this._rotMatrix.m[6];
+                            this._particle._rotationMatrix[6] = this._rotMatrix.m[8];
+                            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;
@@ -52293,9 +52357,9 @@ var BABYLON;
                         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;
+                        this._pivotBackTranslation.x = this._scaledPivot.x;
+                        this._pivotBackTranslation.y = this._scaledPivot.y;
+                        this._pivotBackTranslation.z = this._scaledPivot.z;
                     }
                     // particle vertex loop
                     for (pt = 0; pt < this._shape.length; pt++) {
@@ -52312,18 +52376,18 @@ 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._scaledPivot.x;
+                        this._vertex.y -= this._scaledPivot.y;
+                        this._vertex.z -= this._scaledPivot.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;
+                        this._positions32[idx] = this._particle._globalPosition.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._globalPosition.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._globalPosition.z + this._cam_axisX.z * this._rotated.x + this._cam_axisY.z * this._rotated.y + this._cam_axisZ.z * this._rotated.z;
                         if (this._computeBoundingBox) {
                             if (this._positions32[idx] < this._minimum.x) {
                                 this._minimum.x = this._positions32[idx];
@@ -52419,9 +52483,9 @@ var BABYLON;
                     this._maxBbox.x = this._particle._modelBoundingInfo.maximum.x * this._particle.scaling.x;
                     this._maxBbox.y = this._particle._modelBoundingInfo.maximum.y * this._particle.scaling.y;
                     this._maxBbox.z = this._particle._modelBoundingInfo.maximum.z * this._particle.scaling.z;
-                    bSphere.center.x = this._particle.position.x + (this._minBbox.x + this._maxBbox.x) * 0.5;
-                    bSphere.center.y = this._particle.position.y + (this._minBbox.y + this._maxBbox.y) * 0.5;
-                    bSphere.center.z = this._particle.position.z + (this._minBbox.z + this._maxBbox.z) * 0.5;
+                    bSphere.center.x = this._particle._globalPosition.x + (this._minBbox.x + this._maxBbox.x) * 0.5;
+                    bSphere.center.y = this._particle._globalPosition.y + (this._minBbox.y + this._maxBbox.y) * 0.5;
+                    bSphere.center.z = this._particle._globalPosition.z + (this._minBbox.z + this._maxBbox.z) * 0.5;
                     bSphere.radius = this._bSphereRadiusFactor * 0.5 * Math.sqrt((this._maxBbox.x - this._minBbox.x) * (this._maxBbox.x - this._minBbox.x) + (this._maxBbox.y - this._minBbox.y) * (this._maxBbox.y - this._minBbox.y) + (this._maxBbox.z - this._minBbox.z) * (this._maxBbox.z - this._minBbox.z));
                     bSphere._update(this.mesh._worldMatrix);
                 }
@@ -83364,6 +83428,8 @@ var BABYLON;
                 mainTextureFixedSize: _this._options.mainTextureFixedSize,
                 mainTextureRatio: _this._options.mainTextureRatio
             });
+            // Do not render as long as no meshes have been added
+            _this._shouldRender = false;
             return _this;
         }
         Object.defineProperty(HighlightLayer.prototype, "blurHorizontalSize", {
@@ -83516,6 +83582,7 @@ var BABYLON;
             var previousStencilOperationPass = engine.getStencilOperationPass();
             var previousStencilOperationFail = engine.getStencilOperationFail();
             var previousStencilOperationDepthFail = engine.getStencilOperationDepthFail();
+            var previousStencilReference = engine.getStencilFunctionReference();
             // Stencil operations
             engine.setStencilOperationPass(BABYLON.Engine.REPLACE);
             engine.setStencilOperationFail(BABYLON.Engine.KEEP);
@@ -83542,6 +83609,7 @@ var BABYLON;
             engine.setStencilOperationPass(previousStencilOperationPass);
             engine.setStencilOperationFail(previousStencilOperationFail);
             engine.setStencilOperationDepthFail(previousStencilOperationDepthFail);
+            engine.setStencilFunctionReference(previousStencilReference);
         };
         /**
          * Returns true if the layer contains information to display, otherwise false.

+ 98 - 30
dist/preview release/es6.js

@@ -50519,6 +50519,13 @@ var BABYLON;
             this._stopped = true;
         };
         /**
+         * Remove all active particles
+         */
+        ParticleSystem.prototype.reset = function () {
+            this._stockParticles = [];
+            this._particles = [];
+        };
+        /**
          * @ignore (for internal use only)
          */
         ParticleSystem.prototype._appendParticleVertex = function (index, particle, offsetX, offsetY) {
@@ -51395,7 +51402,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.IParticleEmitterType.js.map
+//# sourceMappingURL=babylon.iParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {
@@ -51693,6 +51700,15 @@ var BABYLON;
              * Last computed particle rotation matrix
              */
             this._rotationMatrix = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0];
+            /**
+             * Parent particle Id, if any.
+             * Default null.
+             */
+            this.parentId = null;
+            /**
+             * Internal global position in the SPS.
+             */
+            this._globalPosition = BABYLON.Vector3.Zero();
             this.idx = particleIndex;
             this._pos = positionIndex;
             this._ind = indiceIndex;
@@ -51921,6 +51937,8 @@ var BABYLON;
             };
             this._needs32Bits = false;
             this._pivotBackTranslation = BABYLON.Vector3.Zero();
+            this._scaledPivot = BABYLON.Vector3.Zero();
+            this._particleHasParent = false;
             this.name = name;
             this._scene = scene || BABYLON.Engine.LastCreatedScene;
             this._camera = scene.activeCamera;
@@ -52155,11 +52173,14 @@ var BABYLON;
                 this._quaternionRotationYPR();
             }
             this._quaternionToRotationMatrix();
+            this._scaledPivot.x = this._copy.pivot.x * this._copy.scaling.x;
+            this._scaledPivot.y = this._copy.pivot.y * this._copy.scaling.y;
+            this._scaledPivot.z = this._copy.pivot.z * this._copy.scaling.z;
             if (this._copy.translateFromPivot) {
                 this._pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);
             }
             else {
-                this._pivotBackTranslation.copyFrom(this._copy.pivot);
+                this._pivotBackTranslation.copyFrom(this._scaledPivot);
             }
             for (i = 0; i < shape.length; i++) {
                 this._vertex.x = shape[i].x;
@@ -52171,9 +52192,9 @@ 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._scaledPivot.x;
+                this._vertex.y -= this._scaledPivot.y;
+                this._vertex.z -= this._scaledPivot.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);
@@ -52317,11 +52338,14 @@ var BABYLON;
                 this._quaternionRotationYPR();
             }
             this._quaternionToRotationMatrix();
+            this._scaledPivot.x = this._particle.pivot.x * this._particle.scaling.x;
+            this._scaledPivot.y = this._particle.pivot.y * this._particle.scaling.y;
+            this._scaledPivot.z = this._particle.pivot.z * this._particle.scaling.z;
             if (this._copy.translateFromPivot) {
                 this._pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);
             }
             else {
-                this._pivotBackTranslation.copyFrom(this._copy.pivot);
+                this._pivotBackTranslation.copyFrom(this._scaledPivot);
             }
             this._shape = particle._model._shape;
             for (var pt = 0; pt < this._shape.length; pt++) {
@@ -52334,9 +52358,9 @@ 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._scaledPivot.x;
+                this._vertex.y -= this._scaledPivot.y;
+                this._vertex.z -= this._scaledPivot.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;
@@ -52353,6 +52377,15 @@ var BABYLON;
             particle.scaling.x = 1.0;
             particle.scaling.y = 1.0;
             particle.scaling.z = 1.0;
+            particle.uvs.x = 0.0;
+            particle.uvs.y = 0.0;
+            particle.uvs.z = 1.0;
+            particle.uvs.w = 1.0;
+            particle.pivot.x = 0.0;
+            particle.pivot.y = 0.0;
+            particle.pivot.z = 0.0;
+            particle.translateFromPivot = false;
+            particle.parentId = null;
         };
         /**
          * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
@@ -52467,6 +52500,10 @@ var BABYLON;
                 }
                 if (this._particle.isVisible) {
                     this._particle._stillInvisible = false; // un-mark permanent invisibility
+                    this._particleHasParent = (this._particle.parentId !== null);
+                    this._scaledPivot.x = this._particle.pivot.x * this._particle.scaling.x;
+                    this._scaledPivot.y = this._particle.pivot.y * this._particle.scaling.y;
+                    this._scaledPivot.z = this._particle.pivot.z * this._particle.scaling.z;
                     // particle rotation matrix
                     if (this.billboard) {
                         this._particle.rotation.x = 0.0;
@@ -52483,15 +52520,42 @@ var BABYLON;
                             this._quaternionRotationYPR();
                         }
                         this._quaternionToRotationMatrix();
-                        this._particle._rotationMatrix[0] = this._rotMatrix.m[0];
-                        this._particle._rotationMatrix[1] = this._rotMatrix.m[1];
-                        this._particle._rotationMatrix[2] = this._rotMatrix.m[2];
-                        this._particle._rotationMatrix[3] = this._rotMatrix.m[4];
-                        this._particle._rotationMatrix[4] = this._rotMatrix.m[5];
-                        this._particle._rotationMatrix[5] = this._rotMatrix.m[6];
-                        this._particle._rotationMatrix[6] = this._rotMatrix.m[8];
-                        this._particle._rotationMatrix[7] = this._rotMatrix.m[9];
-                        this._particle._rotationMatrix[8] = this._rotMatrix.m[10];
+                    }
+                    if (this._particleHasParent) {
+                        this._parent = this.particles[this._particle.parentId];
+                        this._rotated.x = this._particle.position.x * this._parent._rotationMatrix[0] + this._particle.position.y * this._parent._rotationMatrix[3] + this._particle.position.z * this._parent._rotationMatrix[6];
+                        this._rotated.y = this._particle.position.x * this._parent._rotationMatrix[1] + this._particle.position.y * this._parent._rotationMatrix[4] + this._particle.position.z * this._parent._rotationMatrix[7];
+                        this._rotated.z = this._particle.position.x * this._parent._rotationMatrix[2] + this._particle.position.y * this._parent._rotationMatrix[5] + this._particle.position.z * this._parent._rotationMatrix[8];
+                        this._particle._globalPosition.x = this._parent._globalPosition.x + this._rotated.x;
+                        this._particle._globalPosition.y = this._parent._globalPosition.y + this._rotated.y;
+                        this._particle._globalPosition.z = this._parent._globalPosition.z + this._rotated.z;
+                        if (this._computeParticleRotation || this.billboard) {
+                            this._particle._rotationMatrix[0] = this._rotMatrix.m[0] * this._parent._rotationMatrix[0] + this._rotMatrix.m[1] * this._parent._rotationMatrix[3] + this._rotMatrix.m[2] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[1] = this._rotMatrix.m[0] * this._parent._rotationMatrix[1] + this._rotMatrix.m[1] * this._parent._rotationMatrix[4] + this._rotMatrix.m[2] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[2] = this._rotMatrix.m[0] * this._parent._rotationMatrix[2] + this._rotMatrix.m[1] * this._parent._rotationMatrix[5] + this._rotMatrix.m[2] * this._parent._rotationMatrix[8];
+                            this._particle._rotationMatrix[3] = this._rotMatrix.m[4] * this._parent._rotationMatrix[0] + this._rotMatrix.m[5] * this._parent._rotationMatrix[3] + this._rotMatrix.m[6] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[4] = this._rotMatrix.m[4] * this._parent._rotationMatrix[1] + this._rotMatrix.m[5] * this._parent._rotationMatrix[4] + this._rotMatrix.m[6] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[5] = this._rotMatrix.m[4] * this._parent._rotationMatrix[2] + this._rotMatrix.m[5] * this._parent._rotationMatrix[5] + this._rotMatrix.m[6] * this._parent._rotationMatrix[8];
+                            this._particle._rotationMatrix[6] = this._rotMatrix.m[8] * this._parent._rotationMatrix[0] + this._rotMatrix.m[9] * this._parent._rotationMatrix[3] + this._rotMatrix.m[10] * this._parent._rotationMatrix[6];
+                            this._particle._rotationMatrix[7] = this._rotMatrix.m[8] * this._parent._rotationMatrix[1] + this._rotMatrix.m[9] * this._parent._rotationMatrix[4] + this._rotMatrix.m[10] * this._parent._rotationMatrix[7];
+                            this._particle._rotationMatrix[8] = this._rotMatrix.m[8] * this._parent._rotationMatrix[2] + this._rotMatrix.m[9] * this._parent._rotationMatrix[5] + this._rotMatrix.m[10] * this._parent._rotationMatrix[8];
+                        }
+                    }
+                    else {
+                        this._particle._globalPosition.x = this._particle.position.x;
+                        this._particle._globalPosition.y = this._particle.position.y;
+                        this._particle._globalPosition.z = this._particle.position.z;
+                        if (this._computeParticleRotation || this.billboard) {
+                            this._particle._rotationMatrix[0] = this._rotMatrix.m[0];
+                            this._particle._rotationMatrix[1] = this._rotMatrix.m[1];
+                            this._particle._rotationMatrix[2] = this._rotMatrix.m[2];
+                            this._particle._rotationMatrix[3] = this._rotMatrix.m[4];
+                            this._particle._rotationMatrix[4] = this._rotMatrix.m[5];
+                            this._particle._rotationMatrix[5] = this._rotMatrix.m[6];
+                            this._particle._rotationMatrix[6] = this._rotMatrix.m[8];
+                            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;
@@ -52499,9 +52563,9 @@ var BABYLON;
                         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;
+                        this._pivotBackTranslation.x = this._scaledPivot.x;
+                        this._pivotBackTranslation.y = this._scaledPivot.y;
+                        this._pivotBackTranslation.z = this._scaledPivot.z;
                     }
                     // particle vertex loop
                     for (pt = 0; pt < this._shape.length; pt++) {
@@ -52518,18 +52582,18 @@ 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._scaledPivot.x;
+                        this._vertex.y -= this._scaledPivot.y;
+                        this._vertex.z -= this._scaledPivot.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;
+                        this._positions32[idx] = this._particle._globalPosition.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._globalPosition.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._globalPosition.z + this._cam_axisX.z * this._rotated.x + this._cam_axisY.z * this._rotated.y + this._cam_axisZ.z * this._rotated.z;
                         if (this._computeBoundingBox) {
                             if (this._positions32[idx] < this._minimum.x) {
                                 this._minimum.x = this._positions32[idx];
@@ -52625,9 +52689,9 @@ var BABYLON;
                     this._maxBbox.x = this._particle._modelBoundingInfo.maximum.x * this._particle.scaling.x;
                     this._maxBbox.y = this._particle._modelBoundingInfo.maximum.y * this._particle.scaling.y;
                     this._maxBbox.z = this._particle._modelBoundingInfo.maximum.z * this._particle.scaling.z;
-                    bSphere.center.x = this._particle.position.x + (this._minBbox.x + this._maxBbox.x) * 0.5;
-                    bSphere.center.y = this._particle.position.y + (this._minBbox.y + this._maxBbox.y) * 0.5;
-                    bSphere.center.z = this._particle.position.z + (this._minBbox.z + this._maxBbox.z) * 0.5;
+                    bSphere.center.x = this._particle._globalPosition.x + (this._minBbox.x + this._maxBbox.x) * 0.5;
+                    bSphere.center.y = this._particle._globalPosition.y + (this._minBbox.y + this._maxBbox.y) * 0.5;
+                    bSphere.center.z = this._particle._globalPosition.z + (this._minBbox.z + this._maxBbox.z) * 0.5;
                     bSphere.radius = this._bSphereRadiusFactor * 0.5 * Math.sqrt((this._maxBbox.x - this._minBbox.x) * (this._maxBbox.x - this._minBbox.x) + (this._maxBbox.y - this._minBbox.y) * (this._maxBbox.y - this._minBbox.y) + (this._maxBbox.z - this._minBbox.z) * (this._maxBbox.z - this._minBbox.z));
                     bSphere._update(this.mesh._worldMatrix);
                 }
@@ -83620,6 +83684,8 @@ var BABYLON;
                 mainTextureFixedSize: _this._options.mainTextureFixedSize,
                 mainTextureRatio: _this._options.mainTextureRatio
             });
+            // Do not render as long as no meshes have been added
+            _this._shouldRender = false;
             return _this;
         }
         Object.defineProperty(HighlightLayer.prototype, "blurHorizontalSize", {
@@ -83772,6 +83838,7 @@ var BABYLON;
             var previousStencilOperationPass = engine.getStencilOperationPass();
             var previousStencilOperationFail = engine.getStencilOperationFail();
             var previousStencilOperationDepthFail = engine.getStencilOperationDepthFail();
+            var previousStencilReference = engine.getStencilFunctionReference();
             // Stencil operations
             engine.setStencilOperationPass(BABYLON.Engine.REPLACE);
             engine.setStencilOperationFail(BABYLON.Engine.KEEP);
@@ -83798,6 +83865,7 @@ var BABYLON;
             engine.setStencilOperationPass(previousStencilOperationPass);
             engine.setStencilOperationFail(previousStencilOperationFail);
             engine.setStencilOperationDepthFail(previousStencilOperationDepthFail);
+            engine.setStencilFunctionReference(previousStencilReference);
         };
         /**
          * Returns true if the layer contains information to display, otherwise false.

文件差异内容过多而无法显示
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


文件差异内容过多而无法显示
+ 4 - 4
dist/preview release/inspector/babylon.inspector.bundle.js


文件差异内容过多而无法显示
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


文件差异内容过多而无法显示
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


文件差异内容过多而无法显示
+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


文件差异内容过多而无法显示
+ 3 - 3
dist/preview release/loaders/babylon.glTFFileLoader.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


文件差异内容过多而无法显示
+ 3 - 3
dist/preview release/loaders/babylonjs.loaders.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


文件差异内容过多而无法显示
+ 3 - 3
dist/preview release/materialsLibrary/babylonjs.materials.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


文件差异内容过多而无法显示
+ 59 - 59
dist/preview release/viewer/babylon.viewer.js


+ 1 - 0
dist/preview release/what's new.md

@@ -16,6 +16,7 @@
 ## Updates
 
 - Tons of functions and classes received the code comments they deserved (All the community)
+- Added `particleSystem.reset()` to clear a particle system ([deltakosh](https://github.com/deltakosh))
 - Added support for all RGBA orders (BGR, RGB, etc..) for the DDS loader ([deltakosh](https://github.com/deltakosh))
 - Improved [SceneOptimizer](http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer) to provide better adaptability ([deltakosh](https://github.com/deltakosh))
 - Improved `scene.isReady()` function which now takes in account shadows and LOD ([deltakosh](https://github.com/deltakosh))

+ 8 - 0
src/Particles/babylon.particleSystem.ts

@@ -494,6 +494,14 @@
         }
 
         /**
+         * Remove all active particles
+         */
+        public reset(): void {
+            this._stockParticles = [];
+            this._particles = [];
+        }
+
+        /**
          * @ignore (for internal use only)
          */
         public _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void {