diff options
Diffstat (limited to 'src/declarative/particles/defaultshaders')
16 files changed, 96 insertions, 301 deletions
diff --git a/src/declarative/particles/defaultshaders/coloredfragment.shader b/src/declarative/particles/defaultshaders/coloredfragment.shader new file mode 100644 index 0000000000..383888b5c7 --- /dev/null +++ b/src/declarative/particles/defaultshaders/coloredfragment.shader @@ -0,0 +1,10 @@ +uniform sampler2D texture; +uniform lowp float qt_Opacity; + +varying highp vec2 fTex; +varying lowp vec4 fColor; + +void main() { + gl_FragColor = (texture2D(texture, fTex)) * fColor * qt_Opacity; +} + diff --git a/src/declarative/particles/defaultshaders/trailsvertex.shader b/src/declarative/particles/defaultshaders/coloredvertex.shader index 7bc1d66b71..d6498f277f 100644 --- a/src/declarative/particles/defaultshaders/trailsvertex.shader +++ b/src/declarative/particles/defaultshaders/coloredvertex.shader @@ -4,15 +4,14 @@ attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration attribute lowp vec4 vColor; -uniform highp mat4 matrix; +uniform highp mat4 qt_Matrix; uniform highp float timestamp; -uniform lowp float opacity; -varying highp vec2 fTex; +varying highp vec2 fTex; varying lowp vec4 fColor; -void main() { - fTex = vTex; +void main() { + fTex = vTex; highp float size = vData.z; highp float endSize = vData.w; @@ -28,10 +27,10 @@ void main() { + vVec.xy * t * vData.y // apply speed vector.. + 0.5 * vVec.zw * pow(t * vData.y, 2.); - gl_Position = matrix * vec4(pos.x, pos.y, 0, 1); + 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 * opacity; + fColor = vColor * (fadeIn * fadeOut); } diff --git a/src/declarative/particles/defaultshaders/ctfragment.shader b/src/declarative/particles/defaultshaders/ctfragment.shader deleted file mode 100644 index a17f5841ca..0000000000 --- a/src/declarative/particles/defaultshaders/ctfragment.shader +++ /dev/null @@ -1,11 +0,0 @@ -uniform sampler2D texture; -uniform sampler2D colortable; -uniform sampler2D opacitytable; - -varying highp vec2 fTex; -varying lowp vec4 fColor; -varying lowp float tt; - -void main() { - gl_FragColor = (texture2D(texture, fTex).w) * fColor * texture2D(colortable, vec2(tt, 0.5)) *( texture2D(opacitytable, vec2(tt, 0.5)).w); -} diff --git a/src/declarative/particles/defaultshaders/ctvertex.shader b/src/declarative/particles/defaultshaders/ctvertex.shader deleted file mode 100644 index b20676cc49..0000000000 --- a/src/declarative/particles/defaultshaders/ctvertex.shader +++ /dev/null @@ -1,38 +0,0 @@ -attribute highp vec2 vPos; -attribute highp vec2 vTex; -attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize -attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration -attribute lowp vec4 vColor; - -uniform highp mat4 matrix; -uniform highp float timestamp; -uniform sampler2D sizetable; -uniform sampler2D opacitytable; - -varying highp vec2 fTex; -varying lowp vec4 fColor; -varying lowp float tt; - -void main() { - fTex = vTex; - 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) * texture2D(sizetable, vec2(t,0.5)).w; - - if (t < 0. || t > 1.) - currentSize = 0.; - - highp vec2 pos = vPos - - currentSize / 2. + currentSize * vTex // adjust size - + vVec.xy * t * vData.y // apply speed vector.. - + 0.5 * vVec.zw * pow(t * vData.y, 2.); - - gl_Position = matrix * vec4(pos.x, pos.y, 0, 1); - - fColor = vColor; - tt = t; - -} diff --git a/src/declarative/particles/defaultshaders/deformablefragment.shader b/src/declarative/particles/defaultshaders/deformablefragment.shader index 494053e319..1ac25ba208 100644 --- a/src/declarative/particles/defaultshaders/deformablefragment.shader +++ b/src/declarative/particles/defaultshaders/deformablefragment.shader @@ -1,8 +1,9 @@ uniform sampler2D texture; +uniform lowp float qt_Opacity; varying highp vec2 fTex; -varying lowp float fFade; +varying lowp vec4 fColor; void main() { - gl_FragColor = (texture2D(texture, fTex)) * fFade; + gl_FragColor = (texture2D(texture, fTex)) * fColor * qt_Opacity; } diff --git a/src/declarative/particles/defaultshaders/deformablevertex.shader b/src/declarative/particles/defaultshaders/deformablevertex.shader index 01570950b1..001998435f 100644 --- a/src/declarative/particles/defaultshaders/deformablevertex.shader +++ b/src/declarative/particles/defaultshaders/deformablevertex.shader @@ -4,13 +4,13 @@ attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration attribute highp vec4 vDeformVec; //x,y x unit vector; z,w = y unit vector attribute highp vec3 vRotation; //x = radians of rotation, y=rotation speed, z= bool autoRotate +attribute lowp vec4 vColor; -uniform highp mat4 matrix; +uniform highp mat4 qt_Matrix; uniform highp float timestamp; -uniform lowp float opacity; varying highp vec2 fTex; -varying lowp float fFade; +varying lowp vec4 fColor; void main() { fTex = vTex; @@ -21,37 +21,35 @@ void main() { highp float currentSize = mix(size, endSize, t * t); - highp vec2 pos; - if (t < 0. || t > 1.){ + if (t < 0. || t > 1.) currentSize = 0.; - pos = vPos; - }else{ - highp float rotation = vRotation.x + vRotation.y * t * vData.y; - if(vRotation.z == 1.0){ - highp vec2 curVel = vVec.zw * t * vData.y + vVec.xy; - rotation += atan(curVel.y, curVel.x); - } - highp vec2 trigCalcs = vec2(cos(rotation), sin(rotation)); - highp vec2 xDeform = vDeformVec.xy * currentSize * (vTex.x-0.5); - highp vec2 yDeform = vDeformVec.zw * currentSize * (vTex.y-0.5); - highp vec2 xRotatedDeform; - xRotatedDeform.x = trigCalcs.x*xDeform.x - trigCalcs.y*xDeform.y; - xRotatedDeform.y = trigCalcs.y*xDeform.x + trigCalcs.x*xDeform.y; - highp vec2 yRotatedDeform; - yRotatedDeform.x = trigCalcs.x*yDeform.x - trigCalcs.y*yDeform.y; - yRotatedDeform.y = trigCalcs.y*yDeform.x + trigCalcs.x*yDeform.y; - pos = vPos - + xRotatedDeform - + yRotatedDeform - //- vec2(1,1) * currentSize * 0.5 // 'center' - + vVec.xy * t * vData.y // apply speed - + 0.5 * vVec.zw * pow(t * vData.y, 2.); // apply acceleration - } - gl_Position = matrix * vec4(pos.x, pos.y, 0, 1); + highp vec2 pos; + highp float rotation = vRotation.x + vRotation.y * t * vData.y; + if(vRotation.z == 1.0){ + highp vec2 curVel = vVec.zw * t * vData.y + vVec.xy; + rotation += atan(curVel.y, curVel.x); + } + highp vec2 trigCalcs = vec2(cos(rotation), sin(rotation)); + highp vec2 xDeform = vDeformVec.xy * currentSize * (vTex.x-0.5); + highp vec2 yDeform = vDeformVec.zw * currentSize * (vTex.y-0.5); + highp vec2 xRotatedDeform; + xRotatedDeform.x = trigCalcs.x*xDeform.x - trigCalcs.y*xDeform.y; + xRotatedDeform.y = trigCalcs.y*xDeform.x + trigCalcs.x*xDeform.y; + highp vec2 yRotatedDeform; + yRotatedDeform.x = trigCalcs.x*yDeform.x - trigCalcs.y*yDeform.y; + yRotatedDeform.y = trigCalcs.y*yDeform.x + trigCalcs.x*yDeform.y; + pos = vPos + + xRotatedDeform + + yRotatedDeform + //- vec2(1,1) * currentSize * 0.5 // 'center' + + vVec.xy * t * vData.y // apply speed + + 0.5 * vVec.zw * pow(t * vData.y, 2.); // apply acceleration + + 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 * opacity; + fColor = vColor * (fadeIn * fadeOut); } diff --git a/src/declarative/particles/defaultshaders/simplefragment.shader b/src/declarative/particles/defaultshaders/simplefragment.shader index 494053e319..0b0adaa32b 100644 --- a/src/declarative/particles/defaultshaders/simplefragment.shader +++ b/src/declarative/particles/defaultshaders/simplefragment.shader @@ -1,8 +1,9 @@ uniform sampler2D texture; +uniform lowp float qt_Opacity; varying highp vec2 fTex; varying lowp float fFade; void main() { - gl_FragColor = (texture2D(texture, fTex)) * fFade; + gl_FragColor = texture2D(texture, fTex) * (fFade * qt_Opacity); } diff --git a/src/declarative/particles/defaultshaders/simplevertex.shader b/src/declarative/particles/defaultshaders/simplevertex.shader index f185ef0700..b7542e660e 100644 --- a/src/declarative/particles/defaultshaders/simplevertex.shader +++ b/src/declarative/particles/defaultshaders/simplevertex.shader @@ -3,9 +3,8 @@ attribute highp vec2 vTex; attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration -uniform highp mat4 matrix; +uniform highp mat4 qt_Matrix; uniform highp float timestamp; -uniform lowp float opacity; varying highp vec2 fTex; varying lowp float fFade; @@ -27,10 +26,10 @@ void main() { + vVec.xy * t * vData.y // apply speed vector.. + 0.5 * vVec.zw * pow(t * vData.y, 2.); - gl_Position = matrix * vec4(pos.x, pos.y, 0, 1); + 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 * opacity; + fFade = fadeIn * fadeOut; } diff --git a/src/declarative/particles/defaultshaders/spritefragment.shader b/src/declarative/particles/defaultshaders/spritefragment.shader index 4d89d69c6a..86002f03fb 100644 --- a/src/declarative/particles/defaultshaders/spritefragment.shader +++ b/src/declarative/particles/defaultshaders/spritefragment.shader @@ -1,10 +1,17 @@ uniform sampler2D texture; +uniform sampler2D colortable; +uniform sampler2D opacitytable; +uniform lowp float qt_Opacity; varying highp vec2 fTexA; varying highp vec2 fTexB; varying lowp float progress; varying lowp vec4 fColor; +varying lowp float tt; void main() { - gl_FragColor = mix(texture2D(texture, fTexA), texture2D(texture, fTexB), progress) * fColor.w; + gl_FragColor = mix(texture2D(texture, fTexA), texture2D(texture, fTexB), progress) + * fColor + * texture2D(colortable, vec2(tt, 0.5)) + * (texture2D(opacitytable, vec2(tt, 0.5)).w * qt_Opacity); } diff --git a/src/declarative/particles/defaultshaders/spritevertex.shader b/src/declarative/particles/defaultshaders/spritevertex.shader index 78b8e36b3b..7d89726fc2 100644 --- a/src/declarative/particles/defaultshaders/spritevertex.shader +++ b/src/declarative/particles/defaultshaders/spritevertex.shader @@ -1,21 +1,25 @@ attribute highp vec2 vPos; -attribute highp vec2 vTex; +attribute highp vec2 vTex; attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration +attribute lowp vec4 vColor; +attribute highp vec4 vDeformVec; //x,y x unit vector; z,w = y unit vector +attribute highp vec3 vRotation; //x = radians of rotation, y=rotation speed, z= bool autoRotate attribute highp vec4 vAnimData;// idx, duration, frameCount (this anim), timestamp (this anim) -uniform highp mat4 matrix; -uniform highp float timestamp; -uniform lowp float opacity; +uniform highp mat4 qt_Matrix; +uniform highp float timestamp; uniform highp float framecount; //maximum of all anims uniform highp float animcount; +varying lowp float tt; varying highp vec2 fTexA; varying highp vec2 fTexB; varying lowp float progress; varying lowp vec4 fColor; -void main() { + +void main() { highp float size = vData.z; highp float endSize = vData.w; @@ -54,24 +58,36 @@ void main() { frameTex.y = 1. * ((vAnimData.x + 1.)/animcount); fTexB = frameTex; - //Applying Size here seems to screw with RockingAffector? highp float currentSize = mix(size, endSize, t * t); if (t < 0. || t > 1.) currentSize = 0.; - //If affector is mananging pos, they don't set speed? - highp vec2 pos = vPos - - currentSize / 2. + currentSize * vTex // adjust size - + vVec.xy * t * vData.y // apply speed vector.. - + 0.5 * vVec.zw * pow(t * vData.y, 2.); - - gl_Position = matrix * vec4(pos.x, pos.y, 0, 1); - - // calculate opacity - highp float fadeIn = min(t * 10., 1.); - highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); + highp vec2 pos; + highp float rotation = vRotation.x + vRotation.y * t * vData.y; + if(vRotation.z == 1.0){ + highp vec2 curVel = vVec.zw * t * vData.y + vVec.xy; + rotation += atan(curVel.y, curVel.x); + } + highp vec2 trigCalcs = vec2(cos(rotation), sin(rotation)); + highp vec2 xDeform = vDeformVec.xy * currentSize * (vTex.x-0.5); + highp vec2 yDeform = vDeformVec.zw * currentSize * (vTex.y-0.5); + highp vec2 xRotatedDeform; + xRotatedDeform.x = trigCalcs.x*xDeform.x - trigCalcs.y*xDeform.y; + xRotatedDeform.y = trigCalcs.y*xDeform.x + trigCalcs.x*xDeform.y; + highp vec2 yRotatedDeform; + yRotatedDeform.x = trigCalcs.x*yDeform.x - trigCalcs.y*yDeform.y; + yRotatedDeform.y = trigCalcs.y*yDeform.x + trigCalcs.x*yDeform.y; + pos = vPos + + xRotatedDeform + + yRotatedDeform + //- vec2(1,1) * currentSize * 0.5 // 'center' + + vVec.xy * t * vData.y // apply speed + + 0.5 * vVec.zw * pow(t * vData.y, 2.); // apply acceleration + + gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1); + + fColor = vColor; + tt = t; - lowp vec4 white = vec4(1.); - fColor = white * fadeIn * fadeOut * opacity; } diff --git a/src/declarative/particles/defaultshaders/superfragment.shader b/src/declarative/particles/defaultshaders/superfragment.shader deleted file mode 100644 index a17f5841ca..0000000000 --- a/src/declarative/particles/defaultshaders/superfragment.shader +++ /dev/null @@ -1,11 +0,0 @@ -uniform sampler2D texture; -uniform sampler2D colortable; -uniform sampler2D opacitytable; - -varying highp vec2 fTex; -varying lowp vec4 fColor; -varying lowp float tt; - -void main() { - gl_FragColor = (texture2D(texture, fTex).w) * fColor * texture2D(colortable, vec2(tt, 0.5)) *( texture2D(opacitytable, vec2(tt, 0.5)).w); -} diff --git a/src/declarative/particles/defaultshaders/supervertex.shader b/src/declarative/particles/defaultshaders/supervertex.shader deleted file mode 100644 index 432a23ce05..0000000000 --- a/src/declarative/particles/defaultshaders/supervertex.shader +++ /dev/null @@ -1,57 +0,0 @@ -attribute highp vec2 vPos; -attribute highp vec2 vTex; -attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize -attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration -attribute lowp vec4 vColor; -attribute highp vec4 vDeformVec; //x,y x unit vector; z,w = y unit vector -attribute highp vec3 vRotation; //x = radians of rotation, y=rotation speed, z= bool autoRotate - -uniform highp mat4 matrix; -uniform highp float timestamp; -uniform sampler2D sizetable; -uniform sampler2D opacitytable; - -varying highp vec2 fTex; -varying lowp vec4 fColor; -varying lowp float tt; - -void main() { - fTex = vTex; - 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) * texture2D(sizetable, vec2(t,0.5)).w; - - if (t < 0. || t > 1.) - currentSize = 0.; - - highp vec2 pos; - highp float rotation = vRotation.x + vRotation.y * t * vData.y; - if(vRotation.z == 1.0){ - highp vec2 curVel = vVec.zw * t * vData.y + vVec.xy; - rotation += atan(curVel.y, curVel.x); - } - highp vec2 trigCalcs = vec2(cos(rotation), sin(rotation)); - highp vec2 xDeform = vDeformVec.xy * currentSize * (vTex.x-0.5); - highp vec2 yDeform = vDeformVec.zw * currentSize * (vTex.y-0.5); - highp vec2 xRotatedDeform; - xRotatedDeform.x = trigCalcs.x*xDeform.x - trigCalcs.y*xDeform.y; - xRotatedDeform.y = trigCalcs.y*xDeform.x + trigCalcs.x*xDeform.y; - highp vec2 yRotatedDeform; - yRotatedDeform.x = trigCalcs.x*yDeform.x - trigCalcs.y*yDeform.y; - yRotatedDeform.y = trigCalcs.y*yDeform.x + trigCalcs.x*yDeform.y; - pos = vPos - + xRotatedDeform - + yRotatedDeform - //- vec2(1,1) * currentSize * 0.5 // 'center' - + vVec.xy * t * vData.y // apply speed - + 0.5 * vVec.zw * pow(t * vData.y, 2.); // apply acceleration - - gl_Position = matrix * vec4(pos.x, pos.y, 0, 1); - - fColor = vColor; - tt = t; - -} diff --git a/src/declarative/particles/defaultshaders/tabledvertex.shader b/src/declarative/particles/defaultshaders/tabledvertex.shader index d09abbd040..ef3c35da82 100644 --- a/src/declarative/particles/defaultshaders/tabledvertex.shader +++ b/src/declarative/particles/defaultshaders/tabledvertex.shader @@ -5,7 +5,6 @@ attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration attribute lowp vec4 vColor; attribute highp vec4 vDeformVec; //x,y x unit vector; z,w = y unit vector attribute highp vec3 vRotation; //x = radians of rotation, y=rotation speed, z= bool autoRotate -attribute highp vec4 vAnimData;// idx, duration, frameCount (this anim), timestamp (this anim) uniform highp mat4 qt_Matrix; uniform highp float timestamp; @@ -17,12 +16,12 @@ varying lowp vec4 fColor; void main() { + fTex = vTex; highp float size = vData.z; highp float endSize = vData.w; highp float t = (timestamp - vData.x) / vData.y; - fTex = vTex; highp float currentSize = mix(size, endSize, t * t); if (t < 0. || t > 1.) currentSize = 0.; diff --git a/src/declarative/particles/defaultshaders/trailsfragment.shader b/src/declarative/particles/defaultshaders/trailsfragment.shader deleted file mode 100644 index d3db87fa30..0000000000 --- a/src/declarative/particles/defaultshaders/trailsfragment.shader +++ /dev/null @@ -1,8 +0,0 @@ -uniform sampler2D texture; - -varying highp vec2 fTex; -varying lowp vec4 fColor; - -void main() { - gl_FragColor = (texture2D(texture, fTex).w) * fColor; -} diff --git a/src/declarative/particles/defaultshaders/ultrafragment.shader b/src/declarative/particles/defaultshaders/ultrafragment.shader deleted file mode 100644 index 0627d0f1e8..0000000000 --- a/src/declarative/particles/defaultshaders/ultrafragment.shader +++ /dev/null @@ -1,16 +0,0 @@ -uniform sampler2D texture; -uniform sampler2D colortable; -uniform sampler2D opacitytable; - -varying highp vec2 fTexA; -varying highp vec2 fTexB; -varying lowp float progress; -varying lowp vec4 fColor; -varying lowp float tt; - -void main() { - gl_FragColor = mix(texture2D(texture, fTexA), texture2D(texture, fTexB), progress) - * fColor - * texture2D(colortable, vec2(tt, 0.5)) - *( texture2D(opacitytable, vec2(tt, 0.5)).w); -} diff --git a/src/declarative/particles/defaultshaders/ultravertex.shader b/src/declarative/particles/defaultshaders/ultravertex.shader deleted file mode 100644 index 65a1a3077a..0000000000 --- a/src/declarative/particles/defaultshaders/ultravertex.shader +++ /dev/null @@ -1,94 +0,0 @@ -attribute highp vec2 vPos; -attribute highp vec2 vTex; -attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize -attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration -attribute lowp vec4 vColor; -attribute highp vec4 vDeformVec; //x,y x unit vector; z,w = y unit vector -attribute highp vec3 vRotation; //x = radians of rotation, y=rotation speed, z= bool autoRotate -attribute highp vec4 vAnimData;// idx, duration, frameCount (this anim), timestamp (this anim) - -uniform highp mat4 matrix; -uniform highp float timestamp; -uniform highp float framecount; //maximum of all anims -uniform highp float animcount; -uniform sampler2D sizetable; - -varying lowp float tt; -varying highp vec2 fTexA; -varying highp vec2 fTexB; -varying lowp float progress; -varying lowp vec4 fColor; - - -void main() { - highp float size = vData.z; - highp float endSize = vData.w; - - highp float t = (timestamp - vData.x) / vData.y; - - //Calculate frame location in texture - highp float frameIndex = mod((((timestamp - vAnimData.w)*1000.)/vAnimData.y),vAnimData.z); - progress = mod((timestamp - vAnimData.w)*1000., vAnimData.y) / vAnimData.y; - - frameIndex = floor(frameIndex); - highp vec2 frameTex = vTex; - if(vTex.x == 0.) - frameTex.x = (frameIndex/framecount); - else - frameTex.x = 1. * ((frameIndex + 1.)/framecount); - - if(vTex.y == 0.) - frameTex.y = (vAnimData.x/animcount); - else - frameTex.y = 1. * ((vAnimData.x + 1.)/animcount); - - fTexA = frameTex; - //Next frame is also passed, for interpolation - //### Should the next anim be precalculated to allow for interpolation there? - if(frameIndex != vAnimData.z - 1.)//Can't do it for the last frame though, this anim may not loop - frameIndex = mod(frameIndex+1., vAnimData.z); - - if(vTex.x == 0.) - frameTex.x = (frameIndex/framecount); - else - frameTex.x = 1. * ((frameIndex + 1.)/framecount); - - if(vTex.y == 0.) - frameTex.y = (vAnimData.x/animcount); - else - frameTex.y = 1. * ((vAnimData.x + 1.)/animcount); - fTexB = frameTex; - - highp float currentSize = mix(size, endSize, t * t) * texture2D(sizetable, vec2(t,0.5)).w; - - if (t < 0. || t > 1.) - currentSize = 0.; - - highp vec2 pos; - highp float rotation = vRotation.x + vRotation.y * t * vData.y; - if(vRotation.z == 1.0){ - highp vec2 curVel = vVec.zw * t * vData.y + vVec.xy; - rotation += atan(curVel.y, curVel.x); - } - highp vec2 trigCalcs = vec2(cos(rotation), sin(rotation)); - highp vec2 xDeform = vDeformVec.xy * currentSize * (vTex.x-0.5); - highp vec2 yDeform = vDeformVec.zw * currentSize * (vTex.y-0.5); - highp vec2 xRotatedDeform; - xRotatedDeform.x = trigCalcs.x*xDeform.x - trigCalcs.y*xDeform.y; - xRotatedDeform.y = trigCalcs.y*xDeform.x + trigCalcs.x*xDeform.y; - highp vec2 yRotatedDeform; - yRotatedDeform.x = trigCalcs.x*yDeform.x - trigCalcs.y*yDeform.y; - yRotatedDeform.y = trigCalcs.y*yDeform.x + trigCalcs.x*yDeform.y; - pos = vPos - + xRotatedDeform - + yRotatedDeform - //- vec2(1,1) * currentSize * 0.5 // 'center' - + vVec.xy * t * vData.y // apply speed - + 0.5 * vVec.zw * pow(t * vData.y, 2.); // apply acceleration - - gl_Position = matrix * vec4(pos.x, pos.y, 0, 1); - - fColor = vColor; - tt = t; - -} |