David Catuhe %!s(int64=7) %!d(string=hai) anos
pai
achega
0b2333507f
Modificáronse 30 ficheiros con 26866 adicións e 26715 borrados
  1. 6415 6392
      Playground/babylon.d.txt
  2. 14260 14261
      dist/preview release/babylon.d.ts
  3. 22 22
      dist/preview release/babylon.js
  4. 2 23
      dist/preview release/babylon.max.js
  5. 22 22
      dist/preview release/babylon.worker.js
  6. 5744 5723
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  7. 47 47
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  8. 84 27
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  9. 84 27
      dist/preview release/customConfigurations/minimalGLTFViewer/es6.js
  10. 2 23
      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. 58 58
      dist/preview release/viewer/babylon.viewer.js
  29. 92 33
      dist/preview release/viewer/babylon.viewer.max.js
  30. 2 25
      src/Particles/babylon.particleSystem.ts

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 6415 - 6392
Playground/babylon.d.txt


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 14260 - 14261
dist/preview release/babylon.d.ts


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 22 - 22
dist/preview release/babylon.js


+ 2 - 23
dist/preview release/babylon.max.js

@@ -51274,7 +51274,8 @@ var BABYLON;
                     return;
                 }
                 var templateIndex = Math.floor(Math.random() * _this.subEmitters.length);
-                var subSystem = _this.subEmitters[templateIndex]._cloneToSubSystem(_this, particle.position.clone());
+                var subSystem = _this.subEmitters[templateIndex].clone(_this.name + "_sub", particle.position.clone());
+                subSystem._rootParticleSystem = _this;
                 _this.activeSubSystems.push(subSystem);
                 subSystem.start();
             };
@@ -51875,28 +51876,6 @@ var BABYLON;
             this.particleEmitterType = particleEmitter;
             return particleEmitter;
         };
-        ParticleSystem.prototype._cloneToSubSystem = function (root, newEmitter) {
-            var custom = null;
-            var program = null;
-            if (this.customShader != null) {
-                program = this.customShader;
-                var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
-                custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
-            }
-            var result = new ParticleSystem(name, this._capacity, this._scene, custom);
-            result.customShader = program;
-            BABYLON.Tools.DeepCopy(this, result, ["customShader"]);
-            result.name = name + "_Child";
-            result.id = result.name;
-            result.emitter = newEmitter;
-            result.subEmitters = this.subEmitters;
-            result.particleEmitterType = this.particleEmitterType;
-            result._rootParticleSystem = root;
-            if (this.particleTexture) {
-                result.particleTexture = new BABYLON.Texture(this.particleTexture.url, this._scene);
-            }
-            return result;
-        };
         // Clone
         /**
          * Clones the particle system.

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 22 - 22
dist/preview release/babylon.worker.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 5744 - 5723
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 47 - 47
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 84 - 27
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -50955,7 +50955,11 @@ var BABYLON;
          * Creates a new instance of @see Particle
          * @param particleSystem the particle system the particle belongs to
          */
