Parcourir la source

Fix bug with particle emitter clone

David Catuhe il y a 7 ans
Parent
commit
1dd71f9e12
33 fichiers modifiés avec 20601 ajouts et 20329 suppressions
  1. 5373 5348
      Playground/babylon.d.txt
  2. 5741 5716
      dist/preview release/babylon.d.ts
  3. 39 39
      dist/preview release/babylon.js
  4. 37 1
      dist/preview release/babylon.max.js
  5. 40 40
      dist/preview release/babylon.worker.js
  6. 9071 9046
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  7. 44 44
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  8. 37 1
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  9. 37 1
      dist/preview release/customConfigurations/minimalGLTFViewer/es6.js
  10. 37 1
      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. 52 52
      dist/preview release/viewer/babylon.viewer.js
  29. 15 2
      src/Particles/babylon.boxParticleEmitter.ts
  30. 13 1
      src/Particles/babylon.coneParticleEmitter.ts
  31. 6 0
      src/Particles/babylon.iParticleEmitterType.ts
  32. 27 3
      src/Particles/babylon.sphereParticleEmitter.ts
  33. 0 2
      tests/unit/babylon/promises/babylon.promises.tests.ts

Fichier diff supprimé car celui-ci est trop grand
+ 5373 - 5348
Playground/babylon.d.txt


Fichier diff supprimé car celui-ci est trop grand
+ 5741 - 5716
dist/preview release/babylon.d.ts


Fichier diff supprimé car celui-ci est trop grand
+ 39 - 39
dist/preview release/babylon.js


+ 37 - 1
dist/preview release/babylon.max.js

@@ -48680,6 +48680,15 @@ var BABYLON;
             var randZ = BABYLON.Scalar.RandomRange(this.minEmitBox.z, this.maxEmitBox.z);
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        BoxParticleEmitter.prototype.clone = function () {
+            var newOne = new BoxParticleEmitter(this._particleSystem);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return BoxParticleEmitter;
     }());
     BABYLON.BoxParticleEmitter = BoxParticleEmitter;
@@ -48779,6 +48788,15 @@ var BABYLON;
             var randY = h;
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        ConeParticleEmitter.prototype.clone = function () {
+            var newOne = new ConeParticleEmitter(this.radius, this.angle, this.directionRandomizer);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return ConeParticleEmitter;
     }());
     BABYLON.ConeParticleEmitter = ConeParticleEmitter;
@@ -48844,6 +48862,15 @@ var BABYLON;
             var randZ = this.radius * Math.sin(phi) * Math.sin(theta);
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        SphereParticleEmitter.prototype.clone = function () {
+            var newOne = new SphereParticleEmitter(this.radius, this.directionRandomizer);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return SphereParticleEmitter;
     }());
     BABYLON.SphereParticleEmitter = SphereParticleEmitter;
@@ -48886,6 +48913,15 @@ var BABYLON;
             var randZ = BABYLON.Scalar.RandomRange(this.direction1.z, this.direction2.z);
             BABYLON.Vector3.TransformNormalFromFloatsToRef(randX * emitPower, randY * emitPower, randZ * emitPower, worldMatrix, directionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        SphereDirectedParticleEmitter.prototype.clone = function () {
+            var newOne = new SphereDirectedParticleEmitter(this.radius, this.direction1, this.direction2);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return SphereDirectedParticleEmitter;
     }(SphereParticleEmitter));
     BABYLON.SphereDirectedParticleEmitter = SphereDirectedParticleEmitter;
@@ -48895,7 +48931,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.iParticleEmitterType.js.map
+//# sourceMappingURL=babylon.IParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {

Fichier diff supprimé car celui-ci est trop grand
+ 40 - 40
dist/preview release/babylon.worker.js


