Просмотр исходного кода

Updated default particle system

David Catuhe 7 лет назад
Родитель
Сommit
068bd881e9

Разница между файлами не показана из-за своего большого размера
+ 10100 - 10068
dist/preview release/babylon.d.ts


Разница между файлами не показана из-за своего большого размера
+ 64 - 64
dist/preview release/babylon.js


+ 60 - 6
dist/preview release/babylon.max.js

@@ -2448,7 +2448,7 @@ var BABYLON;
             return this;
         };
         /**
-         * Divides the current Vector3 coordinates by the given ones
+         * Divides the current Vector2 coordinates by the given ones
          * @param otherVector defines the other vector
          * @returns the current updated Vector2
          */
@@ -2522,6 +2522,20 @@ var BABYLON;
             if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
             return otherVector && BABYLON.Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && BABYLON.Scalar.WithinEpsilon(this.y, otherVector.y, epsilon);
         };
+        /**
+         * Gets a new Vector2 from current Vector2 floored values
+         * @returns a new Vector2
+         */
+        Vector2.prototype.floor = function () {
+            return new Vector2(Math.floor(this.x), Math.floor(this.y));
+        };
+        /**
+         * Gets a new Vector2 from current Vector2 floored values
+         * @returns a new Vector2
+         */
+        Vector2.prototype.fract = function () {
+            return new Vector2(this.x - Math.floor(this.x), this.y - Math.floor(this.y));
+        };
         // Properties
         /**
          * Gets the length of the vector
@@ -3163,6 +3177,20 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        /**
+         * Gets a new Vector3 from current Vector3 floored values
+         * @returns a new Vector3
+         */
+        Vector3.prototype.floor = function () {
+            return new Vector3(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z));
+        };
+        /**
+         * Gets a new Vector3 from current Vector3 floored values
+         * @returns a new Vector3
+         */
+        Vector3.prototype.fract = function () {
+            return new Vector3(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z));
+        };
         // Properties
         /**
          * Gets the length of the Vector3
@@ -4093,6 +4121,20 @@ var BABYLON;
                 this.w = other.w;
             return this;
         };
+        /**
+         * Gets a new Vector4 from current Vector4 floored values
+         * @returns a new Vector4
+         */
+        Vector4.prototype.floor = function () {
+            return new Vector4(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z), Math.floor(this.w));
+        };
+        /**
+         * Gets a new Vector4 from current Vector3 floored values
+         * @returns a new Vector4
+         */
+        Vector4.prototype.fract = function () {
+            return new Vector4(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z), this.w - Math.floor(this.w));
+        };
         // Properties
         /**
          * Returns the Vector4 length (float).
@@ -62986,6 +63028,7 @@ var BABYLON;
          * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero
          * * The parameter `radius` (positive float, default 1) is the radius value of the lathe
          * * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe
+     * * The parameter `clip` (positive integer, default 0) is the number of sides to not create without effecting the general shape of the sides
          * * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape
          * * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc"
          * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
@@ -63005,6 +63048,7 @@ var BABYLON;
             var shape = options.shape;
             var radius = options.radius || 1;
             var tessellation = options.tessellation || 64;
+            var clip = options.clip || 0;
             var updatable = options.updatable;
             var sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
             var cap = options.cap || BABYLON.Mesh.NO_CAP;
@@ -63016,7 +63060,7 @@ var BABYLON;
             var step = pi2 / tessellation * arc;
             var rotated;
             var path = new Array();
-            for (i = 0; i <= tessellation; i++) {
+            for (i = 0; i <= tessellation - clip; i++) {
                 var path = [];
                 if (cap == BABYLON.Mesh.CAP_START || cap == BABYLON.Mesh.CAP_ALL) {
                     path.push(new BABYLON.Vector3(0, shape[0].y, 0));
@@ -104936,13 +104980,23 @@ var BABYLON;
          * @param scene defines the hosting scene
          * @returns the new Particle system
          */
