diff options
Diffstat (limited to 'src/declarative/particles/qsgimageparticle.cpp')
-rw-r--r-- | src/declarative/particles/qsgimageparticle.cpp | 119 |
1 files changed, 104 insertions, 15 deletions
diff --git a/src/declarative/particles/qsgimageparticle.cpp b/src/declarative/particles/qsgimageparticle.cpp index 89e9a7db8c..2c7f84f809 100644 --- a/src/declarative/particles/qsgimageparticle.cpp +++ b/src/declarative/particles/qsgimageparticle.cpp @@ -53,7 +53,6 @@ #include <qsgengine.h> QT_BEGIN_NAMESPACE - //###Switch to define later, for now user-friendly (no compilation) debugging is worth it DEFINE_BOOL_CONFIG_OPTION(qmlParticlesDebug, QML_PARTICLES_DEBUG) @@ -448,68 +447,157 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size) This element renders a logical particle as an image. The image can be - colorized - - roatated + - rotated - deformed - a sprite-based animation */ /*! \qmlproperty url QtQuick.Particles2::ImageParticle::source + + The source image to be used. + + If the image is a sprite animation, use the sprite property instead. +*/ +/*! + \qmlproperty list<Sprite> QtQuick.Particles2::ImageParticle::sprites + + The sprite or sprites used to draw this particle. */ /*! \qmlproperty url QtQuick.Particles2::ImageParticle::colorTable + + An image whose color will be used as a 1D texture to determine color over life. E.g. when + the particle is halfway through its lifetime, it will have the color specified halfway + across the image. + + This color is blended with the color property and the color of the source image. */ /*! \qmlproperty url QtQuick.Particles2::ImageParticle::sizeTable - Note that currently sizeTable is ignored for sprite particles. + An image whose opacity will be used as a 1D texture to determine size over life. + + This property is expected to be removed shortly, in favor of custom easing curves to determine size over life. */ /*! \qmlproperty url QtQuick.Particles2::ImageParticle::opacityTable + + An image whose opacity will be used as a 1D texture to determine size over life. + + This property is expected to be removed shortly, in favor of custom easing curves to determine opacity over life. */ /*! \qmlproperty color QtQuick.Particles2::ImageParticle::color + + If a color is specified, the provided image will be colorized with it. + + Default is white (no change). */ /*! \qmlproperty real QtQuick.Particles2::ImageParticle::colorVariation + + This number represents the color variation applied to individual particles. + Setting colorVariation is the same as setting redVariation, greenVariation, + and blueVariation to the same number. + + Each channel can vary between particle by up to colorVariation from its usual color. + + Color is measured, per channel, from 0.0 to 1.0. + + Default is 0.0 */ /*! \qmlproperty real QtQuick.Particles2::ImageParticle::redVariation + The variation in the red color channel between particles. + + Color is measured, per channel, from 0.0 to 1.0. + + Default is 0.0 */ /*! \qmlproperty real QtQuick.Particles2::ImageParticle::greenVariation + The variation in the green color channel between particles. + + Color is measured, per channel, from 0.0 to 1.0. + + Default is 0.0 */ /*! \qmlproperty real QtQuick.Particles2::ImageParticle::blueVariation + The variation in the blue color channel between particles. + + Color is measured, per channel, from 0.0 to 1.0. + + Default is 0.0 */ /*! \qmlproperty real QtQuick.Particles2::ImageParticle::alpha + An alpha to be applied to the image. This value is multiplied by the value in + the image, and the value in the color property. + + Particles have additive blending, so lower alpha on single particles leads + to stronger effects when multiple particles overlap. + + Alpha is measured from 0.0 to 1.0. + + Default is 1.0 */ /*! \qmlproperty real QtQuick.Particles2::ImageParticle::alphaVariation + The variation in the alpha channel between particles. + + Alpha is measured from 0.0 to 1.0. + + Default is 0.0 */ /*! \qmlproperty real QtQuick.Particles2::ImageParticle::rotation + + If set the image will be rotated by this many degrees before it is drawn. + + The particle coordinates are not transformed. */ /*! \qmlproperty real QtQuick.Particles2::ImageParticle::rotationVariation + + If set the rotation of individual particles will vary by up to this much + between particles. + */ /*! \qmlproperty real QtQuick.Particles2::ImageParticle::rotationSpeed + + If set particles will rotate at this speed in degrees/second. */ /*! \qmlproperty real QtQuick.Particles2::ImageParticle::rotationSpeedVariation + + If set the rotationSpeed of individual particles will vary by up to this much + between particles. + */ /*! \qmlproperty bool QtQuick.Particles2::ImageParticle::autoRotation + + If set to true then a rotation will be applied on top of the particles rotation, so + that it faces the direction of travel. So to face away from the direction of travel, + set autoRotation to true and rotation to 180. + + Default is false */ /*! \qmlproperty StochasticDirection QtQuick.Particles2::ImageParticle::xVector + + Allows you to deform the particle image when drawn. The rectangular image will + be deformed so that the horizontal sides are in the shape of this vector instead + of (1,0). */ /*! \qmlproperty StochasticDirection QtQuick.Particles2::ImageParticle::yVector -*/ -/*! - \qmlproperty list<Sprite> QtQuick.Particles2::ImageParticle::sprites + + Allows you to deform the particle image when drawn. The rectangular image will + be deformed so that the vertical sides are in the shape of this vector instead + of (0,1). */ /*! \qmlproperty EntryEffect QtQuick.Particles2::ImageParticle::entryEffect @@ -520,7 +608,7 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size) Acceptable values are \list \o None: Particles just appear and disappear. - \o Fade: Particles fade in from 0. opacity at the start of their life, and fade out to 0. at the end. + \o Fade: Particles fade in from 0 opacity at the start of their life, and fade out to 0 at the end. \o Scale: Particles scale in from 0 size at the start of their life, and scale back to 0 at the end. \endlist @@ -724,7 +812,7 @@ void QSGImageParticle::setAutoRotation(bool arg) reset(); } -void QSGImageParticle::setXVector(QSGStochasticDirection* arg) +void QSGImageParticle::setXVector(QSGDirection* arg) { if (m_xVector != arg) { m_xVector = arg; @@ -734,7 +822,7 @@ void QSGImageParticle::setXVector(QSGStochasticDirection* arg) reset(); } -void QSGImageParticle::setYVector(QSGStochasticDirection* arg) +void QSGImageParticle::setYVector(QSGDirection* arg) { if (m_yVector != arg) { m_yVector = arg; @@ -1024,13 +1112,14 @@ QSGNode *QSGImageParticle::updatePaintNode(QSGNode *, UpdatePaintNodeData *) m_pleaseReset = false; } - if (m_system && m_system->isRunning()) + if (m_system && m_system->isRunning() && !m_system->isPaused()){ prepareNextFrame(); - if (m_rootNode){ - update(); - //### Should I be using dirty geometry too/instead? - foreach (QSGGeometryNode* node, m_nodes) - node->markDirty(QSGNode::DirtyMaterial); + if (m_rootNode) { + update(); + //### Should I be using dirty geometry too/instead? + foreach (QSGGeometryNode* node, m_nodes) + node->markDirty(QSGNode::DirtyMaterial); + } } return m_rootNode; |