瀏覽代碼

move subEmitter to its own file

Trevor Baron 7 年之前
父節點
當前提交
657f7b377e
共有 3 個文件被更改,包括 65 次插入63 次删除
  1. 2 1
      Tools/Gulp/config.json
  2. 0 62
      src/Particles/babylon.particleSystem.ts
  3. 63 0
      src/Particles/babylon.subEmitter.ts

+ 2 - 1
Tools/Gulp/config.json

@@ -299,7 +299,8 @@
                 "../../src/Particles/EmitterTypes/babylon.sphereParticleEmitter.js",
                 "../../src/Particles/EmitterTypes/babylon.hemisphericParticleEmitter.js",
                 "../../src/Particles/EmitterTypes/babylon.pointParticleEmitter.js",
-                "../../src/Particles/babylon.particleSystemComponent.js"
+                "../../src/Particles/babylon.particleSystemComponent.js",
+                "../../src/Particles/babylon.subEmitter.js"
             ],
             "dependUpon": [
                 "core"

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

@@ -1,67 +1,5 @@
 module BABYLON {
     /**
-     * Type of sub emitter
-     */
-    export enum SubEmitterType {
-        /**
-         * Attached to the particle over it's lifetime
-         */
-        ATTACHED,
-        /**
-         * Created when the particle dies
-         */
-        END
-    }
-
-    /**
-     * Sub emitter class used to emit particles from an existing particle
-     */
-    export class SubEmitter {
-        /**
-         * Type of the submitter (Default: END)
-         */
-        public type = SubEmitterType.END;
-        /**
-         * If the particle should inherit the direction from the particle it's attached to. (+Y will face the direction the particle is moving) (Default: false)
-         * Note: This only is supported when using an emitter of type Mesh
-         */
-        public inheritDirection = false;
-        /**
-         * How much of the attached particles speed should be added to the sub emitted particle (default: 0)
-         */
-        public inheritedVelocityAmount = 0;
-        /**
-         * Creates a sub emitter
-         * @param particleSystem the particle system to be used by the sub emitter
-         */
-        constructor(public particleSystem:ParticleSystem){
-        }
-        /**
-         * Clones the sub emitter
-         */
-        clone():SubEmitter{
-            // Clone particle system
-            var emitter = this.particleSystem.emitter;
-            if(!emitter){
-                emitter = new Vector3();
-            }else if(emitter instanceof Vector3){
-                emitter = emitter.clone();
-            }else if(emitter instanceof AbstractMesh){
-                emitter = new Mesh("", emitter._scene);
-            }
-            var clone = new SubEmitter(this.particleSystem.clone("",emitter));
-
-            // Clone properties
-            clone.type = this.type;
-            clone.inheritDirection = this.inheritDirection;
-            clone.inheritedVelocityAmount = this.inheritedVelocityAmount;
-
-            clone.particleSystem._disposeEmitterOnDispose = true;
-            return clone;
-        }
-    }
-
-    /**
      * This represents a particle system in Babylon.
      * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.
      * Particles can take different shapes while emitted like box, sphere, cone or you can write your custom function.

+ 63 - 0
src/Particles/babylon.subEmitter.ts

@@ -0,0 +1,63 @@
+module BABYLON {
+    /**
+     * Type of sub emitter
+     */
+    export enum SubEmitterType {
+        /**
+         * Attached to the particle over it's lifetime
+         */
+        ATTACHED,
+        /**
+         * Created when the particle dies
+         */
+        END
+    }
+
+    /**
+     * Sub emitter class used to emit particles from an existing particle
+     */
+    export class SubEmitter {
+        /**
+         * Type of the submitter (Default: END)
+         */
+        public type = SubEmitterType.END;
+        /**
+         * If the particle should inherit the direction from the particle it's attached to. (+Y will face the direction the particle is moving) (Default: false)
+         * Note: This only is supported when using an emitter of type Mesh
+         */
+        public inheritDirection = false;
+        /**
+         * How much of the attached particles speed should be added to the sub emitted particle (default: 0)
+         */
+        public inheritedVelocityAmount = 0;
+        /**
+         * Creates a sub emitter
+         * @param particleSystem the particle system to be used by the sub emitter
+         */
+        constructor(public particleSystem:ParticleSystem){
+        }
+        /**
+         * Clones the sub emitter
+         */
+        clone():SubEmitter{
+            // Clone particle system
+            var emitter = this.particleSystem.emitter;
+            if(!emitter){
+                emitter = new Vector3();
+            }else if(emitter instanceof Vector3){
+                emitter = emitter.clone();
+            }else if(emitter instanceof AbstractMesh){
+                emitter = new Mesh("", emitter._scene);
+            }
+            var clone = new SubEmitter(this.particleSystem.clone("",emitter));
+
+            // Clone properties
+            clone.type = this.type;
+            clone.inheritDirection = this.inheritDirection;
+            clone.inheritedVelocityAmount = this.inheritedVelocityAmount;
+
+            clone.particleSystem._disposeEmitterOnDispose = true;
+            return clone;
+        }
+    }
+}