-        function Particle(particleSystem) {
+        function Particle(
+            /**
+             * particleSystem the particle system the particle belongs to.
+             */
+            particleSystem) {
             this.particleSystem = particleSystem;
             /**
              * The world position of the particle in the scene.
@@ -51001,15 +51005,18 @@ var BABYLON;
             if (!this.particleSystem.isAnimationSheetEnabled) {
                 return;
             }
+            this.updateCellInfoFromSystem();
+        }
+        Particle.prototype.updateCellInfoFromSystem = function () {
             this.cellIndex = this.particleSystem.startSpriteCellID;
             if (this.particleSystem.spriteCellChangeSpeed == 0) {
-                this.updateCellIndex = this.updateCellIndexWithSpeedCalculated;
+                this.updateCellIndex = this._updateCellIndexWithSpeedCalculated;
             }
             else {
-                this.updateCellIndex = this.updateCellIndexWithCustomSpeed;
+                this.updateCellIndex = this._updateCellIndexWithCustomSpeed;
             }
-        }
-        Particle.prototype.updateCellIndexWithSpeedCalculated = function (scaledUpdateSpeed) {
+        };
+        Particle.prototype._updateCellIndexWithSpeedCalculated = function (scaledUpdateSpeed) {
             //   (ageOffset / scaledUpdateSpeed) / available cells
             var numberOfScaledUpdatesPerCell = ((this.lifeTime - this.age) / scaledUpdateSpeed) / (this.particleSystem.endSpriteCellID + 1 - this.cellIndex);
             this._currentFrameCounter += scaledUpdateSpeed;
@@ -51021,7 +51028,7 @@ var BABYLON;
                 }
             }
         };
-        Particle.prototype.updateCellIndexWithCustomSpeed = function () {
+        Particle.prototype._updateCellIndexWithCustomSpeed = function () {
             if (this._currentFrameCounter >= this.particleSystem.spriteCellChangeSpeed) {
                 this.cellIndex++;
                 this._currentFrameCounter = 0;
@@ -51238,6 +51245,40 @@ var BABYLON;
             this._stopped = false;
             this._actualFrame = 0;
             this._vertexBufferSize = 11;
+            // start of sub system methods
+            /**
+             * "Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list.
+             * Its lifetime will start back at 0.
+             */
+            this.recycleParticle = function (particle) {
+                var lastParticle = _this._particles.pop();
+                if (lastParticle !== particle) {
+                    lastParticle.copyTo(particle);
+                }
+                _this._stockParticles.push(lastParticle);
+            };
+            this._createParticle = function () {
+                var particle;
+                if (_this._stockParticles.length !== 0) {
+                    particle = _this._stockParticles.pop();
+                    particle.age = 0;
+                    particle.cellIndex = _this.startSpriteCellID;
+                }
+                else {
+                    particle = new BABYLON.Particle(_this);
+                }
+                return particle;
+            };
+            this._emitFromParticle = function (particle) {
+                if (!_this.subEmitters || _this.subEmitters.length === 0) {
+                    return;
+                }
+                var templateIndex = Math.floor(Math.random() * _this.subEmitters.length);
+                var subSystem = _this.subEmitters[templateIndex].clone(_this.name + "_sub", particle.position.clone());
+                subSystem._rootParticleSystem = _this;
+                _this.activeSubSystems.push(subSystem);
+                subSystem.start();
+            };
             this._appendParticleVertexes = null;
             this.id = name;
             this.name = name;
@@ -51271,6 +51312,7 @@ var BABYLON;
                     var particle = particles[index];
                     particle.age += _this._scaledUpdateSpeed;
                     if (particle.age >= particle.lifeTime) {
+                        _this._emitFromParticle(particle);
                         _this.recycleParticle(particle);
                         index--;
                         continue;
@@ -51392,6 +51434,7 @@ var BABYLON;
             configurable: true
         });
         Object.defineProperty(ParticleSystem.prototype, "particles", {
+            //end of Sub-emitter
             /**
              * Gets the current list of active particles
              */
@@ -51423,18 +51466,6 @@ var BABYLON;
             this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);
         };
         /**
-         * "Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list.
-         * Its lifetime will start back at 0.
-         * @param particle The particle to recycle
-         */
-        ParticleSystem.prototype.recycleParticle = function (particle) {
-            var lastParticle = this._particles.pop();
-            if (lastParticle !== particle) {
-                lastParticle.copyTo(particle);
-                this._stockParticles.push(lastParticle);
-            }
-        };
-        /**
          * Gets the maximum number of particles active at the same time.
          * @returns The max number of active particles.
          */
@@ -51462,13 +51493,22 @@ var BABYLON;
             this._started = true;
             this._stopped = false;
             this._actualFrame = 0;
+            if (this.subEmitters && this.subEmitters.length != 0) {
+                this.activeSubSystems = new Array();
+            }
         };
         /**
          * Stops the particle system.
+         * @param stopSubEmitters if true it will stop the current system and all created sub-Systems if false it will stop the current root system only, this param is used by the root particle system only. the default value is true.
          */
