Do not try to apply autoRotation when the particle has no velocity
authorAlan Alpert <alan.alpert@nokia.com>
Tue, 1 May 2012 06:57:05 +0000 (16:57 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 3 May 2012 06:05:33 +0000 (08:05 +0200)
Task-number: QTBUG-25025

Change-Id: Ibc1340d6ea0e36a8bf412f4da704ef8cd3447294
Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
src/particles/qquickimageparticle.cpp

index 268dfeb..d20862a 100644 (file)
@@ -158,7 +158,8 @@ static const char vertexShaderCode[] =
     "            highp float rotation = vRotation.x + vRotation.y * t * vData.y;\n"
     "            if (vRotation.z == 1.0){\n"
     "                highp vec2 curVel = vVec.zw * t * vData.y + vVec.xy;\n"
-    "                rotation += atan(curVel.y, curVel.x);\n"
+    "                if (length(curVel) > 0.)\n"
+    "                    rotation += atan(curVel.y, curVel.x);\n"
     "            }\n"
     "            highp vec2 trigCalcs = vec2(cos(rotation), sin(rotation));\n"
     "            highp vec4 deform = vDeformVec * currentSize * (vPosTex.zzww - 0.5);\n"