aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/particles/qsgparticlesystem_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/particles/qsgparticlesystem_p.h')
-rw-r--r--src/declarative/particles/qsgparticlesystem_p.h79
1 files changed, 52 insertions, 27 deletions
diff --git a/src/declarative/particles/qsgparticlesystem_p.h b/src/declarative/particles/qsgparticlesystem_p.h
index 9730ff35e8..45b4e164f1 100644
--- a/src/declarative/particles/qsgparticlesystem_p.h
+++ b/src/declarative/particles/qsgparticlesystem_p.h
@@ -47,6 +47,7 @@
#include <QVector>
#include <QHash>
#include <QPointer>
+#include <QSignalMapper>
QT_BEGIN_HEADER
@@ -61,11 +62,14 @@ class QSGParticlePainter;
class QSGParticleData;
-struct GroupData{
+class QSGParticleGroupData{
+public:
+ QSGParticleGroupData():size(0),nextIdx(0)
+ {}
int size;
- int start;
int nextIdx;
- QList<QSGParticlePainter*> types;
+ QSet<QSGParticlePainter*> painters;
+ QVector<QSGParticleData*> data;
};
class QSGParticleSystem : public QSGItem
@@ -131,20 +135,20 @@ protected:
void componentComplete();
private slots:
- void countChanged();
+ void emittersChanged();
+ void loadPainter(QObject* p);
public://but only really for related class usage. Perhaps we should all be friends?
void emitParticle(QSGParticleData* p);
QSGParticleData* newDatum(int groupId);
qint64 systemSync(QSGParticlePainter* p);
QElapsedTimer m_timestamp;
- QVector<QSGParticleData*> m_data;
QSet<QSGParticleData*> m_needsReset;
QHash<QString, int> m_groupIds;
- QHash<int, GroupData*> m_groupData;//id, size, start
+ QHash<int, QSGParticleGroupData*> m_groupData;
qint64 m_timeInt;
bool m_initialized;
- void registerParticleType(QSGParticlePainter* p);
+ void registerParticlePainter(QSGParticlePainter* p);
void registerParticleEmitter(QSGParticleEmitter* e);
void registerParticleAffector(QSGParticleAffector* a);
bool overwrite() const
@@ -158,36 +162,29 @@ private:
bool m_running;
QList<QPointer<QSGParticleEmitter> > m_emitters;
QList<QPointer<QSGParticleAffector> > m_affectors;
- QList<QPointer<QSGParticlePainter> > m_particles;
+ QList<QPointer<QSGParticlePainter> > m_particlePainters;
QList<QPointer<QSGParticlePainter> > m_syncList;
qint64 m_startTime;
int m_nextGroupId;
bool m_overwrite;
bool m_componentComplete;
-};
-//TODO: Clean up all this into ParticleData
+ QSignalMapper m_painterMapper;
+ QSignalMapper m_emitterMapper;
+};
-struct ParticleVertex {
- float x;
- float y;
- float t;
- float lifeSpan;
- float size;
- float endSize;
- float sx;
- float sy;
- float ax;
- float ay;
- //TODO: Need opacity over life control. More variable size over life?
+struct Color4ub {
+ uchar r;
+ uchar g;
+ uchar b;
+ uchar a;
};
class QSGParticleData{
public:
+ //TODO: QObject like memory management (without the cost, just attached to system)
QSGParticleData();
- ParticleVertex pv;
-
//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.
@@ -211,10 +208,38 @@ public:
qreal curSY() const;
int group;
- QSGParticleEmitter* e;
+ QSGParticleEmitter* e;//### Needed?
QSGParticleSystem* system;
- int particleIndex;
- int systemIndex;
+ int index;
+
+ //General Position Stuff
+ float x;
+ float y;
+ float t;
+ float lifeSpan;
+ float size;
+ float endSize;
+ float sx;
+ float sy;
+ float ax;
+ float ay;
+
+ //Other stuff, now universally shared
+ Color4ub color;
+ float xx;
+ float xy;
+ float yx;
+ float yy;
+ float rotation;
+ float rotationSpeed;
+ float autoRotate;//Assume that GPUs prefer floats to bools
+ float animIdx;
+ float frameDuration;
+ float frameCount;
+ float animT;
+ float r;
+ QSGItem* delegate;
+ int modelIndex;
void debugDump();
bool stillAlive();