#include "qsgparticleaffector_p.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
+
/*!
\qmlclass Affector QSGParticleAffector
\inqmlmodule QtQuick.Particles 2
if ((m_onceOff && m_onceOffed.contains(qMakePair(d->group, d->index)))
|| !d->stillAlive())
continue;
- //Need to have previous location for affected. if signal || shape might be faster?
- QPointF curPos = QPointF(d->curX(), d->curY());
+ //Need to have previous location for affected anyways
+ QPointF curPos;
+ if (m_signal || (width() && height()))
+ curPos = QPointF(d->curX(), d->curY());
if (width() == 0 || height() == 0
|| m_shape->contains(QRectF(m_offset.x(), m_offset.y(), width(), height()),curPos)){
if (m_collisionParticles.isEmpty() || isColliding(d)){
bool QSGParticleAffector::affectParticle(QSGParticleData *d, qreal dt)
{
if (isAffectConnected()){
+ d->update = 0.0;
emit affectParticle(d->v8Value(), dt);
- return true;
+ return d->update == 1.0;
}
return m_signal;//If signalling, then we always 'null affect' it.
}
FLOAT_GETTER_AND_SETTER(frameCount)
FLOAT_GETTER_AND_SETTER(animT)
FLOAT_GETTER_AND_SETTER(r)
+FLOAT_GETTER_AND_SETTER(update)
FAKE_FLOAT_GETTER_AND_SETTER(curX, curX, setInstantaneousX)
FAKE_FLOAT_GETTER_AND_SETTER(curVX, curVX, setInstantaneousVX)
FAKE_FLOAT_GETTER_AND_SETTER(curAX, curAX, setInstantaneousAX)
FAKE_FLOAT_GETTER_AND_SETTER(curVY, curVY, setInstantaneousVY)
FAKE_FLOAT_GETTER_AND_SETTER(curAY, curAY, setInstantaneousAY)
-//TODO: Non-floats (color) and special floats (curX) once basic floats are working well
+//TODO: Non-floats (color, update?) once floats are working well
QV8ParticleDataDeletable::QV8ParticleDataDeletable(QV8Engine *engine)
{
FLOAT_REGISTER_ACCESSOR(ft, engine, frameCount);
FLOAT_REGISTER_ACCESSOR(ft, engine, animT);
FLOAT_REGISTER_ACCESSOR(ft, engine, r);
+ FLOAT_REGISTER_ACCESSOR(ft, engine, update);
FLOAT_REGISTER_ACCESSOR(ft, engine, curX);
FLOAT_REGISTER_ACCESSOR(ft, engine, curVX);
FLOAT_REGISTER_ACCESSOR(ft, engine, curAX);