uint updateSprites(uint time);
protected:
- friend class QSGParticleSystem;
+ friend class QQuickParticleSystem;
void restart(int index);
void addToUpdateList(uint t, int idx);
int goalSeek(int curState, int idx, int dist=-1);
HEADERS += \
- $$PWD/qsgangledirection_p.h \
- $$PWD/qsgcustomparticle_p.h \
- $$PWD/qsgcustomaffector_p.h \
- $$PWD/qsgellipseextruder_p.h \
- $$PWD/qsgtrailemitter_p.h \
- $$PWD/qsgfriction_p.h \
- $$PWD/qsggravity_p.h \
- $$PWD/qsgimageparticle_p.h \
- $$PWD/qsgitemparticle_p.h \
- $$PWD/qsgage_p.h \
- $$PWD/qsglineextruder_p.h \
- $$PWD/qsgmaskextruder_p.h \
- $$PWD/qsgparticleaffector_p.h \
- $$PWD/qsgparticleemitter_p.h \
- $$PWD/qsgparticleextruder_p.h \
- $$PWD/qsgparticlepainter_p.h \
- $$PWD/qsgparticlesmodule_p.h \
- $$PWD/qsgparticlesystem_p.h \
- $$PWD/qsgpointattractor_p.h \
- $$PWD/qsgpointdirection_p.h \
- $$PWD/qsgspritegoal_p.h \
- $$PWD/qsgdirection_p.h \
- $$PWD/qsgtargetdirection_p.h \
- $$PWD/qsgturbulence_p.h \
- $$PWD/qsgwander_p.h \
- $$PWD/qsgcumulativedirection_p.h \
- $$PWD/qsgv8particledata_p.h \
- $$PWD/qsgrectangleextruder_p.h \
- $$PWD/qsgparticlegroup_p.h \
- $$PWD/qsggroupgoal_p.h
+ $$PWD/qquickangledirection_p.h \
+ $$PWD/qquickcustomparticle_p.h \
+ $$PWD/qquickcustomaffector_p.h \
+ $$PWD/qquickellipseextruder_p.h \
+ $$PWD/qquicktrailemitter_p.h \
+ $$PWD/qquickfriction_p.h \
+ $$PWD/qquickgravity_p.h \
+ $$PWD/qquickimageparticle_p.h \
+ $$PWD/qquickitemparticle_p.h \
+ $$PWD/qquickage_p.h \
+ $$PWD/qquicklineextruder_p.h \
+ $$PWD/qquickmaskextruder_p.h \
+ $$PWD/qquickparticleaffector_p.h \
+ $$PWD/qquickparticleemitter_p.h \
+ $$PWD/qquickparticleextruder_p.h \
+ $$PWD/qquickparticlepainter_p.h \
+ $$PWD/qquickparticlesmodule_p.h \
+ $$PWD/qquickparticlesystem_p.h \
+ $$PWD/qquickpointattractor_p.h \
+ $$PWD/qquickpointdirection_p.h \
+ $$PWD/qquickspritegoal_p.h \
+ $$PWD/qquickdirection_p.h \
+ $$PWD/qquicktargetdirection_p.h \
+ $$PWD/qquickturbulence_p.h \
+ $$PWD/qquickwander_p.h \
+ $$PWD/qquickcumulativedirection_p.h \
+ $$PWD/qquickv8particledata_p.h \
+ $$PWD/qquickrectangleextruder_p.h \
+ $$PWD/qquickparticlegroup_p.h \
+ $$PWD/qquickgroupgoal_p.h
SOURCES += \
- $$PWD/qsgangledirection.cpp \
- $$PWD/qsgcustomparticle.cpp \
- $$PWD/qsgcustomaffector.cpp \
- $$PWD/qsgellipseextruder.cpp \
- $$PWD/qsgtrailemitter.cpp \
- $$PWD/qsgfriction.cpp \
- $$PWD/qsggravity.cpp \
- $$PWD/qsgimageparticle.cpp \
- $$PWD/qsgitemparticle.cpp \
- $$PWD/qsgage.cpp \
- $$PWD/qsglineextruder.cpp \
- $$PWD/qsgmaskextruder.cpp \
- $$PWD/qsgparticleaffector.cpp \
- $$PWD/qsgparticleemitter.cpp \
- $$PWD/qsgparticleextruder.cpp \
- $$PWD/qsgparticlepainter.cpp \
- $$PWD/qsgparticlesmodule.cpp \
- $$PWD/qsgparticlesystem.cpp \
- $$PWD/qsgpointattractor.cpp \
- $$PWD/qsgpointdirection.cpp \
- $$PWD/qsgspritegoal.cpp \
- $$PWD/qsgdirection.cpp \
- $$PWD/qsgtargetdirection.cpp \
- $$PWD/qsgturbulence.cpp \
- $$PWD/qsgwander.cpp \
- $$PWD/qsgcumulativedirection.cpp \
- $$PWD/qsgv8particledata.cpp \
- $$PWD/qsgrectangleextruder.cpp \
- $$PWD/qsgparticlegroup.cpp \
- $$PWD/qsggroupgoal.cpp
+ $$PWD/qquickangledirection.cpp \
+ $$PWD/qquickcustomparticle.cpp \
+ $$PWD/qquickcustomaffector.cpp \
+ $$PWD/qquickellipseextruder.cpp \
+ $$PWD/qquicktrailemitter.cpp \
+ $$PWD/qquickfriction.cpp \
+ $$PWD/qquickgravity.cpp \
+ $$PWD/qquickimageparticle.cpp \
+ $$PWD/qquickitemparticle.cpp \
+ $$PWD/qquickage.cpp \
+ $$PWD/qquicklineextruder.cpp \
+ $$PWD/qquickmaskextruder.cpp \
+ $$PWD/qquickparticleaffector.cpp \
+ $$PWD/qquickparticleemitter.cpp \
+ $$PWD/qquickparticleextruder.cpp \
+ $$PWD/qquickparticlepainter.cpp \
+ $$PWD/qquickparticlesmodule.cpp \
+ $$PWD/qquickparticlesystem.cpp \
+ $$PWD/qquickpointattractor.cpp \
+ $$PWD/qquickpointdirection.cpp \
+ $$PWD/qquickspritegoal.cpp \
+ $$PWD/qquickdirection.cpp \
+ $$PWD/qquicktargetdirection.cpp \
+ $$PWD/qquickturbulence.cpp \
+ $$PWD/qquickwander.cpp \
+ $$PWD/qquickcumulativedirection.cpp \
+ $$PWD/qquickv8particledata.cpp \
+ $$PWD/qquickrectangleextruder.cpp \
+ $$PWD/qquickparticlegroup.cpp \
+ $$PWD/qquickgroupgoal.cpp
RESOURCES += \
$$PWD/particles.qrc
**
****************************************************************************/
-#include "qsgage_p.h"
-#include "qsgparticleemitter_p.h"
+#include "qquickage_p.h"
+#include "qquickparticleemitter_p.h"
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Age QSGAgeAffector
+ \qmlclass Age QQuickAgeAffector
\inqmlmodule QtQuick.Particles 2
\inherits Affector
\brief The Age affector allows you to prematurely age particles
Default value is true.
*/
-QSGAgeAffector::QSGAgeAffector(QQuickItem *parent) :
- QSGParticleAffector(parent), m_lifeLeft(0), m_advancePosition(true)
+QQuickAgeAffector::QQuickAgeAffector(QQuickItem *parent) :
+ QQuickParticleAffector(parent), m_lifeLeft(0), m_advancePosition(true)
{
}
-bool QSGAgeAffector::affectParticle(QSGParticleData *d, qreal dt)
+bool QQuickAgeAffector::affectParticle(QQuickParticleData *d, qreal dt)
{
Q_UNUSED(dt);
if (d->stillAlive()){
#ifndef KILLAFFECTOR_H
#define KILLAFFECTOR_H
-#include "qsgparticleaffector_p.h"
+#include "qquickparticleaffector_p.h"
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGAgeAffector : public QSGParticleAffector
+class QQuickAgeAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(int lifeLeft READ lifeLeft WRITE setLifeLeft NOTIFY lifeLeftChanged)
Q_PROPERTY(bool advancePosition READ advancePosition WRITE setAdvancePosition NOTIFY advancePositionChanged)
public:
- explicit QSGAgeAffector(QQuickItem *parent = 0);
+ explicit QQuickAgeAffector(QQuickItem *parent = 0);
int lifeLeft() const
{
}
protected:
- virtual bool affectParticle(QSGParticleData *d, qreal dt);
+ virtual bool affectParticle(QQuickParticleData *d, qreal dt);
signals:
void lifeLeftChanged(int arg);
void advancePositionChanged(bool arg);
**
****************************************************************************/
-#include "qsgangledirection_p.h"
+#include "qquickangledirection_p.h"
#include <cmath>
QT_BEGIN_NAMESPACE
const qreal CONV = 0.017453292519943295;
/*!
- \qmlclass AngleDirection QSGAngleDirection
+ \qmlclass AngleDirection QQuickAngleDirection
\inqmlmodule QtQuick.Particles 2
\inherits Direction
\brief The AngleDirection element allows you to specify a direction that varies in angle
The default value is zero.
*/
-QSGAngleDirection::QSGAngleDirection(QObject *parent) :
- QSGDirection(parent)
+QQuickAngleDirection::QQuickAngleDirection(QObject *parent) :
+ QQuickDirection(parent)
, m_angle(0)
, m_magnitude(0)
, m_angleVariation(0)
}
-const QPointF QSGAngleDirection::sample(const QPointF &from)
+const QPointF QQuickAngleDirection::sample(const QPointF &from)
{
Q_UNUSED(from);
QPointF ret;
**
****************************************************************************/
-#ifndef QSGANGLEDDIRECTION_H
-#define QSGANGLEDDIRECTION_H
-#include "qsgdirection_p.h"
+#ifndef QQuickANGLEDDIRECTION_H
+#define QQuickANGLEDDIRECTION_H
+#include "qquickdirection_p.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QSGAngleDirection : public QSGDirection
+class QQuickAngleDirection : public QQuickDirection
{
Q_OBJECT
Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
Q_PROPERTY(qreal angleVariation READ angleVariation WRITE setAngleVariation NOTIFY angleVariationChanged)
Q_PROPERTY(qreal magnitudeVariation READ magnitudeVariation WRITE setMagnitudeVariation NOTIFY magnitudeVariationChanged)
public:
- explicit QSGAngleDirection(QObject *parent = 0);
+ explicit QQuickAngleDirection(QObject *parent = 0);
const QPointF sample(const QPointF &from);
qreal angle() const
{
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QSGANGLEDDIRECTION_H
+#endif // QQuickANGLEDDIRECTION_H
**
****************************************************************************/
-#include "qsgcumulativedirection_p.h"
+#include "qquickcumulativedirection_p.h"
QT_BEGIN_NAMESPACE
/*!
- \qmlclass CumulativeDirection QSGCumulativeDirection
+ \qmlclass CumulativeDirection QQuickCumulativeDirection
\inqmlmodule QtQuick.Particles 2
\inherits Direction
\brief The CumulativeDirection element allows you to specify a direction made of other directions
The CumulativeDirection element will act as a direction that sums the directions within it.
*/
-QSGCumulativeDirection::QSGCumulativeDirection(QObject *parent):QSGDirection(parent)
+QQuickCumulativeDirection::QQuickCumulativeDirection(QObject *parent):QQuickDirection(parent)
{
}
-QDeclarativeListProperty<QSGDirection> QSGCumulativeDirection::directions()
+QDeclarativeListProperty<QQuickDirection> QQuickCumulativeDirection::directions()
{
- return QDeclarativeListProperty<QSGDirection>(this, m_directions);//TODO: Proper list property
+ return QDeclarativeListProperty<QQuickDirection>(this, m_directions);//TODO: Proper list property
}
-const QPointF QSGCumulativeDirection::sample(const QPointF &from)
+const QPointF QQuickCumulativeDirection::sample(const QPointF &from)
{
QPointF ret;
- foreach (QSGDirection* dir, m_directions)
+ foreach (QQuickDirection* dir, m_directions)
ret += dir->sample(from);
return ret;
}
**
****************************************************************************/
-#ifndef QSGCUMULATIVEDIRECTION_P_H
-#define QSGCUMULATIVEDIRECTION_P_H
-#include "qsgdirection_p.h"
+#ifndef QQuickCUMULATIVEDIRECTION_P_H
+#define QQuickCUMULATIVEDIRECTION_P_H
+#include "qquickdirection_p.h"
#include <QDeclarativeListProperty>
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGCumulativeDirection : public QSGDirection
+class QQuickCumulativeDirection : public QQuickDirection
{
Q_OBJECT
- Q_PROPERTY(QDeclarativeListProperty<QSGDirection> directions READ directions)
+ Q_PROPERTY(QDeclarativeListProperty<QQuickDirection> directions READ directions)
Q_CLASSINFO("DefaultProperty", "directions")
public:
- explicit QSGCumulativeDirection(QObject *parent = 0);
- QDeclarativeListProperty<QSGDirection> directions();
+ explicit QQuickCumulativeDirection(QObject *parent = 0);
+ QDeclarativeListProperty<QQuickDirection> directions();
const QPointF sample(const QPointF &from);
private:
- QList<QSGDirection*> m_directions;
+ QList<QQuickDirection*> m_directions;
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QSGCUMULATIVEDIRECTION_P_H
+#endif // QQuickCUMULATIVEDIRECTION_P_H
**
****************************************************************************/
-#include "qsgcustomaffector_p.h"
+#include "qquickcustomaffector_p.h"
#include <private/qv8engine_p.h>
#include <private/qdeclarativeengine_p.h>
#include <QDeclarativeEngine>
Default is true.
*/
-QSGCustomAffector::QSGCustomAffector(QQuickItem *parent) :
- QSGParticleAffector(parent)
+QQuickCustomAffector::QQuickCustomAffector(QQuickItem *parent) :
+ QQuickParticleAffector(parent)
, m_position(&m_nullVector)
, m_speed(&m_nullVector)
, m_acceleration(&m_nullVector)
{
}
-bool QSGCustomAffector::isAffectConnected()
+bool QQuickCustomAffector::isAffectConnected()
{
static int idx = QObjectPrivate::get(this)->signalIndex("affectParticles(QDeclarativeV8Handle,qreal)");
return QObjectPrivate::get(this)->isSignalConnected(idx);
}
-void QSGCustomAffector::affectSystem(qreal dt)
+void QQuickCustomAffector::affectSystem(qreal dt)
{
if (!isAffectConnected()) {
- QSGParticleAffector::affectSystem(dt);
+ QQuickParticleAffector::affectSystem(dt);
return;
}
if (!m_enabled)
return;
updateOffsets();
- QList<QSGParticleData*> toAffect;
- foreach (QSGParticleGroupData* gd, m_system->groupData)
+ QList<QQuickParticleData*> toAffect;
+ foreach (QQuickParticleGroupData* gd, m_system->groupData)
if (activeGroup(m_system->groupData.key(gd)))
- foreach (QSGParticleData* d, gd->data)
+ foreach (QQuickParticleData* d, gd->data)
if (shouldAffect(d))
toAffect << d;
}
}
- foreach (QSGParticleData* d, toAffect)
+ foreach (QQuickParticleData* d, toAffect)
if (d->update == 1.0)
postAffect(d);
}
-bool QSGCustomAffector::affectParticle(QSGParticleData *d, qreal dt)
+bool QQuickCustomAffector::affectParticle(QQuickParticleData *d, qreal dt)
{
//This does the property based affecting, called by superclass if signal isn't hooked up.
bool changed = false;
return changed;
}
-void QSGCustomAffector::affectProperties(const QList<QSGParticleData*> particles, qreal dt)
+void QQuickCustomAffector::affectProperties(const QList<QQuickParticleData*> particles, qreal dt)
{
- foreach (QSGParticleData* d, particles)
+ foreach (QQuickParticleData* d, particles)
if ( affectParticle(d, dt) )
d->update = 1.0;
}
#define CUSTOMAFFECTOR_H
#include <QObject>
-#include "qsgparticlesystem_p.h"
-#include "qsgparticleextruder_p.h"
-#include "qsgparticleaffector_p.h"
-#include "qsgdirection_p.h"
+#include "qquickparticlesystem_p.h"
+#include "qquickparticleextruder_p.h"
+#include "qquickparticleaffector_p.h"
+#include "qquickdirection_p.h"
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGCustomAffector : public QSGParticleAffector
+class QQuickCustomAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(bool relative READ relative WRITE setRelative NOTIFY relativeChanged)
- Q_PROPERTY(QSGDirection *position READ position WRITE setPosition NOTIFY positionChanged RESET positionReset)
- Q_PROPERTY(QSGDirection *speed READ speed WRITE setSpeed NOTIFY speedChanged RESET speedReset)
- Q_PROPERTY(QSGDirection *acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged RESET accelerationReset)
+ Q_PROPERTY(QQuickDirection *position READ position WRITE setPosition NOTIFY positionChanged RESET positionReset)
+ Q_PROPERTY(QQuickDirection *speed READ speed WRITE setSpeed NOTIFY speedChanged RESET speedReset)
+ Q_PROPERTY(QQuickDirection *acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged RESET accelerationReset)
public:
- explicit QSGCustomAffector(QQuickItem *parent = 0);
+ explicit QQuickCustomAffector(QQuickItem *parent = 0);
virtual void affectSystem(qreal dt);
- QSGDirection * position() const
+ QQuickDirection * position() const
{
return m_position;
}
- QSGDirection * speed() const
+ QQuickDirection * speed() const
{
return m_speed;
}
- QSGDirection * acceleration() const
+ QQuickDirection * acceleration() const
{
return m_acceleration;
}
signals:
void affectParticles(QDeclarativeV8Handle particles, qreal dt);
- void positionChanged(QSGDirection * arg);
+ void positionChanged(QQuickDirection * arg);
- void speedChanged(QSGDirection * arg);
+ void speedChanged(QQuickDirection * arg);
- void accelerationChanged(QSGDirection * arg);
+ void accelerationChanged(QQuickDirection * arg);
void relativeChanged(bool arg);
public slots:
- void setPosition(QSGDirection * arg)
+ void setPosition(QQuickDirection * arg)
{
if (m_position != arg) {
m_position = arg;
}
}
- void setSpeed(QSGDirection * arg)
+ void setSpeed(QQuickDirection * arg)
{
if (m_speed != arg) {
m_speed = arg;
}
}
- void setAcceleration(QSGDirection * arg)
+ void setAcceleration(QQuickDirection * arg)
{
if (m_acceleration != arg) {
m_acceleration = arg;
protected:
bool isAffectConnected();
- virtual bool affectParticle(QSGParticleData *d, qreal dt);
+ virtual bool affectParticle(QQuickParticleData *d, qreal dt);
private:
- void affectProperties(const QList<QSGParticleData*> particles, qreal dt);
- QSGDirection * m_position;
- QSGDirection * m_speed;
- QSGDirection * m_acceleration;
+ void affectProperties(const QList<QQuickParticleData*> particles, qreal dt);
+ QQuickDirection * m_position;
+ QQuickDirection * m_speed;
+ QQuickDirection * m_acceleration;
- QSGDirection m_nullVector;
+ QQuickDirection m_nullVector;
bool m_relative;
};
**
****************************************************************************/
-#include "qsgcustomparticle_p.h"
+#include "qquickcustomparticle_p.h"
#include <private/qquickshadereffectmesh_p.h>
#include <cstdlib>
};
/*!
- \qmlclass CustomParticle QSGCustomParticle
+ \qmlclass CustomParticle QQuickCustomParticle
\inqmlmodule QtQuick.Particles 2
\inherits ParticlePainter
\brief The CustomParticle element allows you to specify your own shader to paint particles.
*/
-QSGCustomParticle::QSGCustomParticle(QQuickItem* parent)
- : QSGParticlePainter(parent)
+QQuickCustomParticle::QQuickCustomParticle(QQuickItem* parent)
+ : QQuickParticlePainter(parent)
, m_dirtyData(true)
, m_material(0)
, m_rootNode(0)
setFlag(QQuickItem::ItemHasContents);
}
-class QSGShaderEffectMaterialObject : public QObject, public QQuickShaderEffectMaterial { };
+class QQuickShaderEffectMaterialObject : public QObject, public QQuickShaderEffectMaterial { };
-QSGCustomParticle::~QSGCustomParticle()
+QQuickCustomParticle::~QQuickCustomParticle()
{
if (m_material)
m_material->deleteLater();
}
-void QSGCustomParticle::componentComplete()
+void QQuickCustomParticle::componentComplete()
{
reset();
- QSGParticlePainter::componentComplete();
+ QQuickParticlePainter::componentComplete();
}
sampler2D named "source".
*/
-void QSGCustomParticle::setFragmentShader(const QByteArray &code)
+void QQuickCustomParticle::setFragmentShader(const QByteArray &code)
{
if (m_source.fragmentCode.constData() == code.constData())
return;
over time, the particle data itself only has the starting position and spawn time.
*/
-void QSGCustomParticle::setVertexShader(const QByteArray &code)
+void QQuickCustomParticle::setVertexShader(const QByteArray &code)
{
if (m_source.vertexCode.constData() == code.constData())
return;
emit vertexShaderChanged();
}
-void QSGCustomParticle::reset()
+void QQuickCustomParticle::reset()
{
disconnectPropertySignals();
}
m_sources.clear();
- QSGParticlePainter::reset();
+ QQuickParticlePainter::reset();
m_pleaseReset = true;
update();
}
-void QSGCustomParticle::changeSource(int index)
+void QQuickCustomParticle::changeSource(int index)
{
Q_ASSERT(index >= 0 && index < m_sources.size());
QVariant v = property(m_sources.at(index).name.constData());
setSource(v, index);
}
-void QSGCustomParticle::updateData()
+void QQuickCustomParticle::updateData()
{
m_dirtyData = true;
update();
}
-void QSGCustomParticle::setSource(const QVariant &var, int index)
+void QQuickCustomParticle::setSource(const QVariant &var, int index)
{
Q_ASSERT(index >= 0 && index < m_sources.size());
return;
}
- // TODO: Copy better solution in QSGShaderEffect when they find it.
+ // TODO: Copy better solution in QQuickShaderEffect when they find it.
// 'source.item' needs a canvas to get a scenegraph node.
// The easiest way to make sure it gets a canvas is to
// make it a part of the same item tree as 'this'.
}
}
-void QSGCustomParticle::disconnectPropertySignals()
+void QQuickCustomParticle::disconnectPropertySignals()
{
disconnect(this, 0, this, SLOT(updateData()));
for (int i = 0; i < m_sources.size(); ++i) {
}
}
-void QSGCustomParticle::connectPropertySignals()
+void QQuickCustomParticle::connectPropertySignals()
{
QSet<QByteArray>::const_iterator it;
for (it = m_source.uniformNames.begin(); it != m_source.uniformNames.end(); ++it) {
if (pi >= 0) {
QMetaProperty mp = metaObject()->property(pi);
if (!mp.hasNotifySignal())
- qWarning("QSGCustomParticle: property '%s' does not have notification method!", it->constData());
+ qWarning("QQuickCustomParticle: property '%s' does not have notification method!", it->constData());
QByteArray signalName("2");
signalName.append(mp.notifySignal().signature());
connect(this, signalName, this, SLOT(updateData()));
} else {
- qWarning("QSGCustomParticle: '%s' does not have a matching property!", it->constData());
+ qWarning("QQuickCustomParticle: '%s' does not have a matching property!", it->constData());
}
}
for (int i = 0; i < m_sources.size(); ++i) {
source.mapper->setMapping(this, i);
connect(source.mapper, SIGNAL(mapped(int)), this, SLOT(changeSource(int)));
} else {
- qWarning("QSGCustomParticle: '%s' does not have a matching source!", source.name.constData());
+ qWarning("QQuickCustomParticle: '%s' does not have a matching source!", source.name.constData());
}
}
}
-void QSGCustomParticle::updateProperties()
+void QQuickCustomParticle::updateProperties()
{
QByteArray vertexCode = m_source.vertexCode;
QByteArray fragmentCode = m_source.fragmentCode;
lookThroughShaderCode(fragmentCode);
if (!m_source.respectsMatrix)
- qWarning("QSGCustomParticle: Missing reference to \'qt_Matrix\'.");
+ qWarning("QQuickCustomParticle: Missing reference to \'qt_Matrix\'.");
if (!m_source.respectsOpacity)
- qWarning("QSGCustomParticle: Missing reference to \'qt_Opacity\'.");
+ qWarning("QQuickCustomParticle: Missing reference to \'qt_Opacity\'.");
for (int i = 0; i < m_sources.size(); ++i) {
QVariant v = property(m_sources.at(i).name);
connectPropertySignals();
}
-void QSGCustomParticle::lookThroughShaderCode(const QByteArray &code)
+void QQuickCustomParticle::lookThroughShaderCode(const QByteArray &code)
{
// Regexp for matching attributes and uniforms.
// In human readable form: attribute|uniform [lowp|mediump|highp] <type> <name>
}
}
-QSGNode *QSGCustomParticle::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
+QSGNode *QQuickCustomParticle::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
Q_UNUSED(oldNode);
if (m_pleaseReset){
return m_rootNode;
}
-void QSGCustomParticle::prepareNextFrame(){
+void QQuickCustomParticle::prepareNextFrame(){
if (!m_rootNode)
m_rootNode = buildCustomNodes();
if (!m_rootNode)
buildData();
}
-QQuickShaderEffectNode* QSGCustomParticle::buildCustomNodes()
+QQuickShaderEffectNode* QQuickCustomParticle::buildCustomNodes()
{
#ifdef QT_OPENGL_ES_2
if (m_count * 4 > 0xffff) {
s.vertexCode = qt_particles_default_vertex_code;
if (!m_material) {
- m_material = new QSGShaderEffectMaterialObject;
+ m_material = new QQuickShaderEffectMaterialObject;
}
s.vertexCode = qt_particles_template_vertex_code + s.vertexCode;
}
-void QSGCustomParticle::buildData()
+void QQuickCustomParticle::buildData()
{
if (!m_rootNode)
return;
node->markDirty(QSGNode::DirtyMaterial);
}
-void QSGCustomParticle::initialize(int gIdx, int pIdx)
+void QQuickCustomParticle::initialize(int gIdx, int pIdx)
{
- QSGParticleData* datum = m_system->groupData[gIdx]->data[pIdx];
+ QQuickParticleData* datum = m_system->groupData[gIdx]->data[pIdx];
datum->r = rand()/(qreal)RAND_MAX;
}
-void QSGCustomParticle::commit(int gIdx, int pIdx)
+void QQuickCustomParticle::commit(int gIdx, int pIdx)
{
if (m_nodes[gIdx] == 0)
return;
- QSGParticleData* datum = m_system->groupData[gIdx]->data[pIdx];
+ QQuickParticleData* datum = m_system->groupData[gIdx]->data[pIdx];
PlainVertices *particles = (PlainVertices *) m_nodes[gIdx]->geometry()->vertexData();
PlainVertex *vertices = (PlainVertex *)&particles[pIdx];
for (int i=0; i<4; ++i) {
#ifndef CUSTOM_PARTICLE_H
#define CUSTOM_PARTICLE_H
-#include "qsgparticlepainter_p.h"
+#include "qquickparticlepainter_p.h"
#include <private/qquickshadereffectnode_p.h>
#include <QSignalMapper>
class QSGNode;
struct PlainVertices;
-class QSGShaderEffectMaterialObject;
+class QQuickShaderEffectMaterialObject;
//Genealogy: Hybrid of UltraParticle and ShaderEffect
-class QSGCustomParticle : public QSGParticlePainter
+class QQuickCustomParticle : public QQuickParticlePainter
{
Q_OBJECT
Q_PROPERTY(QByteArray fragmentShader READ fragmentShader WRITE setFragmentShader NOTIFY fragmentShaderChanged)
Q_PROPERTY(QByteArray vertexShader READ vertexShader WRITE setVertexShader NOTIFY vertexShaderChanged)
public:
- explicit QSGCustomParticle(QQuickItem* parent=0);
- ~QSGCustomParticle();
+ explicit QQuickCustomParticle(QQuickItem* parent=0);
+ ~QQuickCustomParticle();
QByteArray fragmentShader() const { return m_source.fragmentCode; }
void setFragmentShader(const QByteArray &code);
QByteArray name;
};
QVector<SourceData> m_sources;
- QSGShaderEffectMaterialObject *m_material;
+ QQuickShaderEffectMaterialObject *m_material;
QQuickShaderEffectNode* m_rootNode;
QHash<int, QQuickShaderEffectNode*> m_nodes;
qreal m_lastTime;
**
****************************************************************************/
-#include "qsgdirection_p.h"
+#include "qquickdirection_p.h"
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Direction QSGDirection
+ \qmlclass Direction QQuickDirection
\inqmlmodule QtQuick.Particles 2
\brief The Direction elements allow you to specify a vector space.
*/
-QSGDirection::QSGDirection(QObject *parent) :
+QQuickDirection::QQuickDirection(QObject *parent) :
QObject(parent)
{
}
-const QPointF QSGDirection::sample(const QPointF &from)
+const QPointF QQuickDirection::sample(const QPointF &from)
{
Q_UNUSED(from);
return QPointF();
QT_MODULE(Declarative)
-class QSGDirection : public QObject
+class QQuickDirection : public QObject
{
Q_OBJECT
public:
- explicit QSGDirection(QObject *parent = 0);
+ explicit QQuickDirection(QObject *parent = 0);
virtual const QPointF sample(const QPointF &from);
signals:
**
****************************************************************************/
-#include "qsgellipseextruder_p.h"
+#include "qquickellipseextruder_p.h"
#include <cmath>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass EllipseShape QSGEllipseExtruder
+ \qmlclass EllipseShape QQuickEllipseExtruder
\inqmlmodule QtQuick.Particles 2
\inherits Shape
\brief The EllipseShape represents an ellipse to other particle system elements
This shape can be used by Emitter subclasses and Affector subclasses to have
them act upon an ellipse shaped area.
*/
-QSGEllipseExtruder::QSGEllipseExtruder(QObject *parent) :
- QSGParticleExtruder(parent)
+QQuickEllipseExtruder::QQuickEllipseExtruder(QObject *parent) :
+ QQuickParticleExtruder(parent)
, m_fill(true)
{
}
Default is true.
*/
-QPointF QSGEllipseExtruder::extrude(const QRectF & r)
+QPointF QQuickEllipseExtruder::extrude(const QRectF & r)
{
qreal theta = ((qreal)rand()/RAND_MAX) * 6.2831853071795862;
qreal mag = m_fill ? ((qreal)rand()/RAND_MAX) : 1;
r.y() + r.height()/2 + mag * (r.height()/2) * sin(theta));
}
-bool QSGEllipseExtruder::contains(const QRectF &bounds, const QPointF &point)
+bool QQuickEllipseExtruder::contains(const QRectF &bounds, const QPointF &point)
{
return bounds.contains(point);//TODO: Ellipse
}
#ifndef ELLIPSEEXTRUDER_H
#define ELLIPSEEXTRUDER_H
-#include "qsgparticleextruder_p.h"
+#include "qquickparticleextruder_p.h"
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGEllipseExtruder : public QSGParticleExtruder
+class QQuickEllipseExtruder : public QQuickParticleExtruder
{
Q_OBJECT
Q_PROPERTY(bool fill READ fill WRITE setFill NOTIFY fillChanged)//###Use base class? If it's still box
public:
- explicit QSGEllipseExtruder(QObject *parent = 0);
+ explicit QQuickEllipseExtruder(QObject *parent = 0);
virtual QPointF extrude(const QRectF &);
virtual bool contains(const QRectF &bounds, const QPointF &point);
**
****************************************************************************/
-#include "qsgfriction_p.h"
+#include "qquickfriction_p.h"
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Friction QSGFrictionAffector
+ \qmlclass Friction QQuickFrictionAffector
\inqmlmodule QtQuick.Particles 2
\inherits Affector
\brief The Friction affector slows down movement proportional to the particle's current speed.
static const qreal epsilon = 0.00001;
-QSGFrictionAffector::QSGFrictionAffector(QQuickItem *parent) :
- QSGParticleAffector(parent), m_factor(0.0), m_threshold(0.0)
+QQuickFrictionAffector::QQuickFrictionAffector(QQuickItem *parent) :
+ QQuickParticleAffector(parent), m_factor(0.0), m_threshold(0.0)
{
}
-bool QSGFrictionAffector::affectParticle(QSGParticleData *d, qreal dt)
+bool QQuickFrictionAffector::affectParticle(QQuickParticleData *d, qreal dt)
{
if (!m_factor)
return false;
#ifndef FRICTIONAFFECTOR_H
#define FRICTIONAFFECTOR_H
-#include "qsgparticleaffector_p.h"
+#include "qquickparticleaffector_p.h"
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGFrictionAffector : public QSGParticleAffector
+class QQuickFrictionAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(qreal factor READ factor WRITE setFactor NOTIFY factorChanged)
Q_PROPERTY(qreal threshold READ threshold WRITE setThreshold NOTIFY thresholdChanged)
public:
- explicit QSGFrictionAffector(QQuickItem *parent = 0);
+ explicit QQuickFrictionAffector(QQuickItem *parent = 0);
qreal factor() const
{
}
protected:
- virtual bool affectParticle(QSGParticleData *d, qreal dt);
+ virtual bool affectParticle(QQuickParticleData *d, qreal dt);
signals:
**
****************************************************************************/
-#include "qsggravity_p.h"
+#include "qquickgravity_p.h"
#include <cmath>
QT_BEGIN_NAMESPACE
const qreal CONV = 0.017453292520444443;
/*!
- \qmlclass Gravity QSGGravityAffector
+ \qmlclass Gravity QQuickGravityAffector
\inqmlmodule QtQuick.Particles 2
\inherits Affector
\brief The Gravity element allows you to set a constant accleration in an angle
Angle of acceleration.
*/
-QSGGravityAffector::QSGGravityAffector(QQuickItem *parent) :
- QSGParticleAffector(parent), m_acceleration(-10), m_angle(90), m_xAcc(0), m_yAcc(0)
+QQuickGravityAffector::QQuickGravityAffector(QQuickItem *parent) :
+ QQuickParticleAffector(parent), m_acceleration(-10), m_angle(90), m_xAcc(0), m_yAcc(0)
{
connect(this, SIGNAL(accelerationChanged(qreal)),
this, SLOT(recalc()));
recalc();
}
-void QSGGravityAffector::recalc()
+void QQuickGravityAffector::recalc()
{
qreal theta = m_angle * CONV;
m_xAcc = m_acceleration * cos(theta);
m_yAcc = m_acceleration * sin(theta);
}
-bool QSGGravityAffector::affectParticle(QSGParticleData *d, qreal dt)
+bool QQuickGravityAffector::affectParticle(QQuickParticleData *d, qreal dt)
{
Q_UNUSED(dt);
bool changed = false;
#ifndef GRAVITYAFFECTOR_H
#define GRAVITYAFFECTOR_H
-#include "qsgparticleaffector_p.h"
+#include "qquickparticleaffector_p.h"
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGGravityAffector : public QSGParticleAffector
+class QQuickGravityAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged)
Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
public:
- explicit QSGGravityAffector(QQuickItem *parent = 0);
+ explicit QQuickGravityAffector(QQuickItem *parent = 0);
qreal acceleration() const
{
return m_acceleration;
return m_angle;
}
protected:
- virtual bool affectParticle(QSGParticleData *d, qreal dt);
+ virtual bool affectParticle(QQuickParticleData *d, qreal dt);
signals:
void accelerationChanged(qreal arg);
**
****************************************************************************/
-#include "qsggroupgoal_p.h"
+#include "qquickgroupgoal_p.h"
#include <private/qquickspriteengine_p.h>
#include <private/qquicksprite_p.h>
-#include "qsgimageparticle_p.h"
+#include "qquickimageparticle_p.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass GroupGoal QSGGroupGoalAffector
+ \qmlclass GroupGoal QQuickGroupGoalAffector
\inqmlmodule QtQuick.Particles 2
\inherits Affector
\brief The GroupGoal Affector allows you to change the state of a group of a particle.
Default is false.
*/
-QSGGroupGoalAffector::QSGGroupGoalAffector(QQuickItem *parent) :
- QSGParticleAffector(parent), m_jump(false)
+QQuickGroupGoalAffector::QQuickGroupGoalAffector(QQuickItem *parent) :
+ QQuickParticleAffector(parent), m_jump(false)
{
m_ignoresTime = true;
}
-void QSGGroupGoalAffector::setGoalState(QString arg)
+void QQuickGroupGoalAffector::setGoalState(QString arg)
{
if (m_goalState != arg) {
m_goalState = arg;
}
}
-bool QSGGroupGoalAffector::affectParticle(QSGParticleData *d, qreal dt)
+bool QQuickGroupGoalAffector::affectParticle(QQuickParticleData *d, qreal dt)
{
Q_UNUSED(dt);
QQuickStochasticEngine *engine = m_system->stateEngine;
#ifndef GROUPGOALAFFECTOR_H
#define GROUPGOALAFFECTOR_H
-#include "qsgparticleaffector_p.h"
+#include "qquickparticleaffector_p.h"
QT_BEGIN_HEADER
class QQuickStochasticEngine;
-class QSGGroupGoalAffector : public QSGParticleAffector
+class QQuickGroupGoalAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(QString goalState READ goalState WRITE setGoalState NOTIFY goalStateChanged)
Q_PROPERTY(bool jump READ jump WRITE setJump NOTIFY jumpChanged)
public:
- explicit QSGGroupGoalAffector(QQuickItem *parent = 0);
+ explicit QQuickGroupGoalAffector(QQuickItem *parent = 0);
QString goalState() const
{
}
protected:
- virtual bool affectParticle(QSGParticleData *d, qreal dt);
+ virtual bool affectParticle(QQuickParticleData *d, qreal dt);
signals:
#include <qsgtexturematerial.h>
#include <qsgtexture.h>
#include <QFile>
-#include "qsgimageparticle_p.h"
-#include "qsgparticleemitter_p.h"
+#include "qquickimageparticle_p.h"
+#include "qquickparticleemitter_p.h"
#include <private/qquicksprite_p.h>
#include <private/qquickspriteengine_p.h>
#include <QOpenGLFunctions>
}
/*!
- \qmlclass ImageParticle QSGImageParticle
+ \qmlclass ImageParticle QQuickImageParticle
\inqmlmodule QtQuick.Particles 2
\inherits ParticlePainter
\brief The ImageParticle element visualizes logical particles using an image
*/
-QSGImageParticle::QSGImageParticle(QQuickItem* parent)
- : QSGParticlePainter(parent)
+QQuickImageParticle::QQuickImageParticle(QQuickItem* parent)
+ : QQuickParticlePainter(parent)
, m_color_variation(0.0)
, m_rootNode(0)
, m_material(0)
m_debugMode = qmlParticlesDebug();
}
-QSGImageParticle::~QSGImageParticle()
+QQuickImageParticle::~QQuickImageParticle()
{
}
-QDeclarativeListProperty<QQuickSprite> QSGImageParticle::sprites()
+QDeclarativeListProperty<QQuickSprite> QQuickImageParticle::sprites()
{
return QDeclarativeListProperty<QQuickSprite>(this, &m_sprites, spriteAppend, spriteCount, spriteAt, spriteClear);
}
-void QSGImageParticle::setImage(const QUrl &image)
+void QQuickImageParticle::setImage(const QUrl &image)
{
if (image == m_image_name)
return;
}
-void QSGImageParticle::setColortable(const QUrl &table)
+void QQuickImageParticle::setColortable(const QUrl &table)
{
if (table == m_colortable_name)
return;
reset();
}
-void QSGImageParticle::setSizetable(const QUrl &table)
+void QQuickImageParticle::setSizetable(const QUrl &table)
{
if (table == m_sizetable_name)
return;
reset();
}
-void QSGImageParticle::setOpacitytable(const QUrl &table)
+void QQuickImageParticle::setOpacitytable(const QUrl &table)
{
if (table == m_opacitytable_name)
return;
reset();
}
-void QSGImageParticle::setColor(const QColor &color)
+void QQuickImageParticle::setColor(const QColor &color)
{
if (color == m_color)
return;
reset();
}
-void QSGImageParticle::setColorVariation(qreal var)
+void QQuickImageParticle::setColorVariation(qreal var)
{
if (var == m_color_variation)
return;
reset();
}
-void QSGImageParticle::setAlphaVariation(qreal arg)
+void QQuickImageParticle::setAlphaVariation(qreal arg)
{
if (m_alphaVariation != arg) {
m_alphaVariation = arg;
reset();
}
-void QSGImageParticle::setAlpha(qreal arg)
+void QQuickImageParticle::setAlpha(qreal arg)
{
if (m_alpha != arg) {
m_alpha = arg;
reset();
}
-void QSGImageParticle::setRedVariation(qreal arg)
+void QQuickImageParticle::setRedVariation(qreal arg)
{
if (m_redVariation != arg) {
m_redVariation = arg;
reset();
}
-void QSGImageParticle::setGreenVariation(qreal arg)
+void QQuickImageParticle::setGreenVariation(qreal arg)
{
if (m_greenVariation != arg) {
m_greenVariation = arg;
reset();
}
-void QSGImageParticle::setBlueVariation(qreal arg)
+void QQuickImageParticle::setBlueVariation(qreal arg)
{
if (m_blueVariation != arg) {
m_blueVariation = arg;
reset();
}
-void QSGImageParticle::setRotation(qreal arg)
+void QQuickImageParticle::setRotation(qreal arg)
{
if (m_rotation != arg) {
m_rotation = arg;
reset();
}
-void QSGImageParticle::setRotationVariation(qreal arg)
+void QQuickImageParticle::setRotationVariation(qreal arg)
{
if (m_rotationVariation != arg) {
m_rotationVariation = arg;
reset();
}
-void QSGImageParticle::setRotationSpeed(qreal arg)
+void QQuickImageParticle::setRotationSpeed(qreal arg)
{
if (m_rotationSpeed != arg) {
m_rotationSpeed = arg;
reset();
}
-void QSGImageParticle::setRotationSpeedVariation(qreal arg)
+void QQuickImageParticle::setRotationSpeedVariation(qreal arg)
{
if (m_rotationSpeedVariation != arg) {
m_rotationSpeedVariation = arg;
reset();
}
-void QSGImageParticle::setAutoRotation(bool arg)
+void QQuickImageParticle::setAutoRotation(bool arg)
{
if (m_autoRotation != arg) {
m_autoRotation = arg;
reset();
}
-void QSGImageParticle::setXVector(QSGDirection* arg)
+void QQuickImageParticle::setXVector(QQuickDirection* arg)
{
if (m_xVector != arg) {
m_xVector = arg;
reset();
}
-void QSGImageParticle::setYVector(QSGDirection* arg)
+void QQuickImageParticle::setYVector(QQuickDirection* arg)
{
if (m_yVector != arg) {
m_yVector = arg;
reset();
}
-void QSGImageParticle::setSpritesInterpolate(bool arg)
+void QQuickImageParticle::setSpritesInterpolate(bool arg)
{
if (m_spritesInterpolate != arg) {
m_spritesInterpolate = arg;
}
}
-void QSGImageParticle::setBloat(bool arg)
+void QQuickImageParticle::setBloat(bool arg)
{
if (m_bloat != arg) {
m_bloat = arg;
reset();
}
-void QSGImageParticle::setEntryEffect(EntryEffect arg)
+void QQuickImageParticle::setEntryEffect(EntryEffect arg)
{
if (m_entryEffect != arg) {
m_entryEffect = arg;
}
}
-void QSGImageParticle::resetColor()
+void QQuickImageParticle::resetColor()
{
m_explicitColor = false;
foreach (const QString &str, m_groups)
- foreach (QSGParticleData* d, m_system->groupData[m_system->groupIds[str]]->data)
+ foreach (QQuickParticleData* d, m_system->groupData[m_system->groupIds[str]]->data)
if (d->colorOwner == this)
d->colorOwner = 0;
m_color = QColor();
m_alphaVariation = 0.0f;
}
-void QSGImageParticle::resetRotation()
+void QQuickImageParticle::resetRotation()
{
m_explicitRotation = false;
foreach (const QString &str, m_groups)
- foreach (QSGParticleData* d, m_system->groupData[m_system->groupIds[str]]->data)
+ foreach (QQuickParticleData* d, m_system->groupData[m_system->groupIds[str]]->data)
if (d->rotationOwner == this)
d->rotationOwner = 0;
m_rotation = 0;
m_autoRotation = false;
}
-void QSGImageParticle::resetDeformation()
+void QQuickImageParticle::resetDeformation()
{
m_explicitDeformation = false;
foreach (const QString &str, m_groups)
- foreach (QSGParticleData* d, m_system->groupData[m_system->groupIds[str]]->data)
+ foreach (QQuickParticleData* d, m_system->groupData[m_system->groupIds[str]]->data)
if (d->deformationOwner == this)
d->deformationOwner = 0;
if (m_xVector)
m_yVector = 0;
}
-void QSGImageParticle::reset()
+void QQuickImageParticle::reset()
{
- QSGParticlePainter::reset();
+ QQuickParticlePainter::reset();
m_pleaseReset = true;
update();
}
-void QSGImageParticle::createEngine()
+void QQuickImageParticle::createEngine()
{
if (m_spriteEngine)
delete m_spriteEngine;
SpriteParticle_Attributes
};
-void QSGImageParticle::clearShadows()
+void QQuickImageParticle::clearShadows()
{
m_shadowInit = false;
- foreach (const QVector<QSGParticleData*> data, m_shadowData)
+ foreach (const QVector<QQuickParticleData*> data, m_shadowData)
qDeleteAll(data);
m_shadowData.clear();
}
//Only call if you need to, may initialize the whole array first time
-QSGParticleData* QSGImageParticle::getShadowDatum(QSGParticleData* datum)
+QQuickParticleData* QQuickImageParticle::getShadowDatum(QQuickParticleData* datum)
{
- QSGParticleGroupData* gd = m_system->groupData[datum->group];
+ QQuickParticleGroupData* gd = m_system->groupData[datum->group];
if (!m_shadowData.contains(datum->group)) {
- QVector<QSGParticleData*> data;
+ QVector<QQuickParticleData*> data;
for (int i=0; i<gd->size(); i++){
- QSGParticleData* datum = new QSGParticleData(m_system);
+ QQuickParticleData* datum = new QQuickParticleData(m_system);
*datum = *(gd->data[i]);
data << datum;
}
return m_shadowData[datum->group][datum->index];
}
-QSGGeometryNode* QSGImageParticle::buildParticleNodes()
+QSGGeometryNode* QQuickImageParticle::buildParticleNodes()
{
#ifdef QT_OPENGL_ES_2
if (m_count * 4 > 0xffff) {
foreach (const QString &str, m_groups){//For sharing higher levels, need to have highest used so it renders
int gIdx = m_system->groupIds[str];
- foreach (QSGParticlePainter* p, m_system->groupData[gIdx]->painters){
- QSGImageParticle* other = qobject_cast<QSGImageParticle*>(p);
+ foreach (QQuickParticlePainter* p, m_system->groupData[gIdx]->painters){
+ QQuickImageParticle* other = qobject_cast<QQuickImageParticle*>(p);
if (other){
if (other->perfLevel > perfLevel) {
if (other->perfLevel >= Tabled){//Deformable is the highest level needed for this, anything higher isn't shared (or requires your own sprite)
return *(m_nodes.begin());
}
-QSGNode *QSGImageParticle::updatePaintNode(QSGNode *, UpdatePaintNodeData *)
+QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *, UpdatePaintNodeData *)
{
if (m_pleaseReset){
m_lastLevel = perfLevel;
return m_rootNode;
}
-void QSGImageParticle::prepareNextFrame()
+void QQuickImageParticle::prepareNextFrame()
{
if (m_rootNode == 0){//TODO: Staggered loading (as emitted)
m_rootNode = buildParticleNodes();
if (m_rootNode == 0)
return;
if(m_debugMode){
- qDebug() << "QSGImageParticle Feature level: " << perfLevel;
- qDebug() << "QSGImageParticle Nodes: ";
+ qDebug() << "QQuickImageParticle Feature level: " << perfLevel;
+ qDebug() << "QQuickImageParticle Nodes: ";
int count = 0;
foreach(int i, m_nodes.keys()){
qDebug() << "Group " << i << " (" << m_system->groupData[i]->size() << " particles)";
node->markDirty(QSGNode::DirtyMaterial);
}
-void QSGImageParticle::reloadColor(const Color4ub &c, QSGParticleData* d)
+void QQuickImageParticle::reloadColor(const Color4ub &c, QQuickParticleData* d)
{
d->color = c;
//TODO: get index for reload - or make function take an index
}
-void QSGImageParticle::initialize(int gIdx, int pIdx)
+void QQuickImageParticle::initialize(int gIdx, int pIdx)
{
Color4ub color;
- QSGParticleData* datum = m_system->groupData[gIdx]->data[pIdx];
+ QQuickParticleData* datum = m_system->groupData[gIdx]->data[pIdx];
qreal redVariation = m_color_variation + m_redVariation;
qreal greenVariation = m_color_variation + m_greenVariation;
qreal blueVariation = m_color_variation + m_blueVariation;
if (m_explicitAnimation){
if (!datum->animationOwner)
datum->animationOwner = this;
- QSGParticleData* writeTo = (datum->animationOwner == this ? datum : getShadowDatum(datum));
+ QQuickParticleData* writeTo = (datum->animationOwner == this ? datum : getShadowDatum(datum));
writeTo->animT = writeTo->t;
//writeTo->animInterpolate = m_spritesInterpolate;
if (m_spriteEngine){
}
}
-void QSGImageParticle::commit(int gIdx, int pIdx)
+void QQuickImageParticle::commit(int gIdx, int pIdx)
{
if (m_pleaseReset)
return;
QSGGeometryNode *node = m_nodes[gIdx];
if (!node)
return;
- QSGParticleData* datum = m_system->groupData[gIdx]->data[pIdx];
+ QQuickParticleData* datum = m_system->groupData[gIdx]->data[pIdx];
node->setFlag(QSGNode::OwnsGeometry, false);
SpriteVertex *spriteVertices = (SpriteVertex *) node->geometry()->vertexData();
DeformableVertex *deformableVertices = (DeformableVertex *) node->geometry()->vertexData();
spriteVertices[i].ax = datum->ax;
spriteVertices[i].ay = datum->ay;
if (m_explicitDeformation && datum->deformationOwner != this) {
- QSGParticleData* shadow = getShadowDatum(datum);
+ QQuickParticleData* shadow = getShadowDatum(datum);
spriteVertices[i].xx = shadow->xx;
spriteVertices[i].xy = shadow->xy;
spriteVertices[i].yx = shadow->yx;
spriteVertices[i].yy = datum->yy;
}
if (m_explicitRotation && datum->rotationOwner != this) {
- QSGParticleData* shadow = getShadowDatum(datum);
+ QQuickParticleData* shadow = getShadowDatum(datum);
spriteVertices[i].rotation = shadow->rotation;
spriteVertices[i].rotationSpeed = shadow->rotationSpeed;
spriteVertices[i].autoRotate = shadow->autoRotate;
}
spriteVertices[i].animInterpolate = m_spritesInterpolate ? 1.0 : 0.0;//### Shadow? In particleData? Or uniform?
if (m_explicitAnimation && datum->animationOwner != this) {
- QSGParticleData* shadow = getShadowDatum(datum);
+ QQuickParticleData* shadow = getShadowDatum(datum);
spriteVertices[i].frameDuration = shadow->frameDuration;
spriteVertices[i].frameCount = shadow->frameCount;
spriteVertices[i].animT = shadow->animT;
spriteVertices[i].animHeight = datum->animHeight;
}
if (m_explicitColor && datum->colorOwner != this) {
- QSGParticleData* shadow = getShadowDatum(datum);
+ QQuickParticleData* shadow = getShadowDatum(datum);
spriteVertices[i].color.r = shadow->color.r;
spriteVertices[i].color.g = shadow->color.g;
spriteVertices[i].color.b = shadow->color.b;
deformableVertices[i].ax = datum->ax;
deformableVertices[i].ay = datum->ay;
if (m_explicitDeformation && datum->deformationOwner != this) {
- QSGParticleData* shadow = getShadowDatum(datum);
+ QQuickParticleData* shadow = getShadowDatum(datum);
deformableVertices[i].xx = shadow->xx;
deformableVertices[i].xy = shadow->xy;
deformableVertices[i].yx = shadow->yx;
deformableVertices[i].yy = datum->yy;
}
if (m_explicitRotation && datum->rotationOwner != this) {
- QSGParticleData* shadow = getShadowDatum(datum);
+ QQuickParticleData* shadow = getShadowDatum(datum);
deformableVertices[i].rotation = shadow->rotation;
deformableVertices[i].rotationSpeed = shadow->rotationSpeed;
deformableVertices[i].autoRotate = shadow->autoRotate;
deformableVertices[i].autoRotate = datum->autoRotate;
}
if (m_explicitColor && datum->colorOwner != this) {
- QSGParticleData* shadow = getShadowDatum(datum);
+ QQuickParticleData* shadow = getShadowDatum(datum);
deformableVertices[i].color.r = shadow->color.r;
deformableVertices[i].color.g = shadow->color.g;
deformableVertices[i].color.b = shadow->color.b;
coloredVertices[i].ax = datum->ax;
coloredVertices[i].ay = datum->ay;
if (m_explicitColor && datum->colorOwner != this) {
- QSGParticleData* shadow = getShadowDatum(datum);
+ QQuickParticleData* shadow = getShadowDatum(datum);
coloredVertices[i].color.r = shadow->color.r;
coloredVertices[i].color.g = shadow->color.g;
coloredVertices[i].color.b = shadow->color.b;
#ifndef ULTRAPARTICLE_H
#define ULTRAPARTICLE_H
-#include "qsgparticlepainter_p.h"
-#include "qsgdirection_p.h"
+#include "qquickparticlepainter_p.h"
+#include "qquickdirection_p.h"
#include <QDeclarativeListProperty>
#include <qsgsimplematerial.h>
#include <QtGui/qcolor.h>
Vertex v4;
};
-class QSGImageParticle : public QSGParticlePainter
+class QQuickImageParticle : public QQuickParticlePainter
{
Q_OBJECT
Q_PROPERTY(QUrl source READ image WRITE setImage NOTIFY imageChanged)
//###Call i/j? Makes more sense to those with vector calculus experience, and I could even add the cirumflex in QML?
//xVector is the vector from the top-left point to the top-right point, and is multiplied by current size
- Q_PROPERTY(QSGDirection* xVector READ xVector WRITE setXVector NOTIFY xVectorChanged RESET resetDeformation)
+ Q_PROPERTY(QQuickDirection* xVector READ xVector WRITE setXVector NOTIFY xVectorChanged RESET resetDeformation)
//yVector is the same, but top-left to bottom-left. The particle is always a parallelogram.
- Q_PROPERTY(QSGDirection* yVector READ yVector WRITE setYVector NOTIFY yVectorChanged RESET resetDeformation)
+ Q_PROPERTY(QQuickDirection* yVector READ yVector WRITE setYVector NOTIFY yVectorChanged RESET resetDeformation)
Q_PROPERTY(QDeclarativeListProperty<QQuickSprite> sprites READ sprites)
Q_PROPERTY(bool spritesInterpolate READ spritesInterpolate WRITE setSpritesInterpolate NOTIFY spritesInterpolateChanged)
Q_PROPERTY(bool bloat READ bloat WRITE setBloat NOTIFY bloatChanged)//Just a debugging property to bypass optimizations
Q_ENUMS(EntryEffect)
public:
- explicit QSGImageParticle(QQuickItem *parent = 0);
- virtual ~QSGImageParticle();
+ explicit QQuickImageParticle(QQuickItem *parent = 0);
+ virtual ~QQuickImageParticle();
QDeclarativeListProperty<QQuickSprite> sprites();
bool autoRotation() const { return m_autoRotation; }
- QSGDirection* xVector() const { return m_xVector; }
+ QQuickDirection* xVector() const { return m_xVector; }
- QSGDirection* yVector() const { return m_yVector; }
+ QQuickDirection* yVector() const { return m_yVector; }
bool spritesInterpolate() const { return m_spritesInterpolate; }
void autoRotationChanged(bool arg);
- void xVectorChanged(QSGDirection* arg);
+ void xVectorChanged(QQuickDirection* arg);
- void yVectorChanged(QSGDirection* arg);
+ void yVectorChanged(QQuickDirection* arg);
void spritesInterpolateChanged(bool arg);
void entryEffectChanged(EntryEffect arg);
public slots:
- void reloadColor(const Color4ub &c, QSGParticleData* d);
+ void reloadColor(const Color4ub &c, QQuickParticleData* d);
void setAlphaVariation(qreal arg);
void setAlpha(qreal arg);
void setAutoRotation(bool arg);
- void setXVector(QSGDirection* arg);
+ void setXVector(QQuickDirection* arg);
- void setYVector(QSGDirection* arg);
+ void setYVector(QQuickDirection* arg);
void setSpritesInterpolate(bool arg);
qreal m_rotationSpeed;
qreal m_rotationSpeedVariation;
bool m_autoRotation;
- QSGDirection* m_xVector;
- QSGDirection* m_yVector;
+ QQuickDirection* m_xVector;
+ QQuickDirection* m_yVector;
QList<QQuickSprite*> m_sprites;
QQuickSpriteEngine* m_spriteEngine;
bool m_explicitRotation;
bool m_explicitDeformation;
bool m_explicitAnimation;
- QHash<int, QVector<QSGParticleData*> > m_shadowData;
+ QHash<int, QVector<QQuickParticleData*> > m_shadowData;
bool m_shadowInit;
void clearShadows();
- QSGParticleData* getShadowDatum(QSGParticleData* datum);
+ QQuickParticleData* getShadowDatum(QQuickParticleData* datum);
bool m_bloat;
PerformanceLevel perfLevel;
**
****************************************************************************/
-#include "qsgitemparticle_p.h"
+#include "qquickitemparticle_p.h"
#include <private/qquickvisualitemmodel_p.h>
#include <qsgnode.h>
#include <QTimer>
*/
QQuickItemParticle::QQuickItemParticle(QQuickItem *parent) :
- QSGParticlePainter(parent), m_fade(true), m_delegate(0)
+ QQuickParticlePainter(parent), m_fade(true), m_delegate(0)
{
setFlag(QQuickItem::ItemHasContents);
QTimer* manageDelegates = new QTimer(this);//TODO: don't leak
}
m_deletables.clear();
- foreach (QSGParticleData* d, m_loadables){
+ foreach (QQuickParticleData* d, m_loadables){
if (m_stasis.contains(d->delegate))
qWarning() << "Current model particles prefers overwrite:false";
//remove old item from the particle that is dying to make room for this one
void QQuickItemParticle::reset()
{
- QSGParticlePainter::reset();
+ QQuickParticlePainter::reset();
//TODO: Cleanup items?
m_loadables.clear();
//deletables?
int count = m_system->groupData[gIdx]->size();
for (int i=0; i<count; i++){
- QSGParticleData* data = m_system->groupData[gIdx]->data[i];
+ QQuickParticleData* data = m_system->groupData[gIdx]->data[i];
QQuickItem* item = data->delegate;
if (!item)
continue;
#ifndef ITEMPARTICLE_H
#define ITEMPARTICLE_H
-#include "qsgparticlepainter_p.h"
+#include "qquickparticlepainter_p.h"
#include <QPointer>
#include <QSet>
QT_BEGIN_HEADER
class QQuickVisualDataModel;
class QQuickItemParticleAttached;
-class QQuickItemParticle : public QSGParticlePainter
+class QQuickItemParticle : public QQuickParticlePainter
{
Q_OBJECT
Q_PROPERTY(bool fade READ fade WRITE setFade NOTIFY fadeChanged)
void tick();
private:
QList<QQuickItem* > m_deletables;
- QList< QSGParticleData* > m_loadables;
+ QList< QQuickParticleData* > m_loadables;
bool m_fade;
QList<QQuickItem*> m_pendingItems;
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qsglineextruder_p.h"
+#include "qquicklineextruder_p.h"
#include <cmath>
/*!
- \qmlclass LineShape QSGLineExtruder
+ \qmlclass LineShape QQuickLineExtruder
\inqmlmodule QtQuick.Particles 2
\inherits Shape
\brief The LineShape represents a line to Affectors and Emitter
The line will then go from (0,height) to (width, 0).
*/
-QSGLineExtruder::QSGLineExtruder(QObject *parent) :
- QSGParticleExtruder(parent), m_mirrored(false)
+QQuickLineExtruder::QQuickLineExtruder(QObject *parent) :
+ QQuickParticleExtruder(parent), m_mirrored(false)
{
}
-QPointF QSGLineExtruder::extrude(const QRectF &r)
+QPointF QQuickLineExtruder::extrude(const QRectF &r)
{
qreal x,y;
if (!r.height()){
#ifndef LINEEXTRUDER_H
#define LINEEXTRUDER_H
-#include "qsgparticleextruder_p.h"
+#include "qquickparticleextruder_p.h"
-class QSGLineExtruder : public QSGParticleExtruder
+class QQuickLineExtruder : public QQuickParticleExtruder
{
Q_OBJECT
//Default is topleft to bottom right. Flipped makes it topright to bottom left
Q_PROPERTY(bool mirrored READ mirrored WRITE setmirrored NOTIFY mirroredChanged)
public:
- explicit QSGLineExtruder(QObject *parent = 0);
+ explicit QQuickLineExtruder(QObject *parent = 0);
virtual QPointF extrude(const QRectF &);
bool mirrored() const
{
**
****************************************************************************/
-#include "qsgmaskextruder_p.h"
+#include "qquickmaskextruder_p.h"
#include <QImage>
#include <QDebug>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass MaskShape QSGMaskExtruder
+ \qmlclass MaskShape QQuickMaskExtruder
\inqmlmodule QtQuick.Particles 2
\inherits Shape
\brief The MaskShape element allows you to represent an image as a shape to affectors and emitters.
*/
-QSGMaskExtruder::QSGMaskExtruder(QObject *parent) :
- QSGParticleExtruder(parent)
+QQuickMaskExtruder::QQuickMaskExtruder(QObject *parent) :
+ QQuickParticleExtruder(parent)
, m_lastWidth(-1)
, m_lastHeight(-1)
{
}
-QPointF QSGMaskExtruder::extrude(const QRectF &r)
+QPointF QQuickMaskExtruder::extrude(const QRectF &r)
{
ensureInitialized(r);
if (!m_mask.count() || m_img.isNull())
return p + r.topLeft();
}
-bool QSGMaskExtruder::contains(const QRectF &bounds, const QPointF &point)
+bool QQuickMaskExtruder::contains(const QRectF &bounds, const QPointF &point)
{
ensureInitialized(bounds);//###Current usage patterns WILL lead to different bounds/r calls. Separate list?
if (m_img.isNull())
return m_img.rect().contains(p) && (bool)m_img.pixelIndex(p);
}
-void QSGMaskExtruder::ensureInitialized(const QRectF &r)
+void QQuickMaskExtruder::ensureInitialized(const QRectF &r)
{
if (m_lastWidth == r.width() && m_lastHeight == r.height())
return;//Same as before
#ifndef MASKEXTRUDER_H
#define MASKEXTRUDER_H
-#include "qsgparticleextruder_p.h"
+#include "qquickparticleextruder_p.h"
#include <QUrl>
#include <QImage>
QT_MODULE(Declarative)
-class QSGMaskExtruder : public QSGParticleExtruder
+class QQuickMaskExtruder : public QQuickParticleExtruder
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
public:
- explicit QSGMaskExtruder(QObject *parent = 0);
+ explicit QQuickMaskExtruder(QObject *parent = 0);
virtual QPointF extrude(const QRectF &);
virtual bool contains(const QRectF &bounds, const QPointF &point);
**
****************************************************************************/
-#include "qsgparticleaffector_p.h"
+#include "qquickparticleaffector_p.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Affector QSGParticleAffector
+ \qmlclass Affector QQuickParticleAffector
\inqmlmodule QtQuick.Particles 2
\brief Affector elements can alter the attributes of logical particles at any point in their lifetime.
x,y is the particles current position.
*/
-QSGParticleAffector::QSGParticleAffector(QQuickItem *parent) :
+QQuickParticleAffector::QQuickParticleAffector(QQuickItem *parent) :
QQuickItem(parent), m_needsReset(false), m_ignoresTime(false), m_onceOff(false), m_enabled(true)
- , m_system(0), m_updateIntSet(false), m_shape(new QSGParticleExtruder(this))
+ , m_system(0), m_updateIntSet(false), m_shape(new QQuickParticleExtruder(this))
{
}
-bool QSGParticleAffector::isAffectedConnected()
+bool QQuickParticleAffector::isAffectedConnected()
{
static int idx = QObjectPrivate::get(this)->signalIndex("affected(qreal,qreal)");
return QObjectPrivate::get(this)->isSignalConnected(idx);
}
-void QSGParticleAffector::componentComplete()
+void QQuickParticleAffector::componentComplete()
{
- if (!m_system && qobject_cast<QSGParticleSystem*>(parentItem()))
- setSystem(qobject_cast<QSGParticleSystem*>(parentItem()));
+ if (!m_system && qobject_cast<QQuickParticleSystem*>(parentItem()))
+ setSystem(qobject_cast<QQuickParticleSystem*>(parentItem()));
QQuickItem::componentComplete();
}
-bool QSGParticleAffector::activeGroup(int g) {
+bool QQuickParticleAffector::activeGroup(int g) {
if (m_updateIntSet){
m_groupIds.clear();
foreach (const QString &p, m_groups)
return m_groupIds.isEmpty() || m_groupIds.contains(g);
}
-bool QSGParticleAffector::shouldAffect(QSGParticleData* d)
+bool QQuickParticleAffector::shouldAffect(QQuickParticleData* d)
{
if (!d)
return false;
}
-void QSGParticleAffector::postAffect(QSGParticleData* d)
+void QQuickParticleAffector::postAffect(QQuickParticleData* d)
{
m_system->needsReset << d;
if (m_onceOff)
emit affected(d->curX(), d->curY());
}
-const qreal QSGParticleAffector::simulationDelta = 0.020;
-const qreal QSGParticleAffector::simulationCutoff = 1.000;//If this goes above 1.0, then m_once behaviour needs special codepath
+const qreal QQuickParticleAffector::simulationDelta = 0.020;
+const qreal QQuickParticleAffector::simulationCutoff = 1.000;//If this goes above 1.0, then m_once behaviour needs special codepath
-void QSGParticleAffector::affectSystem(qreal dt)
+void QQuickParticleAffector::affectSystem(qreal dt)
{
if (!m_enabled)
return;
updateOffsets();//### Needed if an ancestor is transformed.
if (m_onceOff)
dt = 1.0;
- foreach (QSGParticleGroupData* gd, m_system->groupData) {
+ foreach (QQuickParticleGroupData* gd, m_system->groupData) {
if (activeGroup(m_system->groupData.key(gd))) {
- foreach (QSGParticleData* d, gd->data) {
+ foreach (QQuickParticleData* d, gd->data) {
if (shouldAffect(d)) {
bool affected = false;
qreal myDt = dt;
}
}
-bool QSGParticleAffector::affectParticle(QSGParticleData *, qreal )
+bool QQuickParticleAffector::affectParticle(QQuickParticleData *, qreal )
{
return true;
}
-void QSGParticleAffector::reset(QSGParticleData* pd)
+void QQuickParticleAffector::reset(QQuickParticleData* pd)
{//TODO: This, among other ones, should be restructured so they don't all need to remember to call the superclass
if (m_onceOff)
if (activeGroup(pd->group))
m_onceOffed.remove(qMakePair(pd->group, pd->index));
}
-void QSGParticleAffector::updateOffsets()
+void QQuickParticleAffector::updateOffsets()
{
if (m_system)
m_offset = m_system->mapFromItem(this, QPointF(0, 0));
}
-bool QSGParticleAffector::isColliding(QSGParticleData *d)
+bool QQuickParticleAffector::isColliding(QQuickParticleData *d)
{
qreal myCurX = d->curX();
qreal myCurY = d->curY();
qreal myCurSize = d->curSize()/2;
foreach (const QString &group, m_whenCollidingWith){
- foreach (QSGParticleData* other, m_system->groupData[m_system->groupIds[group]]->data){
+ foreach (QQuickParticleData* other, m_system->groupData[m_system->groupIds[group]]->data){
if (!other->stillAlive())
continue;
qreal otherCurX = other->curX();
#define PARTICLEAFFECTOR_H
#include <QObject>
-#include "qsgparticlesystem_p.h"
-#include "qsgparticleextruder_p.h"
+#include "qquickparticlesystem_p.h"
+#include "qquickparticleextruder_p.h"
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGParticleAffector : public QQuickItem
+class QQuickParticleAffector : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(QSGParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
+ Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
Q_PROPERTY(QStringList groups READ groups WRITE setGroups NOTIFY groupsChanged)
Q_PROPERTY(QStringList whenCollidingWith READ whenCollidingWith WRITE setWhenCollidingWith NOTIFY whenCollidingWithChanged)
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(bool once READ onceOff WRITE setOnceOff NOTIFY onceChanged)
- Q_PROPERTY(QSGParticleExtruder* shape READ shape WRITE setShape NOTIFY shapeChanged)
+ Q_PROPERTY(QQuickParticleExtruder* shape READ shape WRITE setShape NOTIFY shapeChanged)
public:
- explicit QSGParticleAffector(QQuickItem *parent = 0);
+ explicit QQuickParticleAffector(QQuickItem *parent = 0);
virtual void affectSystem(qreal dt);
- virtual void reset(QSGParticleData*);//As some store their own data per particle?
- QSGParticleSystem* system() const
+ virtual void reset(QQuickParticleData*);//As some store their own data per particle?
+ QQuickParticleSystem* system() const
{
return m_system;
}
return m_onceOff;
}
- QSGParticleExtruder* shape() const
+ QQuickParticleExtruder* shape() const
{
return m_shape;
}
signals:
- void systemChanged(QSGParticleSystem* arg);
+ void systemChanged(QQuickParticleSystem* arg);
void groupsChanged(QStringList arg);
void onceChanged(bool arg);
- void shapeChanged(QSGParticleExtruder* arg);
+ void shapeChanged(QQuickParticleExtruder* arg);
void affected(qreal x, qreal y);
void whenCollidingWithChanged(QStringList arg);
public slots:
-void setSystem(QSGParticleSystem* arg)
+void setSystem(QQuickParticleSystem* arg)
{
if (m_system != arg) {
m_system = arg;
}
}
-void setShape(QSGParticleExtruder* arg)
+void setShape(QQuickParticleExtruder* arg)
{
if (m_shape != arg) {
m_shape = arg;
void updateOffsets();
protected:
- friend class QSGParticleSystem;
- virtual bool affectParticle(QSGParticleData *d, qreal dt);
+ friend class QQuickParticleSystem;
+ virtual bool affectParticle(QQuickParticleData *d, qreal dt);
bool m_needsReset:1;//### What is this really saving?
bool m_ignoresTime:1;
bool m_onceOff:1;
bool m_enabled:1;
- QSGParticleSystem* m_system;
+ QQuickParticleSystem* m_system;
QStringList m_groups;
bool activeGroup(int g);
- bool shouldAffect(QSGParticleData* datum);//Call to do the logic on whether it is affecting that datum
- void postAffect(QSGParticleData* datum);//Call to do the post-affect logic on particles which WERE affected(once off, needs reset, affected signal)
+ bool shouldAffect(QQuickParticleData* datum);//Call to do the logic on whether it is affecting that datum
+ void postAffect(QQuickParticleData* datum);//Call to do the post-affect logic on particles which WERE affected(once off, needs reset, affected signal)
virtual void componentComplete();
QPointF m_offset;
bool isAffectedConnected();
QSet<QPair<int, int> > m_onceOffed;
bool m_updateIntSet;
- QSGParticleExtruder* m_shape;
+ QQuickParticleExtruder* m_shape;
QStringList m_whenCollidingWith;
- bool isColliding(QSGParticleData* d);
+ bool isColliding(QQuickParticleData* d);
};
QT_END_NAMESPACE
**
****************************************************************************/
-#include "qsgparticleemitter_p.h"
+#include "qquickparticleemitter_p.h"
#include <private/qdeclarativeengine_p.h>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Emitter QSGParticleEmitter
+ \qmlclass Emitter QQuickParticleEmitter
\inqmlmodule QtQuick.Particles 2
\brief The Emitter element allows you to emit logical particles.
it back off.
*/
-QSGParticleEmitter::QSGParticleEmitter(QQuickItem *parent) :
+QQuickParticleEmitter::QQuickParticleEmitter(QQuickItem *parent) :
QQuickItem(parent)
, m_particlesPerSecond(10)
, m_particleDuration(1000)
this, SIGNAL(particleCountChanged()));
}
-QSGParticleEmitter::~QSGParticleEmitter()
+QQuickParticleEmitter::~QQuickParticleEmitter()
{
if (m_defaultExtruder)
delete m_defaultExtruder;
}
-bool QSGParticleEmitter::isEmitConnected()
+bool QQuickParticleEmitter::isEmitConnected()
{
static int idx = QObjectPrivate::get(this)->signalIndex("emitParticles(QDeclarativeV8Handle)");
return QObjectPrivate::get(this)->isSignalConnected(idx);
}
-void QSGParticleEmitter::componentComplete()
+void QQuickParticleEmitter::componentComplete()
{
- if (!m_system && qobject_cast<QSGParticleSystem*>(parentItem()))
- setSystem(qobject_cast<QSGParticleSystem*>(parentItem()));
+ if (!m_system && qobject_cast<QQuickParticleSystem*>(parentItem()))
+ setSystem(qobject_cast<QQuickParticleSystem*>(parentItem()));
QQuickItem::componentComplete();
}
-void QSGParticleEmitter::setEnabled(bool arg)
+void QQuickParticleEmitter::setEnabled(bool arg)
{
if (m_enabled != arg) {
m_enabled = arg;
}
-QSGParticleExtruder* QSGParticleEmitter::effectiveExtruder()
+QQuickParticleExtruder* QQuickParticleEmitter::effectiveExtruder()
{
if (m_extruder)
return m_extruder;
if (!m_defaultExtruder)
- m_defaultExtruder = new QSGParticleExtruder;
+ m_defaultExtruder = new QQuickParticleExtruder;
return m_defaultExtruder;
}
-void QSGParticleEmitter::pulse(int milliseconds)
+void QQuickParticleEmitter::pulse(int milliseconds)
{
if (!particleCount())
qWarning() << "pulse called on an emitter with a particle count of zero";
m_pulseLeft = milliseconds;
}
-void QSGParticleEmitter::burst(int num)
+void QQuickParticleEmitter::burst(int num)
{
if (!particleCount())
qWarning() << "burst called on an emitter with a particle count of zero";
m_burstQueue << qMakePair(num, QPointF(x(), y()));
}
-void QSGParticleEmitter::burst(int num, qreal x, qreal y)
+void QQuickParticleEmitter::burst(int num, qreal x, qreal y)
{
if (!particleCount())
qWarning() << "burst called on an emitter with a particle count of zero";
m_burstQueue << qMakePair(num, QPointF(x, y));
}
-void QSGParticleEmitter::setMaxParticleCount(int arg)
+void QQuickParticleEmitter::setMaxParticleCount(int arg)
{
if (m_maxParticleCount != arg) {
if (arg < 0 && m_maxParticleCount >= 0){
}
}
-int QSGParticleEmitter::particleCount() const
+int QQuickParticleEmitter::particleCount() const
{
if (m_maxParticleCount >= 0)
return m_maxParticleCount;
return m_particlesPerSecond*((m_particleDuration+m_particleDurationVariation)/1000.0);
}
-void QSGParticleEmitter::setSpeedFromMovement(qreal t)
+void QQuickParticleEmitter::setSpeedFromMovement(qreal t)
{
if (t == m_speed_from_movement)
return;
emit speedFromMovementChanged();
}
-void QSGParticleEmitter::reset()
+void QQuickParticleEmitter::reset()
{
m_reset_last = true;
}
-void QSGParticleEmitter::emitWindow(int timeStamp)
+void QQuickParticleEmitter::emitWindow(int timeStamp)
{
if (m_system == 0)
return;
if (!m_burstQueue.isEmpty() && !m_pulseLeft && !m_enabled)//'outside time' emissions only
pt = time;
- QList<QSGParticleData*> toEmit;
+ QList<QQuickParticleData*> toEmit;
while ((pt < time && m_emitCap) || !m_burstQueue.isEmpty()) {
//int pos = m_last_particle % m_particle_count;
- QSGParticleData* datum = m_system->newDatum(m_system->groupIds[m_group], !m_overwrite);
+ QQuickParticleData* datum = m_system->newDatum(m_system->groupIds[m_group], !m_overwrite);
if (datum){//actually emit(otherwise we've been asked to skip this one)
datum->e = this;//###useful?
qreal t = 1 - (pt - opt) / dt;
emitParticles(QDeclarativeV8Handle::fromHandle(array));//A chance for arbitrary JS changes
}
- foreach (QSGParticleData* d, toEmit)
+ foreach (QQuickParticleData* d, toEmit)
m_system->emitParticle(d);
m_last_emission = pt;
#include <QQuickItem>
#include <QDebug>
-#include "qsgparticlesystem_p.h"
-#include "qsgparticleextruder_p.h"
-#include "qsgdirection_p.h"
+#include "qquickparticlesystem_p.h"
+#include "qquickparticleextruder_p.h"
+#include "qquickdirection_p.h"
#include <QList>
#include <QPair>
QT_MODULE(Declarative)
-class QSGParticleEmitter : public QQuickItem
+class QQuickParticleEmitter : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(QSGParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
+ Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
Q_PROPERTY(QString group READ group WRITE setGroup NOTIFY groupChanged)
- Q_PROPERTY(QSGParticleExtruder* shape READ extruder WRITE setExtruder NOTIFY extruderChanged)
+ Q_PROPERTY(QQuickParticleExtruder* shape READ extruder WRITE setExtruder NOTIFY extruderChanged)
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(int startTime READ startTime WRITE setStartTime NOTIFY startTimeChanged)
Q_PROPERTY(qreal endSize READ particleEndSize WRITE setParticleEndSize NOTIFY particleEndSizeChanged)
Q_PROPERTY(qreal sizeVariation READ particleSizeVariation WRITE setParticleSizeVariation NOTIFY particleSizeVariationChanged)
- Q_PROPERTY(QSGDirection *speed READ speed WRITE setSpeed NOTIFY speedChanged)
- Q_PROPERTY(QSGDirection *acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged)
+ Q_PROPERTY(QQuickDirection *speed READ speed WRITE setSpeed NOTIFY speedChanged)
+ Q_PROPERTY(QQuickDirection *acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged)
Q_PROPERTY(qreal speedFromMovement READ speedFromMovement WRITE setSpeedFromMovement NOTIFY speedFromMovementChanged)
Q_ENUMS(Lifetime)
public:
- explicit QSGParticleEmitter(QQuickItem *parent = 0);
- virtual ~QSGParticleEmitter();
+ explicit QQuickParticleEmitter(QQuickItem *parent = 0);
+ virtual ~QQuickParticleEmitter();
virtual void emitWindow(int timeStamp);
enum Lifetime {
- InfiniteLife = QSGParticleSystem::maxLife
+ InfiniteLife = QQuickParticleSystem::maxLife
};
bool enabled() const
return m_particleDuration;
}
- QSGParticleSystem* system() const
+ QQuickParticleSystem* system() const
{
return m_system;
}
void particleDurationChanged(int);
void enabledChanged(bool);
- void systemChanged(QSGParticleSystem* arg);
+ void systemChanged(QQuickParticleSystem* arg);
void groupChanged(QString arg);
void particleDurationVariationChanged(int arg);
- void extruderChanged(QSGParticleExtruder* arg);
+ void extruderChanged(QQuickParticleExtruder* arg);
void particleSizeChanged(qreal arg);
void particleSizeVariationChanged(qreal arg);
- void speedChanged(QSGDirection * arg);
+ void speedChanged(QQuickDirection * arg);
- void accelerationChanged(QSGDirection * arg);
+ void accelerationChanged(QQuickDirection * arg);
void maximumEmittedChanged(int arg);
void particleCountChanged();
}
}
- void setSystem(QSGParticleSystem* arg)
+ void setSystem(QQuickParticleSystem* arg)
{
if (m_system != arg) {
m_system = arg;
emit particleDurationVariationChanged(arg);
}
}
- void setExtruder(QSGParticleExtruder* arg)
+ void setExtruder(QQuickParticleExtruder* arg)
{
if (m_extruder != arg) {
m_extruder = arg;
}
}
- void setSpeed(QSGDirection * arg)
+ void setSpeed(QQuickDirection * arg)
{
if (m_speed != arg) {
m_speed = arg;
}
}
- void setAcceleration(QSGDirection * arg)
+ void setAcceleration(QQuickDirection * arg)
{
if (m_acceleration != arg) {
m_acceleration = arg;
public:
int particleCount() const;
- QSGParticleExtruder* extruder() const
+ QQuickParticleExtruder* extruder() const
{
return m_extruder;
}
return m_particleSizeVariation;
}
- QSGDirection * speed() const
+ QQuickDirection * speed() const
{
return m_speed;
}
- QSGDirection * acceleration() const
+ QQuickDirection * acceleration() const
{
return m_acceleration;
}
int m_particleDuration;
int m_particleDurationVariation;
bool m_enabled;
- QSGParticleSystem* m_system;
+ QQuickParticleSystem* m_system;
QString m_group;
- QSGParticleExtruder* m_extruder;
- QSGParticleExtruder* m_defaultExtruder;
- QSGParticleExtruder* effectiveExtruder();
- QSGDirection * m_speed;
- QSGDirection * m_acceleration;
+ QQuickParticleExtruder* m_extruder;
+ QQuickParticleExtruder* m_defaultExtruder;
+ QQuickParticleExtruder* effectiveExtruder();
+ QQuickDirection * m_speed;
+ QQuickDirection * m_acceleration;
qreal m_particleSize;
qreal m_particleEndSize;
qreal m_particleSizeVariation;
bool isEmitConnected();
private:
- QSGDirection m_nullVector;
+ QQuickDirection m_nullVector;
};
**
****************************************************************************/
-#include "qsgparticleextruder_p.h"
+#include "qquickparticleextruder_p.h"
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Shape QSGParticleExtruder
+ \qmlclass Shape QQuickParticleExtruder
\inqmlmodule QtQuick.Particles 2
\brief The Shape element allows you to specify an area for affectors and emitter.
The base class is just a rectangle.
*/
-QSGParticleExtruder::QSGParticleExtruder(QObject *parent) :
+QQuickParticleExtruder::QQuickParticleExtruder(QObject *parent) :
QObject(parent)
{
}
-QPointF QSGParticleExtruder::extrude(const QRectF &rect)
+QPointF QQuickParticleExtruder::extrude(const QRectF &rect)
{
return QPointF(((qreal)rand() / RAND_MAX) * rect.width() + rect.x(),
((qreal)rand() / RAND_MAX) * rect.height() + rect.y());
}
-bool QSGParticleExtruder::contains(const QRectF &bounds, const QPointF &point)
+bool QQuickParticleExtruder::contains(const QRectF &bounds, const QPointF &point)
{
return bounds.contains(point);
}
QT_MODULE(Declarative)
-class QSGParticleExtruder : public QObject
+class QQuickParticleExtruder : public QObject
{
Q_OBJECT
public:
- explicit QSGParticleExtruder(QObject *parent = 0);
+ explicit QQuickParticleExtruder(QObject *parent = 0);
virtual QPointF extrude(const QRectF &);
virtual bool contains(const QRectF &bounds, const QPointF &point);
**
****************************************************************************/
-#include "qsgparticlegroup_p.h"
+#include "qquickparticlegroup_p.h"
/*!
- \qmlclass ParticleGroup QSGParticleGroup
+ \qmlclass ParticleGroup QQuickParticleGroup
\inqmlmodule QtQuick.Particles 2
\brief ParticleGroup elements allow you to set attributes on a logical particle group.
milliseconds will occur before another transition is attempted.
*/
-QSGParticleGroup::QSGParticleGroup(QObject* parent)
+QQuickParticleGroup::QQuickParticleGroup(QObject* parent)
: QQuickStochasticState(parent)
, m_system(0)
{
void delayedRedirect(QDeclarativeListProperty<QObject> *prop, QObject *value)
{
- QSGParticleGroup* pg = qobject_cast<QSGParticleGroup*>(prop->object);
+ QQuickParticleGroup* pg = qobject_cast<QQuickParticleGroup*>(prop->object);
if (pg)
pg->delayRedirect(value);
}
-QDeclarativeListProperty<QObject> QSGParticleGroup::particleChildren()
+QDeclarativeListProperty<QObject> QQuickParticleGroup::particleChildren()
{
- QSGParticleSystem* system = qobject_cast<QSGParticleSystem*>(parent());
+ QQuickParticleSystem* system = qobject_cast<QQuickParticleSystem*>(parent());
if (system)
- return QDeclarativeListProperty<QObject>(this, 0, &QSGParticleSystem::statePropertyRedirect);
+ return QDeclarativeListProperty<QObject>(this, 0, &QQuickParticleSystem::statePropertyRedirect);
else
return QDeclarativeListProperty<QObject>(this, 0, &delayedRedirect);
}
-void QSGParticleGroup::setSystem(QSGParticleSystem* arg)
+void QQuickParticleGroup::setSystem(QQuickParticleSystem* arg)
{
if (m_system != arg) {
m_system = arg;
}
}
-void QSGParticleGroup::delayRedirect(QObject *obj)
+void QQuickParticleGroup::delayRedirect(QObject *obj)
{
m_delayedRedirects << obj;
}
-void QSGParticleGroup::performDelayedRedirects()
+void QQuickParticleGroup::performDelayedRedirects()
{
if (!m_system)
return;
m_delayedRedirects.clear();
}
-void QSGParticleGroup::componentComplete(){
- if (!m_system && qobject_cast<QSGParticleSystem*>(parent()))
- setSystem(qobject_cast<QSGParticleSystem*>(parent()));
+void QQuickParticleGroup::componentComplete(){
+ if (!m_system && qobject_cast<QQuickParticleSystem*>(parent()))
+ setSystem(qobject_cast<QQuickParticleSystem*>(parent()));
}
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef QSGPARTICLEGROUP
-#define QSGPARTICLEGROUP
+#ifndef QQuickPARTICLEGROUP
+#define QQuickPARTICLEGROUP
#include <private/qquickspriteengine_p.h>
-#include "qsgparticlesystem_p.h"
+#include "qquickparticlesystem_p.h"
#include "qdeclarativeparserstatus.h"
QT_BEGIN_NAMESPACE
-class QSGParticleGroup : public QQuickStochasticState, public QDeclarativeParserStatus
+class QQuickParticleGroup : public QQuickStochasticState, public QDeclarativeParserStatus
{
Q_OBJECT
//### Would setting limits per group be useful? Or clutter the API?
//Q_PROPERTY(int maximumAlive READ maximumAlive WRITE setMaximumAlive NOTIFY maximumAliveChanged)
- Q_PROPERTY(QSGParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
+ Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
//Intercept children requests and assign to the group & system
Q_PROPERTY(QDeclarativeListProperty<QObject> particleChildren READ particleChildren DESIGNABLE false)//### Hidden property for in-state system definitions - ought not to be used in actual "Sprite" states
Q_INTERFACES(QDeclarativeParserStatus)
public:
- explicit QSGParticleGroup(QObject* parent = 0);
+ explicit QQuickParticleGroup(QObject* parent = 0);
QDeclarativeListProperty<QObject> particleChildren();
return m_maximumAlive;
}
- QSGParticleSystem* system() const
+ QQuickParticleSystem* system() const
{
return m_system;
}
}
}
- void setSystem(QSGParticleSystem* arg);
+ void setSystem(QQuickParticleSystem* arg);
void delayRedirect(QObject* obj);
void maximumAliveChanged(int arg);
- void systemChanged(QSGParticleSystem* arg);
+ void systemChanged(QQuickParticleSystem* arg);
protected:
virtual void componentComplete();
void performDelayedRedirects();
int m_maximumAlive;
- QSGParticleSystem* m_system;
+ QQuickParticleSystem* m_system;
QList<QObject*> m_delayedRedirects;
};
**
****************************************************************************/
-#include "qsgparticlepainter_p.h"
+#include "qquickparticlepainter_p.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass ParticlePainter QSGParticlePainter
+ \qmlclass ParticlePainter QQuickParticlePainter
\inqmlmodule QtQuick.Particles 2
\inherits ParticlePainter
\brief ParticlePainter elements allow you to specify how to paint particles.
If empty, it will paint the default particle group ("").
*/
-QSGParticlePainter::QSGParticlePainter(QQuickItem *parent) :
+QQuickParticlePainter::QQuickParticlePainter(QQuickItem *parent) :
QQuickItem(parent),
- m_system(0), m_count(0), m_pleaseReset(true), m_sentinel(new QSGParticleData(0))
+ m_system(0), m_count(0), m_pleaseReset(true), m_sentinel(new QQuickParticleData(0))
{
}
-void QSGParticlePainter::componentComplete()
+void QQuickParticlePainter::componentComplete()
{
- if (!m_system && qobject_cast<QSGParticleSystem*>(parentItem()))
- setSystem(qobject_cast<QSGParticleSystem*>(parentItem()));
+ if (!m_system && qobject_cast<QQuickParticleSystem*>(parentItem()))
+ setSystem(qobject_cast<QQuickParticleSystem*>(parentItem()));
QQuickItem::componentComplete();
}
-void QSGParticlePainter::setSystem(QSGParticleSystem *arg)
+void QQuickParticlePainter::setSystem(QQuickParticleSystem *arg)
{
if (m_system != arg) {
m_system = arg;
}
}
-void QSGParticlePainter::load(QSGParticleData* d)
+void QQuickParticlePainter::load(QQuickParticleData* d)
{
if (m_pleaseReset)
return;
m_pendingCommits << qMakePair<int, int>(d->group, d->index);
}
-void QSGParticlePainter::reload(QSGParticleData* d)
+void QQuickParticlePainter::reload(QQuickParticleData* d)
{
if (m_pleaseReset)
return;
m_pendingCommits << qMakePair<int, int>(d->group, d->index);
}
-void QSGParticlePainter::reset()
+void QQuickParticlePainter::reset()
{
}
-void QSGParticlePainter::setCount(int c)//### TODO: some resizeing so that particles can reallocate on size change instead of recreate
+void QQuickParticlePainter::setCount(int c)//### TODO: some resizeing so that particles can reallocate on size change instead of recreate
{
Q_ASSERT(c >= 0); //XXX
if (c == m_count)
reset();
}
-int QSGParticlePainter::count()
+int QQuickParticlePainter::count()
{
return m_count;
}
-void QSGParticlePainter::calcSystemOffset(bool resetPending)
+void QQuickParticlePainter::calcSystemOffset(bool resetPending)
{
if (!m_system || !parentItem())
return;
//Reload all particles//TODO: Necessary?
foreach (const QString &g, m_groups){
int gId = m_system->groupIds[g];
- foreach (QSGParticleData* d, m_system->groupData[gId]->data)
+ foreach (QQuickParticleData* d, m_system->groupData[gId]->data)
reload(d);
}
}
}
typedef QPair<int,int> intPair;
-void QSGParticlePainter::performPendingCommits()
+void QQuickParticlePainter::performPendingCommits()
{
calcSystemOffset();
foreach (intPair p, m_pendingCommits)
#include <QObject>
#include <QDebug>
#include <QPair>
-#include "qsgparticlesystem_p.h"
+#include "qquickparticlesystem_p.h"
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGParticlePainter : public QQuickItem
+class QQuickParticlePainter : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(QSGParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
+ Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
Q_PROPERTY(QStringList groups READ groups WRITE setGroups NOTIFY groupsChanged)
public:
- explicit QSGParticlePainter(QQuickItem *parent = 0);
+ explicit QQuickParticlePainter(QQuickItem *parent = 0);
//Data Interface to system
- void load(QSGParticleData*);
- void reload(QSGParticleData*);
+ void load(QQuickParticleData*);
+ void reload(QQuickParticleData*);
void setCount(int c);
int count();
void performPendingCommits();//Called from updatePaintNode
- QSGParticleSystem* system() const
+ QQuickParticleSystem* system() const
{
return m_system;
}
signals:
void countChanged();
- void systemChanged(QSGParticleSystem* arg);
+ void systemChanged(QQuickParticleSystem* arg);
void groupsChanged(QStringList arg);
public slots:
- void setSystem(QSGParticleSystem* arg);
+ void setSystem(QQuickParticleSystem* arg);
void setGroups(QStringList arg)
{
Q_UNUSED(pIdx);
}
- QSGParticleSystem* m_system;
- friend class QSGParticleSystem;
+ QQuickParticleSystem* m_system;
+ friend class QQuickParticleSystem;
int m_count;
bool m_pleaseReset;//Used by subclasses, but it's a nice optimization to know when stuff isn't going to matter.
QStringList m_groups;
QPointF m_systemOffset;
private:
- QSGParticleData* m_sentinel;
+ QQuickParticleData* m_sentinel;
QSet<QPair<int,int> > m_pendingCommits;
- //QVector<QSGParticleData*> m_shadowData;//For when we implement overwrite: false
+ //QVector<QQuickParticleData*> m_shadowData;//For when we implement overwrite: false
};
QT_END_NAMESPACE
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Declarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickangledirection_p.h"
+#include "qquickcustomparticle_p.h"
+#include "qquickellipseextruder_p.h"
+#include "qquicktrailemitter_p.h"
+#include "qquickfriction_p.h"
+#include "qquickgravity_p.h"
+#include "qquickimageparticle_p.h"
+#include "qquickitemparticle_p.h"
+#include "qquickage_p.h"
+#include "qquicklineextruder_p.h"
+#include "qquickmaskextruder_p.h"
+#include "qquickparticleaffector_p.h"
+#include "qquickparticleemitter_p.h"
+#include "qquickparticleextruder_p.h"
+#include "qquickparticlepainter_p.h"
+#include "qquickparticlesmodule_p.h"
+#include "qquickparticlesystem_p.h"
+#include "qquickpointattractor_p.h"
+#include "qquickpointdirection_p.h"
+#include "qquickspritegoal_p.h"
+#include "qquickdirection_p.h"
+#include "qquicktargetdirection_p.h"
+#include "qquickturbulence_p.h"
+#include "qquickwander_p.h"
+#include "qquickcumulativedirection_p.h"
+#include "qquickcustomaffector_p.h"
+#include "qquickrectangleextruder_p.h"
+#include "qquickparticlegroup_p.h"
+#include "qquickgroupgoal_p.h"
+
+QT_BEGIN_NAMESPACE
+
+void QQuickParticlesModule::defineModule()
+{
+ const char* uri = "QtQuick.Particles";
+
+ qmlRegisterType<QQuickParticleSystem>(uri, 2, 0, "ParticleSystem");
+ qmlRegisterType<QQuickParticleGroup>(uri, 2, 0, "ParticleGroup");
+
+ qmlRegisterType<QQuickImageParticle>(uri, 2, 0, "ImageParticle");
+ qmlRegisterType<QQuickCustomParticle>(uri, 2, 0, "CustomParticle");
+ qmlRegisterType<QQuickItemParticle>(uri, 2, 0, "ItemParticle");
+
+ qmlRegisterType<QQuickParticleEmitter>(uri, 2, 0, "Emitter");
+ qmlRegisterType<QQuickTrailEmitter>(uri, 2, 0, "TrailEmitter");
+
+ qmlRegisterType<QQuickEllipseExtruder>(uri, 2, 0, "EllipseShape");
+ qmlRegisterType<QQuickRectangleExtruder>(uri, 2, 0, "RectangleShape");
+ qmlRegisterType<QQuickLineExtruder>(uri, 2, 0, "LineShape");
+ qmlRegisterType<QQuickMaskExtruder>(uri, 2, 0, "MaskShape");
+
+ qmlRegisterType<QQuickPointDirection>(uri, 2, 0, "PointDirection");
+ qmlRegisterType<QQuickAngleDirection>(uri, 2, 0, "AngleDirection");
+ qmlRegisterType<QQuickTargetDirection>(uri, 2, 0, "TargetDirection");
+ qmlRegisterType<QQuickCumulativeDirection>(uri, 2, 0, "CumulativeDirection");
+
+ qmlRegisterType<QQuickCustomAffector>(uri, 2, 0, "Affector");
+ qmlRegisterType<QQuickWanderAffector>(uri, 2, 0, "Wander");
+ qmlRegisterType<QQuickFrictionAffector>(uri, 2, 0, "Friction");
+ qmlRegisterType<QQuickAttractorAffector>(uri, 2, 0, "Attractor");
+ qmlRegisterType<QQuickGravityAffector>(uri, 2, 0, "Gravity");
+ qmlRegisterType<QQuickAgeAffector>(uri, 2, 0, "Age");
+ qmlRegisterType<QQuickSpriteGoalAffector>(uri, 2, 0, "SpriteGoal");
+ qmlRegisterType<QQuickGroupGoalAffector>(uri, 2, 0, "GroupGoal");
+ qmlRegisterType<QQuickTurbulenceAffector>(uri, 2, 0 , "Turbulence");
+
+ //Exposed just for completeness
+ qmlRegisterUncreatableType<QQuickParticleAffector>(uri, 2, 0, "ParticleAffector",
+ QStringLiteral("Abstract type. Use one of the inheriting types instead."));
+ qmlRegisterUncreatableType<QQuickParticlePainter>(uri, 2, 0, "ParticlePainter",
+ QStringLiteral("Abstract type. Use one of the inheriting types instead."));
+ qmlRegisterUncreatableType<QQuickParticleExtruder>(uri, 2, 0, "ParticleExtruder",
+ QStringLiteral("Abstract type. Use one of the inheriting types instead."));
+ qmlRegisterUncreatableType<QQuickDirection>(uri, 2, 0, "NullVector",
+ QStringLiteral("Abstract type. Use one of the inheriting types instead."));
+}
+
+QT_END_NAMESPACE
+
**
****************************************************************************/
-#ifndef QSGPARTICLESMODULE_H
-#define QSGPARTICLESMODULE_H
+#ifndef QQuickPARTICLESMODULE_H
+#define QQuickPARTICLESMODULE_H
#include <qdeclarative.h>
QT_MODULE(Declarative)
-class QSGParticlesModule
+class QQuickParticlesModule
{
public:
static void defineModule();
QT_END_HEADER
-#endif // QSGPARTICLESMODULE_H
+#endif // QQuickPARTICLESMODULE_H
**
****************************************************************************/
-#include "qsgparticlesystem_p.h"
+#include "qquickparticlesystem_p.h"
#include <qsgnode.h>
-#include "qsgparticleemitter_p.h"
-#include "qsgparticleaffector_p.h"
-#include "qsgparticlepainter_p.h"
+#include "qquickparticleemitter_p.h"
+#include "qquickparticleaffector_p.h"
+#include "qquickparticlepainter_p.h"
#include <private/qquickspriteengine_p.h>
#include <private/qquicksprite_p.h>
-#include "qsgv8particledata_p.h"
-#include "qsgparticlegroup_p.h"
+#include "qquickv8particledata_p.h"
+#include "qquickparticlegroup_p.h"
-#include "qsgtrailemitter_p.h"//###For auto-follow on states, perhaps should be in emitter?
+#include "qquicktrailemitter_p.h"//###For auto-follow on states, perhaps should be in emitter?
#include <private/qdeclarativeengine_p.h>
#include <cmath>
#include <QDebug>
//###Switch to define later, for now user-friendly (no compilation) debugging is worth it
DEFINE_BOOL_CONFIG_OPTION(qmlParticlesDebug, QML_PARTICLES_DEBUG)
/*!
- \qmlclass ParticleSystem QSGParticleSystem
+ \qmlclass ParticleSystem QQuickParticleSystem
\inqmlmodule QtQuick.Particles 2
\brief The ParticleSystem brings together ParticlePainter, Emitter and Affector elements.
return (int)qRound(a*1000.0);
}
-QSGParticleDataHeap::QSGParticleDataHeap()
+QQuickParticleDataHeap::QQuickParticleDataHeap()
: m_data(0)
{
m_data.reserve(1000);
clear();
}
-void QSGParticleDataHeap::grow() //###Consider automatic growth vs resize() calls from GroupData
+void QQuickParticleDataHeap::grow() //###Consider automatic growth vs resize() calls from GroupData
{
m_data.resize(1 << ++m_size);
}
-void QSGParticleDataHeap::insert(QSGParticleData* data)
+void QQuickParticleDataHeap::insert(QQuickParticleData* data)
{
insertTimed(data, roundedTime(data->t + data->lifeSpan));
}
-void QSGParticleDataHeap::insertTimed(QSGParticleData* data, int time){
+void QQuickParticleDataHeap::insertTimed(QQuickParticleData* data, int time){
//TODO: Optimize 0 lifespan (or already dead) case
if (m_lookups.contains(time)){
m_data[m_lookups[time]].data << data;
bubbleUp(m_end++);
}
-int QSGParticleDataHeap::top()
+int QQuickParticleDataHeap::top()
{
if (m_end == 0)
return 1 << 30;
return m_data[0].time;
}
-QSet<QSGParticleData*> QSGParticleDataHeap::pop()
+QSet<QQuickParticleData*> QQuickParticleDataHeap::pop()
{
if (!m_end)
- return QSet<QSGParticleData*> ();
- QSet<QSGParticleData*> ret = m_data[0].data;
+ return QSet<QQuickParticleData*> ();
+ QSet<QQuickParticleData*> ret = m_data[0].data;
m_lookups.remove(m_data[0].time);
if (m_end == 1){
--m_end;
return ret;
}
-void QSGParticleDataHeap::clear()
+void QQuickParticleDataHeap::clear()
{
m_size = 0;
m_end = 0;
m_lookups.clear();
}
-bool QSGParticleDataHeap::contains(QSGParticleData* d)
+bool QQuickParticleDataHeap::contains(QQuickParticleData* d)
{
for (int i=0; i<m_end; i++)
if (m_data[i].data.contains(d))
return false;
}
-void QSGParticleDataHeap::swap(int a, int b)
+void QQuickParticleDataHeap::swap(int a, int b)
{
m_tmp = m_data[a];
m_data[a] = m_data[b];
m_lookups[m_data[b].time] = b;
}
-void QSGParticleDataHeap::bubbleUp(int idx)//tends to be called once
+void QQuickParticleDataHeap::bubbleUp(int idx)//tends to be called once
{
if (!idx)
return;
}
}
-void QSGParticleDataHeap::bubbleDown(int idx)//tends to be called log n times
+void QQuickParticleDataHeap::bubbleDown(int idx)//tends to be called log n times
{
int left = idx*2 + 1;
if (left >= m_end)
}
}
-QSGParticleGroupData::QSGParticleGroupData(int id, QSGParticleSystem* sys):index(id),m_size(0),m_system(sys)
+QQuickParticleGroupData::QQuickParticleGroupData(int id, QQuickParticleSystem* sys):index(id),m_size(0),m_system(sys)
{
initList();
}
-QSGParticleGroupData::~QSGParticleGroupData()
+QQuickParticleGroupData::~QQuickParticleGroupData()
{
- foreach (QSGParticleData* d, data)
+ foreach (QQuickParticleData* d, data)
delete d;
}
-int QSGParticleGroupData::size()
+int QQuickParticleGroupData::size()
{
return m_size;
}
-QString QSGParticleGroupData::name()//### Worth caching as well?
+QString QQuickParticleGroupData::name()//### Worth caching as well?
{
return m_system->groupIds.key(index);
}
-void QSGParticleGroupData::setSize(int newSize){
+void QQuickParticleGroupData::setSize(int newSize){
if (newSize == m_size)
return;
Q_ASSERT(newSize > m_size);//XXX allow shrinking
data.resize(newSize);
for (int i=m_size; i<newSize; i++){
- data[i] = new QSGParticleData(m_system);
+ data[i] = new QQuickParticleData(m_system);
data[i]->group = index;
data[i]->index = i;
reusableIndexes << i;
}
int delta = newSize - m_size;
m_size = newSize;
- foreach (QSGParticlePainter* p, painters)
+ foreach (QQuickParticlePainter* p, painters)
p->setCount(p->count() + delta);
}
-void QSGParticleGroupData::initList()
+void QQuickParticleGroupData::initList()
{
dataHeap.clear();
}
-void QSGParticleGroupData::kill(QSGParticleData* d)
+void QQuickParticleGroupData::kill(QQuickParticleData* d)
{
Q_ASSERT(d->group == index);
d->lifeSpan = 0;//Kill off
- foreach (QSGParticlePainter* p, painters)
+ foreach (QQuickParticlePainter* p, painters)
p->reload(d);
reusableIndexes << d->index;
}
-QSGParticleData* QSGParticleGroupData::newDatum(bool respectsLimits)
+QQuickParticleData* QQuickParticleGroupData::newDatum(bool respectsLimits)
{
//recycle();//Extra recycler round to be sure?
return data[oldSize];
}
-bool QSGParticleGroupData::recycle()
+bool QQuickParticleGroupData::recycle()
{
while (dataHeap.top() <= m_system->timeInt){
- foreach (QSGParticleData* datum, dataHeap.pop()){
+ foreach (QQuickParticleData* datum, dataHeap.pop()){
if (!datum->stillAlive()){
reusableIndexes << datum->index;
}else{
return reusableIndexes.count() == m_size;
}
-void QSGParticleGroupData::prepareRecycler(QSGParticleData* d){
+void QQuickParticleGroupData::prepareRecycler(QQuickParticleData* d){
if (d->lifeSpan*1000 < m_system->maxLife){
dataHeap.insert(d);
} else {
}
}
-QSGParticleData::QSGParticleData(QSGParticleSystem* sys)
+QQuickParticleData::QQuickParticleData(QQuickParticleSystem* sys)
: group(0)
, e(0)
, system(sys)
modelIndex = -1;
}
-void QSGParticleData::clone(const QSGParticleData& other)
+void QQuickParticleData::clone(const QQuickParticleData& other)
{
x = other.x;
y = other.y;
animationOwner = other.animationOwner;
}
-QDeclarativeV8Handle QSGParticleData::v8Value()
+QDeclarativeV8Handle QQuickParticleData::v8Value()
{
if (!v8Datum)
- v8Datum = new QSGV8ParticleData(QDeclarativeEnginePrivate::getV8Engine(qmlEngine(system)), this);
+ v8Datum = new QQuickV8ParticleData(QDeclarativeEnginePrivate::getV8Engine(qmlEngine(system)), this);
return v8Datum->v8Value();
}
//sets the x accleration without affecting the instantaneous x velocity or position
-void QSGParticleData::setInstantaneousAX(qreal ax)
+void QQuickParticleData::setInstantaneousAX(qreal ax)
{
qreal t = (system->timeInt / 1000.0) - this->t;
qreal vx = (this->vx + t*this->ax) - t*ax;
}
//sets the x velocity without affecting the instantaneous x postion
-void QSGParticleData::setInstantaneousVX(qreal vx)
+void QQuickParticleData::setInstantaneousVX(qreal vx)
{
qreal t = (system->timeInt / 1000.0) - this->t;
qreal evx = vx - t*this->ax;
}
//sets the instantaneous x postion
-void QSGParticleData::setInstantaneousX(qreal x)
+void QQuickParticleData::setInstantaneousX(qreal x)
{
qreal t = (system->timeInt / 1000.0) - this->t;
this->x = x - t*this->vx - 0.5 * t*t*this->ax;
}
//sets the y accleration without affecting the instantaneous y velocity or position
-void QSGParticleData::setInstantaneousAY(qreal ay)
+void QQuickParticleData::setInstantaneousAY(qreal ay)
{
qreal t = (system->timeInt / 1000.0) - this->t;
qreal vy = (this->vy + t*this->ay) - t*ay;
}
//sets the y velocity without affecting the instantaneous y position
-void QSGParticleData::setInstantaneousVY(qreal vy)
+void QQuickParticleData::setInstantaneousVY(qreal vy)
{
qreal t = (system->timeInt / 1000.0) - this->t;
qreal evy = vy - t*this->ay;
}
//sets the instantaneous Y position
-void QSGParticleData::setInstantaneousY(qreal y)
+void QQuickParticleData::setInstantaneousY(qreal y)
{
qreal t = (system->timeInt / 1000.0) - this->t;
this->y = y - t*this->vy - 0.5 * t*t*this->ay;
}
-qreal QSGParticleData::curX() const
+qreal QQuickParticleData::curX() const
{
qreal t = (system->timeInt / 1000.0) - this->t;
return this->x + this->vx * t + 0.5 * this->ax * t * t;
}
-qreal QSGParticleData::curVX() const
+qreal QQuickParticleData::curVX() const
{
qreal t = (system->timeInt / 1000.0) - this->t;
return this->vx + t*this->ax;
}
-qreal QSGParticleData::curY() const
+qreal QQuickParticleData::curY() const
{
qreal t = (system->timeInt / 1000.0) - this->t;
return y + vy * t + 0.5 * ay * t * t;
}
-qreal QSGParticleData::curVY() const
+qreal QQuickParticleData::curVY() const
{
qreal t = (system->timeInt / 1000.0) - this->t;
return vy + t*ay;
}
-void QSGParticleData::debugDump()
+void QQuickParticleData::debugDump()
{
qDebug() << "Particle" << systemIndex << group << "/" << index << stillAlive()
<< "Pos: " << x << "," << y
<< "Time: " << t << "," <<lifeSpan << ";" << (system->timeInt / 1000.0) ;
}
-bool QSGParticleData::stillAlive()
+bool QQuickParticleData::stillAlive()
{
if (!system)
return false;
return (t + lifeSpan - EPSILON) > ((qreal)system->timeInt/1000.0);
}
-float QSGParticleData::curSize()
+float QQuickParticleData::curSize()
{
if (!system || !lifeSpan)
return 0.0f;
return size + (endSize - size) * (1 - (lifeLeft() / lifeSpan));
}
-float QSGParticleData::lifeLeft()
+float QQuickParticleData::lifeLeft()
{
if (!system)
return 0.0f;
return (t + lifeSpan) - (system->timeInt/1000.0);
}
-void QSGParticleData::extendLife(float time)
+void QQuickParticleData::extendLife(float time)
{
qreal newX = curX();
qreal newY = curY();
vy = evy;
}
-QSGParticleSystem::QSGParticleSystem(QQuickItem *parent) :
+QQuickParticleSystem::QQuickParticleSystem(QQuickItem *parent) :
QQuickItem(parent),
stateEngine(0),
m_running(true),
m_debugMode = qmlParticlesDebug();
}
-QSGParticleSystem::~QSGParticleSystem()
+QQuickParticleSystem::~QQuickParticleSystem()
{
- foreach (QSGParticleGroupData* gd, groupData)
+ foreach (QQuickParticleGroupData* gd, groupData)
delete gd;
}
-void QSGParticleSystem::initGroups()
+void QQuickParticleSystem::initGroups()
{
m_reusableIndexes.clear();
m_nextIndex = 0;
groupData.clear();
groupIds.clear();
- QSGParticleGroupData* gd = new QSGParticleGroupData(0, this);//Default group
+ QQuickParticleGroupData* gd = new QQuickParticleGroupData(0, this);//Default group
groupData.insert(0,gd);
groupIds.insert(QString(), 0);
m_nextGroupId = 1;
}
-void QSGParticleSystem::registerParticlePainter(QSGParticlePainter* p)
+void QQuickParticleSystem::registerParticlePainter(QQuickParticlePainter* p)
{
//TODO: a way to Unregister emitters, painters and affectors
- m_painters << QPointer<QSGParticlePainter>(p);//###Set or uniqueness checking?
+ m_painters << QPointer<QQuickParticlePainter>(p);//###Set or uniqueness checking?
connect(p, SIGNAL(groupsChanged(QStringList)),
&m_painterMapper, SLOT(map()));
loadPainter(p);
}
-void QSGParticleSystem::registerParticleEmitter(QSGParticleEmitter* e)
+void QQuickParticleSystem::registerParticleEmitter(QQuickParticleEmitter* e)
{
- m_emitters << QPointer<QSGParticleEmitter>(e);//###How to get them out?
+ m_emitters << QPointer<QQuickParticleEmitter>(e);//###How to get them out?
connect(e, SIGNAL(particleCountChanged()),
this, SLOT(emittersChanged()));
connect(e, SIGNAL(groupChanged(QString)),
e->reset();//Start, so that starttime factors appropriately
}
-void QSGParticleSystem::registerParticleAffector(QSGParticleAffector* a)
+void QQuickParticleSystem::registerParticleAffector(QQuickParticleAffector* a)
{
- m_affectors << QPointer<QSGParticleAffector>(a);
+ m_affectors << QPointer<QQuickParticleAffector>(a);
}
-void QSGParticleSystem::registerParticleGroup(QSGParticleGroup* g)
+void QQuickParticleSystem::registerParticleGroup(QQuickParticleGroup* g)
{
- m_groups << QPointer<QSGParticleGroup>(g);
+ m_groups << QPointer<QQuickParticleGroup>(g);
createEngine();
}
-void QSGParticleSystem::setRunning(bool arg)
+void QQuickParticleSystem::setRunning(bool arg)
{
if (m_running != arg) {
m_running = arg;
}
}
-void QSGParticleSystem::setPaused(bool arg){
+void QQuickParticleSystem::setPaused(bool arg){
if (m_paused != arg) {
m_paused = arg;
if (m_animation && m_animation->state() != QAbstractAnimation::Stopped)
m_paused ? m_animation->pause() : m_animation->resume();
if (!m_paused){
- foreach (QSGParticlePainter *p, m_painters)
+ foreach (QQuickParticlePainter *p, m_painters)
p->update();
}
emit pausedChanged(arg);
}
}
-void QSGParticleSystem::statePropertyRedirect(QDeclarativeListProperty<QObject> *prop, QObject *value)
+void QQuickParticleSystem::statePropertyRedirect(QDeclarativeListProperty<QObject> *prop, QObject *value)
{
//Hooks up automatic state-associated stuff
- QSGParticleSystem* sys = qobject_cast<QSGParticleSystem*>(prop->object->parent());
- QSGParticleGroup* group = qobject_cast<QSGParticleGroup*>(prop->object);
+ QQuickParticleSystem* sys = qobject_cast<QQuickParticleSystem*>(prop->object->parent());
+ QQuickParticleGroup* group = qobject_cast<QQuickParticleGroup*>(prop->object);
if (!group || !sys || !value)
return;
stateRedirect(group, sys, value);
}
-void QSGParticleSystem::stateRedirect(QSGParticleGroup* group, QSGParticleSystem* sys, QObject *value)
+void QQuickParticleSystem::stateRedirect(QQuickParticleGroup* group, QQuickParticleSystem* sys, QObject *value)
{
QStringList list;
list << group->name();
- QSGParticleAffector* a = qobject_cast<QSGParticleAffector*>(value);
+ QQuickParticleAffector* a = qobject_cast<QQuickParticleAffector*>(value);
if (a){
a->setParentItem(sys);
a->setGroups(list);
a->setSystem(sys);
return;
}
- QSGTrailEmitter* fe = qobject_cast<QSGTrailEmitter*>(value);
+ QQuickTrailEmitter* fe = qobject_cast<QQuickTrailEmitter*>(value);
if (fe){
fe->setParentItem(sys);
fe->setFollow(group->name());
fe->setSystem(sys);
return;
}
- QSGParticleEmitter* e = qobject_cast<QSGParticleEmitter*>(value);
+ QQuickParticleEmitter* e = qobject_cast<QQuickParticleEmitter*>(value);
if (e){
e->setParentItem(sys);
e->setGroup(group->name());
e->setSystem(sys);
return;
}
- QSGParticlePainter* p = qobject_cast<QSGParticlePainter*>(value);
+ QQuickParticlePainter* p = qobject_cast<QQuickParticlePainter*>(value);
if (p){
p->setParentItem(sys);
p->setGroups(list);
qWarning() << value << " was placed inside a particle system state but cannot be taken into the particle system. It will be lost.";
}
-void QSGParticleSystem::componentComplete()
+void QQuickParticleSystem::componentComplete()
{
QQuickItem::componentComplete();
m_componentComplete = true;
- m_animation = new QSGParticleSystemAnimation(this);
+ m_animation = new QQuickParticleSystemAnimation(this);
reset();//restarts animation as well
}
-void QSGParticleSystem::reset()
+void QQuickParticleSystem::reset()
{
if (!m_componentComplete)
return;
if (!m_running)
return;
- foreach (QSGParticleEmitter* e, m_emitters)
+ foreach (QQuickParticleEmitter* e, m_emitters)
e->reset();
emittersChanged();
- foreach (QSGParticlePainter *p, m_painters){
+ foreach (QQuickParticlePainter *p, m_painters){
loadPainter(p);
p->reset();
}
}
-void QSGParticleSystem::loadPainter(QObject *p)
+void QQuickParticleSystem::loadPainter(QObject *p)
{
if (!m_componentComplete)
return;
- QSGParticlePainter* painter = qobject_cast<QSGParticlePainter*>(p);
+ QQuickParticlePainter* painter = qobject_cast<QQuickParticlePainter*>(p);
Q_ASSERT(painter);//XXX
- foreach (QSGParticleGroupData* sg, groupData)
+ foreach (QQuickParticleGroupData* sg, groupData)
sg->painters.remove(painter);
int particleCount = 0;
if (painter->groups().isEmpty()){//Uses default particle
foreach (const QString &group, painter->groups()){
if (group != QLatin1String("") && !groupIds[group]){//new group
int id = m_nextGroupId++;
- QSGParticleGroupData* gd = new QSGParticleGroupData(id, this);
+ QQuickParticleGroupData* gd = new QQuickParticleGroupData(id, this);
groupIds.insert(group, id);
groupData.insert(id, gd);
}
return;
}
-void QSGParticleSystem::emittersChanged()
+void QQuickParticleSystem::emittersChanged()
{
if (!m_componentComplete)
return;
newSizes << 0;
}
- foreach (QSGParticleEmitter* e, m_emitters){//Populate groups and set sizes.
+ foreach (QQuickParticleEmitter* e, m_emitters){//Populate groups and set sizes.
if (!groupIds.contains(e->group())
|| (!e->group().isEmpty() && !groupIds[e->group()])){//or it was accidentally inserted by a failed lookup earlier
int id = m_nextGroupId++;
- QSGParticleGroupData* gd = new QSGParticleGroupData(id, this);
+ QQuickParticleGroupData* gd = new QQuickParticleGroupData(id, this);
groupIds.insert(e->group(), id);
groupData.insert(id, gd);
previousSizes << 0;
if (particleCount > bySysIdx.size())//New datum requests haven't updated it
bySysIdx.resize(particleCount);
- foreach (QSGParticlePainter *p, m_painters)
+ foreach (QQuickParticlePainter *p, m_painters)
loadPainter(p);
if (!m_groups.isEmpty())
}
-void QSGParticleSystem::createEngine()
+void QQuickParticleSystem::createEngine()
{
if (!m_componentComplete)
return;
if (stateEngine && m_debugMode)
qDebug() << "Resetting Existing Sprite Engine...";
//### Solve the losses if size/states go down
- foreach (QSGParticleGroup* group, m_groups){
+ foreach (QQuickParticleGroup* group, m_groups){
bool exists = false;
foreach (const QString &name, groupIds.keys())
if (group->name() == name)
exists = true;
if (!exists){
int id = m_nextGroupId++;
- QSGParticleGroupData* gd = new QSGParticleGroupData(id, this);
+ QQuickParticleGroupData* gd = new QQuickParticleGroupData(id, this);
groupIds.insert(group->name(), id);
groupData.insert(id, gd);
}
if (m_groups.count()){
//Reorder groups List so as to have the same order as groupData
- QList<QSGParticleGroup*> newList;
+ QList<QQuickParticleGroup*> newList;
for (int i=0; i<m_nextGroupId; i++){
bool exists = false;
QString name = groupData[i]->name();
- foreach (QSGParticleGroup* existing, m_groups){
+ foreach (QQuickParticleGroup* existing, m_groups){
if (existing->name() == name){
newList << existing;
exists = true;
}
}
if (!exists){
- newList << new QSGParticleGroup(this);
+ newList << new QQuickParticleGroup(this);
newList.back()->setName(name);
}
}
m_groups = newList;
QList<QQuickStochasticState*> states;
- foreach (QSGParticleGroup* g, m_groups)
+ foreach (QQuickParticleGroup* g, m_groups)
states << (QQuickStochasticState*)g;
if (!stateEngine)
}
-void QSGParticleSystem::particleStateChange(int idx)
+void QQuickParticleSystem::particleStateChange(int idx)
{
moveGroups(bySysIdx[idx], stateEngine->curState(idx));
}
-void QSGParticleSystem::moveGroups(QSGParticleData *d, int newGIdx)
+void QQuickParticleSystem::moveGroups(QQuickParticleData *d, int newGIdx)
{
if (!d || newGIdx == d->group)
return;
- QSGParticleData* pd = newDatum(newGIdx, false, d->systemIndex);
+ QQuickParticleData* pd = newDatum(newGIdx, false, d->systemIndex);
if (!pd)
return;
groupData[d->group]->kill(d);
}
-int QSGParticleSystem::nextSystemIndex()
+int QQuickParticleSystem::nextSystemIndex()
{
if (!m_reusableIndexes.isEmpty()){
int ret = *(m_reusableIndexes.begin());
return m_nextIndex++;
}
-QSGParticleData* QSGParticleSystem::newDatum(int groupId, bool respectLimits, int sysIndex)
+QQuickParticleData* QQuickParticleSystem::newDatum(int groupId, bool respectLimits, int sysIndex)
{
Q_ASSERT(groupId < groupData.count());//XXX shouldn't really be an assert
- QSGParticleData* ret = groupData[groupId]->newDatum(respectLimits);
+ QQuickParticleData* ret = groupData[groupId]->newDatum(respectLimits);
if (!ret){
return 0;
}
return ret;
}
-void QSGParticleSystem::emitParticle(QSGParticleData* pd)
+void QQuickParticleSystem::emitParticle(QQuickParticleData* pd)
{// called from prepareNextFrame()->emitWindow - enforce?
//Account for relative emitter position
QPointF offset = this->mapFromItem(pd->e, QPointF(0, 0));
finishNewDatum(pd);
}
-void QSGParticleSystem::finishNewDatum(QSGParticleData *pd){
+void QQuickParticleSystem::finishNewDatum(QQuickParticleData *pd){
Q_ASSERT(pd);
groupData[pd->group]->prepareRecycler(pd);
- foreach (QSGParticleAffector *a, m_affectors)
+ foreach (QQuickParticleAffector *a, m_affectors)
if (a && a->m_needsReset)
a->reset(pd);
- foreach (QSGParticlePainter* p, groupData[pd->group]->painters)
+ foreach (QQuickParticlePainter* p, groupData[pd->group]->painters)
if (p)
p->load(pd);
}
-void QSGParticleSystem::updateCurrentTime( int currentTime )
+void QQuickParticleSystem::updateCurrentTime( int currentTime )
{
if (!initialized)
return;//error in initialization
bool oldClear = m_empty;
m_empty = true;
- foreach (QSGParticleGroupData* gd, groupData)//Recycle all groups and see if they're out of live particles
+ foreach (QQuickParticleGroupData* gd, groupData)//Recycle all groups and see if they're out of live particles
m_empty = gd->recycle() && m_empty;
if (stateEngine)
stateEngine->updateSprites(timeInt);
- foreach (QSGParticleEmitter* emitter, m_emitters)
+ foreach (QQuickParticleEmitter* emitter, m_emitters)
if (emitter)
emitter->emitWindow(timeInt);
- foreach (QSGParticleAffector* a, m_affectors)
+ foreach (QQuickParticleAffector* a, m_affectors)
if (a)
a->affectSystem(dt);
- foreach (QSGParticleData* d, needsReset)
- foreach (QSGParticlePainter* p, groupData[d->group]->painters)
+ foreach (QQuickParticleData* d, needsReset)
+ foreach (QQuickParticlePainter* p, groupData[d->group]->painters)
if (p && d)
p->reload(d);
emptyChanged(m_empty);
}
-int QSGParticleSystem::systemSync(QSGParticlePainter* p)
+int QQuickParticleSystem::systemSync(QQuickParticlePainter* p)
{
if (!m_running)
return 0;
QT_MODULE(Declarative)
-class QSGParticleSystem;
-class QSGParticleAffector;
-class QSGParticleEmitter;
-class QSGParticlePainter;
-class QSGParticleData;
-class QSGParticleSystemAnimation;
+class QQuickParticleSystem;
+class QQuickParticleAffector;
+class QQuickParticleEmitter;
+class QQuickParticlePainter;
+class QQuickParticleData;
+class QQuickParticleSystemAnimation;
class QQuickStochasticEngine;
class QQuickSprite;
-class QSGV8ParticleData;
-class QSGParticleGroup;
-class QSGImageParticle;
+class QQuickV8ParticleData;
+class QQuickParticleGroup;
+class QQuickImageParticle;
-struct QSGParticleDataHeapNode{
+struct QQuickParticleDataHeapNode{
int time;//in ms
- QSet<QSGParticleData*> data;//Set ptrs instead?
+ QSet<QQuickParticleData*> data;//Set ptrs instead?
};
-class QSGParticleDataHeap {
+class QQuickParticleDataHeap {
//Idea is to do a binary heap, but which also stores a set of int,Node* so that if the int already exists, you can
//add it to the data* list. Pops return the whole list at once.
public:
- QSGParticleDataHeap();
- void insert(QSGParticleData* data);
- void insertTimed(QSGParticleData* data, int time);
+ QQuickParticleDataHeap();
+ void insert(QQuickParticleData* data);
+ void insertTimed(QQuickParticleData* data, int time);
int top();
- QSet<QSGParticleData*> pop();
+ QSet<QQuickParticleData*> pop();
void clear();
- bool contains(QSGParticleData*);//O(n), for debugging purposes only
+ bool contains(QQuickParticleData*);//O(n), for debugging purposes only
private:
void grow();
void swap(int, int);
void bubbleDown(int);
int m_size;
int m_end;
- QSGParticleDataHeapNode m_tmp;
- QVector<QSGParticleDataHeapNode> m_data;
+ QQuickParticleDataHeapNode m_tmp;
+ QVector<QQuickParticleDataHeapNode> m_data;
QHash<int,int> m_lookups;
};
-class Q_AUTOTEST_EXPORT QSGParticleGroupData {
+class Q_AUTOTEST_EXPORT QQuickParticleGroupData {
public:
- QSGParticleGroupData(int id, QSGParticleSystem* sys);
- ~QSGParticleGroupData();
+ QQuickParticleGroupData(int id, QQuickParticleSystem* sys);
+ ~QQuickParticleGroupData();
int size();
QString name();
void setSize(int newSize);
int index;
- QSet<QSGParticlePainter*> painters;
+ QSet<QQuickParticlePainter*> painters;
//TODO: Refactor particle data list out into a separate class
- QVector<QSGParticleData*> data;
- QSGParticleDataHeap dataHeap;
+ QVector<QQuickParticleData*> data;
+ QQuickParticleDataHeap dataHeap;
QSet<int> reusableIndexes;
bool recycle(); //Force recycling round, reutrns true if all indexes are now reusable
void initList();
- void kill(QSGParticleData* d);
+ void kill(QQuickParticleData* d);
//After calling this, initialize, then call prepareRecycler(d)
- QSGParticleData* newDatum(bool respectsLimits);
+ QQuickParticleData* newDatum(bool respectsLimits);
//TODO: Find and clean up those that don't get added to the recycler (currently they get lost)
- void prepareRecycler(QSGParticleData* d);
+ void prepareRecycler(QQuickParticleData* d);
private:
int m_size;
- QSGParticleSystem* m_system;
+ QQuickParticleSystem* m_system;
};
struct Color4ub {
uchar a;
};
-class Q_AUTOTEST_EXPORT QSGParticleData {
+class Q_AUTOTEST_EXPORT QQuickParticleData {
public:
//TODO: QObject like memory management (without the cost, just attached to system)
- QSGParticleData(QSGParticleSystem* sys);
+ QQuickParticleData(QQuickParticleSystem* sys);
//Convenience functions for working backwards, because parameters are from the start of particle life
//If setting multiple parameters at once, doing the conversion yourself will be faster.
qreal curAY() const { return ay; }
int group;
- QSGParticleEmitter* e;//### Needed?
- QSGParticleSystem* system;
+ QQuickParticleEmitter* e;//### Needed?
+ QQuickParticleSystem* system;
int index;
int systemIndex;
float update;//Used by custom affectors
//Used by image particle
- QSGImageParticle* colorOwner;
- QSGImageParticle* rotationOwner;
- QSGImageParticle* deformationOwner;
- QSGImageParticle* animationOwner;
+ QQuickImageParticle* colorOwner;
+ QQuickImageParticle* rotationOwner;
+ QQuickImageParticle* deformationOwner;
+ QQuickImageParticle* animationOwner;
void debugDump();
bool stillAlive();
float lifeLeft();
float curSize();
- void clone(const QSGParticleData& other);//Not =, leaves meta-data like index
+ void clone(const QQuickParticleData& other);//Not =, leaves meta-data like index
QDeclarativeV8Handle v8Value();
void extendLife(float time);
private:
- QSGV8ParticleData* v8Datum;
+ QQuickV8ParticleData* v8Datum;
};
-class Q_AUTOTEST_EXPORT QSGParticleSystem : public QQuickItem
+class Q_AUTOTEST_EXPORT QQuickParticleSystem : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged)
public:
- explicit QSGParticleSystem(QQuickItem *parent = 0);
- ~QSGParticleSystem();
+ explicit QQuickParticleSystem(QQuickItem *parent = 0);
+ ~QQuickParticleSystem();
bool isRunning() const
{
public:
//These can be called multiple times per frame, performance critical
- void emitParticle(QSGParticleData* p);
- QSGParticleData* newDatum(int groupId, bool respectLimits = true, int sysIdx = -1);
- void finishNewDatum(QSGParticleData*);
- void moveGroups(QSGParticleData *d, int newGIdx);
+ void emitParticle(QQuickParticleData* p);
+ QQuickParticleData* newDatum(int groupId, bool respectLimits = true, int sysIdx = -1);
+ void finishNewDatum(QQuickParticleData*);
+ void moveGroups(QQuickParticleData *d, int newGIdx);
int nextSystemIndex();
//This one only once per painter per frame
- int systemSync(QSGParticlePainter* p);
+ int systemSync(QQuickParticlePainter* p);
//Data members here for ease of related class and auto-test usage. Not "public" API. TODO: d_ptrize
- QSet<QSGParticleData*> needsReset;
- QVector<QSGParticleData*> bySysIdx; //Another reference to the data (data owned by group), but by sysIdx
+ QSet<QQuickParticleData*> needsReset;
+ QVector<QQuickParticleData*> bySysIdx; //Another reference to the data (data owned by group), but by sysIdx
QHash<QString, int> groupIds;
- QHash<int, QSGParticleGroupData*> groupData;
+ QHash<int, QQuickParticleGroupData*> groupData;
QQuickStochasticEngine* stateEngine;
//Also only here for auto-test usage
void updateCurrentTime( int currentTime );
- QSGParticleSystemAnimation* m_animation;
+ QQuickParticleSystemAnimation* m_animation;
bool m_running;
int timeInt;
bool initialized;
int particleCount;
- void registerParticlePainter(QSGParticlePainter* p);
- void registerParticleEmitter(QSGParticleEmitter* e);
- void registerParticleAffector(QSGParticleAffector* a);
- void registerParticleGroup(QSGParticleGroup* g);
+ void registerParticlePainter(QQuickParticlePainter* p);
+ void registerParticleEmitter(QQuickParticleEmitter* e);
+ void registerParticleAffector(QQuickParticleAffector* a);
+ void registerParticleGroup(QQuickParticleGroup* g);
static void statePropertyRedirect(QDeclarativeListProperty<QObject> *prop, QObject *value);
- static void stateRedirect(QSGParticleGroup* group, QSGParticleSystem* sys, QObject *value);
+ static void stateRedirect(QQuickParticleGroup* group, QQuickParticleSystem* sys, QObject *value);
bool isPaused() const
{
return m_paused;
private:
void initializeSystem();
void initGroups();
- QList<QPointer<QSGParticleEmitter> > m_emitters;
- QList<QPointer<QSGParticleAffector> > m_affectors;
- QList<QPointer<QSGParticlePainter> > m_painters;
- QList<QPointer<QSGParticlePainter> > m_syncList;
- QList<QSGParticleGroup*> m_groups;
+ QList<QPointer<QQuickParticleEmitter> > m_emitters;
+ QList<QPointer<QQuickParticleAffector> > m_affectors;
+ QList<QPointer<QQuickParticlePainter> > m_painters;
+ QList<QPointer<QQuickParticlePainter> > m_syncList;
+ QList<QQuickParticleGroup*> m_groups;
int m_nextGroupId;
int m_nextIndex;
QSet<int> m_reusableIndexes;
};
// Internally, this animation drives all the timing. Painters sync up in their updatePaintNode
-class QSGParticleSystemAnimation : public QAbstractAnimation
+class QQuickParticleSystemAnimation : public QAbstractAnimation
{
Q_OBJECT
public:
- QSGParticleSystemAnimation(QSGParticleSystem* system)
+ QQuickParticleSystemAnimation(QQuickParticleSystem* system)
: QAbstractAnimation(static_cast<QObject*>(system)), m_system(system)
{ }
protected:
}
private:
- QSGParticleSystem* m_system;
+ QQuickParticleSystem* m_system;
};
**
****************************************************************************/
-#include "qsgpointattractor_p.h"
+#include "qquickpointattractor_p.h"
#include <cmath>
#include <QDebug>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Attractor QSGAttractorAffector
+ \qmlclass Attractor QQuickAttractorAffector
\inqmlmodule QtQuick.Particles 2
\inherits Affector
\brief The Attractor allows you to attract particles towards a specific point.
*/
-QSGAttractorAffector::QSGAttractorAffector(QQuickItem *parent) :
- QSGParticleAffector(parent), m_strength(0.0), m_x(0), m_y(0)
+QQuickAttractorAffector::QQuickAttractorAffector(QQuickItem *parent) :
+ QQuickParticleAffector(parent), m_strength(0.0), m_x(0), m_y(0)
, m_physics(Velocity), m_proportionalToDistance(Linear)
{
}
-bool QSGAttractorAffector::affectParticle(QSGParticleData *d, qreal dt)
+bool QQuickAttractorAffector::affectParticle(QQuickParticleData *d, qreal dt)
{
if (m_strength == 0.0)
return false;
#ifndef ATTRACTORAFFECTOR_H
#define ATTRACTORAFFECTOR_H
-#include "qsgparticleaffector_p.h"
+#include "qquickparticleaffector_p.h"
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGAttractorAffector : public QSGParticleAffector
+class QQuickAttractorAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged)
Acceleration
};
- explicit QSGAttractorAffector(QQuickItem *parent = 0);
+ explicit QQuickAttractorAffector(QQuickItem *parent = 0);
qreal strength() const
{
}
protected:
- virtual bool affectParticle(QSGParticleData *d, qreal dt);
+ virtual bool affectParticle(QQuickParticleData *d, qreal dt);
private:
qreal m_strength;
qreal m_x;
**
****************************************************************************/
-#include "qsgpointdirection_p.h"
+#include "qquickpointdirection_p.h"
QT_BEGIN_NAMESPACE
/*!
- \qmlclass PointDirection QSGPointDirection
+ \qmlclass PointDirection QQuickPointDirection
\inqmlmodule QtQuick.Particles 2
\inherits Direction
\brief The PointDirection element allows you to specify a direction that varies in x and y components
\qmlproperty real QtQuick.Particles2::PointDirection::yVariation
*/
-QSGPointDirection::QSGPointDirection(QObject *parent) :
- QSGDirection(parent)
+QQuickPointDirection::QQuickPointDirection(QObject *parent) :
+ QQuickDirection(parent)
, m_x(0)
, m_y(0)
, m_xVariation(0)
{
}
-const QPointF QSGPointDirection::sample(const QPointF &)
+const QPointF QQuickPointDirection::sample(const QPointF &)
{
QPointF ret;
ret.setX(m_x - m_xVariation + rand() / float(RAND_MAX) * m_xVariation * 2);
#ifndef POINTVECTOR_H
#define POINTVECTOR_H
-#include "qsgdirection_p.h"
+#include "qquickdirection_p.h"
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGPointDirection : public QSGDirection
+class QQuickPointDirection : public QQuickDirection
{
Q_OBJECT
Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
Q_PROPERTY(qreal xVariation READ xVariation WRITE setXVariation NOTIFY xVariationChanged)
Q_PROPERTY(qreal yVariation READ yVariation WRITE setYVariation NOTIFY yVariationChanged)
public:
- explicit QSGPointDirection(QObject *parent = 0);
+ explicit QQuickPointDirection(QObject *parent = 0);
virtual const QPointF sample(const QPointF &from);
qreal x() const
{
**
****************************************************************************/
-#include "qsgrectangleextruder_p.h"
+#include "qquickrectangleextruder_p.h"
QT_BEGIN_NAMESPACE
/*!
- \qmlclass RectangleShape QSGRectangleExtruder
+ \qmlclass RectangleShape QQuickRectangleExtruder
\inqmlmodule QtQuick.Particles 2
\brief The RectangleShape element allows you to specify an area for affectors and emitter.
Just a rectangle.
*/
-QSGRectangleExtruder::QSGRectangleExtruder(QObject *parent) :
- QSGParticleExtruder(parent), m_fill(true)
+QQuickRectangleExtruder::QQuickRectangleExtruder(QObject *parent) :
+ QQuickParticleExtruder(parent), m_fill(true)
{
}
-QPointF QSGRectangleExtruder::extrude(const QRectF &rect)
+QPointF QQuickRectangleExtruder::extrude(const QRectF &rect)
{
if (m_fill)
return QPointF(((qreal)rand() / RAND_MAX) * rect.width() + rect.x(),
}
}
-bool QSGRectangleExtruder::contains(const QRectF &bounds, const QPointF &point)
+bool QQuickRectangleExtruder::contains(const QRectF &bounds, const QPointF &point)
{
return bounds.contains(point);
}
#ifndef RECTANGLEEXTRUDER_H
#define RECTANGLEEXTRUDER_H
-#include "qsgparticleextruder_p.h"
+#include "qquickparticleextruder_p.h"
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGRectangleExtruder : public QSGParticleExtruder
+class QQuickRectangleExtruder : public QQuickParticleExtruder
{
Q_OBJECT
Q_PROPERTY(bool fill READ fill WRITE setFill NOTIFY fillChanged)
public:
- explicit QSGRectangleExtruder(QObject *parent = 0);
+ explicit QQuickRectangleExtruder(QObject *parent = 0);
virtual QPointF extrude(const QRectF &);
virtual bool contains(const QRectF &bounds, const QPointF &point);
bool fill() const
**
****************************************************************************/
-#include "qsgspritegoal_p.h"
+#include "qquickspritegoal_p.h"
#include <private/qquickspriteengine_p.h>
#include <private/qquicksprite_p.h>
-#include "qsgimageparticle_p.h"
+#include "qquickimageparticle_p.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass SpriteGoal QSGSpriteGoalAffector
+ \qmlclass SpriteGoal QQuickSpriteGoalAffector
\inqmlmodule QtQuick.Particles 2
\inherits Affector
\brief The SpriteGoal Affector allows you to change the state of a sprite particle.
deprecated, use GroupGoal instead
*/
-QSGSpriteGoalAffector::QSGSpriteGoalAffector(QQuickItem *parent) :
- QSGParticleAffector(parent),
+QQuickSpriteGoalAffector::QQuickSpriteGoalAffector(QQuickItem *parent) :
+ QQuickParticleAffector(parent),
m_goalIdx(-1),
m_lastEngine(0),
m_jump(false),
m_ignoresTime = true;
}
-void QSGSpriteGoalAffector::updateStateIndex(QQuickStochasticEngine* e)
+void QQuickSpriteGoalAffector::updateStateIndex(QQuickStochasticEngine* e)
{
if (m_systemStates){
m_goalIdx = m_system->groupIds[m_goalState];
}
}
-void QSGSpriteGoalAffector::setGoalState(QString arg)
+void QQuickSpriteGoalAffector::setGoalState(QString arg)
{
if (m_goalState != arg) {
m_goalState = arg;
}
}
-bool QSGSpriteGoalAffector::affectParticle(QSGParticleData *d, qreal dt)
+bool QQuickSpriteGoalAffector::affectParticle(QQuickParticleData *d, qreal dt)
{
Q_UNUSED(dt);
QQuickStochasticEngine *engine = 0;
if (!m_systemStates){
//TODO: Affect all engines
- foreach (QSGParticlePainter *p, m_system->groupData[d->group]->painters)
- if (qobject_cast<QSGImageParticle*>(p))
- engine = qobject_cast<QSGImageParticle*>(p)->spriteEngine();
+ foreach (QQuickParticlePainter *p, m_system->groupData[d->group]->painters)
+ if (qobject_cast<QQuickImageParticle*>(p))
+ engine = qobject_cast<QQuickImageParticle*>(p)->spriteEngine();
}else{
engine = m_system->stateEngine;
if (!engine)
#ifndef SPRITEGOALAFFECTOR_H
#define SPRITEGOALAFFECTOR_H
-#include "qsgparticleaffector_p.h"
+#include "qquickparticleaffector_p.h"
#include <QtDeclarative/qdeclarativeinfo.h>
QT_BEGIN_HEADER
class QQuickStochasticEngine;
-class QSGSpriteGoalAffector : public QSGParticleAffector
+class QQuickSpriteGoalAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(QString goalState READ goalState WRITE setGoalState NOTIFY goalStateChanged)
Q_PROPERTY(bool jump READ jump WRITE setJump NOTIFY jumpChanged)
Q_PROPERTY(bool systemStates READ systemStates WRITE setSystemStates NOTIFY systemStatesChanged)
public:
- explicit QSGSpriteGoalAffector(QQuickItem *parent = 0);
+ explicit QQuickSpriteGoalAffector(QQuickItem *parent = 0);
QString goalState() const
{
}
protected:
- virtual bool affectParticle(QSGParticleData *d, qreal dt);
+ virtual bool affectParticle(QQuickParticleData *d, qreal dt);
signals:
void goalStateChanged(QString arg);
**
****************************************************************************/
-#include "qsgtargetdirection_p.h"
-#include "qsgparticleemitter_p.h"
+#include "qquicktargetdirection_p.h"
+#include "qquickparticleemitter_p.h"
#include <cmath>
#include <QDebug>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass TargetDirection QSGTargetDirection
+ \qmlclass TargetDirection QQuickTargetDirection
\inqmlmodule QtQuick.Particles 2
\inherits Direction
\brief The TargetDirection element allows you to specify a direction towards the target point
pixels per second.
*/
-QSGTargetDirection::QSGTargetDirection(QObject *parent) :
- QSGDirection(parent)
+QQuickTargetDirection::QQuickTargetDirection(QObject *parent) :
+ QQuickDirection(parent)
, m_targetX(0)
, m_targetY(0)
, m_targetVariation(0)
{
}
-const QPointF QSGTargetDirection::sample(const QPointF &from)
+const QPointF QQuickTargetDirection::sample(const QPointF &from)
{
//###This approach loses interpolating the last position of the target (like we could with the emitter) is it worthwhile?
QPointF ret;
qreal targetX;
qreal targetY;
if (m_targetItem){
- QSGParticleEmitter* parentEmitter = qobject_cast<QSGParticleEmitter*>(parent());
+ QQuickParticleEmitter* parentEmitter = qobject_cast<QQuickParticleEmitter*>(parent());
targetX = m_targetItem->width()/2;
targetY = m_targetItem->height()/2;
if (!parentEmitter){
#ifndef DIRECTEDVECTOR_H
#define DIRECTEDVECTOR_H
-#include "qsgdirection_p.h"
+#include "qquickdirection_p.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QQuickItem;
-class QSGTargetDirection : public QSGDirection
+class QQuickTargetDirection : public QQuickDirection
{
Q_OBJECT
Q_PROPERTY(qreal targetX READ targetX WRITE setTargetX NOTIFY targetXChanged)
Q_PROPERTY(qreal magnitudeVariation READ magnitudeVariation WRITE setMagnitudeVariation NOTIFY magnitudeVariationChanged)
public:
- explicit QSGTargetDirection(QObject *parent = 0);
+ explicit QQuickTargetDirection(QObject *parent = 0);
virtual const QPointF sample(const QPointF &from);
qreal targetX() const
**
****************************************************************************/
-#include "qsgtrailemitter_p.h"
+#include "qquicktrailemitter_p.h"
#include <private/qdeclarativeengine_p.h>
#include <cmath>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass TrailEmitter QSGTrailEmitter
+ \qmlclass TrailEmitter QQuickTrailEmitter
\inqmlmodule QtQuick.Particles 2
- \inherits QSGParticleEmitter
+ \inherits QQuickParticleEmitter
\brief The TrailEmitter element allows you to emit logical particles from other logical particles.
This element emits logical particles into the ParticleSystem, with the
starting positions based on those of other logical particles.
*/
-QSGTrailEmitter::QSGTrailEmitter(QQuickItem *parent) :
- QSGParticleEmitter(parent)
+QQuickTrailEmitter::QQuickTrailEmitter(QQuickItem *parent) :
+ QQuickParticleEmitter(parent)
, m_particlesPerParticlePerSecond(0)
, m_lastTimeStamp(0)
, m_emitterXVariation(0)
, m_emitterYVariation(0)
, m_followCount(0)
, m_emissionExtruder(0)
- , m_defaultEmissionExtruder(new QSGParticleExtruder(this))
+ , m_defaultEmissionExtruder(new QQuickParticleExtruder(this))
{
//TODO: If followed increased their size
connect(this, SIGNAL(followChanged(QString)),
*/
-bool QSGTrailEmitter::isEmitFollowConnected()
+bool QQuickTrailEmitter::isEmitFollowConnected()
{
static int idx = QObjectPrivate::get(this)->signalIndex("emitFollowParticles(QDeclarativeV8Handle,QDeclarativeV8Handle)");
return QObjectPrivate::get(this)->isSignalConnected(idx);
}
-void QSGTrailEmitter::recalcParticlesPerSecond(){
+void QQuickTrailEmitter::recalcParticlesPerSecond(){
if (!m_system)
return;
m_followCount = m_system->groupData[m_system->groupIds[m_follow]]->size();
}
}
-void QSGTrailEmitter::reset()
+void QQuickTrailEmitter::reset()
{
m_followCount = 0;
}
-void QSGTrailEmitter::emitWindow(int timeStamp)
+void QQuickTrailEmitter::emitWindow(int timeStamp)
{
if (m_system == 0)
return;
int gId = m_system->groupIds[m_follow];
int gId2 = m_system->groupIds[m_group];
- foreach (QSGParticleData *d, m_system->groupData[gId]->data){
+ foreach (QQuickParticleData *d, m_system->groupData[gId]->data){
if (!d || !d->stillAlive()){
m_lastEmission[d->index] = time; //Should only start emitting when it returns to life
continue;
continue;
}
- QList<QSGParticleData*> toEmit;
+ QList<QQuickParticleData*> toEmit;
while (pt < time || !m_burstQueue.isEmpty()){
- QSGParticleData* datum = m_system->newDatum(gId2, !m_overwrite);
+ QQuickParticleData* datum = m_system->newDatum(gId2, !m_overwrite);
if (datum){//else, skip this emission
datum->e = this;//###useful?
d->y - offset.y() + d->vy * followT + d->ay * followT2 - eH/2,
eW, eH);
- QSGParticleExtruder* effectiveEmissionExtruder = m_emissionExtruder ? m_emissionExtruder : m_defaultEmissionExtruder;
+ QQuickParticleExtruder* effectiveEmissionExtruder = m_emissionExtruder ? m_emissionExtruder : m_defaultEmissionExtruder;
const QPointF &newPos = effectiveEmissionExtruder->extrude(boundsRect);
datum->x = newPos.x();
datum->y = newPos.y();
else if (isEmitConnected())
emitParticles(QDeclarativeV8Handle::fromHandle(array));//A chance for arbitrary JS changes
}
- foreach (QSGParticleData* d, toEmit)
+ foreach (QQuickParticleData* d, toEmit)
m_system->emitParticle(d);
m_lastEmission[d->index] = pt;
}
#ifndef FOLLOWEMITTER_H
#define FOLLOWEMITTER_H
-#include "qsgparticleemitter_p.h"
-#include "qsgparticleaffector_p.h"
+#include "qquickparticleemitter_p.h"
+#include "qquickparticleaffector_p.h"
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGTrailEmitter : public QSGParticleEmitter
+class QQuickTrailEmitter : public QQuickParticleEmitter
{
Q_OBJECT
Q_PROPERTY(QString follow READ follow WRITE setFollow NOTIFY followChanged)
Q_PROPERTY(int emitRatePerParticle READ particlesPerParticlePerSecond WRITE setParticlesPerParticlePerSecond NOTIFY particlesPerParticlePerSecondChanged)
- Q_PROPERTY(QSGParticleExtruder* emitShape READ emissonShape WRITE setEmissionShape NOTIFY emissionShapeChanged)
+ Q_PROPERTY(QQuickParticleExtruder* emitShape READ emissonShape WRITE setEmissionShape NOTIFY emissionShapeChanged)
Q_PROPERTY(qreal emitHeight READ emitterYVariation WRITE setEmitterYVariation NOTIFY emitterYVariationChanged)
Q_PROPERTY(qreal emitWidth READ emitterXVariation WRITE setEmitterXVariation NOTIFY emitterXVariationChanged)
enum EmitSize {
ParticleSize = -2//Anything less than 0 will do
};
- explicit QSGTrailEmitter(QQuickItem *parent = 0);
+ explicit QQuickTrailEmitter(QQuickItem *parent = 0);
virtual void emitWindow(int timeStamp);
virtual void reset();
return m_follow;
}
- QSGParticleExtruder* emissonShape() const
+ QQuickParticleExtruder* emissonShape() const
{
return m_emissionExtruder;
}
void followChanged(QString arg);
- void emissionShapeChanged(QSGParticleExtruder* arg);
+ void emissionShapeChanged(QQuickParticleExtruder* arg);
public slots:
}
}
- void setEmissionShape(QSGParticleExtruder* arg)
+ void setEmissionShape(QQuickParticleExtruder* arg)
{
if (m_emissionExtruder != arg) {
m_emissionExtruder = arg;
void recalcParticlesPerSecond();
private:
- QSet<QSGParticleData*> m_pending;
+ QSet<QQuickParticleData*> m_pending;
QVector<qreal> m_lastEmission;
int m_particlesPerParticlePerSecond;
qreal m_lastTimeStamp;
qreal m_emitterYVariation;
QString m_follow;
int m_followCount;
- QSGParticleExtruder* m_emissionExtruder;
- QSGParticleExtruder* m_defaultEmissionExtruder;
+ QQuickParticleExtruder* m_emissionExtruder;
+ QQuickParticleExtruder* m_defaultEmissionExtruder;
bool isEmitFollowConnected();
};
**
****************************************************************************/
-#include "qsgturbulence_p.h"
-#include "qsgparticlepainter_p.h"//TODO: Why was this needed again?
+#include "qquickturbulence_p.h"
+#include "qquickparticlepainter_p.h"//TODO: Why was this needed again?
#include <cmath>
#include <cstdlib>
#include <QDebug>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Turbulence QSGTurbulenceAffector
+ \qmlclass Turbulence QQuickTurbulenceAffector
\inqmlmodule QtQuick.Particles 2
\inherits Affector
\brief Turbulence provides fluid like forces based on a noise image.
A default image will be used if none is provided.
*/
-QSGTurbulenceAffector::QSGTurbulenceAffector(QQuickItem *parent) :
- QSGParticleAffector(parent),
+QQuickTurbulenceAffector::QQuickTurbulenceAffector(QQuickItem *parent) :
+ QQuickParticleAffector(parent),
m_strength(10), m_lastT(0), m_gridSize(0), m_field(0), m_vectorField(0), m_inited(false)
{
}
-void QSGTurbulenceAffector::geometryChanged(const QRectF &, const QRectF &)
+void QQuickTurbulenceAffector::geometryChanged(const QRectF &, const QRectF &)
{
initializeGrid();
}
-QSGTurbulenceAffector::~QSGTurbulenceAffector()
+QQuickTurbulenceAffector::~QQuickTurbulenceAffector()
{
if (m_field) {
for (int i=0; i<m_gridSize; i++)
return sqrt(x*x + y*y);
}
-void QSGTurbulenceAffector::initializeGrid()
+void QQuickTurbulenceAffector::initializeGrid()
{
if (!m_inited)
return;
}
}
-qreal QSGTurbulenceAffector::boundsRespectingField(int x, int y)
+qreal QQuickTurbulenceAffector::boundsRespectingField(int x, int y)
{
if (x < 0)
x = 0;
return m_field[x][y];
}
-void QSGTurbulenceAffector::ensureInit()
+void QQuickTurbulenceAffector::ensureInit()
{
if (m_inited)
return;
initializeGrid();
}
-void QSGTurbulenceAffector::affectSystem(qreal dt)
+void QQuickTurbulenceAffector::affectSystem(qreal dt)
{
if (!m_system || !m_enabled)
return;
updateOffsets();//### Needed if an ancestor is transformed.
QRect boundsRect(0,0,m_gridSize,m_gridSize);
- foreach (QSGParticleGroupData *gd, m_system->groupData){
+ foreach (QQuickParticleGroupData *gd, m_system->groupData){
if (!activeGroup(m_system->groupData.key(gd)))
continue;
- foreach (QSGParticleData *d, gd->data){
+ foreach (QQuickParticleData *d, gd->data){
if (!shouldAffect(d))
continue;
QPoint pos = (QPointF(d->curX(), d->curY()) - m_offset).toPoint();
#ifndef TURBULENCEAFFECTOR_H
#define TURBULENCEAFFECTOR_H
-#include "qsgparticleaffector_p.h"
+#include "qquickparticleaffector_p.h"
#include <QDeclarativeListProperty>
QT_BEGIN_HEADER
QT_MODULE(Declarative)
-class QSGParticlePainter;
+class QQuickParticlePainter;
-class QSGTurbulenceAffector : public QSGParticleAffector
+class QQuickTurbulenceAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged)
Q_PROPERTY(QUrl noiseSource READ noiseSource WRITE setNoiseSource NOTIFY noiseSourceChanged)
public:
- explicit QSGTurbulenceAffector(QQuickItem *parent = 0);
- ~QSGTurbulenceAffector();
+ explicit QQuickTurbulenceAffector(QQuickItem *parent = 0);
+ ~QQuickTurbulenceAffector();
virtual void affectSystem(qreal dt);
qreal strength() const
**
****************************************************************************/
-#include "qsgv8particledata_p.h"
-#include "qsgparticlesystem_p.h"//for QSGParticleData
+#include "qquickv8particledata_p.h"
+#include "qquickparticlesystem_p.h"//for QQuickParticleData
#include <QDebug>
QT_BEGIN_NAMESPACE
V8_RESOURCE_TYPE(ParticleDataType)
public:
QV8ParticleDataResource(QV8Engine *e) : QV8ObjectResource(e) {}
- QSGParticleData* datum;//TODO: Guard needed?
+ QQuickParticleData* datum;//TODO: Guard needed?
};
class QV8ParticleDataDeletable : public QV8Engine::Deletable
V8_DEFINE_EXTENSION(QV8ParticleDataDeletable, particleV8Data);
-QSGV8ParticleData::QSGV8ParticleData(QV8Engine* engine, QSGParticleData* datum)
+QQuickV8ParticleData::QQuickV8ParticleData(QV8Engine* engine, QQuickParticleData* datum)
{
if (!engine || !datum)
return;
m_v8Value->SetExternalResource(r);
}
-QSGV8ParticleData::~QSGV8ParticleData()
+QQuickV8ParticleData::~QQuickV8ParticleData()
{
qPersistentDispose(m_v8Value);
}
-QDeclarativeV8Handle QSGV8ParticleData::v8Value()
+QDeclarativeV8Handle QQuickV8ParticleData::v8Value()
{
return QDeclarativeV8Handle::fromHandle(m_v8Value);
}
**
****************************************************************************/
-#ifndef QSGV8PARTICLEDATA_H
-#define QSGV8PARTICLEDATA_H
+#ifndef QQuickV8PARTICLEDATA_H
+#define QQuickV8PARTICLEDATA_H
#include <private/qv8engine_p.h>
QT_MODULE(Declarative)
-class QSGParticleData;
-class QSGV8ParticleData {
+class QQuickParticleData;
+class QQuickV8ParticleData {
public:
- QSGV8ParticleData(QV8Engine*,QSGParticleData*);
- ~QSGV8ParticleData();
+ QQuickV8ParticleData(QV8Engine*,QQuickParticleData*);
+ ~QQuickV8ParticleData();
QDeclarativeV8Handle v8Value();
private:
v8::Persistent<v8::Object> m_v8Value;
**
****************************************************************************/
-#include "qsgwander_p.h"
-#include "qsgparticlesystem_p.h"//for ParticlesVertices
+#include "qquickwander_p.h"
+#include "qquickparticlesystem_p.h"//for ParticlesVertices
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Wander QSGWanderAffector
+ \qmlclass Wander QQuickWanderAffector
\inqmlmodule QtQuick.Particles 2
\inherits Affector
\brief The Wander affector allows particles to randomly vary their trajectory.
\endlist
*/
-QSGWanderAffector::QSGWanderAffector(QQuickItem *parent) :
- QSGParticleAffector(parent), m_xVariance(0), m_yVariance(0), m_pace(0)
+QQuickWanderAffector::QQuickWanderAffector(QQuickItem *parent) :
+ QQuickParticleAffector(parent), m_xVariance(0), m_yVariance(0), m_pace(0)
, m_affectedParameter(Velocity)
{
m_needsReset = true;
}
-QSGWanderAffector::~QSGWanderAffector()
+QQuickWanderAffector::~QQuickWanderAffector()
{
for (QHash<int, WanderData*>::const_iterator iter=m_wanderData.constBegin();
iter != m_wanderData.constEnd(); iter++)
delete (*iter);
}
-WanderData* QSGWanderAffector::getData(int idx)
+WanderData* QQuickWanderAffector::getData(int idx)
{
if (m_wanderData.contains(idx))
return m_wanderData[idx];
return d;
}
-void QSGWanderAffector::reset(int systemIdx)
+void QQuickWanderAffector::reset(int systemIdx)
{
if (m_wanderData.contains(systemIdx))
delete m_wanderData[systemIdx];
m_wanderData.remove(systemIdx);
}
-bool QSGWanderAffector::affectParticle(QSGParticleData* data, qreal dt)
+bool QQuickWanderAffector::affectParticle(QQuickParticleData* data, qreal dt)
{
/*TODO: Add a mode which does basically this - picking a direction, going in it (random speed) and then going back
WanderData* d = getData(data->systemIndex);
#ifndef WANDERAFFECTOR_H
#define WANDERAFFECTOR_H
#include <QHash>
-#include "qsgparticleaffector_p.h"
+#include "qquickparticleaffector_p.h"
QT_BEGIN_HEADER
qreal y_var;
};
-class QSGWanderAffector : public QSGParticleAffector
+class QQuickWanderAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(qreal pace READ pace WRITE setPace NOTIFY paceChanged)
Acceleration
};
- explicit QSGWanderAffector(QQuickItem *parent = 0);
- ~QSGWanderAffector();
+ explicit QQuickWanderAffector(QQuickItem *parent = 0);
+ ~QQuickWanderAffector();
virtual void reset(int systemIdx);
qreal xVariance() const
}
protected:
- virtual bool affectParticle(QSGParticleData *d, qreal dt);
+ virtual bool affectParticle(QQuickParticleData *d, qreal dt);
signals:
void xVarianceChanged(qreal arg);
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Declarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsgangledirection_p.h"
-#include "qsgcustomparticle_p.h"
-#include "qsgellipseextruder_p.h"
-#include "qsgtrailemitter_p.h"
-#include "qsgfriction_p.h"
-#include "qsggravity_p.h"
-#include "qsgimageparticle_p.h"
-#include "qsgitemparticle_p.h"
-#include "qsgage_p.h"
-#include "qsglineextruder_p.h"
-#include "qsgmaskextruder_p.h"
-#include "qsgparticleaffector_p.h"
-#include "qsgparticleemitter_p.h"
-#include "qsgparticleextruder_p.h"
-#include "qsgparticlepainter_p.h"
-#include "qsgparticlesmodule_p.h"
-#include "qsgparticlesystem_p.h"
-#include "qsgpointattractor_p.h"
-#include "qsgpointdirection_p.h"
-#include "qsgspritegoal_p.h"
-#include "qsgdirection_p.h"
-#include "qsgtargetdirection_p.h"
-#include "qsgturbulence_p.h"
-#include "qsgwander_p.h"
-#include "qsgcumulativedirection_p.h"
-#include "qsgcustomaffector_p.h"
-#include "qsgrectangleextruder_p.h"
-#include "qsgparticlegroup_p.h"
-#include "qsggroupgoal_p.h"
-
-QT_BEGIN_NAMESPACE
-
-void QSGParticlesModule::defineModule()
-{
- const char* uri = "QtQuick.Particles";
-
- qmlRegisterType<QSGParticleSystem>(uri, 2, 0, "ParticleSystem");
- qmlRegisterType<QSGParticleGroup>(uri, 2, 0, "ParticleGroup");
-
- qmlRegisterType<QSGImageParticle>(uri, 2, 0, "ImageParticle");
- qmlRegisterType<QSGCustomParticle>(uri, 2, 0, "CustomParticle");
- qmlRegisterType<QQuickItemParticle>(uri, 2, 0, "ItemParticle");
-
- qmlRegisterType<QSGParticleEmitter>(uri, 2, 0, "Emitter");
- qmlRegisterType<QSGTrailEmitter>(uri, 2, 0, "TrailEmitter");
-
- qmlRegisterType<QSGEllipseExtruder>(uri, 2, 0, "EllipseShape");
- qmlRegisterType<QSGRectangleExtruder>(uri, 2, 0, "RectangleShape");
- qmlRegisterType<QSGLineExtruder>(uri, 2, 0, "LineShape");
- qmlRegisterType<QSGMaskExtruder>(uri, 2, 0, "MaskShape");
-
- qmlRegisterType<QSGPointDirection>(uri, 2, 0, "PointDirection");
- qmlRegisterType<QSGAngleDirection>(uri, 2, 0, "AngleDirection");
- qmlRegisterType<QSGTargetDirection>(uri, 2, 0, "TargetDirection");
- qmlRegisterType<QSGCumulativeDirection>(uri, 2, 0, "CumulativeDirection");
-
- qmlRegisterType<QSGCustomAffector>(uri, 2, 0, "Affector");
- qmlRegisterType<QSGWanderAffector>(uri, 2, 0, "Wander");
- qmlRegisterType<QSGFrictionAffector>(uri, 2, 0, "Friction");
- qmlRegisterType<QSGAttractorAffector>(uri, 2, 0, "Attractor");
- qmlRegisterType<QSGGravityAffector>(uri, 2, 0, "Gravity");
- qmlRegisterType<QSGAgeAffector>(uri, 2, 0, "Age");
- qmlRegisterType<QSGSpriteGoalAffector>(uri, 2, 0, "SpriteGoal");
- qmlRegisterType<QSGGroupGoalAffector>(uri, 2, 0, "GroupGoal");
- qmlRegisterType<QSGTurbulenceAffector>(uri, 2, 0 , "Turbulence");
-
- //Exposed just for completeness
- qmlRegisterUncreatableType<QSGParticleAffector>(uri, 2, 0, "ParticleAffector",
- QStringLiteral("Abstract type. Use one of the inheriting types instead."));
- qmlRegisterUncreatableType<QSGParticlePainter>(uri, 2, 0, "ParticlePainter",
- QStringLiteral("Abstract type. Use one of the inheriting types instead."));
- qmlRegisterUncreatableType<QSGParticleExtruder>(uri, 2, 0, "ParticleExtruder",
- QStringLiteral("Abstract type. Use one of the inheriting types instead."));
- qmlRegisterUncreatableType<QSGDirection>(uri, 2, 0, "NullVector",
- QStringLiteral("Abstract type. Use one of the inheriting types instead."));
-}
-
-QT_END_NAMESPACE
-
#include <private/qdeclarativeutilmodule_p.h>
#include <private/qquickitemsmodule_p.h>
-#include <private/qsgparticlesmodule_p.h>
+#include <private/qquickparticlesmodule_p.h>
#ifdef Q_OS_WIN // for %APPDATA%
#include <qt_windows.h>
QDeclarativeUtilModule::defineModule();
QDeclarativeEnginePrivate::defineModule();
QQuickItemsModule::defineModule();
- QSGParticlesModule::defineModule();
+ QQuickParticlesModule::defineModule();
QDeclarativeValueTypeFactory::registerValueTypes();
}
}
TEMPLATE = subdirs
PRIVATETESTS += \
- qsgage \
- qsgangleddirection \
- qsgcumulativedirection \
- qsgcustomaffector \
- qsgcustomparticle \
- qsgellipseextruder \
- qsgfriction \
- qsggravity \
- qsgimageparticle \
- qsgitemparticle \
- qsglineextruder \
- qsgmaskextruder \
- qsgparticlegroup \
- qsgparticlesystem \
- qsgpointattractor \
- qsgpointdirection \
- qsgrectangleextruder \
- qsgtargetdirection \
- qsgtrailemitter \
- qsgturbulence \
- qsgwander
+ qquickage \
+ qquickangleddirection \
+ qquickcumulativedirection \
+ qquickcustomaffector \
+ qquickcustomparticle \
+ qquickellipseextruder \
+ qquickfriction \
+ qquickgravity \
+ qquickimageparticle \
+ qquickitemparticle \
+ qquicklineextruder \
+ qquickmaskextruder \
+ qquickparticlegroup \
+ qquickparticlesystem \
+ qquickpointattractor \
+ qquickpointdirection \
+ qquickrectangleextruder \
+ qquicktargetdirection \
+ qquicktrailemitter \
+ qquickturbulence \
+ qquickwander
contains(QT_CONFIG, private_tests) {
SUBDIRS += $$PRIVATETESTS
CONFIG += testcase
-TARGET = tst_qsgage
-SOURCES += tst_qsgage.cpp
+TARGET = tst_qquickage
+SOURCES += tst_qquickage.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgage : public QObject
+class tst_qquickage : public QObject
{
Q_OBJECT
public:
- tst_qsgage();
+ tst_qquickage();
private slots:
void test_kill();
void test_sustained();
};
-tst_qsgage::tst_qsgage()
+tst_qquickage::tst_qquickage()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgage::test_kill()
+void tst_qquickage::test_kill()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/kill.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-void tst_qsgage::test_jump()
+void tst_qquickage::test_jump()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/jump.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-void tst_qsgage::test_onceOff()
+void tst_qquickage::test_onceOff()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/onceoff.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-void tst_qsgage::test_sustained()
+void tst_qquickage::test_sustained()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/sustained.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
//TODO: Ensure some particles have lived to 0.4s point despite unified timer
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgage);
+QTEST_MAIN(tst_qquickage);
-#include "tst_qsgage.moc"
+#include "tst_qquickage.moc"
CONFIG += testcase
-TARGET = tst_qsgage
-SOURCES += tst_qsgage.cpp
+TARGET = tst_qquickangleddirection
+SOURCES += tst_qquickangleddirection.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
testDataFiles.path = .
DEPLOYMENT += testDataFiles
-CONFIG += insignificant_test
-
QT += core-private gui-private v8-private declarative-private opengl-private testlib
#include <QtTest/QtTest>
#include <qmath.h>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgangleddirection : public QObject
+class tst_qquickangleddirection : public QObject
{
Q_OBJECT
public:
- tst_qsgangleddirection();
+ tst_qquickangleddirection();
private slots:
void test_basic();
};
-tst_qsgangleddirection::tst_qsgangleddirection()
+tst_qquickangleddirection::tst_qquickangleddirection()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgangleddirection::test_basic()
+void tst_qquickangleddirection::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgangleddirection);
+QTEST_MAIN(tst_qquickangleddirection);
-#include "tst_qsgangleddirection.moc"
+#include "tst_qquickangleddirection.moc"
CONFIG += testcase
-TARGET = tst_qsgage
-SOURCES += tst_qsgage.cpp
+TARGET = tst_qquickcumulativedirection
+SOURCES += tst_qquickcumulativedirection.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
testDataFiles.path = .
DEPLOYMENT += testDataFiles
-CONFIG += insignificant_test
-
QT += core-private gui-private v8-private declarative-private opengl-private testlib
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgcumulativedirection : public QObject
+class tst_qquickcumulativedirection : public QObject
{
Q_OBJECT
public:
- tst_qsgcumulativedirection();
+ tst_qquickcumulativedirection();
private slots:
void test_basic();
};
-tst_qsgcumulativedirection::tst_qsgcumulativedirection()
+tst_qquickcumulativedirection::tst_qquickcumulativedirection()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgcumulativedirection::test_basic()
+void tst_qquickcumulativedirection::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgcumulativedirection);
+QTEST_MAIN(tst_qquickcumulativedirection);
-#include "tst_qsgcumulativedirection.moc"
+#include "tst_qquickcumulativedirection.moc"
CONFIG += testcase
-TARGET = tst_qsgellipseextruder
-SOURCES += tst_qsgellipseextruder.cpp
+TARGET = tst_qquickcustomaffector
+SOURCES += tst_qquickcustomaffector.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgcustomaffector : public QObject
+class tst_qquickcustomaffector : public QObject
{
Q_OBJECT
public:
- tst_qsgcustomaffector();
+ tst_qquickcustomaffector();
private slots:
void test_basic();
void test_move();
};
-tst_qsgcustomaffector::tst_qsgcustomaffector()
+tst_qquickcustomaffector::tst_qquickcustomaffector()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgcustomaffector::test_basic()
+void tst_qquickcustomaffector::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-void tst_qsgcustomaffector::test_move()
+void tst_qquickcustomaffector::test_move()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/move.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
if (!d->stillAlive())
}
}
-QTEST_MAIN(tst_qsgcustomaffector);
+QTEST_MAIN(tst_qquickcustomaffector);
-#include "tst_qsgcustomaffector.moc"
+#include "tst_qquickcustomaffector.moc"
CONFIG += testcase
-TARGET = tst_qsgellipseextruder
-SOURCES += tst_qsgellipseextruder.cpp
+TARGET = tst_qquickcustomparticle
+SOURCES += tst_qquickcustomparticle.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgcustomparticle : public QObject
+class tst_qquickcustomparticle : public QObject
{
Q_OBJECT
public:
- tst_qsgcustomparticle();
+ tst_qquickcustomparticle();
private slots:
void test_basic();
};
-tst_qsgcustomparticle::tst_qsgcustomparticle()
+tst_qquickcustomparticle::tst_qquickcustomparticle()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgcustomparticle::test_basic()
+void tst_qquickcustomparticle::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
QVERIFY(view);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
bool oneNonZero = false;
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
QVERIFY(oneNonZero);//Zero is a valid value, but it also needs to be set to a random number
}
-QTEST_MAIN(tst_qsgcustomparticle);
+QTEST_MAIN(tst_qquickcustomparticle);
-#include "tst_qsgcustomparticle.moc"
+#include "tst_qquickcustomparticle.moc"
CONFIG += testcase
-TARGET = tst_qsgage
-SOURCES += tst_qsgage.cpp
+TARGET = tst_qquickellipseextruder
+SOURCES += tst_qquickellipseextruder.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
testDataFiles.path = .
DEPLOYMENT += testDataFiles
-CONFIG += insignificant_test
-
QT += core-private gui-private v8-private declarative-private opengl-private testlib
#include <qmath.h>
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgellipseextruder : public QObject
+class tst_qquickellipseextruder : public QObject
{
Q_OBJECT
public:
- tst_qsgellipseextruder();
+ tst_qquickellipseextruder();
private slots:
void test_basic();
bool inCircle(qreal x, qreal y, qreal r, bool borderOnly=false);
};
-tst_qsgellipseextruder::tst_qsgellipseextruder()
+tst_qquickellipseextruder::tst_qquickellipseextruder()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-bool tst_qsgellipseextruder::inCircle(qreal x, qreal y, qreal r, bool borderOnly)
+bool tst_qquickellipseextruder::inCircle(qreal x, qreal y, qreal r, bool borderOnly)
{
x -= r;
y -= r;
return mag - EPSILON < r;
}
-void tst_qsgellipseextruder::test_basic()
+void tst_qquickellipseextruder::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
//Filled
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
//Just border
QCOMPARE(system->groupData[1]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[1]->data) {
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgellipseextruder);
+QTEST_MAIN(tst_qquickellipseextruder);
-#include "tst_qsgellipseextruder.moc"
+#include "tst_qquickellipseextruder.moc"
CONFIG += testcase
-TARGET = tst_qsgturbulence
-SOURCES += tst_qsgturbulence.cpp
+TARGET = tst_qquickfriction
+SOURCES += tst_qquickfriction.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgfriction : public QObject
+class tst_qquickfriction : public QObject
{
Q_OBJECT
public:
- tst_qsgfriction();
+ tst_qquickfriction();
private slots:
void test_basic();
void test_threshold();
};
-tst_qsgfriction::tst_qsgfriction()
+tst_qquickfriction::tst_qquickfriction()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgfriction::test_basic()
+void tst_qquickfriction::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
//Default is just slowed a little
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
//Nondefault comes to a complete stop within the first half of its life
QCOMPARE(system->groupData[1]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[1]->data) {
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-void tst_qsgfriction::test_threshold()
+void tst_qquickfriction::test_threshold()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/threshold.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
//Speed capped at 50, but it might take a frame or two to get there
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1.0f)
continue; //Particle data unused
if (myFuzzyGEQ(d->t, ((qreal)system->timeInt/1000.0) - 0.1))
}
}
-QTEST_MAIN(tst_qsgfriction);
+QTEST_MAIN(tst_qquickfriction);
-#include "tst_qsgfriction.moc"
+#include "tst_qquickfriction.moc"
CONFIG += testcase
-TARGET = tst_qsggravity
-SOURCES += tst_qsggravity.cpp
+TARGET = tst_qquickgravity
+SOURCES += tst_qquickgravity.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsggravity : public QObject
+class tst_qquickgravity : public QObject
{
Q_OBJECT
public:
- tst_qsggravity();
+ tst_qquickgravity();
private slots:
void test_basic();
};
-tst_qsggravity::tst_qsggravity()
+tst_qquickgravity::tst_qquickgravity()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsggravity::test_basic()
+void tst_qquickgravity::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsggravity);
+QTEST_MAIN(tst_qquickgravity);
-#include "tst_qsggravity.moc"
+#include "tst_qquickgravity.moc"
CONFIG += testcase
-TARGET = tst_qsgellipseextruder
-SOURCES += tst_qsgellipseextruder.cpp
+TARGET = tst_qquickimageparticle
+SOURCES += tst_qquickimageparticle.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
const double CONV_FACTOR = 0.017453292519943295;//Degrees to radians
-class tst_qsgimageparticle : public QObject
+class tst_qquickimageparticle : public QObject
{
Q_OBJECT
public:
- tst_qsgimageparticle();
+ tst_qquickimageparticle();
private slots:
void test_basic();
void test_sprite();
};
-tst_qsgimageparticle::tst_qsgimageparticle()
+tst_qquickimageparticle::tst_qquickimageparticle()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgimageparticle::test_basic()
+void tst_qquickimageparticle::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
-void tst_qsgimageparticle::test_colored()
+void tst_qquickimageparticle::test_colored()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/colored.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
-void tst_qsgimageparticle::test_deformed()
+void tst_qquickimageparticle::test_deformed()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/deformed.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
-void tst_qsgimageparticle::test_tabled()
+void tst_qquickimageparticle::test_tabled()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/tabled.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
-void tst_qsgimageparticle::test_sprite()
+void tst_qquickimageparticle::test_sprite()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/sprite.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgimageparticle);
+QTEST_MAIN(tst_qquickimageparticle);
-#include "tst_qsgimageparticle.moc"
+#include "tst_qquickimageparticle.moc"
CONFIG += testcase
-TARGET = tst_qsgellipseextruder
-SOURCES += tst_qsgellipseextruder.cpp
+TARGET = tst_qquickitemparticle
+SOURCES += tst_qquickitemparticle.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qquickimage_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgitemparticle : public QObject
+class tst_qquickitemparticle : public QObject
{
Q_OBJECT
public:
- tst_qsgitemparticle();
+ tst_qquickitemparticle();
private slots:
void test_basic();
};
-tst_qsgitemparticle::tst_qsgitemparticle()
+tst_qquickitemparticle::tst_qquickitemparticle()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgitemparticle::test_basic()
+void tst_qquickitemparticle::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgitemparticle);
+QTEST_MAIN(tst_qquickitemparticle);
-#include "tst_qsgitemparticle.moc"
+#include "tst_qquickitemparticle.moc"
CONFIG += testcase
-TARGET = tst_qsgangleddirection
-SOURCES += tst_qsgangleddirection.cpp
+TARGET = tst_qquicklineextruder
+SOURCES += tst_qquicklineextruder.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsglineextruder : public QObject
+class tst_qquicklineextruder : public QObject
{
Q_OBJECT
public:
- tst_qsglineextruder();
+ tst_qquicklineextruder();
private slots:
void test_basic();
};
-tst_qsglineextruder::tst_qsglineextruder()
+tst_qquicklineextruder::tst_qquicklineextruder()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsglineextruder::test_basic()
+void tst_qquicklineextruder::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
QCOMPARE(system->groupData[1]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[1]->data) {
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsglineextruder);
+QTEST_MAIN(tst_qquicklineextruder);
-#include "tst_qsglineextruder.moc"
+#include "tst_qquicklineextruder.moc"
CONFIG += testcase
-TARGET = tst_qsgcustomparticle
-SOURCES += tst_qsgcustomparticle.cpp
+TARGET = tst_qquickmaskextruder
+SOURCES += tst_qquickmaskextruder.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgmaskextruder : public QObject
+class tst_qquickmaskextruder : public QObject
{
Q_OBJECT
public:
- tst_qsgmaskextruder();
+ tst_qquickmaskextruder();
private slots:
void test_basic();
};
-tst_qsgmaskextruder::tst_qsgmaskextruder()
+tst_qquickmaskextruder::tst_qquickmaskextruder()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgmaskextruder::test_basic()
+void tst_qquickmaskextruder::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgmaskextruder);
+QTEST_MAIN(tst_qquickmaskextruder);
-#include "tst_qsgmaskextruder.moc"
+#include "tst_qquickmaskextruder.moc"
CONFIG += testcase
-TARGET = tst_qsgellipseextruder
-SOURCES += tst_qsgellipseextruder.cpp
+TARGET = tst_qquickparticlegroup
+SOURCES += tst_qquickparticlegroup.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgparticlegroup : public QObject
+class tst_qquickparticlegroup : public QObject
{
Q_OBJECT
public:
- tst_qsgparticlegroup();
+ tst_qquickparticlegroup();
private slots:
void test_instantTransition();
};
-tst_qsgparticlegroup::tst_qsgparticlegroup()
+tst_qquickparticlegroup::tst_qquickparticlegroup()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgparticlegroup::test_instantTransition()
+void tst_qquickparticlegroup::test_instantTransition()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
//A frame or two worth of particles will be missed, the transition doesn't take effect on the frame it's spawned (QTBUG-21781)
QVERIFY(system->groupData[0]->size() <= 500 && system->groupData[0]->size() >= 450);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgparticlegroup);
+QTEST_MAIN(tst_qquickparticlegroup);
-#include "tst_qsgparticlegroup.moc"
+#include "tst_qquickparticlegroup.moc"
CONFIG += testcase
-TARGET = tst_qsgellipseextruder
-SOURCES += tst_qsgellipseextruder.cpp
+TARGET = tst_qquickparticlesystem
+SOURCES += tst_qquickparticlesystem.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgparticlesystem : public QObject
+class tst_qquickparticlesystem : public QObject
{
Q_OBJECT
public:
- tst_qsgparticlesystem();
+ tst_qquickparticlesystem();
private slots:
void test_basic();
};
-tst_qsgparticlesystem::tst_qsgparticlesystem()
+tst_qquickparticlesystem::tst_qquickparticlesystem()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgparticlesystem::test_basic()
+void tst_qquickparticlesystem::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
int stillAlive = 0;
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
QVERIFY(extremelyFuzzyCompare(stillAlive, 500, 5));//Small simulation variance is permissible.
}
-QTEST_MAIN(tst_qsgparticlesystem);
+QTEST_MAIN(tst_qquickparticlesystem);
-#include "tst_qsgparticlesystem.moc"
+#include "tst_qquickparticlesystem.moc"
CONFIG += testcase
-TARGET = tst_qsgellipseextruder
-SOURCES += tst_qsgellipseextruder.cpp
+TARGET = tst_qquickpointattractor
+SOURCES += tst_qquickpointattractor.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgpointattractor : public QObject
+class tst_qquickpointattractor : public QObject
{
Q_OBJECT
public:
- tst_qsgpointattractor();
+ tst_qquickpointattractor();
private slots:
void test_basic();
};
-tst_qsgpointattractor::tst_qsgpointattractor()
+tst_qquickpointattractor::tst_qquickpointattractor()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgpointattractor::test_basic()
+void tst_qquickpointattractor::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgpointattractor);
+QTEST_MAIN(tst_qquickpointattractor);
-#include "tst_qsgpointattractor.moc"
+#include "tst_qquickpointattractor.moc"
CONFIG += testcase
-TARGET = tst_qsgellipseextruder
-SOURCES += tst_qsgellipseextruder.cpp
+TARGET = tst_qquickpointdirection
+SOURCES += tst_qquickpointdirection.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgpointdirection : public QObject
+class tst_qquickpointdirection : public QObject
{
Q_OBJECT
public:
- tst_qsgpointdirection();
+ tst_qquickpointdirection();
private slots:
void test_basic();
};
-tst_qsgpointdirection::tst_qsgpointdirection()
+tst_qquickpointdirection::tst_qquickpointdirection()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgpointdirection::test_basic()
+void tst_qquickpointdirection::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgpointdirection);
+QTEST_MAIN(tst_qquickpointdirection);
-#include "tst_qsgpointdirection.moc"
+#include "tst_qquickpointdirection.moc"
CONFIG += testcase
-TARGET = tst_qsgcumulativedirection
-SOURCES += tst_qsgcumulativedirection.cpp
+TARGET = tst_qquickrectangleextruder
+SOURCES += tst_qquickrectangleextruder.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgrectangleextruder : public QObject
+class tst_qquickrectangleextruder : public QObject
{
Q_OBJECT
public:
- tst_qsgrectangleextruder();
+ tst_qquickrectangleextruder();
private slots:
void test_basic();
};
-tst_qsgrectangleextruder::tst_qsgrectangleextruder()
+tst_qquickrectangleextruder::tst_qquickrectangleextruder()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgrectangleextruder::test_basic()
+void tst_qquickrectangleextruder::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
QCOMPARE(system->groupData[1]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[1]->data) {
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgrectangleextruder);
+QTEST_MAIN(tst_qquickrectangleextruder);
-#include "tst_qsgrectangleextruder.moc"
+#include "tst_qquickrectangleextruder.moc"
CONFIG += testcase
-TARGET = tst_qsgage
-SOURCES += tst_qsgage.cpp
+TARGET = tst_qquicktargetdirection
+SOURCES += tst_qquicktargetdirection.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
testDataFiles.path = .
DEPLOYMENT += testDataFiles
-CONFIG += insignificant_test
-
QT += core-private gui-private v8-private declarative-private opengl-private testlib
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgtargetdirection : public QObject
+class tst_qquicktargetdirection : public QObject
{
Q_OBJECT
public:
- tst_qsgtargetdirection();
+ tst_qquicktargetdirection();
private slots:
void test_basic();
};
-tst_qsgtargetdirection::tst_qsgtargetdirection()
+tst_qquicktargetdirection::tst_qquicktargetdirection()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgtargetdirection::test_basic()
+void tst_qquicktargetdirection::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgtargetdirection);
+QTEST_MAIN(tst_qquicktargetdirection);
-#include "tst_qsgtargetdirection.moc"
+#include "tst_qquicktargetdirection.moc"
CONFIG += testcase
-TARGET = tst_qsgcustomaffector
-SOURCES += tst_qsgcustomaffector.cpp
+TARGET = tst_qquicktrailemitter
+SOURCES += tst_qquicktrailemitter.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgtrailemitter : public QObject
+class tst_qquicktrailemitter : public QObject
{
Q_OBJECT
public:
- tst_qsgtrailemitter();
+ tst_qquicktrailemitter();
private slots:
void test_basic();
};
-tst_qsgtrailemitter::tst_qsgtrailemitter()
+tst_qquicktrailemitter::tst_qquicktrailemitter()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgtrailemitter::test_basic()
+void tst_qquicktrailemitter::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
QCOMPARE(system->groupData[1]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[1]->data) {
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgtrailemitter);
+QTEST_MAIN(tst_qquicktrailemitter);
-#include "tst_qsgtrailemitter.moc"
+#include "tst_qquicktrailemitter.moc"
CONFIG += testcase
-TARGET = tst_qsgimageparticle
-SOURCES += tst_qsgimageparticle.cpp
+TARGET = tst_qquickturbulence
+SOURCES += tst_qquickturbulence.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgturbulence : public QObject
+class tst_qquickturbulence : public QObject
{
Q_OBJECT
public:
- tst_qsgturbulence();
+ tst_qquickturbulence();
private slots:
void test_basic();
};
-tst_qsgturbulence::tst_qsgturbulence()
+tst_qquickturbulence::tst_qquickturbulence()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgturbulence::test_basic()
+void tst_qquickturbulence::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
//Note that the noise image built-in provides the 'randomness', so this test should be stable so long as it and the size
//of the Turbulence item remain the same
QCOMPARE(system->groupData[0]->size(), 500);
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
}
}
-QTEST_MAIN(tst_qsgturbulence);
+QTEST_MAIN(tst_qquickturbulence);
-#include "tst_qsgturbulence.moc"
+#include "tst_qquickturbulence.moc"
CONFIG += testcase
-TARGET = tst_qsgfriction
-SOURCES += tst_qsgfriction.cpp
+TARGET = tst_qquickwander
+SOURCES += tst_qquickwander.cpp
macx:CONFIG -= app_bundle
testDataFiles.files = data
#include <QtTest/QtTest>
#include "../shared/particlestestsshared.h"
-#include <private/qsgparticlesystem_p.h>
+#include <private/qquickparticlesystem_p.h>
#include <private/qabstractanimation_p.h>
-class tst_qsgwander : public QObject
+class tst_qquickwander : public QObject
{
Q_OBJECT
public:
- tst_qsgwander();
+ tst_qquickwander();
private slots:
void test_basic();
};
-tst_qsgwander::tst_qsgwander()
+tst_qquickwander::tst_qquickwander()
{
QUnifiedTimer::instance()->setConsistentTiming(true);
}
-void tst_qsgwander::test_basic()
+void tst_qquickwander::test_basic()
{
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml", 600);
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QCOMPARE(system->groupData[0]->size(), 500);
//the 500 was randomly changed from 0.0 in velocity
bool vxChanged = false;
bool vyChanged = false;
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
QVERIFY(vyChanged);
}
-QTEST_MAIN(tst_qsgwander);
+QTEST_MAIN(tst_qquickwander);
-#include "tst_qsgwander.moc"
+#include "tst_qquickwander.moc"
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qsgitemparticle
-SOURCES += tst_qsgitemparticle.cpp
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-QT += core-private gui-private v8-private declarative-private opengl-private testlib
-
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qsglineextruder
-SOURCES += tst_qsglineextruder.cpp
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-QT += core-private gui-private v8-private declarative-private opengl-private testlib
-
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qsgmaskextruder
-SOURCES += tst_qsgmaskextruder.cpp
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-QT += core-private gui-private v8-private declarative-private opengl-private testlib
-
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qsgparticlegroup
-SOURCES += tst_qsgparticlegroup.cpp
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-QT += core-private gui-private v8-private declarative-private opengl-private testlib
-
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qsgparticlesystem
-SOURCES += tst_qsgparticlesystem.cpp
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-QT += core-private gui-private v8-private declarative-private opengl-private testlib
-
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qsgpointattractor
-SOURCES += tst_qsgpointattractor.cpp
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-QT += core-private gui-private v8-private declarative-private opengl-private testlib
-
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qsgpointdirection
-SOURCES += tst_qsgpointdirection.cpp
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-QT += core-private gui-private v8-private declarative-private opengl-private testlib
-
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qsgrectangleextruder
-SOURCES += tst_qsgrectangleextruder.cpp
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-QT += core-private gui-private v8-private declarative-private opengl-private testlib
-
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qsgtargetdirection
-SOURCES += tst_qsgtargetdirection.cpp
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-QT += core-private gui-private v8-private declarative-private opengl-private testlib
-
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qsgtrailemitter
-SOURCES += tst_qsgtrailemitter.cpp
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-QT += core-private gui-private v8-private declarative-private opengl-private testlib
-
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qsgwander
-SOURCES += tst_qsgwander.cpp
-macx:CONFIG -= app_bundle
-
-testDataFiles.files = data
-testDataFiles.path = .
-DEPLOYMENT += testDataFiles
-
-QT += core-private gui-private v8-private declarative-private opengl-private testlib
-
{
QFETCH(int, dt);
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml");
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
//Pretend we're running, but we manually advance the simulation
system->m_running = true;
system->m_animation = 0;
int stillAlive = 0;
QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 1000, 10));//Small simulation variance is permissible.
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused
{
QFETCH(int, dt);
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/filtered.qml");
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
//Pretend we're running, but we manually advance the simulation
system->m_running = true;
system->m_animation = 0;
int stillAlive = 0;
QVERIFY(extremelyFuzzyCompare(system->groupData[1]->size(), 1000, 10));//Small simulation variance is permissible.
- foreach (QSGParticleData *d, system->groupData[1]->data) {
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
if (d->t == -1)
continue; //Particle data unused
{
QFETCH(int, dt);
QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml");
- QSGParticleSystem* system = view->rootObject()->findChild<QSGParticleSystem*>("system");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
//Pretend we're running, but we manually advance the simulation
system->m_running = true;
system->m_animation = 0;
int stillAlive = 0;
QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 1000, 10));//Small simulation variance is permissible.
- foreach (QSGParticleData *d, system->groupData[0]->data) {
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
if (d->t == -1)
continue; //Particle data unused