aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/particles/customparticle
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/particles/customparticle')
-rw-r--r--examples/quick/particles/customparticle/content/blurparticles.qml142
-rw-r--r--examples/quick/particles/customparticle/content/fragmentshader.qml116
-rw-r--r--examples/quick/particles/customparticle/content/imagecolors.qml126
-rw-r--r--examples/quick/particles/customparticle/customparticle.pro9
-rw-r--r--examples/quick/particles/customparticle/customparticle.qml56
-rw-r--r--examples/quick/particles/customparticle/customparticle.qmlproject16
-rw-r--r--examples/quick/particles/customparticle/doc/images/qml-customparticle-example.pngbin0 -> 123781 bytes
-rw-r--r--examples/quick/particles/customparticle/doc/src/customparticle.qdoc54
-rw-r--r--examples/quick/particles/customparticle/main.cpp41
9 files changed, 560 insertions, 0 deletions
diff --git a/examples/quick/particles/customparticle/content/blurparticles.qml b/examples/quick/particles/customparticle/content/blurparticles.qml
new file mode 100644
index 0000000000..30197fe414
--- /dev/null
+++ b/examples/quick/particles/customparticle/content/blurparticles.qml
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "white"
+ width: 240
+ height: 360
+ ParticleSystem {
+ id: sys
+ }
+ Emitter {
+ system:sys
+ height: parent.height
+ emitRate: 1
+ lifeSpan: 12000
+ velocity: PointDirection {x:20;}
+ size: 128
+ }
+ ShaderEffectSource {
+ id: theSource
+ sourceItem: theItem
+ hideSource: true
+ }
+ Image {
+ id: theItem
+ source: "../../images/starfish_1.png"
+ }
+
+ CustomParticle {
+ system: sys
+ //! [vertex]
+ vertexShader:"
+ uniform lowp float qt_Opacity;
+ varying lowp float fFade;
+ varying lowp float fBlur;
+
+ void main() {
+ defaultMain();
+ highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y;
+ highp float fadeIn = min(t * 10., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+
+ fFade = fadeIn * fadeOut * qt_Opacity;
+ fBlur = max(0.2 * t, t * qt_ParticleR);
+ }
+ "
+ //! [vertex]
+ property variant source: theSource
+ property variant blurred: ShaderEffectSource {
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(0.0, 1.0 / height)
+ property variant source: ShaderEffectSource {
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(1.0 / width, 0.0)
+ property variant source: theSource
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
+ }
+ }
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
+ }
+ }
+ //! [fragment]
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform sampler2D blurred;
+ varying highp vec2 qt_TexCoord0;
+ varying highp float fBlur;
+ varying highp float fFade;
+ void main() {
+ gl_FragColor = mix(texture2D(source, qt_TexCoord0), texture2D(blurred, qt_TexCoord0), min(1.0,fBlur*3.0)) * fFade;
+ }"
+ //! [fragment]
+
+ }
+}
+
diff --git a/examples/quick/particles/customparticle/content/fragmentshader.qml b/examples/quick/particles/customparticle/content/fragmentshader.qml
new file mode 100644
index 0000000000..2cea780f33
--- /dev/null
+++ b/examples/quick/particles/customparticle/content/fragmentshader.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+ParticleSystem {
+ id: root
+ width: 320
+ height: 480
+ Rectangle {
+ z: -1
+ anchors.fill: parent
+ color: "black"
+ Text {
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 14
+ color: "white"
+ text: "It's all in the fragment shader."
+ }
+ }
+
+ Emitter {
+ emitRate: 400
+ lifeSpan: 8000
+ size: 24
+ sizeVariation: 16
+ velocity: PointDirection {x: root.width/10; y: root.height/10;}
+ acceleration: PointDirection {x: -root.width/40; y: -root.height/40; xVariation: -root.width/20; yVariation: -root.width/20}
+ }
+
+ CustomParticle {
+ vertexShader:"
+ uniform lowp float qt_Opacity;
+ varying lowp float fFade;
+ varying highp vec2 fPos;
+
+ void main() {
+ qt_TexCoord0 = qt_ParticleTex;
+ highp float size = qt_ParticleData.z;
+ highp float endSize = qt_ParticleData.w;
+
+ highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y;
+
+ highp float currentSize = mix(size, endSize, t * t);
+
+ if (t < 0. || t > 1.)
+ currentSize = 0.;
+
+ highp vec2 pos = qt_ParticlePos
+ - currentSize / 2. + currentSize * qt_ParticleTex // adjust size
+ + qt_ParticleVec.xy * t * qt_ParticleData.y // apply velocity vector..
+ + 0.5 * qt_ParticleVec.zw * pow(t * qt_ParticleData.y, 2.);
+
+ gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1);
+
+ highp float fadeIn = min(t * 20., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+
+ fFade = fadeIn * fadeOut * qt_Opacity;
+ fPos = vec2(pos.x/320., pos.y/480.);
+ }
+ "
+ //! [0]
+ fragmentShader: "
+ varying highp vec2 fPos;
+ varying lowp float fFade;
+ varying highp vec2 qt_TexCoord0;
+ void main() {//*2 because this generates dark colors mostly
+ highp vec2 circlePos = qt_TexCoord0*2.0 - vec2(1.0,1.0);
+ highp float dist = length(circlePos);
+ highp float circleFactor = max(min(1.0 - dist, 1.0), 0.0);
+ gl_FragColor = vec4(fPos.x*2.0 - fPos.y, fPos.y*2.0 - fPos.x, fPos.x*fPos.y*2.0, 0.0) * circleFactor * fFade;
+ }"
+ //! [0]
+
+ }
+}
diff --git a/examples/quick/particles/customparticle/content/imagecolors.qml b/examples/quick/particles/customparticle/content/imagecolors.qml
new file mode 100644
index 0000000000..857375a05c
--- /dev/null
+++ b/examples/quick/particles/customparticle/content/imagecolors.qml
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: root
+ color: "white"
+ width: 310
+ height: 300
+ anchors.centerIn: parent
+ ParticleSystem { id: sys }
+ CustomParticle {
+ system: sys
+ property real maxWidth: root.width
+ property real maxHeight: root.height
+ ShaderEffectSource {
+ id: pictureSource
+ sourceItem: picture
+ hideSource: true
+ }
+ Image {
+ id: picture
+ source: "../../images/starfish_3.png"
+ }
+ ShaderEffectSource {
+ id: particleSource
+ sourceItem: particle
+ hideSource: true
+ }
+ Image {
+ id: particle
+ source: "../../images/particle4.png"
+ }
+ //! [vertex]
+ vertexShader:"
+ uniform highp float maxWidth;
+ uniform highp float maxHeight;
+ varying highp vec2 fTex2;
+ varying lowp float fFade;
+ uniform lowp float qt_Opacity;
+
+ void main() {
+
+ fTex2 = vec2(qt_ParticlePos.x, qt_ParticlePos.y);
+ //Uncomment this next line for each particle to use full texture, instead of the solid color at the center of the particle.
+ //fTex2 = fTex2 + ((- qt_ParticleData.z / 2. + qt_ParticleData.z) * qt_ParticleTex); //Adjusts size so it's like a chunk of image.
+ fTex2 = fTex2 / vec2(maxWidth, maxHeight);
+ highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y;
+ fFade = min(t*4., (1.-t*t)*.75) * qt_Opacity;
+ defaultMain();
+ }
+ "
+ //! [vertex]
+ property variant particleTexture: particleSource
+ property variant pictureTexture: pictureSource
+ //! [fragment]
+ fragmentShader: "
+ uniform sampler2D particleTexture;
+ uniform sampler2D pictureTexture;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 fTex2;
+ varying lowp float fFade;
+ void main() {
+ gl_FragColor = texture2D(pictureTexture, fTex2) * texture2D(particleTexture, qt_TexCoord0).w * fFade;
+ }"
+ //! [fragment]
+ }
+
+ Emitter {
+ id: emitter
+ system: sys
+ enabled: false
+ lifeSpan: 8000
+ maximumEmitted: 4000
+ anchors.fill: parent
+ size: 16
+ acceleration: PointDirection { xVariation: 12; yVariation: 12 }
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: emitter.burst(4000);
+ }
+ }
+}
diff --git a/examples/quick/particles/customparticle/customparticle.pro b/examples/quick/particles/customparticle/customparticle.pro
new file mode 100644
index 0000000000..77db1a6aab
--- /dev/null
+++ b/examples/quick/particles/customparticle/customparticle.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+
+QT += quick qml
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/customparticle
+qml.files = customparticle.qml content
+qml.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/customparticle
+INSTALLS += target qml
diff --git a/examples/quick/particles/customparticle/customparticle.qml b/examples/quick/particles/customparticle/customparticle.qml
new file mode 100644
index 0000000000..ee93648132
--- /dev/null
+++ b/examples/quick/particles/customparticle/customparticle.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../../shared" as Examples
+
+Item {
+ height: 480
+ width: 320
+ Examples.LauncherList {
+ id: ll
+ anchors.fill: parent
+ Component.onCompleted: {
+ addExample("Blur Particles", "Particles that get blurred over time", Qt.resolvedUrl("content/blurparticles.qml"));
+ addExample("Fragment Shader", "Particles drawn with a custom fragment shader", Qt.resolvedUrl("content/fragmentshader.qml"));
+ addExample("Image Colors", "An image explodes into colored particles", Qt.resolvedUrl("content/imagecolors.qml"));
+ }
+ }
+}
diff --git a/examples/quick/particles/customparticle/customparticle.qmlproject b/examples/quick/particles/customparticle/customparticle.qmlproject
new file mode 100644
index 0000000000..6ea1849e31
--- /dev/null
+++ b/examples/quick/particles/customparticle/customparticle.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "customparticle.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/particles/customparticle/doc/images/qml-customparticle-example.png b/examples/quick/particles/customparticle/doc/images/qml-customparticle-example.png
new file mode 100644
index 0000000000..e23c6c8efc
--- /dev/null
+++ b/examples/quick/particles/customparticle/doc/images/qml-customparticle-example.png
Binary files differ
diff --git a/examples/quick/particles/customparticle/doc/src/customparticle.qdoc b/examples/quick/particles/customparticle/doc/src/customparticle.qdoc
new file mode 100644
index 0000000000..39c3d7c101
--- /dev/null
+++ b/examples/quick/particles/customparticle/doc/src/customparticle.qdoc
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title QtQuick.Particles Examples - CustomParticle
+ \example particles/customparticle
+ \brief This is a collection of examples using CustomParticle in the QML particle system.
+ \image qml-customparticle-example.png
+
+ This is a collection of small QML examples relating to using CustomParticle in the particle system.
+ Each example is a small QML file emphasizing a different way to use CustomParticle.
+
+ Blur Particles adds a blur effect to the particles, which increases over the particle's life time.
+ It uses a custom vertex shader:
+ \snippet particles/customparticle/content/blurparticles.qml vertex
+ to propagate life time simulation to a custom fragement shader:
+ \snippet particles/customparticle/content/blurparticles.qml fragment
+ which has access to both the normal image sampler and a blurred sampler, the image plus a ShaderEffect.
+
+ Fragment Shader just uses the particle system as a vertex delivery system.
+ \snippet particles/customparticle/content/fragmentshader.qml 0
+
+ Image Colors uses CustomParticle to assign colors to particles based on their location in a picture.
+ The vertex shader,
+ \snippet particles/customparticle/content/imagecolors.qml vertex
+ passes along the starting position for each vertex to the fragment shader,
+ \snippet particles/customparticle/content/imagecolors.qml fragment
+ which uses it to determine the color for that particle.
+
+*/
diff --git a/examples/quick/particles/customparticle/main.cpp b/examples/quick/particles/customparticle/main.cpp
new file mode 100644
index 0000000000..ec5619c6f0
--- /dev/null
+++ b/examples/quick/particles/customparticle/main.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(customparticle)