-        ParticleHelper.CreateDefault = function (emitter, scene) {
-            var system = new BABYLON.ParticleSystem("default system", 1000, scene);
+        ParticleHelper.CreateDefault = function (emitter, capacity, scene) {
+            if (capacity === void 0) { capacity = 500; }
+            var system = new BABYLON.ParticleSystem("default system", capacity, scene);
             system.emitter = emitter;
             system.particleTexture = new BABYLON.Texture("https://www.babylonjs.com/assets/Flare.png", system.getScene());
+            system.createConeEmitter(0.1, Math.PI / 4);
+            // Particle color
+            system.color1 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
+            system.color2 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
+            system.colorDead = new BABYLON.Color4(1.0, 1.0, 1.0, 0.0);
+            // Particle Size
             system.minSize = 0.1;
-            system.maxSize = 0.5;
-            system.emitRate = 200;
+            system.maxSize = 0.1;
+            // Emission speed
+            system.minEmitPower = 2;
+            system.maxEmitPower = 2;
+            system.emitRate = 30;
             return system;
         };
         /**

+ 60 - 6
dist/preview release/babylon.no-module.max.js

@@ -2415,7 +2415,7 @@ var BABYLON;
             return this;
         };
         /**
-         * Divides the current Vector3 coordinates by the given ones
+         * Divides the current Vector2 coordinates by the given ones
          * @param otherVector defines the other vector
          * @returns the current updated Vector2
          */
@@ -2489,6 +2489,20 @@ var BABYLON;
             if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
             return otherVector && BABYLON.Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && BABYLON.Scalar.WithinEpsilon(this.y, otherVector.y, epsilon);
         };
+        /**
+         * Gets a new Vector2 from current Vector2 floored values
+         * @returns a new Vector2
+         */
+        Vector2.prototype.floor = function () {
+            return new Vector2(Math.floor(this.x), Math.floor(this.y));
+        };
+        /**
+         * Gets a new Vector2 from current Vector2 floored values
+         * @returns a new Vector2
+         */
+        Vector2.prototype.fract = function () {
+            return new Vector2(this.x - Math.floor(this.x), this.y - Math.floor(this.y));
+        };
         // Properties
         /**
          * Gets the length of the vector
@@ -3130,6 +3144,20 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        /**
+         * Gets a new Vector3 from current Vector3 floored values
+         * @returns a new Vector3
+         */
+        Vector3.prototype.floor = function () {
+            return new Vector3(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z));
+        };
+        /**
+         * Gets a new Vector3 from current Vector3 floored values
+         * @returns a new Vector3
+         */
+        Vector3.prototype.fract = function () {
+            return new Vector3(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z));
+        };
         // Properties
         /**
          * Gets the length of the Vector3
@@ -4060,6 +4088,20 @@ var BABYLON;
                 this.w = other.w;
             return this;
         };
+        /**
+         * Gets a new Vector4 from current Vector4 floored values
+         * @returns a new Vector4
+         */
+        Vector4.prototype.floor = function () {
+            return new Vector4(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z), Math.floor(this.w));
+        };
+        /**
+         * Gets a new Vector4 from current Vector3 floored values
+         * @returns a new Vector4
+         */
+        Vector4.prototype.fract = function () {
+            return new Vector4(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z), this.w - Math.floor(this.w));
+        };
         // Properties
         /**
          * Returns the Vector4 length (float).
@@ -62953,6 +62995,7 @@ var BABYLON;
          * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero
          * * The parameter `radius` (positive float, default 1) is the radius value of the lathe
          * * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe
+     * * The parameter `clip` (positive integer, default 0) is the number of sides to not create without effecting the general shape of the sides
          * * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape
          * * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc"
          * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
@@ -62972,6 +63015,7 @@ var BABYLON;
             var shape = options.shape;
             var radius = options.radius || 1;
             var tessellation = options.tessellation || 64;
+            var clip = options.clip || 0;
             var updatable = options.updatable;
             var sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
             var cap = options.cap || BABYLON.Mesh.NO_CAP;
@@ -62983,7 +63027,7 @@ var BABYLON;
             var step = pi2 / tessellation * arc;
             var rotated;
             var path = new Array();
-            for (i = 0; i <= tessellation; i++) {
+            for (i = 0; i <= tessellation - clip; i++) {
                 var path = [];
                 if (cap == BABYLON.Mesh.CAP_START || cap == BABYLON.Mesh.CAP_ALL) {
                     path.push(new BABYLON.Vector3(0, shape[0].y, 0));
@@ -104903,13 +104947,23 @@ var BABYLON;
          * @param scene defines the hosting scene
          * @returns the new Particle system
          */
