Browse Source

Add ParticleSystemHelper.CreateDefault

David Catuhe 7 năm trước cách đây
mục cha
commit
7263bfa898

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 13956 - 13949
Playground/babylon.d.txt


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 16803 - 16796
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 30 - 30
dist/preview release/babylon.js


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

@@ -55454,7 +55454,7 @@ var BABYLON;
             this._isAnimationSheetEnabled = isAnimationSheetEnabled;
             this._isAnimationSheetEnabled = isAnimationSheetEnabled;
             this._scene = scene || BABYLON.Engine.LastCreatedScene;
             this._scene = scene || BABYLON.Engine.LastCreatedScene;
             this._customEffect = customEffect;
             this._customEffect = customEffect;
-            scene.particleSystems.push(this);
+            this._scene.particleSystems.push(this);
             this._useInstancing = this._scene.getEngine().getCaps().instancedArrays;
             this._useInstancing = this._scene.getEngine().getCaps().instancedArrays;
             this._createIndexBuffer();
             this._createIndexBuffer();
             this._createVertexBuffers();
             this._createVertexBuffers();
@@ -56889,6 +56889,21 @@ var BABYLON;
             return particleSystem;
             return particleSystem;
         };
         };
         /**
         /**
+         * Create a default particle system that you can tweak
+         * @param emitter defines the emitter to use
+         * @param scene defines the hosting scene
+         * @returns the new Particle system
+         */
+        ParticleSystem.CreateDefault = function (emitter, scene) {
+            var system = new ParticleSystem("default system", 1000, scene);
+            system.emitter = emitter;
+            system.particleTexture = new BABYLON.Texture("https://www.babylonjs.com/assets/Flare.png", system._scene);
+            system.minSize = 0.1;
+            system.maxSize = 0.5;
+            system.emitRate = 200;
+            return system;
+        };
+        /**
          * Source color is added to the destination color without alpha affecting the result.
          * Source color is added to the destination color without alpha affecting the result.
          */
          */
         ParticleSystem.BLENDMODE_ONEONE = 0;
         ParticleSystem.BLENDMODE_ONEONE = 0;

+ 16 - 1
dist/preview release/babylon.no-module.max.js

@@ -55421,7 +55421,7 @@ var BABYLON;
             this._isAnimationSheetEnabled = isAnimationSheetEnabled;
             this._isAnimationSheetEnabled = isAnimationSheetEnabled;
             this._scene = scene || BABYLON.Engine.LastCreatedScene;
             this._scene = scene || BABYLON.Engine.LastCreatedScene;
             this._customEffect = customEffect;
             this._customEffect = customEffect;
-            scene.particleSystems.push(this);
+            this._scene.particleSystems.push(this);
             this._useInstancing = this._scene.getEngine().getCaps().instancedArrays;
             this._useInstancing = this._scene.getEngine().getCaps().instancedArrays;
             this._createIndexBuffer();
             this._createIndexBuffer();
             this._createVertexBuffers();
             this._createVertexBuffers();
@@ -56856,6 +56856,21 @@ var BABYLON;
             return particleSystem;
             return particleSystem;
         };
         };
         /**
         /**
+         * Create a default particle system that you can tweak
+         * @param emitter defines the emitter to use
+         * @param scene defines the hosting scene
+         * @returns the new Particle system
+         */
+        ParticleSystem.CreateDefault = function (emitter, scene) {
+            var system = new ParticleSystem("default system", 1000, scene);
+            system.emitter = emitter;
+            system.particleTexture = new BABYLON.Texture("https://www.babylonjs.com/assets/Flare.png", system._scene);
+            system.minSize = 0.1;
+            system.maxSize = 0.5;
+            system.emitRate = 200;
+            return system;
+        };
+        /**
          * Source color is added to the destination color without alpha affecting the result.
          * Source color is added to the destination color without alpha affecting the result.
          */
          */
         ParticleSystem.BLENDMODE_ONEONE = 0;
         ParticleSystem.BLENDMODE_ONEONE = 0;

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 30 - 30
dist/preview release/babylon.worker.js


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

@@ -55421,7 +55421,7 @@ var BABYLON;
             this._isAnimationSheetEnabled = isAnimationSheetEnabled;
             this._isAnimationSheetEnabled = isAnimationSheetEnabled;
             this._scene = scene || BABYLON.Engine.LastCreatedScene;
             this._scene = scene || BABYLON.Engine.LastCreatedScene;
             this._customEffect = customEffect;
             this._customEffect = customEffect;
-            scene.particleSystems.push(this);
+            this._scene.particleSystems.push(this);
             this._useInstancing = this._scene.getEngine().getCaps().instancedArrays;
             this._useInstancing = this._scene.getEngine().getCaps().instancedArrays;
             this._createIndexBuffer();
             this._createIndexBuffer();
             this._createVertexBuffers();
             this._createVertexBuffers();
@@ -56856,6 +56856,21 @@ var BABYLON;
             return particleSystem;
             return particleSystem;
         };
         };
         /**
         /**
+         * Create a default particle system that you can tweak
+         * @param emitter defines the emitter to use
+         * @param scene defines the hosting scene
+         * @returns the new Particle system
+         */
+        ParticleSystem.CreateDefault = function (emitter, scene) {
+            var system = new ParticleSystem("default system", 1000, scene);
+            system.emitter = emitter;
+            system.particleTexture = new BABYLON.Texture("https://www.babylonjs.com/assets/Flare.png", system._scene);
+            system.minSize = 0.1;
+            system.maxSize = 0.5;
+            system.emitRate = 200;
+            return system;
+        };
+        /**
          * Source color is added to the destination color without alpha affecting the result.
          * Source color is added to the destination color without alpha affecting the result.
          */
          */
         ParticleSystem.BLENDMODE_ONEONE = 0;
         ParticleSystem.BLENDMODE_ONEONE = 0;

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 18 - 0
src/Particles/babylon.particleHelper.ts

@@ -9,6 +9,24 @@ module BABYLON {
         public static BaseAssetsUrl = "https://assets.babylonjs.com/particles";
         public static BaseAssetsUrl = "https://assets.babylonjs.com/particles";
 
 
         /**
         /**
+         * Create a default particle system that you can tweak
+         * @param emitter defines the emitter to use
+         * @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!);
+        
+            system.emitter = emitter;
+            system.particleTexture = new Texture("https://www.babylonjs.com/assets/Flare.png", system._scene);
+            system.minSize = 0.1;
+            system.maxSize = 0.5;
+            system.emitRate = 200;
+
+            return system;
+        }
+
+        /**
          * This is the main static method (one-liner) of this helper to create different particle systems
          * This is the main static method (one-liner) of this helper to create different particle systems
          * @param type This string represents the type to the particle system to create
          * @param type This string represents the type to the particle system to create
          * @param scene The scene where the particle system should live
          * @param scene The scene where the particle system should live

+ 1 - 1
src/Particles/babylon.particleSystem.ts

@@ -510,7 +510,7 @@
 
 
             this._customEffect = customEffect;
             this._customEffect = customEffect;
 
 
-            scene.particleSystems.push(this);
+            this._scene.particleSystems.push(this);
 
 
             this._useInstancing = this._scene.getEngine().getCaps().instancedArrays;
             this._useInstancing = this._scene.getEngine().getCaps().instancedArrays;