Fichier diff supprimé car celui-ci est trop grand
+ 9071 - 9046
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Fichier diff supprimé car celui-ci est trop grand
+ 44 - 44
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 37 - 1
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -48680,6 +48680,15 @@ var BABYLON;
             var randZ = BABYLON.Scalar.RandomRange(this.minEmitBox.z, this.maxEmitBox.z);
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        BoxParticleEmitter.prototype.clone = function () {
+            var newOne = new BoxParticleEmitter(this._particleSystem);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return BoxParticleEmitter;
     }());
     BABYLON.BoxParticleEmitter = BoxParticleEmitter;
@@ -48779,6 +48788,15 @@ var BABYLON;
             var randY = h;
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        ConeParticleEmitter.prototype.clone = function () {
+            var newOne = new ConeParticleEmitter(this.radius, this.angle, this.directionRandomizer);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return ConeParticleEmitter;
     }());
     BABYLON.ConeParticleEmitter = ConeParticleEmitter;
@@ -48844,6 +48862,15 @@ var BABYLON;
             var randZ = this.radius * Math.sin(phi) * Math.sin(theta);
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        SphereParticleEmitter.prototype.clone = function () {
+            var newOne = new SphereParticleEmitter(this.radius, this.directionRandomizer);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return SphereParticleEmitter;
     }());
     BABYLON.SphereParticleEmitter = SphereParticleEmitter;
@@ -48886,6 +48913,15 @@ var BABYLON;
             var randZ = BABYLON.Scalar.RandomRange(this.direction1.z, this.direction2.z);
             BABYLON.Vector3.TransformNormalFromFloatsToRef(randX * emitPower, randY * emitPower, randZ * emitPower, worldMatrix, directionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        SphereDirectedParticleEmitter.prototype.clone = function () {
+            var newOne = new SphereDirectedParticleEmitter(this.radius, this.direction1, this.direction2);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return SphereDirectedParticleEmitter;
     }(SphereParticleEmitter));
     BABYLON.SphereDirectedParticleEmitter = SphereDirectedParticleEmitter;
@@ -48895,7 +48931,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.iParticleEmitterType.js.map
+//# sourceMappingURL=babylon.IParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {

+ 37 - 1
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -48666,6 +48666,15 @@ var BABYLON;
             var randZ = BABYLON.Scalar.RandomRange(this.minEmitBox.z, this.maxEmitBox.z);
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        BoxParticleEmitter.prototype.clone = function () {
+            var newOne = new BoxParticleEmitter(this._particleSystem);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return BoxParticleEmitter;
     }());
     BABYLON.BoxParticleEmitter = BoxParticleEmitter;
@@ -48765,6 +48774,15 @@ var BABYLON;
             var randY = h;
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        ConeParticleEmitter.prototype.clone = function () {
+            var newOne = new ConeParticleEmitter(this.radius, this.angle, this.directionRandomizer);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return ConeParticleEmitter;
     }());
     BABYLON.ConeParticleEmitter = ConeParticleEmitter;
@@ -48830,6 +48848,15 @@ var BABYLON;
             var randZ = this.radius * Math.sin(phi) * Math.sin(theta);
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        SphereParticleEmitter.prototype.clone = function () {
+            var newOne = new SphereParticleEmitter(this.radius, this.directionRandomizer);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return SphereParticleEmitter;
     }());
     BABYLON.SphereParticleEmitter = SphereParticleEmitter;
@@ -48872,6 +48899,15 @@ var BABYLON;
             var randZ = BABYLON.Scalar.RandomRange(this.direction1.z, this.direction2.z);
             BABYLON.Vector3.TransformNormalFromFloatsToRef(randX * emitPower, randY * emitPower, randZ * emitPower, worldMatrix, directionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        SphereDirectedParticleEmitter.prototype.clone = function () {
+            var newOne = new SphereDirectedParticleEmitter(this.radius, this.direction1, this.direction2);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return SphereDirectedParticleEmitter;
     }(SphereParticleEmitter));
     BABYLON.SphereDirectedParticleEmitter = SphereDirectedParticleEmitter;
@@ -48881,7 +48917,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.iParticleEmitterType.js.map
+//# sourceMappingURL=babylon.IParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {

