David Catuhe 7 years ago
parent
commit
0e1990dbb6

File diff suppressed because it is too large
+ 17186 - 17188
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 27 - 27
dist/preview release/babylon.js


File diff suppressed because it is too large
+ 10 - 22
dist/preview release/babylon.max.js


File diff suppressed because it is too large
+ 10 - 22
dist/preview release/babylon.no-module.max.js


File diff suppressed because it is too large
+ 27 - 27
dist/preview release/babylon.worker.js


File diff suppressed because it is too large
+ 10 - 22
dist/preview release/es6.js


File diff suppressed because it is too large
+ 27 - 27
dist/preview release/viewer/babylon.viewer.js


File diff suppressed because it is too large
+ 10 - 22
dist/preview release/viewer/babylon.viewer.max.js


+ 1 - 22
src/Particles/babylon.gpuParticleSystem.ts

@@ -604,7 +604,7 @@
             this._scene.particleSystems.push(this);
 
             this._updateEffectOptions = {
-                attributes: ["position", "age", "life", "seed", "size", "color", "direction", "initialDirection", "angle", "initialSize", "cellIndex"],
+                attributes: ["position", "age", "life", "seed", "size", "color", "direction", "initialDirection", "angle", "cellIndex"],
                 uniformsNames: ["currentCount", "timeDelta", "emitterWM", "lifeTime", "color1", "color2", "sizeRange", "scaleRange","gravity", "emitPower",
                                 "direction1", "direction2", "minEmitBox", "maxEmitBox", "radius", "directionRandomizer", "height", "coneAngle", "stopFactor", 
                                 "angleRange", "radiusRange", "cellInfos"],
@@ -656,10 +656,6 @@
             updateVertexBuffers["seed"] = source.createVertexBuffer("seed", 5, 4);
             updateVertexBuffers["size"] = source.createVertexBuffer("size", 9, 3);
             let offset = 12;
-            if (this._sizeGradientsTexture) {
-                updateVertexBuffers["initialSize"] = source.createVertexBuffer("initialSize", offset, 3);
-                offset += 3;
-            }
 
             if (!this._colorGradientsTexture) {
                 updateVertexBuffers["color"] = source.createVertexBuffer("color", offset, 4);
@@ -696,9 +692,6 @@
             renderVertexBuffers["size"] = source.createVertexBuffer("size", 9, 3, this._attributesStrideSize, true);      
             
             let offset = 12;
-            if (this._sizeGradientsTexture) {
-                offset += 3;
-            }
 
             if (!this._colorGradientsTexture) {
                 renderVertexBuffers["color"] = source.createVertexBuffer("color", offset, 4, this._attributesStrideSize, true);
@@ -744,10 +737,6 @@
                 this._attributesStrideSize -= 4;
             }
 
-            if (this._sizeGradientsTexture) {
-                this._attributesStrideSize += 3;
-            }
-
             if (this._isAnimationSheetEnabled) {
                 this._attributesStrideSize += 1;
             }            
@@ -773,12 +762,6 @@
                 data.push(0.0);
                 data.push(0.0);
 
-                if (this._sizeGradientsTexture) {
-                    data.push(0.0);
-                    data.push(0.0);
-                    data.push(0.0);  
-                }                
-
                 if (!this._colorGradientsTexture) {
                     // color
                     data.push(0.0);
@@ -861,10 +844,6 @@
 
             this._updateEffectOptions.transformFeedbackVaryings = ["outPosition", "outAge", "outLife", "outSeed", "outSize"];           
 
-            if (this._sizeGradientsTexture) {
-                this._updateEffectOptions.transformFeedbackVaryings.push("outInitialSize");
-            }
-
             if (!this._colorGradientsTexture) {
                 this._updateEffectOptions.transformFeedbackVaryings.push("outColor");
             }

+ 0 - 3
src/Particles/babylon.particle.ts

@@ -64,9 +64,6 @@
         public _initialDirection: Nullable<Vector3>;
 
         /** @hidden */
-        public _initialSize: number;
-
-        /** @hidden */
         public _initialStartSpriteCellID: number;
         public _initialEndSpriteCellID: number;
 

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

@@ -530,7 +530,7 @@
                                     particle._currentSize2 = (<FactorGradient>nextGradient).getFactor();    
                                     particle._currentSizeGradient = (<FactorGradient>currentGradient);
                                 }                                
-                                particle.size = particle._initialSize * Scalar.Lerp(particle._currentSize1, particle._currentSize2, scale);
+                                particle.size = Scalar.Lerp(particle._currentSize1, particle._currentSize2, scale);
                             });
                         }
 
@@ -1031,7 +1031,6 @@
                     }
                 }
                 // Size and scale
-                particle._initialSize = particle.size;
                 particle.scale.copyFromFloats(Scalar.RandomRange(this.minScaleX, this.maxScaleX), Scalar.RandomRange(this.minScaleY, this.maxScaleY));
 
                 // Angle

+ 3 - 11
src/Shaders/gpuUpdateParticles.vertex.fx

@@ -68,9 +68,6 @@ out float outAge;
 out float outLife;
 out vec4 outSeed;
 out vec3 outSize;
-#ifdef SIZEGRADIENTS
-out vec3 outInitialSize;
-#endif
 #ifndef COLORGRADIENTS
 out vec4 outColor;
 #endif
@@ -85,7 +82,6 @@ out float outCellIndex;
 
 #ifdef SIZEGRADIENTS
 uniform sampler2D sizeGradientSampler;
-in vec3 initialSize;
 #endif 
 
 #ifdef ANIMATESHEET
@@ -136,14 +132,10 @@ void main() {
     outSeed = seed;
 
     // Size
-    outSize.x = sizeRange.x + (sizeRange.y - sizeRange.x) * randoms.g;
+    outSize.x = texture(sizeGradientSampler, vec2(0, 0)).r;
     outSize.y = scaleRange.x + (scaleRange.y - scaleRange.x) * randoms.b;
     outSize.z = scaleRange.z + (scaleRange.w - scaleRange.z) * randoms.a; 
 
-#ifdef SIZEGRADIENTS
-    outInitialSize = outSize;
-#endif    
-
 #ifndef COLORGRADIENTS
     // Color
     outColor = color1 + (color2 - color1) * randoms.b;
@@ -234,8 +226,8 @@ void main() {
 #endif
 
 #ifdef SIZEGRADIENTS
-    outInitialSize = initialSize;
-	outSize = initialSize * texture(sizeGradientSampler, vec2(age / life, 0)).r;
+	outSize.x = texture(sizeGradientSampler, vec2(age / life, 0)).r;
+    outSize.yz = size.yz;
 #else
     outSize = size;
 #endif 

BIN
tests/validation/ReferenceImages/particle_helper.png


BIN
tests/validation/ReferenceImages/yeti.png


+ 6 - 0
tests/validation/config.json

@@ -2,6 +2,12 @@
   "root": "https://rawgit.com/BabylonJS/Website/master",
   "tests": [  
     {
+      "title": "Particle Helper",
+      "playgroundId": "#1VGT5D#2",
+      "renderCount": 50,
+      "referenceImage": "particle_helper.png"
+    },     
+    {
       "title": "Chibi Rex",
       "playgroundId": "#QATUCH#4",
       "renderCount": 50,