-        ParticleHelper.CreateDefault = function (emitter, scene) {
-            var system = new BABYLON.ParticleSystem("default system", 1000, scene);
+        ParticleHelper.CreateDefault = function (emitter, capacity, scene) {
+            if (capacity === void 0) { capacity = 500; }
+            var system = new BABYLON.ParticleSystem("default system", capacity, scene);
             system.emitter = emitter;
             system.particleTexture = new BABYLON.Texture("https://www.babylonjs.com/assets/Flare.png", system.getScene());
+            system.createConeEmitter(0.1, Math.PI / 4);
+            // Particle color
+            system.color1 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
+            system.color2 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
+            system.colorDead = new BABYLON.Color4(1.0, 1.0, 1.0, 0.0);
+            // Particle Size
             system.minSize = 0.1;
-            system.maxSize = 0.5;
-            system.emitRate = 200;
+            system.maxSize = 0.1;
+            // Emission speed
+            system.minEmitPower = 2;
+            system.maxEmitPower = 2;
+            system.emitRate = 30;
             return system;
         };
         /**

Разница между файлами не показана из-за своего большого размера
+ 65 - 65
dist/preview release/babylon.worker.js


+ 60 - 6
dist/preview release/es6.js

@@ -2415,7 +2415,7 @@ var BABYLON;
             return this;
         };
         /**
-         * Divides the current Vector3 coordinates by the given ones
+         * Divides the current Vector2 coordinates by the given ones
          * @param otherVector defines the other vector
          * @returns the current updated Vector2
          */
@@ -2489,6 +2489,20 @@ var BABYLON;
             if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
             return otherVector && BABYLON.Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && BABYLON.Scalar.WithinEpsilon(this.y, otherVector.y, epsilon);
         };
+        /**
+         * Gets a new Vector2 from current Vector2 floored values
+         * @returns a new Vector2
+         */
+        Vector2.prototype.floor = function () {
+            return new Vector2(Math.floor(this.x), Math.floor(this.y));
+        };
+        /**
+         * Gets a new Vector2 from current Vector2 floored values
+         * @returns a new Vector2
+         */
+        Vector2.prototype.fract = function () {
+            return new Vector2(this.x - Math.floor(this.x), this.y - Math.floor(this.y));
+        };
         // Properties
         /**
          * Gets the length of the vector
@@ -3130,6 +3144,20 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        /**
+         * Gets a new Vector3 from current Vector3 floored values
+         * @returns a new Vector3
+         */
+        Vector3.prototype.floor = function () {
+            return new Vector3(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z));
+        };
+        /**
+         * Gets a new Vector3 from current Vector3 floored values
+         * @returns a new Vector3
+         */
+        Vector3.prototype.fract = function () {
+            return new Vector3(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z));
+        };
         // Properties
         /**
          * Gets the length of the Vector3
@@ -4060,6 +4088,20 @@ var BABYLON;
                 this.w = other.w;
             return this;
         };
+        /**
+         * Gets a new Vector4 from current Vector4 floored values
+         * @returns a new Vector4
+         */
+        Vector4.prototype.floor = function () {
+            return new Vector4(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z), Math.floor(this.w));
+        };
+        /**
+         * Gets a new Vector4 from current Vector3 floored values
+         * @returns a new Vector4
+         */
+        Vector4.prototype.fract = function () {
+            return new Vector4(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z), this.w - Math.floor(this.w));
+        };
         // Properties
         /**
          * Returns the Vector4 length (float).
@@ -62953,6 +62995,7 @@ var BABYLON;
          * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero
          * * The parameter `radius` (positive float, default 1) is the radius value of the lathe
          * * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe
+     * * The parameter `clip` (positive integer, default 0) is the number of sides to not create without effecting the general shape of the sides
          * * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape
          * * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc"
          * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
@@ -62972,6 +63015,7 @@ var BABYLON;
             var shape = options.shape;
             var radius = options.radius || 1;
             var tessellation = options.tessellation || 64;
+            var clip = options.clip || 0;
             var updatable = options.updatable;
             var sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
             var cap = options.cap || BABYLON.Mesh.NO_CAP;
@@ -62983,7 +63027,7 @@ var BABYLON;
             var step = pi2 / tessellation * arc;
             var rotated;
             var path = new Array();
-            for (i = 0; i <= tessellation; i++) {
+            for (i = 0; i <= tessellation - clip; i++) {
                 var path = [];
                 if (cap == BABYLON.Mesh.CAP_START || cap == BABYLON.Mesh.CAP_ALL) {
                     path.push(new BABYLON.Vector3(0, shape[0].y, 0));
@@ -104903,13 +104947,23 @@ var BABYLON;
          * @param scene defines the hosting scene
          * @returns the new Particle system
          */
