aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/particles/defaultshaders
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/particles/defaultshaders')
-rw-r--r--src/declarative/particles/defaultshaders/coloredvertex.shader18
-rw-r--r--src/declarative/particles/defaultshaders/deformablevertex.shader18
-rw-r--r--src/declarative/particles/defaultshaders/simplevertex.shader22
-rw-r--r--src/declarative/particles/defaultshaders/spritevertex.shader5
4 files changed, 43 insertions, 20 deletions
diff --git a/src/declarative/particles/defaultshaders/coloredvertex.shader b/src/declarative/particles/defaultshaders/coloredvertex.shader
index cdbb130dd9..5b8339276c 100644
--- a/src/declarative/particles/defaultshaders/coloredvertex.shader
+++ b/src/declarative/particles/defaultshaders/coloredvertex.shader
@@ -5,6 +5,7 @@ attribute lowp vec4 vColor;
uniform highp mat4 qt_Matrix;
uniform highp float timestamp;
+uniform highp float entry;
varying lowp vec4 fColor;
@@ -19,6 +20,18 @@ void main() {
if (t < 0. || t > 1.)
currentSize = 0.;
+ lowp float 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
@@ -27,8 +40,5 @@ 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.));
-
- fColor = vColor * (fadeIn * fadeOut);
+ fColor = vColor * (fFade);
}
diff --git a/src/declarative/particles/defaultshaders/deformablevertex.shader b/src/declarative/particles/defaultshaders/deformablevertex.shader
index 001998435f..ab6acde36d 100644
--- a/src/declarative/particles/defaultshaders/deformablevertex.shader
+++ b/src/declarative/particles/defaultshaders/deformablevertex.shader
@@ -8,6 +8,7 @@ attribute lowp vec4 vColor;
uniform highp mat4 qt_Matrix;
uniform highp float timestamp;
+uniform highp float entry;
varying highp vec2 fTex;
varying lowp vec4 fColor;
@@ -24,6 +25,18 @@ void main() {
if (t < 0. || t > 1.)
currentSize = 0.;
+ lowp float 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;
+ }
+
highp vec2 pos;
highp float rotation = vRotation.x + vRotation.y * t * vData.y;
if(vRotation.z == 1.0){
@@ -48,8 +61,5 @@ 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.));
-
- fColor = vColor * (fadeIn * fadeOut);
+ fColor = vColor * fFade;
}
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;
}
diff --git a/src/declarative/particles/defaultshaders/spritevertex.shader b/src/declarative/particles/defaultshaders/spritevertex.shader
index 7d89726fc2..c28e74c763 100644
--- a/src/declarative/particles/defaultshaders/spritevertex.shader
+++ b/src/declarative/particles/defaultshaders/spritevertex.shader
@@ -20,8 +20,6 @@ varying lowp vec4 fColor;
void main() {
- highp float size = vData.z;
- highp float endSize = vData.w;
highp float t = (timestamp - vData.x) / vData.y;
@@ -58,7 +56,7 @@ void main() {
frameTex.y = 1. * ((vAnimData.x + 1.)/animcount);
fTexB = frameTex;
- 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.;
@@ -89,5 +87,4 @@ void main() {
fColor = vColor;
tt = t;
-
}