+ 37 - 1
dist/preview release/es6.js

@@ -48666,6 +48666,15 @@ var BABYLON;
             var randZ = BABYLON.Scalar.RandomRange(this.minEmitBox.z, this.maxEmitBox.z);
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        BoxParticleEmitter.prototype.clone = function () {
+            var newOne = new BoxParticleEmitter(this._particleSystem);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return BoxParticleEmitter;
     }());
     BABYLON.BoxParticleEmitter = BoxParticleEmitter;
@@ -48765,6 +48774,15 @@ var BABYLON;
             var randY = h;
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        ConeParticleEmitter.prototype.clone = function () {
+            var newOne = new ConeParticleEmitter(this.radius, this.angle, this.directionRandomizer);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return ConeParticleEmitter;
     }());
     BABYLON.ConeParticleEmitter = ConeParticleEmitter;
@@ -48830,6 +48848,15 @@ var BABYLON;
             var randZ = this.radius * Math.sin(phi) * Math.sin(theta);
             BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        SphereParticleEmitter.prototype.clone = function () {
+            var newOne = new SphereParticleEmitter(this.radius, this.directionRandomizer);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return SphereParticleEmitter;
     }());
     BABYLON.SphereParticleEmitter = SphereParticleEmitter;
@@ -48872,6 +48899,15 @@ var BABYLON;
             var randZ = BABYLON.Scalar.RandomRange(this.direction1.z, this.direction2.z);
             BABYLON.Vector3.TransformNormalFromFloatsToRef(randX * emitPower, randY * emitPower, randZ * emitPower, worldMatrix, directionToUpdate);
         };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        SphereDirectedParticleEmitter.prototype.clone = function () {
+            var newOne = new SphereDirectedParticleEmitter(this.radius, this.direction1, this.direction2);
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
         return SphereDirectedParticleEmitter;
     }(SphereParticleEmitter));
     BABYLON.SphereDirectedParticleEmitter = SphereDirectedParticleEmitter;
@@ -48881,7 +48917,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.iParticleEmitterType.js.map
+//# sourceMappingURL=babylon.IParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {

Fichier diff supprimé car celui-ci est trop grand
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 4 - 4
dist/preview release/inspector/babylon.inspector.bundle.js


Fichier diff supprimé car celui-ci est trop grand
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 3 - 3
dist/preview release/loaders/babylon.glTFFileLoader.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 3 - 3
dist/preview release/loaders/babylonjs.loaders.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 3 - 3
dist/preview release/materialsLibrary/babylonjs.materials.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 52 - 52
dist/preview release/viewer/babylon.viewer.js


+ 15 - 2
src/Particles/babylon.boxParticleEmitter.ts

@@ -74,7 +74,7 @@ module BABYLON {
          * @param directionToUpdate is the direction vector to update with the result
          * @param particle is the particle we are computed the direction for
          */
-        startDirectionFunction(emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle): void {
+        public startDirectionFunction(emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle): void {
             var randX = Scalar.RandomRange(this.direction1.x, this.direction2.x);
             var randY = Scalar.RandomRange(this.direction1.y, this.direction2.y);
             var randZ = Scalar.RandomRange(this.direction1.z, this.direction2.z);
@@ -88,12 +88,25 @@ module BABYLON {
          * @param positionToUpdate is the position vector to update with the result
          * @param particle is the particle we are computed the position for
          */
-        startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle): void {
+        public startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle): void {
             var randX = Scalar.RandomRange(this.minEmitBox.x, this.maxEmitBox.x);
             var randY = Scalar.RandomRange(this.minEmitBox.y, this.maxEmitBox.y);
             var randZ = Scalar.RandomRange(this.minEmitBox.z, this.maxEmitBox.z);
 
             Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         }
+
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        public clone(): BoxParticleEmitter
+        {
+            let newOne = new BoxParticleEmitter(this._particleSystem);
+
+            Tools.DeepCopy(this, newOne);
+
+            return newOne;
+        }
     }
 }

+ 13 - 1
src/Particles/babylon.coneParticleEmitter.ts

@@ -53,7 +53,7 @@ module BABYLON {
          * @param directionToUpdate is the direction vector to update with the result
          * @param particle is the particle we are computed the direction for
          */
-        startDirectionFunction(emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle): void {
+        public startDirectionFunction(emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle): void {
             if (this.angle === 0) {
                 Vector3.TransformNormalFromFloatsToRef(0, emitPower, 0, worldMatrix, directionToUpdate);
             }
@@ -92,5 +92,17 @@ module BABYLON {
 
             Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         }
+
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        public clone(): ConeParticleEmitter {
+            let newOne = new ConeParticleEmitter(this.radius, this.angle, this.directionRandomizer);
+
+            Tools.DeepCopy(this, newOne);
+
+            return newOne;
+        }          
     }
 }

+ 6 - 0
src/Particles/babylon.iParticleEmitterType.ts

@@ -20,5 +20,11 @@ module BABYLON {
          * @param particle is the particle we are computed the position for
          */
         startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle): void;
+
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        clone(): IParticleEmitterType;
     }
 }