-        ParticleSystem.prototype.stop = function () {
+        ParticleSystem.prototype.stop = function (stopSubEmitters) {
+            if (stopSubEmitters === void 0) { stopSubEmitters = true; }
             this._stopped = true;
+            if (stopSubEmitters) {
+                this._stopSubEmitters();
+            }
         };
+        // animation sheet
         /**
          * Remove all active particles
          */
@@ -51519,6 +51559,25 @@ var BABYLON;
             this._vertexData[offset + 10] = offsetY;
             this._vertexData[offset + 11] = particle.cellIndex;
         };
+        ParticleSystem.prototype._stopSubEmitters = function () {
+            if (!this.activeSubSystems) {
+                return;
+            }
+            this.activeSubSystems.forEach(function (subSystem) {
+                subSystem.stop(true);
+            });
+            this.activeSubSystems = new Array();
+        };
+        ParticleSystem.prototype._removeFromRoot = function () {
+            if (!this._rootParticleSystem) {
+                return;
+            }
+            var index = this._rootParticleSystem.activeSubSystems.indexOf(this);
+            if (index !== -1) {
+                this._rootParticleSystem.activeSubSystems.splice(index, 1);
+            }
+        };
+        // end of sub system methods
         ParticleSystem.prototype._update = function (newParticles) {
             // Update current
             this._alive = this._particles.length > 0;
@@ -51538,14 +51597,7 @@ var BABYLON;
                 if (this._particles.length === this._capacity) {
                     break;
                 }
-                if (this._stockParticles.length !== 0) {
-                    particle = this._stockParticles.pop();
-                    particle.age = 0;
-                    particle.cellIndex = this.startSpriteCellID;
-                }
-                else {
-                    particle = new BABYLON.Particle(this);
-                }
+                particle = this._createParticle();
                 this._particles.push(particle);
                 var emitPower = BABYLON.Scalar.RandomRange(this.minEmitPower, this.maxEmitPower);
                 if (this.startPositionFunction) {
@@ -51668,6 +51720,9 @@ var BABYLON;
             if (this._vertexBuffer) {
                 this._vertexBuffer.update(this._vertexData);
             }
+            if (this.manualEmitCount === 0 && this.disposeOnStop) {
+                this.stop();
+            }
         };
         ParticleSystem.prototype._appenedParticleVertexesWithSheet = function (offset, particle) {
             this._appendParticleVertexWithAnimation(offset++, particle, 0, 0);
@@ -51754,6 +51809,7 @@ var BABYLON;
                 this.particleTexture.dispose();
                 this.particleTexture = null;
             }
+            this._removeFromRoot();
             // Remove from scene
             var index = this._scene.particleSystems.indexOf(this);
             if (index > -1) {
@@ -51820,6 +51876,7 @@ var BABYLON;
             this.particleEmitterType = particleEmitter;
             return particleEmitter;
         };
+        // Clone
         /**
          * Clones the particle system.
          * @param name The name of the cloned object

+ 84 - 27
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -50928,7 +50928,11 @@ var BABYLON;
          * Creates a new instance of @see Particle
          * @param particleSystem the particle system the particle belongs to
          */
-        function Particle(particleSystem) {
+        function Particle(
+            /**
+             * particleSystem the particle system the particle belongs to.
+             */
+            particleSystem) {
             this.particleSystem = particleSystem;
             /**
              * The world position of the particle in the scene.
@@ -50974,15 +50978,18 @@ var BABYLON;
             if (!this.particleSystem.isAnimationSheetEnabled) {
                 return;
             }
+            this.updateCellInfoFromSystem();
+        }
+        Particle.prototype.updateCellInfoFromSystem = function () {
             this.cellIndex = this.particleSystem.startSpriteCellID;
             if (this.particleSystem.spriteCellChangeSpeed == 0) {
-                this.updateCellIndex = this.updateCellIndexWithSpeedCalculated;
+                this.updateCellIndex = this._updateCellIndexWithSpeedCalculated;
             }
             else {
-                this.updateCellIndex = this.updateCellIndexWithCustomSpeed;
+                this.updateCellIndex = this._updateCellIndexWithCustomSpeed;
             }
-        }
-        Particle.prototype.updateCellIndexWithSpeedCalculated = function (scaledUpdateSpeed) {
+        };
+        Particle.prototype._updateCellIndexWithSpeedCalculated = function (scaledUpdateSpeed) {
             //   (ageOffset / scaledUpdateSpeed) / available cells
             var numberOfScaledUpdatesPerCell = ((this.lifeTime - this.age) / scaledUpdateSpeed) / (this.particleSystem.endSpriteCellID + 1 - this.cellIndex);
             this._currentFrameCounter += scaledUpdateSpeed;
@@ -50994,7 +51001,7 @@ var BABYLON;
                 }
             }
         };
-        Particle.prototype.updateCellIndexWithCustomSpeed = function () {
+        Particle.prototype._updateCellIndexWithCustomSpeed = function () {
             if (this._currentFrameCounter >= this.particleSystem.spriteCellChangeSpeed) {
                 this.cellIndex++;
                 this._currentFrameCounter = 0;
@@ -51211,6 +51218,40 @@ var BABYLON;
             this._stopped = false;
             this._actualFrame = 0;
             this._vertexBufferSize = 11;
+            // start of sub system methods
+            /**
+             * "Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list.
+             * Its lifetime will start back at 0.
+             */
+            this.recycleParticle = function (particle) {
+                var lastParticle = _this._particles.pop();
+                if (lastParticle !== particle) {
+                    lastParticle.copyTo(particle);
+                }
+                _this._stockParticles.push(lastParticle);
+            };
+            this._createParticle = function () {
+                var particle;
+                if (_this._stockParticles.length !== 0) {
+                    particle = _this._stockParticles.pop();
+                    particle.age = 0;
+                    particle.cellIndex = _this.startSpriteCellID;
+                }
+                else {
+                    particle = new BABYLON.Particle(_this);
+                }
+                return particle;
+            };
+            this._emitFromParticle = function (particle) {
+                if (!_this.subEmitters || _this.subEmitters.length === 0) {
+                    return;
+                }
+                var templateIndex = Math.floor(Math.random() * _this.subEmitters.length);
+                var subSystem = _this.subEmitters[templateIndex].clone(_this.name + "_sub", particle.position.clone());
+                subSystem._rootParticleSystem = _this;
+                _this.activeSubSystems.push(subSystem);
+                subSystem.start();
+            };
             this._appendParticleVertexes = null;
             this.id = name;
             this.name = name;
@@ -51244,6 +51285,7 @@ var BABYLON;
                     var particle = particles[index];
                     particle.age += _this._scaledUpdateSpeed;
                     if (particle.age >= particle.lifeTime) {
+                        _this._emitFromParticle(particle);
                         _this.recycleParticle(particle);
                         index--;
                         continue;
@@ -51365,6 +51407,7 @@ var BABYLON;
             configurable: true
         });
         Object.defineProperty(ParticleSystem.prototype, "particles", {
+            //end of Sub-emitter
             /**
              * Gets the current list of active particles
              */
@@ -51396,18 +51439,6 @@ var BABYLON;
             this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);
         };
         /**
-         * "Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list.
-         * Its lifetime will start back at 0.
-         * @param particle The particle to recycle
-         */
-        ParticleSystem.prototype.recycleParticle = function (particle) {
-            var lastParticle = this._particles.pop();
-            if (lastParticle !== particle) {
-                lastParticle.copyTo(particle);
-                this._stockParticles.push(lastParticle);
-            }
-        };
-        /**
          * Gets the maximum number of particles active at the same time.
          * @returns The max number of active particles.
          */
@@ -51435,13 +51466,22 @@ var BABYLON;
             this._started = true;
             this._stopped = false;
             this._actualFrame = 0;
+            if (this.subEmitters && this.subEmitters.length != 0) {
+                this.activeSubSystems = new Array();
+            }
         };
         /**
          * Stops the particle system.
+         * @param stopSubEmitters if true it will stop the current system and all created sub-Systems if false it will stop the current root system only, this param is used by the root particle system only. the default value is true.
          */
-        ParticleSystem.prototype.stop = function () {
+        ParticleSystem.prototype.stop = function (stopSubEmitters) {
+            if (stopSubEmitters === void 0) { stopSubEmitters = true; }
             this._stopped = true;
+            if (stopSubEmitters) {
+                this._stopSubEmitters();
+            }
         };
+        // animation sheet
         /**
          * Remove all active particles
          */
@@ -51492,6 +51532,25 @@ var BABYLON;
             this._vertexData[offset + 10] = offsetY;
             this._vertexData[offset + 11] = particle.cellIndex;
         };
+        ParticleSystem.prototype._stopSubEmitters = function () {
+            if (!this.activeSubSystems) {
+                return;
+            }
+            this.activeSubSystems.forEach(function (subSystem) {
+                subSystem.stop(true);
+            });
+            this.activeSubSystems = new Array();
+        };
+        ParticleSystem.prototype._removeFromRoot = function () {
+            if (!this._rootParticleSystem) {
+                return;
+            }
+            var index = this._rootParticleSystem.activeSubSystems.indexOf(this);
+            if (index !== -1) {
+                this._rootParticleSystem.activeSubSystems.splice(index, 1);
+            }
+        };
+        // end of sub system methods
         ParticleSystem.prototype._update = function (newParticles) {
             // Update current
             this._alive = this._particles.length > 0;
@@ -51511,14 +51570,7 @@ var BABYLON;
                 if (this._particles.length === this._capacity) {
                     break;
                 }
-                if (this._stockParticles.length !== 0) {
-                    particle = this._stockParticles.pop();
-                    particle.age = 0;
-                    particle.cellIndex = this.startSpriteCellID;
-                }
-                else {
-                    particle = new BABYLON.Particle(this);
-                }
+                particle = this._createParticle();
                 this._particles.push(particle);
                 var emitPower = BABYLON.Scalar.RandomRange(this.minEmitPower, this.maxEmitPower);
                 if (this.startPositionFunction) {
@@ -51641,6 +51693,9 @@ var BABYLON;
             if (this._vertexBuffer) {
                 this._vertexBuffer.update(this._vertexData);
             }
+            if (this.manualEmitCount === 0 && this.disposeOnStop) {
+                this.stop();
+            }
         };
         ParticleSystem.prototype._appenedParticleVertexesWithSheet = function (offset, particle) {
             this._appendParticleVertexWithAnimation(offset++, particle, 0, 0);
@@ -51727,6 +51782,7 @@ var BABYLON;
                 this.particleTexture.dispose();
                 this.particleTexture = null;
             }
+            this._removeFromRoot();
             // Remove from scene
             var index = this._scene.particleSystems.indexOf(this);
             if (index > -1) {
@@ -51793,6 +51849,7 @@ var BABYLON;
             this.particleEmitterType = particleEmitter;
             return particleEmitter;
         };
+        // Clone
         /**
          * Clones the particle system.
          * @param name The name of the cloned object

+ 2 - 23
dist/preview release/es6.js

@@ -51247,7 +51247,8 @@ var BABYLON;
                     return;
                 }
                 var templateIndex = Math.floor(Math.random() * _this.subEmitters.length);
-                var subSystem = _this.subEmitters[templateIndex]._cloneToSubSystem(_this, particle.position.clone());
+                var subSystem = _this.subEmitters[templateIndex].clone(_this.name + "_sub", particle.position.clone());
+                subSystem._rootParticleSystem = _this;
                 _this.activeSubSystems.push(subSystem);
                 subSystem.start();
             };
@@ -51848,28 +51849,6 @@ var BABYLON;
             this.particleEmitterType = particleEmitter;
             return particleEmitter;
         };
-        ParticleSystem.prototype._cloneToSubSystem = function (root, newEmitter) {
-            var custom = null;
-            var program = null;
-            if (this.customShader != null) {
-                program = this.customShader;
-                var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
-                custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
-            }
-            var result = new ParticleSystem(name, this._capacity, this._scene, custom);
-            result.customShader = program;
-            BABYLON.Tools.DeepCopy(this, result, ["customShader"]);
-            result.name = name + "_Child";
-            result.id = result.name;
-            result.emitter = newEmitter;
-            result.subEmitters = this.subEmitters;
-            result.particleEmitterType = this.particleEmitterType;
-            result._rootParticleSystem = root;
-            if (this.particleTexture) {
-                result.particleTexture = new BABYLON.Texture(this.particleTexture.url, this._scene);
-            }
-            return result;
-        };
         // Clone
         /**
          * Clones the particle system.

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 4 - 4
dist/preview release/inspector/babylon.inspector.bundle.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3 - 3
dist/preview release/loaders/babylon.glTFFileLoader.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3 - 3
dist/preview release/loaders/babylonjs.loaders.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3 - 3
dist/preview release/materialsLibrary/babylonjs.materials.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 58 - 58
dist/preview release/viewer/babylon.viewer.js


+ 92 - 33
dist/preview release/viewer/babylon.viewer.max.js

@@ -51038,7 +51038,11 @@ var BABYLON;
          * Creates a new instance of @see Particle
          * @param particleSystem the particle system the particle belongs to
          */
-        function Particle(particleSystem) {
+        function Particle(
+            /**
+             * particleSystem the particle system the particle belongs to.
+             */
+            particleSystem) {
             this.particleSystem = particleSystem;
             /**
              * The world position of the particle in the scene.
@@ -51084,15 +51088,18 @@ var BABYLON;
             if (!this.particleSystem.isAnimationSheetEnabled) {
                 return;
             }
+            this.updateCellInfoFromSystem();
+        }
+        Particle.prototype.updateCellInfoFromSystem = function () {
             this.cellIndex = this.particleSystem.startSpriteCellID;
             if (this.particleSystem.spriteCellChangeSpeed == 0) {
-                this.updateCellIndex = this.updateCellIndexWithSpeedCalculated;
+                this.updateCellIndex = this._updateCellIndexWithSpeedCalculated;
             }
             else {
-                this.updateCellIndex = this.updateCellIndexWithCustomSpeed;
+                this.updateCellIndex = this._updateCellIndexWithCustomSpeed;
             }
-        }
-        Particle.prototype.updateCellIndexWithSpeedCalculated = function (scaledUpdateSpeed) {
+        };
+        Particle.prototype._updateCellIndexWithSpeedCalculated = function (scaledUpdateSpeed) {
             //   (ageOffset / scaledUpdateSpeed) / available cells
             var numberOfScaledUpdatesPerCell = ((this.lifeTime - this.age) / scaledUpdateSpeed) / (this.particleSystem.endSpriteCellID + 1 - this.cellIndex);
             this._currentFrameCounter += scaledUpdateSpeed;
@@ -51104,7 +51111,7 @@ var BABYLON;
                 }
             }
         };
-        Particle.prototype.updateCellIndexWithCustomSpeed = function () {
+        Particle.prototype._updateCellIndexWithCustomSpeed = function () {
             if (this._currentFrameCounter >= this.particleSystem.spriteCellChangeSpeed) {
                 this.cellIndex++;
                 this._currentFrameCounter = 0;
@@ -51321,6 +51328,40 @@ var BABYLON;
             this._stopped = false;
             this._actualFrame = 0;
             this._vertexBufferSize = 11;
+            // start of sub system methods
+            /**
+             * "Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list.
+             * Its lifetime will start back at 0.
+             */
+            this.recycleParticle = function (particle) {
+                var lastParticle = _this._particles.pop();
+                if (lastParticle !== particle) {
+                    lastParticle.copyTo(particle);
+                }
+                _this._stockParticles.push(lastParticle);
+            };
+            this._createParticle = function () {
+                var particle;
+                if (_this._stockParticles.length !== 0) {
+                    particle = _this._stockParticles.pop();
+                    particle.age = 0;
+                    particle.cellIndex = _this.startSpriteCellID;
+                }
+                else {
+                    particle = new BABYLON.Particle(_this);
+                }
+                return particle;
+            };
+            this._emitFromParticle = function (particle) {
+                if (!_this.subEmitters || _this.subEmitters.length === 0) {
+                    return;
+                }
+                var templateIndex = Math.floor(Math.random() * _this.subEmitters.length);
+                var subSystem = _this.subEmitters[templateIndex].clone(_this.name + "_sub", particle.position.clone());
+                subSystem._rootParticleSystem = _this;
+                _this.activeSubSystems.push(subSystem);
+                subSystem.start();
+            };
             this._appendParticleVertexes = null;
             this.id = name;
             this.name = name;
@@ -51354,6 +51395,7 @@ var BABYLON;
                     var particle = particles[index];
                     particle.age += _this._scaledUpdateSpeed;
                     if (particle.age >= particle.lifeTime) {
+                        _this._emitFromParticle(particle);
                         _this.recycleParticle(particle);
                         index--;
                         continue;
@@ -51475,6 +51517,7 @@ var BABYLON;
             configurable: true
         });
         Object.defineProperty(ParticleSystem.prototype, "particles", {
+            //end of Sub-emitter
             /**
              * Gets the current list of active particles
              */
@@ -51506,18 +51549,6 @@ var BABYLON;
             this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);
         };
         /**
-         * "Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list.
-         * Its lifetime will start back at 0.
-         * @param particle The particle to recycle
-         */
-        ParticleSystem.prototype.recycleParticle = function (particle) {
-            var lastParticle = this._particles.pop();
-            if (lastParticle !== particle) {
-                lastParticle.copyTo(particle);
-                this._stockParticles.push(lastParticle);
-            }
-        };
-        /**
          * Gets the maximum number of particles active at the same time.
          * @returns The max number of active particles.
          */
@@ -51545,13 +51576,22 @@ var BABYLON;
             this._started = true;
             this._stopped = false;
             this._actualFrame = 0;
+            if (this.subEmitters && this.subEmitters.length != 0) {
+                this.activeSubSystems = new Array();
+            }
         };
         /**
          * Stops the particle system.
+         * @param stopSubEmitters if true it will stop the current system and all created sub-Systems if false it will stop the current root system only, this param is used by the root particle system only. the default value is true.
          */
-        ParticleSystem.prototype.stop = function () {
+        ParticleSystem.prototype.stop = function (stopSubEmitters) {
+            if (stopSubEmitters === void 0) { stopSubEmitters = true; }
             this._stopped = true;
+            if (stopSubEmitters) {
+                this._stopSubEmitters();
+            }
         };
+        // animation sheet
         /**
          * Remove all active particles
          */
@@ -51602,6 +51642,25 @@ var BABYLON;
             this._vertexData[offset + 10] = offsetY;
             this._vertexData[offset + 11] = particle.cellIndex;
         };
+        ParticleSystem.prototype._stopSubEmitters = function () {
+            if (!this.activeSubSystems) {
+                return;
+            }
+            this.activeSubSystems.forEach(function (subSystem) {
+                subSystem.stop(true);
+            });
+            this.activeSubSystems = new Array();
+        };
+        ParticleSystem.prototype._removeFromRoot = function () {
+            if (!this._rootParticleSystem) {
+                return;
+            }
+            var index = this._rootParticleSystem.activeSubSystems.indexOf(this);
+            if (index !== -1) {
+                this._rootParticleSystem.activeSubSystems.splice(index, 1);
+            }
+        };
+        // end of sub system methods
         ParticleSystem.prototype._update = function (newParticles) {
             // Update current
             this._alive = this._particles.length > 0;
@@ -51621,14 +51680,7 @@ var BABYLON;
                 if (this._particles.length === this._capacity) {
                     break;
                 }
-                if (this._stockParticles.length !== 0) {
-                    particle = this._stockParticles.pop();
-                    particle.age = 0;
-                    particle.cellIndex = this.startSpriteCellID;
-                }
-                else {
-                    particle = new BABYLON.Particle(this);
-                }
+                particle = this._createParticle();
                 this._particles.push(particle);
                 var emitPower = BABYLON.Scalar.RandomRange(this.minEmitPower, this.maxEmitPower);
                 if (this.startPositionFunction) {
@@ -51751,6 +51803,9 @@ var BABYLON;
             if (this._vertexBuffer) {
                 this._vertexBuffer.update(this._vertexData);
             }
+            if (this.manualEmitCount === 0 && this.disposeOnStop) {
+                this.stop();
+            }
         };
         ParticleSystem.prototype._appenedParticleVertexesWithSheet = function (offset, particle) {
             this._appendParticleVertexWithAnimation(offset++, particle, 0, 0);
@@ -51837,6 +51892,7 @@ var BABYLON;
                 this.particleTexture.dispose();
                 this.particleTexture = null;
             }
+            this._removeFromRoot();
             // Remove from scene
             var index = this._scene.particleSystems.indexOf(this);
             if (index > -1) {
@@ -51903,6 +51959,7 @@ var BABYLON;
             this.particleEmitterType = particleEmitter;
             return particleEmitter;
         };
+        // Clone
         /**
          * Clones the particle system.
          * @param name The name of the cloned object
@@ -111032,15 +111089,15 @@ var BABYLON;
                     if (babylonMesh._delayInfo.indexOf(kind) === -1) {
                         babylonMesh._delayInfo.push(kind);
                     }
+                    if (attribute === "COLOR_0") {
+                        // Assume vertex color has alpha on the mesh. The alphaMode of the material controls whether the material should use alpha or not.
+                        babylonMesh.hasVertexAlpha = true;
+                    }
                     var accessor = GLTFLoader._GetProperty(context + "/attributes/" + attribute, _this._gltf.accessors, attributes[attribute]);
                     promises.push(_this._loadAccessorAsync("#/accessors/" + accessor._index, accessor).then(function (data) {
                         var attributeData = GLTFLoader._ConvertToFloat32Array(context, accessor, data);
-                        if (attribute === "COLOR_0") {
-                            // Assume vertex color has alpha on the mesh. The alphaMode of the material controls whether the material should use alpha or not.
-                            babylonMesh.hasVertexAlpha = true;
-                            if (accessor.type === "VEC3") {
-                                attributeData = GLTFLoader._ConvertVec3ToVec4(context, attributeData);
-                            }
+                        if (attribute === "COLOR_0" && accessor.type === "VEC3") {
+                            attributeData = GLTFLoader._ConvertVec3ToVec4(context, attributeData);
                         }
                         babylonVertexData.set(attributeData, kind);
                     }));
@@ -111898,6 +111955,8 @@ var BABYLON;
                         if (babylonMaterial && babylonMeshes) {
                             for (var _b = 0, babylonMeshes_1 = babylonMeshes; _b < babylonMeshes_1.length; _b++) {
                                 var babylonMesh = babylonMeshes_1[_b];
+                                // Ensure nonUniformScaling is set if necessary.
+                                babylonMesh.computeWorldMatrix(true);
                                 promises.push(babylonMaterial.forceCompilationAsync(babylonMesh));
                                 if (this.useClipPlane) {
                                     promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { clipPlane: true }));

+ 2 - 25
src/Particles/babylon.particleSystem.ts

@@ -623,7 +623,8 @@
 
             var templateIndex = Math.floor(Math.random() * this.subEmitters.length);
 
-            var subSystem = this.subEmitters[templateIndex]._cloneToSubSystem(this, particle.position.clone());
+            var subSystem = this.subEmitters[templateIndex].clone(this.name + "_sub", particle.position.clone());
+            subSystem._rootParticleSystem = this;
             this.activeSubSystems.push(subSystem);
             subSystem.start();
         }
@@ -991,30 +992,6 @@
             return particleEmitter;
         }
 
-        private _cloneToSubSystem(root: ParticleSystem, newEmitter: Vector3): ParticleSystem {
-            var custom: Nullable<Effect> = null;
-            var program: any = null;
-            if (this.customShader != null) {
-                program = this.customShader;
-                var defines: string = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
-                custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
-            }
-            var result = new ParticleSystem(name, this._capacity, this._scene, custom);
-            result.customShader = program;
-            Tools.DeepCopy(this, result, ["customShader"]);
-            result.name = name + "_Child";
-            result.id = result.name;
-            result.emitter = newEmitter;
-            result.subEmitters = this.subEmitters;
-            result.particleEmitterType = this.particleEmitterType;
-            result._rootParticleSystem = root;
-            if (this.particleTexture) {
-                result.particleTexture = new Texture(this.particleTexture.url, this._scene);
-            }
-
-            return result;
-        }
-
         // Clone
         /**
          * Clones the particle system.