Clean up ImageParticle shader
authorAlan Alpert <alan.alpert@nokia.com>
Fri, 28 Oct 2011 10:10:31 +0000 (20:10 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 1 Nov 2011 01:42:00 +0000 (02:42 +0100)
Avoid implicit float casts in GLSL and bail out of size == 0 properly

Change-Id: I72a742697089d88c64fc05d23d3009cdcfdb480b
Reviewed-by: Martin Jones <martin.jones@nokia.com>
src/declarative/particles/qquickimageparticle.cpp

index 6345280..49bdcb2 100644 (file)
@@ -150,10 +150,16 @@ static const char vertexShaderCode[] =
     "    else if (entry == 2.)\n"
     "        currentSize = currentSize * fadeIn * fadeOut;\n"
     "\n"
-    "    if (currentSize <= 0)//Sizes too small look jittery as they move\n"
-    "        currentSize = 0;\n"
-    "    else if (currentSize < 3)\n"
-    "        currentSize = 3;\n"
+    "    if (currentSize <= 0.){\n"
+    "#ifdef DEFORM //Not point sprites\n"
+    "        gl_Position = qt_Matrix * vec4(vPos.x, vPos.y, 0., 1.);\n"
+    "#else\n"
+    "        gl_PointSize = 0.;\n"
+    "#endif\n"
+    "        return;\n"
+    "    }\n"
+    "    if (currentSize < 3.)//Sizes too small look jittery as they move\n"
+    "        currentSize = 3.;\n"
     "\n"
     "    highp vec2 pos;\n"
     "#ifdef DEFORM\n"