-        ParticleHelper.CreateDefault = function (emitter, scene) {
-            var system = new BABYLON.ParticleSystem("default system", 1000, scene);
+        ParticleHelper.CreateDefault = function (emitter, capacity, scene) {
+            if (capacity === void 0) { capacity = 500; }
+            var system = new BABYLON.ParticleSystem("default system", capacity, scene);
             system.emitter = emitter;
             system.particleTexture = new BABYLON.Texture("https://www.babylonjs.com/assets/Flare.png", system.getScene());
+            system.createConeEmitter(0.1, Math.PI / 4);
+            // Particle color
+            system.color1 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
+            system.color2 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
+            system.colorDead = new BABYLON.Color4(1.0, 1.0, 1.0, 0.0);
+            // Particle Size
             system.minSize = 0.1;
-            system.maxSize = 0.5;
-            system.emitRate = 200;
+            system.maxSize = 0.1;
+            // Emission speed
+            system.minEmitPower = 2;
+            system.maxEmitPower = 2;
+            system.emitRate = 30;
             return system;
         };
         /**

+ 1 - 1
dist/preview release/gui/babylon.gui.d.ts

@@ -1,6 +1,6 @@
 /*BabylonJS GUI*/
 // Dependencies for this module:
-//   ../../../../tools/Gulp/babylonjs
+//   ../../../../Tools/Gulp/babylonjs
 declare module BABYLON.GUI {
 }
 declare module BABYLON.GUI {

+ 1 - 1
dist/preview release/gui/babylon.gui.module.d.ts

@@ -1,6 +1,6 @@
 /*BabylonJS GUI*/
 // Dependencies for this module:
-//   ../../../../tools/Gulp/babylonjs
+//   ../../../../Tools/Gulp/babylonjs
 
 declare module 'babylonjs-gui' {
     export * from "babylonjs-gui/2D";

+ 2 - 2
dist/preview release/inspector/babylon.inspector.d.ts

@@ -1,7 +1,7 @@
 /*BabylonJS Inspector*/
 // Dependencies for this module:
-//   ../../../../tools/Gulp/babylonjs
-//   ../../../../tools/Gulp/babylonjs-gui
+//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/Gulp/babylonjs-gui
 declare module INSPECTOR {
 }
 declare module INSPECTOR {

+ 2 - 2
dist/preview release/inspector/babylon.inspector.module.d.ts

@@ -1,7 +1,7 @@
 /*BabylonJS Inspector*/
 // Dependencies for this module:
-//   ../../../../tools/Gulp/babylonjs
-//   ../../../../tools/Gulp/babylonjs-gui
+//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/Gulp/babylonjs-gui
 
 declare module 'babylonjs-inspector' {
     export * from 'babylonjs-inspector/adapters';

+ 2 - 2
dist/preview release/viewer/babylon.viewer.d.ts

@@ -4,8 +4,8 @@
 declare module "babylonjs-loaders"{ export=BABYLON;}
 // Generated by dts-bundle v0.7.3
 // Dependencies for this module:
-//   ../../../../../tools/Gulp/babylonjs
-//   ../../../../../tools/Gulp/babylonjs-loaders
+//   ../../../../../Tools/Gulp/babylonjs
+//   ../../../../../Tools/Gulp/babylonjs-loaders
 declare module BabylonViewer {
     /**
         * BabylonJS Viewer

Разница между файлами не показана из-за своего большого размера
+ 3 - 3
dist/preview release/viewer/babylon.viewer.js


Разница между файлами не показана из-за своего большого размера
+ 3 - 3
dist/preview release/viewer/babylon.viewer.max.js


+ 2 - 2
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -5,8 +5,8 @@ declare module "babylonjs-loaders"{ export=BABYLON;}
 
 // Generated by dts-bundle v0.7.3
 // Dependencies for this module:
-//   ../../../../../tools/Gulp/babylonjs
-//   ../../../../../tools/Gulp/babylonjs-loaders
+//   ../../../../../Tools/Gulp/babylonjs
+//   ../../../../../Tools/Gulp/babylonjs-loaders
 
 declare module 'babylonjs-viewer' {
     import { mapperManager } from 'babylonjs-viewer/configuration/mappers';

+ 17 - 4
src/Particles/babylon.particleHelper.ts

@@ -14,14 +14,27 @@ module BABYLON {
          * @param scene defines the hosting scene
          * @returns the new Particle system
          */
-        public static CreateDefault(emitter: Nullable<AbstractMesh | Vector3>, scene?: Scene): ParticleSystem {
-            var system = new ParticleSystem("default system", 1000, scene!);
+        public static CreateDefault(emitter: Nullable<AbstractMesh | Vector3>,  capacity = 500, scene?: Scene): ParticleSystem {
+            var system = new ParticleSystem("default system", capacity, scene!);
         
             system.emitter = emitter;
             system.particleTexture = new Texture("https://www.babylonjs.com/assets/Flare.png", system.getScene());
+            system.createConeEmitter(0.1, Math.PI / 4);
+
+            // Particle color
+            system.color1 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
+            system.color2 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
+            system.colorDead = new BABYLON.Color4(1.0, 1.0, 1.0, 0.0);
+            
+            // Particle Size
             system.minSize = 0.1;
-            system.maxSize = 0.5;
-            system.emitRate = 200;
+            system.maxSize = 0.1;
+
+            // Emission speed
+            system.minEmitPower = 2;
+            system.maxEmitPower = 2;
+
+            system.emitRate = 30;
 
             return system;
         }