+ 27 - 3
src/Particles/babylon.sphereParticleEmitter.ts

@@ -29,7 +29,7 @@ module BABYLON {
          * @param directionToUpdate is the direction vector to update with the result
          * @param particle is the particle we are computed the direction for
          */
-        startDirectionFunction(emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle): void {
+        public startDirectionFunction(emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle): void {
             var direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();
             var randX = Scalar.RandomRange(0, this.directionRandomizer);
             var randY = Scalar.RandomRange(0, this.directionRandomizer);
@@ -48,7 +48,7 @@ module BABYLON {
          * @param positionToUpdate is the position vector to update with the result
          * @param particle is the particle we are computed the position for
          */
-        startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle): void {
+        public startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle): void {
             var phi = Scalar.RandomRange(0, 2 * Math.PI);
             var theta = Scalar.RandomRange(0, Math.PI);
             var randX = this.radius * Math.cos(phi) * Math.sin(theta);
@@ -56,6 +56,18 @@ module BABYLON {
             var randZ = this.radius * Math.sin(phi) * Math.sin(theta);
             Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
         }
+
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        public clone(): SphereParticleEmitter {
+            let newOne = new SphereParticleEmitter(this.radius, this.directionRandomizer);
+
+            Tools.DeepCopy(this, newOne);
+
+            return newOne;
+        }        
     }
 
     /**
@@ -89,11 +101,23 @@ module BABYLON {
          * @param directionToUpdate is the direction vector to update with the result
          * @param particle is the particle we are computed the direction for
          */
-        startDirectionFunction(emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle): void {
+        public startDirectionFunction(emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle): void {
             var randX = Scalar.RandomRange(this.direction1.x, this.direction2.x);
             var randY = Scalar.RandomRange(this.direction1.y, this.direction2.y);
             var randZ = Scalar.RandomRange(this.direction1.z, this.direction2.z);
             Vector3.TransformNormalFromFloatsToRef(randX * emitPower, randY * emitPower, randZ * emitPower, worldMatrix, directionToUpdate);
         }
+
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        public clone(): SphereDirectedParticleEmitter {
+            let newOne = new SphereDirectedParticleEmitter(this.radius, this.direction1, this.direction2);
+
+            Tools.DeepCopy(this, newOne);
+
+            return newOne;
+        }          
     }
 }

+ 0 - 2
tests/unit/babylon/promises/babylon.promises.tests.ts

@@ -162,7 +162,6 @@ describe('Babylon.Promise', () => {
             var sum = 0;
             promise1.then(function(value) {
                 sum++;
-                console.log(sum);
                 if (sum === 2) {
                     done();
                 }
@@ -170,7 +169,6 @@ describe('Babylon.Promise', () => {
             
             promise1.then(function(value) {
                 sum++;
-                console.log(sum);
                 if (sum === 2) {
                     done();
                 }