Sfoglia il codice sorgente

Upgrading particle system for custom function

David Catuhe 10 anni fa
parent
commit
24df7141f4

+ 4 - 0
Babylon/Particles/babylon.particleSystem.js

@@ -163,6 +163,10 @@
                 }
             }
 
+            if (this.customUpdateFunction) {
+                this.customUpdateFunction(this.particles);
+            }
+
             // Add new ones
             var worldMatrix;
 

+ 6 - 6
Babylon/Particles/babylon.particleSystem.ts

@@ -38,8 +38,8 @@
         public particleTexture: Texture;
 
         public onDispose: () => void;
+        public customUpdateFunction: (particles: Particle[]) => void;
 
-        public customParticleUpdate: (part: Particle) => void;
         public blendMode = ParticleSystem.BLENDMODE_ONEONE;
 
         public forceDepthWrite = false;
@@ -174,10 +174,6 @@
                 var particle = this.particles[index];
                 particle.age += this._scaledUpdateSpeed;
 
-                if (this.customParticleUpdate) {
-                    this.customParticleUpdate(particle);
-                }
-                
                 if (particle.age >= particle.lifeTime) {
                     this._stockParticles.push(this.particles.splice(index, 1)[0]);
                     index--;
@@ -200,6 +196,10 @@
                 }
             }
 
+            if (this.customUpdateFunction) {
+                this.customUpdateFunction(this.particles);
+            }
+
             // Add new ones
             var worldMatrix;
 
@@ -434,4 +434,4 @@
             return result;
         }
     }
-}  
+}  

+ 7 - 1
babylon.2.0-alpha.debug.js

@@ -11710,7 +11710,9 @@ var BABYLON;
             var result = new BABYLON.Mesh(name, this.getScene());
 
            
-            this._geometry.applyToMesh(result);
+            if (this._geometry) {
+                this._geometry.applyToMesh(result);
+            }
 
            
             BABYLON.Tools.DeepCopy(this, result, ["name", "material", "skeleton"], []);
@@ -16947,6 +16949,10 @@ var BABYLON;
                 }
             }
 
+            if (this.customUpdateFunction) {
+                this.customUpdateFunction(this.particles);
+            }
+
            
             var worldMatrix;
 

File diff suppressed because it is too large
+ 3 - 3
babylon.2.0-alpha.js