diff options
Diffstat (limited to 'src/declarative/particles/defaultshaders/simplevertex.shader')
-rw-r--r-- | src/declarative/particles/defaultshaders/simplevertex.shader | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/declarative/particles/defaultshaders/simplevertex.shader b/src/declarative/particles/defaultshaders/simplevertex.shader index 1c07363505..c287e159a5 100644 --- a/src/declarative/particles/defaultshaders/simplevertex.shader +++ b/src/declarative/particles/defaultshaders/simplevertex.shader @@ -4,20 +4,30 @@ attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration uniform highp mat4 qt_Matrix; uniform highp float timestamp; +uniform highp float entry; varying lowp float fFade; void main() { - highp float size = vData.z; - highp float endSize = vData.w; - highp float t = (timestamp - vData.x) / vData.y; - highp float currentSize = mix(size, endSize, t * t); + highp float currentSize = mix(vData.z, vData.w, t * t); if (t < 0. || t > 1.) currentSize = 0.; + fFade = 1.; + + if (entry == 1.){ + highp float fadeIn = min(t * 10., 1.); + highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); + fFade = fadeIn * fadeOut; + }else if(entry == 2.){ + highp float sizeIn = min(t * 10., 1.); + highp float sizeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); + currentSize = currentSize * sizeIn * sizeOut; + } + gl_PointSize = currentSize; highp vec2 pos = vPos @@ -26,8 +36,4 @@ void main() { gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1); - highp float fadeIn = min(t * 10., 1.); - highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); - - fFade = fadeIn * fadeOut; } |