aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles/qquickcustomaffector.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2016-03-08 10:13:15 +0100
committerErik Verbruggen <erik.verbruggen@theqtcompany.com>2016-03-08 09:37:21 +0000
commit350a74ec69b535df07ad7ca45415090749c75293 (patch)
tree911d3c17b0af4f733f5449c6796014cfc9ac0d04 /src/particles/qquickcustomaffector.cpp
parent922e9d6b0c7ae1acdae4986e8000ad9a693b7469 (diff)
Particles: Shrink QQuickParticleData by 2 pointers.
Samegame creates about 23,000 particles, so this reduces the memory by ~180kb on 32bit, so ~360kb on 64bit. Change-Id: I0581524ab232b474c5d43abeabd7ebf6174e740f Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/particles/qquickcustomaffector.cpp')
-rw-r--r--src/particles/qquickcustomaffector.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/particles/qquickcustomaffector.cpp b/src/particles/qquickcustomaffector.cpp
index 6f50c17287..b95810bb62 100644
--- a/src/particles/qquickcustomaffector.cpp
+++ b/src/particles/qquickcustomaffector.cpp
@@ -138,8 +138,8 @@ void QQuickCustomAffector::affectSystem(qreal dt)
if (justAffected) {
foreach (QQuickParticleData* d, toAffect) {//Not postAffect to avoid saying the particle changed
if (m_onceOff)
- m_onceOffed << qMakePair(d->group, d->index);
- emit affected(d->curX(), d->curY());
+ m_onceOffed << qMakePair(d->groupId, d->index);
+ emit affected(d->curX(m_system), d->curY(m_system));
}
return;
}
@@ -154,7 +154,7 @@ void QQuickCustomAffector::affectSystem(qreal dt)
QV4::ScopedArrayObject array(scope, v4->newArrayObject(toAffect.size()));
QV4::ScopedValue v(scope);
for (int i=0; i<toAffect.size(); i++)
- array->putIndexed(i, (v = toAffect[i]->v4Value()));
+ array->putIndexed(i, (v = toAffect[i]->v4Value(m_system)));
if (dt >= simulationCutoff || dt <= simulationDelta) {
affectProperties(toAffect, dt);
@@ -184,7 +184,7 @@ 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;
- QPointF curPos(d->curX(), d->curY());
+ QPointF curPos(d->curX(m_system), d->curY(m_system));
if (m_acceleration != &m_nullVector){
QPointF pos = m_acceleration->sample(curPos);
@@ -194,22 +194,22 @@ bool QQuickCustomAffector::affectParticle(QQuickParticleData *d, qreal dt)
pos += curAcc;
}
if (pos != curAcc) {
- d->setInstantaneousAX(pos.x());
- d->setInstantaneousAY(pos.y());
+ d->setInstantaneousAX(pos.x(), m_system);
+ d->setInstantaneousAY(pos.y(), m_system);
changed = true;
}
}
if (m_velocity != &m_nullVector){
QPointF pos = m_velocity->sample(curPos);
- QPointF curVel = QPointF(d->curVX(), d->curVY());
+ QPointF curVel = QPointF(d->curVX(m_system), d->curVY(m_system));
if (m_relative) {
pos *= dt;
pos += curVel;
}
if (pos != curVel) {
- d->setInstantaneousVX(pos.x());
- d->setInstantaneousVY(pos.y());
+ d->setInstantaneousVX(pos.x(), m_system);
+ d->setInstantaneousVY(pos.y(), m_system);
changed = true;
}
}
@@ -221,8 +221,8 @@ bool QQuickCustomAffector::affectParticle(QQuickParticleData *d, qreal dt)
pos += curPos;
}
if (pos != curPos) {
- d->setInstantaneousX(pos.x());
- d->setInstantaneousY(pos.y());
+ d->setInstantaneousX(pos.x(), m_system);
+ d->setInstantaneousY(pos.y(), m_system);
changed = true;
}
}