Jelajahi Sumber

Added pointEmitter to particles

David Catuhe 7 tahun lalu
induk
melakukan
c51e896dd7

+ 1 - 0
Tools/Gulp/config.json

@@ -294,6 +294,7 @@
                 "../../src/Particles/EmitterTypes/babylon.boxParticleEmitter.js",
                 "../../src/Particles/EmitterTypes/babylon.boxParticleEmitter.js",
                 "../../src/Particles/EmitterTypes/babylon.coneParticleEmitter.js",
                 "../../src/Particles/EmitterTypes/babylon.coneParticleEmitter.js",
                 "../../src/Particles/EmitterTypes/babylon.sphereParticleEmitter.js",
                 "../../src/Particles/EmitterTypes/babylon.sphereParticleEmitter.js",
+                "../../src/Particles/EmitterTypes/babylon.pointParticleEmitter.js",
                 "../../src/Particles/babylon.particleSystemComponent.js"
                 "../../src/Particles/babylon.particleSystemComponent.js"
             ],
             ],
             "dependUpon": [
             "dependUpon": [

File diff ditekan karena terlalu besar
+ 2988 - 2916
dist/preview release/babylon.d.ts


File diff ditekan karena terlalu besar
+ 27 - 27
dist/preview release/babylon.js


+ 117 - 7
dist/preview release/babylon.max.js

@@ -56558,7 +56558,20 @@ var BABYLON;
             this.onDisposeObservable.clear();
             this.onDisposeObservable.clear();
         };
         };
         /**
         /**
-         * Creates a Sphere Emitter for the particle system. (emits along the sphere radius)
+         * Creates a Point Emitter for the particle system (emits directly from the emitter position)
+         * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
+         * @param direction2 Particles are emitted between the direction1 and direction2 from within the box
+         * @returns the emitter
+         */
+        ParticleSystem.prototype.createPointEmitter = function (direction1, direction2) {
+            var particleEmitter = new BABYLON.PointParticleEmitter();
+            particleEmitter.direction1 = direction1;
+            particleEmitter.direction2 = direction2;
+            this.particleEmitterType = particleEmitter;
+            return particleEmitter;
+        };
+        /**
+         * Creates a Sphere Emitter for the particle system (emits along the sphere radius)
          * @param radius The radius of the sphere to emit from
          * @param radius The radius of the sphere to emit from
          * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
          * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
          * @returns the emitter
          * @returns the emitter
@@ -56571,7 +56584,7 @@ var BABYLON;
             return particleEmitter;
             return particleEmitter;
         };
         };
         /**
         /**
-         * Creates a Directed Sphere Emitter for the particle system. (emits between direction1 and direction2)
+         * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)
          * @param radius The radius of the sphere to emit from
          * @param radius The radius of the sphere to emit from
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere
          * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere
          * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere
@@ -56586,7 +56599,7 @@ var BABYLON;
             return particleEmitter;
             return particleEmitter;
         };
         };
         /**
         /**
-         * Creates a Cone Emitter for the particle system. (emits from the cone to the particle position)
+         * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)
          * @param radius The radius of the cone to emit from
          * @param radius The radius of the cone to emit from
          * @param angle The base angle of the cone
          * @param angle The base angle of the cone
          * @returns the emitter
          * @returns the emitter
@@ -56598,7 +56611,6 @@ var BABYLON;
             this.particleEmitterType = particleEmitter;
             this.particleEmitterType = particleEmitter;
             return particleEmitter;
             return particleEmitter;
         };
         };
-        // this method needs to be changed when breaking changes will be allowed to match the sphere and cone methods and properties direction1,2 and minEmitBox,maxEmitBox to be removed from the system.
         /**
         /**
          * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)
          * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
@@ -57025,7 +57037,7 @@ var BABYLON;
             return newOne;
             return newOne;
         };
         };
         /**
         /**
-         * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
+         * Called by the GPUParticleSystem to setup the update shader
          * @param effect defines the update shader
          * @param effect defines the update shader
          */
          */
         BoxParticleEmitter.prototype.applyToShader = function (effect) {
         BoxParticleEmitter.prototype.applyToShader = function (effect) {
@@ -57197,7 +57209,7 @@ var BABYLON;
             return newOne;
             return newOne;
         };
         };
         /**
         /**
-         * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
+         * Called by the GPUParticleSystem to setup the update shader
          * @param effect defines the update shader
          * @param effect defines the update shader
          */
          */
         ConeParticleEmitter.prototype.applyToShader = function (effect) {
         ConeParticleEmitter.prototype.applyToShader = function (effect) {
@@ -57422,7 +57434,7 @@ var BABYLON;
             return newOne;
             return newOne;
         };
         };
         /**
         /**
-         * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
+         * Called by the GPUParticleSystem to setup the update shader
          * @param effect defines the update shader
          * @param effect defines the update shader
          */
          */
         SphereDirectedParticleEmitter.prototype.applyToShader = function (effect) {
         SphereDirectedParticleEmitter.prototype.applyToShader = function (effect) {
@@ -57473,6 +57485,104 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
+    /**
+     * Particle emitter emitting particles from a point.
+     * It emits the particles randomly between 2 given directions.
+     */
+    var PointParticleEmitter = /** @class */ (function () {
+        /**
+         * Creates a new instance PointParticleEmitter
+         */
+        function PointParticleEmitter() {
+            /**
+             * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.
+             */
+            this.direction1 = new BABYLON.Vector3(0, 1.0, 0);
+            /**
+             * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.
+             */
+            this.direction2 = new BABYLON.Vector3(0, 1.0, 0);
+        }
+        /**
+         * Called by the particle System when the direction is computed for the created particle.
+         * @param worldMatrix is the world matrix of the particle system
+         * @param directionToUpdate is the direction vector to update with the result
+         * @param particle is the particle we are computed the direction for
+         */
+        PointParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {
+            var randX = BABYLON.Scalar.RandomRange(this.direction1.x, this.direction2.x);
+            var randY = BABYLON.Scalar.RandomRange(this.direction1.y, this.direction2.y);
+            var randZ = BABYLON.Scalar.RandomRange(this.direction1.z, this.direction2.z);
+            BABYLON.Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);
+        };
+        /**
+         * Called by the particle System when the position is computed for the created particle.
+         * @param worldMatrix is the world matrix of the particle system
+         * @param positionToUpdate is the position vector to update with the result
+         * @param particle is the particle we are computed the position for
+         */
+        PointParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {
+            BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(0, 0, 0, worldMatrix, positionToUpdate);
+        };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        PointParticleEmitter.prototype.clone = function () {
+            var newOne = new PointParticleEmitter();
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
+        /**
+         * Called by the GPUParticleSystem to setup the update shader
+         * @param effect defines the update shader
+         */
+        PointParticleEmitter.prototype.applyToShader = function (effect) {
+            effect.setVector3("direction1", this.direction1);
+            effect.setVector3("direction2", this.direction2);
+        };
+        /**
+         * Returns a string to use to update the GPU particles update shader
+         * @returns a string containng the defines string
+         */
+        PointParticleEmitter.prototype.getEffectDefines = function () {
+            return "#define POINTEMITTER";
+        };
+        /**
+         * Returns the string "PointParticleEmitter"
+         * @returns a string containing the class name
+         */
+        PointParticleEmitter.prototype.getClassName = function () {
+            return "PointParticleEmitter";
+        };
+        /**
+         * Serializes the particle system to a JSON object.
+         * @returns the JSON object
+         */
+        PointParticleEmitter.prototype.serialize = function () {
+            var serializationObject = {};
+            serializationObject.type = this.getClassName();
+            serializationObject.direction1 = this.direction1.asArray();
+            serializationObject.direction2 = this.direction2.asArray();
+            return serializationObject;
+        };
+        /**
+         * Parse properties from a JSON object
+         * @param serializationObject defines the JSON object
+         */
+        PointParticleEmitter.prototype.parse = function (serializationObject) {
+            BABYLON.Vector3.FromArrayToRef(serializationObject.direction1, 0, this.direction1);
+            BABYLON.Vector3.FromArrayToRef(serializationObject.direction2, 0, this.direction2);
+        };
+        return PointParticleEmitter;
+    }());
+    BABYLON.PointParticleEmitter = PointParticleEmitter;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.pointParticleEmitter.js.map
+
+var BABYLON;
+(function (BABYLON) {
     // Adds the parsers to the scene parsers.
     // Adds the parsers to the scene parsers.
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM, function (parsedData, scene, container, rootUrl) {
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM, function (parsedData, scene, container, rootUrl) {
         var individualParser = BABYLON.AbstractScene.GetIndividualParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM);
         var individualParser = BABYLON.AbstractScene.GetIndividualParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM);

+ 117 - 7
dist/preview release/babylon.no-module.max.js

@@ -56525,7 +56525,20 @@ var BABYLON;
             this.onDisposeObservable.clear();
             this.onDisposeObservable.clear();
         };
         };
         /**
         /**
-         * Creates a Sphere Emitter for the particle system. (emits along the sphere radius)
+         * Creates a Point Emitter for the particle system (emits directly from the emitter position)
+         * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
+         * @param direction2 Particles are emitted between the direction1 and direction2 from within the box
+         * @returns the emitter
+         */
+        ParticleSystem.prototype.createPointEmitter = function (direction1, direction2) {
+            var particleEmitter = new BABYLON.PointParticleEmitter();
+            particleEmitter.direction1 = direction1;
+            particleEmitter.direction2 = direction2;
+            this.particleEmitterType = particleEmitter;
+            return particleEmitter;
+        };
+        /**
+         * Creates a Sphere Emitter for the particle system (emits along the sphere radius)
          * @param radius The radius of the sphere to emit from
          * @param radius The radius of the sphere to emit from
          * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
          * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
          * @returns the emitter
          * @returns the emitter
@@ -56538,7 +56551,7 @@ var BABYLON;
             return particleEmitter;
             return particleEmitter;
         };
         };
         /**
         /**
-         * Creates a Directed Sphere Emitter for the particle system. (emits between direction1 and direction2)
+         * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)
          * @param radius The radius of the sphere to emit from
          * @param radius The radius of the sphere to emit from
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere
          * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere
          * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere
@@ -56553,7 +56566,7 @@ var BABYLON;
             return particleEmitter;
             return particleEmitter;
         };
         };
         /**
         /**
-         * Creates a Cone Emitter for the particle system. (emits from the cone to the particle position)
+         * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)
          * @param radius The radius of the cone to emit from
          * @param radius The radius of the cone to emit from
          * @param angle The base angle of the cone
          * @param angle The base angle of the cone
          * @returns the emitter
          * @returns the emitter
@@ -56565,7 +56578,6 @@ var BABYLON;
             this.particleEmitterType = particleEmitter;
             this.particleEmitterType = particleEmitter;
             return particleEmitter;
             return particleEmitter;
         };
         };
-        // this method needs to be changed when breaking changes will be allowed to match the sphere and cone methods and properties direction1,2 and minEmitBox,maxEmitBox to be removed from the system.
         /**
         /**
          * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)
          * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
@@ -56992,7 +57004,7 @@ var BABYLON;
             return newOne;
             return newOne;
         };
         };
         /**
         /**
-         * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
+         * Called by the GPUParticleSystem to setup the update shader
          * @param effect defines the update shader
          * @param effect defines the update shader
          */
          */
         BoxParticleEmitter.prototype.applyToShader = function (effect) {
         BoxParticleEmitter.prototype.applyToShader = function (effect) {
@@ -57164,7 +57176,7 @@ var BABYLON;
             return newOne;
             return newOne;
         };
         };
         /**
         /**
-         * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
+         * Called by the GPUParticleSystem to setup the update shader
          * @param effect defines the update shader
          * @param effect defines the update shader
          */
          */
         ConeParticleEmitter.prototype.applyToShader = function (effect) {
         ConeParticleEmitter.prototype.applyToShader = function (effect) {
@@ -57389,7 +57401,7 @@ var BABYLON;
             return newOne;
             return newOne;
         };
         };
         /**
         /**
-         * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
+         * Called by the GPUParticleSystem to setup the update shader
          * @param effect defines the update shader
          * @param effect defines the update shader
          */
          */
         SphereDirectedParticleEmitter.prototype.applyToShader = function (effect) {
         SphereDirectedParticleEmitter.prototype.applyToShader = function (effect) {
@@ -57440,6 +57452,104 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
+    /**
+     * Particle emitter emitting particles from a point.
+     * It emits the particles randomly between 2 given directions.
+     */
+    var PointParticleEmitter = /** @class */ (function () {
+        /**
+         * Creates a new instance PointParticleEmitter
+         */
+        function PointParticleEmitter() {
+            /**
+             * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.
+             */
+            this.direction1 = new BABYLON.Vector3(0, 1.0, 0);
+            /**
+             * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.
+             */
+            this.direction2 = new BABYLON.Vector3(0, 1.0, 0);
+        }
+        /**
+         * Called by the particle System when the direction is computed for the created particle.
+         * @param worldMatrix is the world matrix of the particle system
+         * @param directionToUpdate is the direction vector to update with the result
+         * @param particle is the particle we are computed the direction for
+         */
+        PointParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {
+            var randX = BABYLON.Scalar.RandomRange(this.direction1.x, this.direction2.x);
+            var randY = BABYLON.Scalar.RandomRange(this.direction1.y, this.direction2.y);
+            var randZ = BABYLON.Scalar.RandomRange(this.direction1.z, this.direction2.z);
+            BABYLON.Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);
+        };
+        /**
+         * Called by the particle System when the position is computed for the created particle.
+         * @param worldMatrix is the world matrix of the particle system
+         * @param positionToUpdate is the position vector to update with the result
+         * @param particle is the particle we are computed the position for
+         */
+        PointParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {
+            BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(0, 0, 0, worldMatrix, positionToUpdate);
+        };
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        PointParticleEmitter.prototype.clone = function () {
+            var newOne = new PointParticleEmitter();
+            BABYLON.Tools.DeepCopy(this, newOne);
+            return newOne;
+        };
+        /**
+         * Called by the GPUParticleSystem to setup the update shader
+         * @param effect defines the update shader
+         */
+        PointParticleEmitter.prototype.applyToShader = function (effect) {
+            effect.setVector3("direction1", this.direction1);
+            effect.setVector3("direction2", this.direction2);
+        };
+        /**
+         * Returns a string to use to update the GPU particles update shader
+         * @returns a string containng the defines string
+         */
+        PointParticleEmitter.prototype.getEffectDefines = function () {
+            return "#define POINTEMITTER";
+        };
+        /**
+         * Returns the string "PointParticleEmitter"
+         * @returns a string containing the class name
+         */
+        PointParticleEmitter.prototype.getClassName = function () {
+            return "PointParticleEmitter";
+        };
+        /**
+         * Serializes the particle system to a JSON object.
+         * @returns the JSON object
+         */
+        PointParticleEmitter.prototype.serialize = function () {
+            var serializationObject = {};
+            serializationObject.type = this.getClassName();
+            serializationObject.direction1 = this.direction1.asArray();
+            serializationObject.direction2 = this.direction2.asArray();
+            return serializationObject;
+        };
+        /**
+         * Parse properties from a JSON object
+         * @param serializationObject defines the JSON object
+         */
+        PointParticleEmitter.prototype.parse = function (serializationObject) {
+            BABYLON.Vector3.FromArrayToRef(serializationObject.direction1, 0, this.direction1);
+            BABYLON.Vector3.FromArrayToRef(serializationObject.direction2, 0, this.direction2);
+        };
+        return PointParticleEmitter;
+    }());
+    BABYLON.PointParticleEmitter = PointParticleEmitter;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.pointParticleEmitter.js.map
+
+var BABYLON;
+(function (BABYLON) {
     // Adds the parsers to the scene parsers.
     // Adds the parsers to the scene parsers.
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM, function (parsedData, scene, container, rootUrl) {
     BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM, function (parsedData, scene, container, rootUrl) {
         var individualParser = BABYLON.AbstractScene.GetIndividualParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM);
         var individualParser = BABYLON.AbstractScene.GetIndividualParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM);

File diff ditekan karena terlalu besar
+ 27 - 27
dist/preview release/babylon.worker.js


File diff ditekan karena terlalu besar
+ 119 - 9
dist/preview release/es6.js


File diff ditekan karena terlalu besar
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


File diff ditekan karena terlalu besar
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


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

@@ -17,6 +17,7 @@
   - Added support for `minScaleX`, `minScaleY`, `maxScaleX`, `maxScaleY`. [Doc](https://doc.babylonjs.com/babylon101/particles#size)
   - Added support for `minScaleX`, `minScaleY`, `maxScaleX`, `maxScaleY`. [Doc](https://doc.babylonjs.com/babylon101/particles#size)
   - Added support for `radiusRange` for sphere emitter. [Doc](https://doc.babylonjs.com/babylon101/particles#sphere-emitter)
   - Added support for `radiusRange` for sphere emitter. [Doc](https://doc.babylonjs.com/babylon101/particles#sphere-emitter)
   - Added support for `radiusRange` and `heightRange` for cone emitter. [Doc](https://doc.babylonjs.com/babylon101/particles#cone-emitter)
   - Added support for `radiusRange` and `heightRange` for cone emitter. [Doc](https://doc.babylonjs.com/babylon101/particles#cone-emitter)
+  - Added new point emitter. [Doc](https://doc.babylonjs.com/babylon101/particles#point-emitter)
   - Added support for `ParticleSystem.BLENDMODE_ADD` alpha mode. [Doc](https://doc.babylonjs.com/babylon101/particles#particle-blending)
   - Added support for `ParticleSystem.BLENDMODE_ADD` alpha mode. [Doc](https://doc.babylonjs.com/babylon101/particles#particle-blending)
   - Added support for color gradients. [Doc](https://doc.babylonjs.com/babylon101/particles#particle-colors)
   - Added support for color gradients. [Doc](https://doc.babylonjs.com/babylon101/particles#particle-colors)
   - Added support for pre-warming. [Doc](https://doc.babylonjs.com/babylon101/particles#pre-warming)
   - Added support for pre-warming. [Doc](https://doc.babylonjs.com/babylon101/particles#pre-warming)

+ 1 - 1
src/Particles/EmitterTypes/babylon.boxParticleEmitter.ts

@@ -72,7 +72,7 @@ module BABYLON {
         }
         }
 
 
         /**
         /**
-         * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
+         * Called by the GPUParticleSystem to setup the update shader
          * @param effect defines the update shader
          * @param effect defines the update shader
          */        
          */        
         public applyToShader(effect: Effect): void {            
         public applyToShader(effect: Effect): void {            

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

@@ -124,7 +124,7 @@ module BABYLON {
         }        
         }        
         
         
         /**
         /**
-         * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
+         * Called by the GPUParticleSystem to setup the update shader
          * @param effect defines the update shader
          * @param effect defines the update shader
          */        
          */        
         public applyToShader(effect: Effect): void {
         public applyToShader(effect: Effect): void {

+ 109 - 0
src/Particles/EmitterTypes/babylon.pointParticleEmitter.ts

@@ -0,0 +1,109 @@
+module BABYLON {
+    /**
+     * Particle emitter emitting particles from a point.
+     * It emits the particles randomly between 2 given directions. 
+     */
+    export class PointParticleEmitter implements IParticleEmitterType {
+
+        /**
+         * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.
+         */
+        public direction1 = new Vector3(0, 1.0, 0);
+        /**
+         * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.
+         */
+        public direction2 = new Vector3(0, 1.0, 0);
+             
+        /**
+         * Creates a new instance PointParticleEmitter
+         */
+        constructor() {
+
+        }
+
+        /**
+         * Called by the particle System when the direction is computed for the created particle.
+         * @param worldMatrix is the world matrix of the particle system
+         * @param directionToUpdate is the direction vector to update with the result
+         * @param particle is the particle we are computed the direction for
+         */
+        public startDirectionFunction(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, randY, randZ, worldMatrix, directionToUpdate);
+        }
+
+        /**
+         * Called by the particle System when the position is computed for the created particle.
+         * @param worldMatrix is the world matrix of the particle system
+         * @param positionToUpdate is the position vector to update with the result
+         * @param particle is the particle we are computed the position for
+         */
+        public startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle): void {
+            Vector3.TransformCoordinatesFromFloatsToRef(0, 0, 0, worldMatrix, positionToUpdate);
+        }
+
+        /**
+         * Clones the current emitter and returns a copy of it
+         * @returns the new emitter
+         */
+        public clone(): PointParticleEmitter
+        {
+            let newOne = new PointParticleEmitter();
+
+            Tools.DeepCopy(this, newOne);
+
+            return newOne;
+        }
+
+        /**
+         * Called by the GPUParticleSystem to setup the update shader
+         * @param effect defines the update shader
+         */        
+        public applyToShader(effect: Effect): void {            
+            effect.setVector3("direction1", this.direction1);
+            effect.setVector3("direction2", this.direction2);
+        }
+
+        /**
+         * Returns a string to use to update the GPU particles update shader
+         * @returns a string containng the defines string
+         */
+        public getEffectDefines(): string {
+            return "#define POINTEMITTER"
+        }
+
+        /**
+         * Returns the string "PointParticleEmitter"
+         * @returns a string containing the class name
+         */
+        public getClassName(): string {
+            return "PointParticleEmitter";
+        }   
+        
+        /**
+         * Serializes the particle system to a JSON object.
+         * @returns the JSON object
+         */        
+        public serialize(): any {
+            var serializationObject: any = {};
+
+            serializationObject.type = this.getClassName();
+            serializationObject.direction1  = this.direction1.asArray();
+            serializationObject.direction2  = this.direction2.asArray();
+
+            return serializationObject;
+        }
+
+        /**
+         * Parse properties from a JSON object
+         * @param serializationObject defines the JSON object
+         */
+        public parse(serializationObject: any): void {
+            Vector3.FromArrayToRef(serializationObject.direction1, 0, this.direction1);
+            Vector3.FromArrayToRef(serializationObject.direction2, 0, this.direction2);
+        }
+    }
+}

+ 1 - 1
src/Particles/EmitterTypes/babylon.sphereParticleEmitter.ts

@@ -174,7 +174,7 @@ module BABYLON {
         }     
         }     
         
         
         /**
         /**
-         * Called by the {BABYLON.GPUParticleSystem} to setup the update shader
+         * Called by the GPUParticleSystem to setup the update shader
          * @param effect defines the update shader
          * @param effect defines the update shader
          */        
          */        
         public applyToShader(effect: Effect): void {
         public applyToShader(effect: Effect): void {

+ 18 - 4
src/Particles/babylon.particleSystem.ts

@@ -1584,7 +1584,22 @@
         }
         }
 
 
         /**
         /**
-         * Creates a Sphere Emitter for the particle system. (emits along the sphere radius)
+         * Creates a Point Emitter for the particle system (emits directly from the emitter position)
+         * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
+         * @param direction2 Particles are emitted between the direction1 and direction2 from within the box
+         * @returns the emitter
+         */
+        public createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter {
+            var particleEmitter = new PointParticleEmitter();
+            particleEmitter.direction1 = direction1;
+            particleEmitter.direction2 = direction2;
+
+            this.particleEmitterType = particleEmitter;
+            return particleEmitter;
+        }
+
+        /**
+         * Creates a Sphere Emitter for the particle system (emits along the sphere radius)
          * @param radius The radius of the sphere to emit from
          * @param radius The radius of the sphere to emit from
          * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
          * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
          * @returns the emitter
          * @returns the emitter
@@ -1596,7 +1611,7 @@
         }
         }
 
 
         /**
         /**
-         * Creates a Directed Sphere Emitter for the particle system. (emits between direction1 and direction2)
+         * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)
          * @param radius The radius of the sphere to emit from
          * @param radius The radius of the sphere to emit from
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere
          * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere
          * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere
@@ -1609,7 +1624,7 @@
         }
         }
 
 
         /**
         /**
-         * Creates a Cone Emitter for the particle system. (emits from the cone to the particle position)
+         * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)
          * @param radius The radius of the cone to emit from
          * @param radius The radius of the cone to emit from
          * @param angle The base angle of the cone
          * @param angle The base angle of the cone
          * @returns the emitter
          * @returns the emitter
@@ -1620,7 +1635,6 @@
             return particleEmitter;
             return particleEmitter;
         }
         }
 
 
-        // this method needs to be changed when breaking changes will be allowed to match the sphere and cone methods and properties direction1,2 and minEmitBox,maxEmitBox to be removed from the system.
         /**
         /**
          * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)
          * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
          * @param direction1 Particles are emitted between the direction1 and direction2 from within the box

+ 14 - 2
src/Shaders/gpuUpdateParticles.vertex.fx

@@ -26,6 +26,11 @@ uniform vec3 minEmitBox;
 uniform vec3 maxEmitBox;
 uniform vec3 maxEmitBox;
 #endif
 #endif
 
 
+#ifdef POINTEMITTER
+uniform vec3 direction1;
+uniform vec3 direction2;
+#endif
+
 #ifdef SPHEREEMITTER
 #ifdef SPHEREEMITTER
 uniform float radius;
 uniform float radius;
 uniform float radiusRange;
 uniform float radiusRange;
@@ -175,13 +180,20 @@ void main() {
 #endif        
 #endif        
 
 
     // Position / Direction (based on emitter type)
     // Position / Direction (based on emitter type)
-#ifdef BOXEMITTER
+#ifdef POINTEMITTER
     vec3 randoms2 = getRandomVec3(seed.y);
     vec3 randoms2 = getRandomVec3(seed.y);
     vec3 randoms3 = getRandomVec3(seed.z);
     vec3 randoms3 = getRandomVec3(seed.z);
 
 
-    position = minEmitBox + (maxEmitBox - minEmitBox) * randoms2;
+    position = vec3(0, 0, 0);
 
 
     direction = direction1 + (direction2 - direction1) * randoms3;
     direction = direction1 + (direction2 - direction1) * randoms3;
+#elif defined(BOXEMITTER)
+    vec3 randoms2 = getRandomVec3(seed.y);
+    vec3 randoms3 = getRandomVec3(seed.z);
+
+    position = minEmitBox + (maxEmitBox - minEmitBox) * randoms2;
+
+    direction = direction1 + (direction2 - direction1) * randoms3;    
 #elif defined(SPHEREEMITTER)
 #elif defined(SPHEREEMITTER)
     vec3 randoms2 = getRandomVec3(seed.y);
     vec3 randoms2 = getRandomVec3(seed.y);
     vec3 randoms3 = getRandomVec3(seed.z);
     vec3 randoms3 = getRandomVec3(seed.z);