aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/declarative/particles/custom/fallingleaves.qml32
-rw-r--r--src/declarative/particles/qsgcustomemitter.cpp4
-rw-r--r--src/declarative/particles/qsgcustomparticle.cpp8
-rw-r--r--src/declarative/particles/qsgemitter.cpp4
-rw-r--r--src/declarative/particles/qsgfollowemitter.cpp12
-rw-r--r--src/declarative/particles/qsgfriction.cpp8
-rw-r--r--src/declarative/particles/qsgimageparticle.cpp8
-rw-r--r--src/declarative/particles/qsgimageparticle_p.h8
-rw-r--r--src/declarative/particles/qsgparticlesystem.cpp62
-rw-r--r--src/declarative/particles/qsgparticlesystem_p.h14
-rw-r--r--src/declarative/particles/qsgpointattractor.cpp4
-rw-r--r--src/declarative/particles/qsgtargetaffector.cpp12
-rw-r--r--src/declarative/particles/qsgturbulence.cpp4
-rw-r--r--src/declarative/particles/qsgv8particledata.cpp38
-rw-r--r--src/declarative/particles/qsgwander.cpp8
15 files changed, 141 insertions, 85 deletions
diff --git a/examples/declarative/particles/custom/fallingleaves.qml b/examples/declarative/particles/custom/fallingleaves.qml
index e41d214594..1d1282ebbb 100644
--- a/examples/declarative/particles/custom/fallingleaves.qml
+++ b/examples/declarative/particles/custom/fallingleaves.qml
@@ -13,21 +13,24 @@ Item {
Emitter{
system: sys
width: parent.width
- emitRate: 6
- lifeSpan: 12000
+ emitRate: 4
+ lifeSpan: 14000
size: 80
speed: PointDirection{ y: 60 }
}
Wander {
system: sys
anchors.fill: parent
+ anchors.bottomMargin: 100
xVariance: 60
pace: 60
}
CustomAffector{
system: sys
- property real coefficient: 0.5
- property real speed: 10.0
+ property real coefficient: 0.1
+ property real speed: 1.5
+ width: parent.width
+ height: parent.height - 100
onAffectParticle:{
/* //Linear movement
if (particle.r == 0){
@@ -53,6 +56,27 @@ Item {
}
}
+ CustomAffector{//Custom Friction, adds some 'randomness'
+ system: sys
+ //onceOff: true
+ x: -60
+ width: parent.width + 120
+ height: 100
+ anchors.bottom: parent.bottom
+ onAffectParticle:{
+ var pseudoRand = (Math.floor(particle.t*1327) % 10) + 1;
+ var yslow = pseudoRand * 0.001 + 1.01;
+ var xslow = pseudoRand * 0.0005 + 1.0;
+ if (particle.curVY < 1)
+ particle.curVY == 0;
+ else
+ particle.curVY = (particle.curVY / yslow);
+ if (particle.curVX < 1)
+ particle.curVX == 0;
+ else
+ particle.curVX = (particle.curVX / xslow);
+ }
+ }
ImageParticle{
anchors.fill: parent
id: particles
diff --git a/src/declarative/particles/qsgcustomemitter.cpp b/src/declarative/particles/qsgcustomemitter.cpp
index 4a379a3d72..0500e0c75e 100644
--- a/src/declarative/particles/qsgcustomemitter.cpp
+++ b/src/declarative/particles/qsgcustomemitter.cpp
@@ -147,8 +147,8 @@ void QSGCustomEmitter::emitWindow(int timeStamp)
// Particle speed
const QPointF &speed = m_speed->sample(newPos);
- datum->sx = speed.x();
- datum->sy = speed.y();
+ datum->vx = speed.x();
+ datum->vy = speed.y();
// Particle acceleration
const QPointF &accel = m_acceleration->sample(newPos);
diff --git a/src/declarative/particles/qsgcustomparticle.cpp b/src/declarative/particles/qsgcustomparticle.cpp
index f1477f6ebf..1ce8e43363 100644
--- a/src/declarative/particles/qsgcustomparticle.cpp
+++ b/src/declarative/particles/qsgcustomparticle.cpp
@@ -105,8 +105,8 @@ struct PlainVertex {
float lifeSpan;
float size;
float endSize;
- float sx;
- float sy;
+ float vx;
+ float vy;
float ax;
float ay;
float r;
@@ -535,8 +535,8 @@ void QSGCustomParticle::commit(int gIdx, int pIdx)
vertices[i].lifeSpan = datum->lifeSpan;
vertices[i].size = datum->size;
vertices[i].endSize = datum->endSize;
- vertices[i].sx = datum->sx;
- vertices[i].sy = datum->sy;
+ vertices[i].vx = datum->vx;
+ vertices[i].vy = datum->vy;
vertices[i].ax = datum->ax;
vertices[i].ay = datum->ay;
vertices[i].r = datum->r;
diff --git a/src/declarative/particles/qsgemitter.cpp b/src/declarative/particles/qsgemitter.cpp
index f05ee6af8a..10d59dfaf8 100644
--- a/src/declarative/particles/qsgemitter.cpp
+++ b/src/declarative/particles/qsgemitter.cpp
@@ -220,9 +220,9 @@ void QSGBasicEmitter::emitWindow(int timeStamp)
// Particle speed
const QPointF &speed = m_speed->sample(newPos);
- datum->sx = speed.x()
+ datum->vx = speed.x()
+ m_speed_from_movement * vx;
- datum->sy = speed.y()
+ datum->vy = speed.y()
+ m_speed_from_movement * vy;
// Particle acceleration
diff --git a/src/declarative/particles/qsgfollowemitter.cpp b/src/declarative/particles/qsgfollowemitter.cpp
index ff9f83df14..0d4e7f73fd 100644
--- a/src/declarative/particles/qsgfollowemitter.cpp
+++ b/src/declarative/particles/qsgfollowemitter.cpp
@@ -220,12 +220,12 @@ void QSGFollowEmitter::emitWindow(int timeStamp)
qreal sizeOffset = d->size/2;//TODO: Current size? As an option
//TODO: Set variations
//Subtract offset, because PS expects this in emitter coordinates
- QRectF boundsRect(d->x - offset.x() + d->sx * followT + d->ax * followT2 - m_emitterXVariation/2,
- d->y - offset.y() + d->sy * followT + d->ay * followT2 - m_emitterYVariation/2,
+ QRectF boundsRect(d->x - offset.x() + d->vx * followT + d->ax * followT2 - m_emitterXVariation/2,
+ d->y - offset.y() + d->vy * followT + d->ay * followT2 - m_emitterYVariation/2,
m_emitterXVariation,
m_emitterYVariation);
- // QRectF boundsRect(d->x + d->sx * followT + d->ax * followT2 + offset.x() - sizeOffset,
- // d->y + d->sy * followT + d->ay * followT2 + offset.y() - sizeOffset,
+ // QRectF boundsRect(d->x + d->vx * followT + d->ax * followT2 + offset.x() - sizeOffset,
+ // d->y + d->vy * followT + d->ay * followT2 + offset.y() - sizeOffset,
// sizeOffset*2,
// sizeOffset*2);
@@ -236,8 +236,8 @@ void QSGFollowEmitter::emitWindow(int timeStamp)
// Particle speed
const QPointF &speed = m_speed->sample(newPos);
- datum->sx = speed.x();
- datum->sy = speed.y();
+ datum->vx = speed.x();
+ datum->vy = speed.y();
// Particle acceleration
const QPointF &accel = m_acceleration->sample(newPos);
diff --git a/src/declarative/particles/qsgfriction.cpp b/src/declarative/particles/qsgfriction.cpp
index fcd43a57d9..e6a43013e8 100644
--- a/src/declarative/particles/qsgfriction.cpp
+++ b/src/declarative/particles/qsgfriction.cpp
@@ -63,10 +63,10 @@ bool QSGFrictionAffector::affectParticle(QSGParticleData *d, qreal dt)
{
if (!m_factor)
return false;
- qreal curSX = d->curSX();
- qreal curSY = d->curSY();
- d->setInstantaneousSX(curSX + (curSX * m_factor * -1 * dt));
- d->setInstantaneousSY(curSY + (curSY * m_factor * -1 * dt));
+ qreal curVX = d->curVX();
+ qreal curVY = d->curVY();
+ d->setInstantaneousVX(curVX + (curVX * m_factor * -1 * dt));
+ d->setInstantaneousVY(curVY + (curVY * m_factor * -1 * dt));
return true;
}
QT_END_NAMESPACE
diff --git a/src/declarative/particles/qsgimageparticle.cpp b/src/declarative/particles/qsgimageparticle.cpp
index e4ba67f6e7..52e94b169a 100644
--- a/src/declarative/particles/qsgimageparticle.cpp
+++ b/src/declarative/particles/qsgimageparticle.cpp
@@ -985,8 +985,8 @@ void QSGImageParticle::commit(int gIdx, int pIdx)
ultraVertices[i].lifeSpan = datum->lifeSpan;
ultraVertices[i].size = datum->size;
ultraVertices[i].endSize = datum->endSize;
- ultraVertices[i].sx = datum->sx;
- ultraVertices[i].sy = datum->sy;
+ ultraVertices[i].vx = datum->vx;
+ ultraVertices[i].vy = datum->vy;
ultraVertices[i].ax = datum->ax;
ultraVertices[i].ay = datum->ay;
ultraVertices[i].xx = datum->xx;
@@ -1018,8 +1018,8 @@ void QSGImageParticle::commit(int gIdx, int pIdx)
simpleVertices[i].lifeSpan = datum->lifeSpan;
simpleVertices[i].size = datum->size;
simpleVertices[i].endSize = datum->endSize;
- simpleVertices[i].sx = datum->sx;
- simpleVertices[i].sy = datum->sy;
+ simpleVertices[i].vx = datum->vx;
+ simpleVertices[i].vy = datum->vy;
simpleVertices[i].ax = datum->ax;
simpleVertices[i].ay = datum->ay;
}
diff --git a/src/declarative/particles/qsgimageparticle_p.h b/src/declarative/particles/qsgimageparticle_p.h
index ed9db5281e..1ac840ca9f 100644
--- a/src/declarative/particles/qsgimageparticle_p.h
+++ b/src/declarative/particles/qsgimageparticle_p.h
@@ -66,8 +66,8 @@ struct SimpleVertex {
float lifeSpan;
float size;
float endSize;
- float sx;
- float sy;
+ float vx;
+ float vy;
float ax;
float ay;
};
@@ -88,8 +88,8 @@ struct UltraVertex {
float lifeSpan;
float size;
float endSize;
- float sx;
- float sy;
+ float vx;
+ float vy;
float ax;
float ay;
Color4ub color;
diff --git a/src/declarative/particles/qsgparticlesystem.cpp b/src/declarative/particles/qsgparticlesystem.cpp
index 6f4a6171c2..f48156315c 100644
--- a/src/declarative/particles/qsgparticlesystem.cpp
+++ b/src/declarative/particles/qsgparticlesystem.cpp
@@ -306,8 +306,8 @@ QSGParticleData::QSGParticleData(QSGParticleSystem* sys)
lifeSpan = 0;
size = 0;
endSize = 0;
- sx = 0;
- sy = 0;
+ vx = 0;
+ vy = 0;
ax = 0;
ay = 0;
xx = 1;
@@ -338,8 +338,8 @@ void QSGParticleData::clone(const QSGParticleData& other)
lifeSpan = other.lifeSpan;
size = other.size;
endSize = other.endSize;
- sx = other.sx;
- sy = other.sy;
+ vx = other.vx;
+ vy = other.vy;
ax = other.ax;
ay = other.ay;
xx = other.xx;
@@ -372,24 +372,24 @@ QDeclarativeV8Handle QSGParticleData::v8Value()
void QSGParticleData::setInstantaneousAX(qreal ax)
{
qreal t = (system->m_timeInt / 1000.0) - this->t;
- qreal sx = (this->sx + t*this->ax) - t*ax;
- qreal ex = this->x + this->sx * t + 0.5 * this->ax * t * t;
- qreal x = ex - t*sx - 0.5 * t*t*ax;
+ qreal vx = (this->vx + t*this->ax) - t*ax;
+ qreal ex = this->x + this->vx * t + 0.5 * this->ax * t * t;
+ qreal x = ex - t*vx - 0.5 * t*t*ax;
this->ax = ax;
- this->sx = sx;
+ this->vx = vx;
this->x = x;
}
//sets the x velocity without affecting the instantaneous x postion
-void QSGParticleData::setInstantaneousSX(qreal vx)
+void QSGParticleData::setInstantaneousVX(qreal vx)
{
qreal t = (system->m_timeInt / 1000.0) - this->t;
- qreal sx = vx - t*this->ax;
- qreal ex = this->x + this->sx * t + 0.5 * this->ax * t * t;
- qreal x = ex - t*sx - 0.5 * t*t*this->ax;
+ qreal evx = vx - t*this->ax;
+ qreal ex = this->x + this->vx * t + 0.5 * this->ax * t * t;
+ qreal x = ex - t*evx - 0.5 * t*t*this->ax;
- this->sx = sx;
+ this->vx = evx;
this->x = x;
}
@@ -397,31 +397,31 @@ void QSGParticleData::setInstantaneousSX(qreal vx)
void QSGParticleData::setInstantaneousX(qreal x)
{
qreal t = (system->m_timeInt / 1000.0) - this->t;
- this->x = x - t*this->sx - 0.5 * t*t*this->ax;
+ 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)
{
qreal t = (system->m_timeInt / 1000.0) - this->t;
- qreal sy = (this->sy + t*this->ay) - t*ay;
- qreal ey = this->y + this->sy * t + 0.5 * this->ay * t * t;
- qreal y = ey - t*sy - 0.5 * t*t*ay;
+ qreal vy = (this->vy + t*this->ay) - t*ay;
+ qreal ey = this->y + this->vy * t + 0.5 * this->ay * t * t;
+ qreal y = ey - t*vy - 0.5 * t*t*ay;
this->ay = ay;
- this->sy = sy;
+ this->vy = vy;
this->y = y;
}
//sets the y velocity without affecting the instantaneous y position
-void QSGParticleData::setInstantaneousSY(qreal vy)
+void QSGParticleData::setInstantaneousVY(qreal vy)
{
qreal t = (system->m_timeInt / 1000.0) - this->t;
- qreal sy = vy - t*this->ay;
- qreal ey = this->y + this->sy * t + 0.5 * this->ay * t * t;
- qreal y = ey - t*sy - 0.5 * t*t*this->ay;
+ qreal evy = vy - t*this->ay;
+ qreal ey = this->y + this->vy * t + 0.5 * this->ay * t * t;
+ qreal y = ey - t*evy - 0.5 * t*t*this->ay;
- this->sy = sy;
+ this->vy = evy;
this->y = y;
}
@@ -429,38 +429,38 @@ void QSGParticleData::setInstantaneousSY(qreal vy)
void QSGParticleData::setInstantaneousY(qreal y)
{
qreal t = (system->m_timeInt / 1000.0) - this->t;
- this->y = y - t*this->sy - 0.5 * t*t*this->ay;
+ this->y = y - t*this->vy - 0.5 * t*t*this->ay;
}
qreal QSGParticleData::curX() const
{
qreal t = (system->m_timeInt / 1000.0) - this->t;
- return this->x + this->sx * t + 0.5 * this->ax * t * t;
+ return this->x + this->vx * t + 0.5 * this->ax * t * t;
}
-qreal QSGParticleData::curSX() const
+qreal QSGParticleData::curVX() const
{
qreal t = (system->m_timeInt / 1000.0) - this->t;
- return this->sx + t*this->ax;
+ return this->vx + t*this->ax;
}
qreal QSGParticleData::curY() const
{
qreal t = (system->m_timeInt / 1000.0) - this->t;
- return y + sy * t + 0.5 * ay * t * t;
+ return y + vy * t + 0.5 * ay * t * t;
}
-qreal QSGParticleData::curSY() const
+qreal QSGParticleData::curVY() const
{
qreal t = (system->m_timeInt / 1000.0) - this->t;
- return sy + t*ay;
+ return vy + t*ay;
}
void QSGParticleData::debugDump()
{
qDebug() << "Particle" << systemIndex << group << "/" << index << stillAlive()
<< "Pos: " << x << "," << y
- //<< "Vel: " << sx << "," << sy
+ //<< "Vel: " << vx << "," << sy
//<< "Acc: " << ax << "," << ay
<< "Size: " << size << "," << endSize
<< "Time: " << t << "," <<lifeSpan << ";" << (system->m_timeInt / 1000.0) ;
diff --git a/src/declarative/particles/qsgparticlesystem_p.h b/src/declarative/particles/qsgparticlesystem_p.h
index fd46ee25c5..9f4020d041 100644
--- a/src/declarative/particles/qsgparticlesystem_p.h
+++ b/src/declarative/particles/qsgparticlesystem_p.h
@@ -150,21 +150,23 @@ public:
//sets the x accleration without affecting the instantaneous x velocity or position
void setInstantaneousAX(qreal ax);
//sets the x velocity without affecting the instantaneous x postion
- void setInstantaneousSX(qreal vx);
+ void setInstantaneousVX(qreal vx);
//sets the instantaneous x postion
void setInstantaneousX(qreal x);
//sets the y accleration without affecting the instantaneous y velocity or position
void setInstantaneousAY(qreal ay);
//sets the y velocity without affecting the instantaneous y postion
- void setInstantaneousSY(qreal vy);
+ void setInstantaneousVY(qreal vy);
//sets the instantaneous Y postion
void setInstantaneousY(qreal y);
//TODO: Slight caching?
qreal curX() const;
- qreal curSX() const;
+ qreal curVX() const;
+ qreal curAX() const { return ax; }
qreal curY() const;
- qreal curSY() const;
+ qreal curVY() const;
+ qreal curAY() const { return ay; }
int group;
QSGParticleEmitter* e;//### Needed?
@@ -179,8 +181,8 @@ public:
float lifeSpan;
float size;
float endSize;
- float sx;
- float sy;
+ float vx;
+ float vy;
float ax;
float ay;
diff --git a/src/declarative/particles/qsgpointattractor.cpp b/src/declarative/particles/qsgpointattractor.cpp
index 6be61aa716..cc4cac66a4 100644
--- a/src/declarative/particles/qsgpointattractor.cpp
+++ b/src/declarative/particles/qsgpointattractor.cpp
@@ -92,8 +92,8 @@ bool QSGPointAttractorAffector::affectParticle(QSGParticleData *d, qreal dt)
break;
case Velocity: //also default
default:
- d->setInstantaneousSX(d->sx + dx);
- d->setInstantaneousSY(d->sy + dy);
+ d->setInstantaneousVX(d->vx + dx);
+ d->setInstantaneousVY(d->vy + dy);
}
return true;
diff --git a/src/declarative/particles/qsgtargetaffector.cpp b/src/declarative/particles/qsgtargetaffector.cpp
index c5b5b074b5..e7bbebe6db 100644
--- a/src/declarative/particles/qsgtargetaffector.cpp
+++ b/src/declarative/particles/qsgtargetaffector.cpp
@@ -66,8 +66,8 @@ bool QSGTargetAffector::affectParticle(QSGParticleData *d, qreal dt)
qreal t = tt - (d->lifeSpan - d->lifeLeft());
if (t <= 0)
return false;
- qreal tx = d->x + d->sx * tt + 0.5 * d->ax * tt * tt;
- qreal ty = d->y + d->sy * tt + 0.5 * d->ay * tt * tt;
+ qreal tx = d->x + d->vx * tt + 0.5 * d->ax * tt * tt;
+ qreal ty = d->y + d->vy * tt + 0.5 * d->ay * tt * tt;
if (QPointF(tx,ty) == target)
return false;
@@ -77,14 +77,14 @@ bool QSGTargetAffector::affectParticle(QSGParticleData *d, qreal dt)
qreal w = 1 - (t / tt) + 0.05;
w = qMin(w, 1.0);
- qreal wvX = vX * w + d->sx * (1 - w);
- qreal wvY = vY * w + d->sy * (1 - w);
+ qreal wvX = vX * w + d->vx * (1 - w);
+ qreal wvY = vY * w + d->vy * (1 - w);
//Screws with the acceleration so that the given start pos with the chosen weighted velocity will still end at the target coordinates
qreal ax = (2*(target.x() - d->x - wvX*tt)) / (tt*tt);
qreal ay = (2*(target.y() - d->y - wvY*tt)) / (tt*tt);
- d->sx = wvX;
- d->sy = wvY;
+ d->vx = wvX;
+ d->vy = wvY;
d->ax = ax;
d->ay = ay;
diff --git a/src/declarative/particles/qsgturbulence.cpp b/src/declarative/particles/qsgturbulence.cpp
index c846f151b4..e9812d7825 100644
--- a/src/declarative/particles/qsgturbulence.cpp
+++ b/src/declarative/particles/qsgturbulence.cpp
@@ -173,8 +173,8 @@ void QSGTurbulenceAffector::affectSystem(qreal dt)
fy += m_field[p.first][p.second].y() * ((m_magSum - dist)/m_magSum);
}
if (fx || fy){
- d->setInstantaneousSX(d->curSX()+ fx * dt);
- d->setInstantaneousSY(d->curSY()+ fy * dt);
+ d->setInstantaneousVX(d->curVX()+ fx * dt);
+ d->setInstantaneousVY(d->curVY()+ fy * dt);
m_system->m_needsReset << d;
}
}
diff --git a/src/declarative/particles/qsgv8particledata.cpp b/src/declarative/particles/qsgv8particledata.cpp
index 6b31e3771e..b3ff482d8b 100644
--- a/src/declarative/particles/qsgv8particledata.cpp
+++ b/src/declarative/particles/qsgv8particledata.cpp
@@ -110,6 +110,24 @@ static void particleData_set_ ## VARIABLE (v8::Local<v8::String>, v8::Local<v8::
r->datum-> VARIABLE = value->NumberValue();\
}
+#define FAKE_FLOAT_GETTER_AND_SETTER(VARIABLE, GETTER, SETTER) static v8::Handle<v8::Value> particleData_get_ ## VARIABLE (v8::Local<v8::String>, const v8::AccessorInfo &info) \
+{ \
+ QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(info.This()); \
+ if (!r || !r->datum) \
+ V8THROW_ERROR("Not a valid ParticleData object"); \
+\
+ return v8::Number::New(r->datum-> GETTER ());\
+}\
+\
+static void particleData_set_ ## VARIABLE (v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info)\
+{\
+ QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(info.This());\
+ if (!r || !r->datum)\
+ V8THROW_ERROR_SETTER("Not a valid ParticleData object");\
+\
+ r->datum-> SETTER ( value->NumberValue() );\
+}
+
#define FLOAT_REGISTER_ACCESSOR(FT, ENGINE, VARIABLE) FT ->PrototypeTemplate()->SetAccessor( v8::String::New( #VARIABLE ), particleData_get_ ## VARIABLE , particleData_set_ ## VARIABLE , v8::External::Wrap(ENGINE))
FLOAT_GETTER_AND_SETTER(x)
@@ -118,8 +136,8 @@ FLOAT_GETTER_AND_SETTER(t)
FLOAT_GETTER_AND_SETTER(lifeSpan)
FLOAT_GETTER_AND_SETTER(size)
FLOAT_GETTER_AND_SETTER(endSize)
-FLOAT_GETTER_AND_SETTER(sx)
-FLOAT_GETTER_AND_SETTER(sy)
+FLOAT_GETTER_AND_SETTER(vx)
+FLOAT_GETTER_AND_SETTER(vy)
FLOAT_GETTER_AND_SETTER(ax)
FLOAT_GETTER_AND_SETTER(ay)
FLOAT_GETTER_AND_SETTER(xx)
@@ -132,6 +150,12 @@ FLOAT_GETTER_AND_SETTER(frameDuration)
FLOAT_GETTER_AND_SETTER(frameCount)
FLOAT_GETTER_AND_SETTER(animT)
FLOAT_GETTER_AND_SETTER(r)
+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(curY, curY, setInstantaneousY)
+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
@@ -151,8 +175,8 @@ QV8ParticleDataDeletable::QV8ParticleDataDeletable(QV8Engine *engine)
FLOAT_REGISTER_ACCESSOR(ft, engine, lifeSpan);
FLOAT_REGISTER_ACCESSOR(ft, engine, size);
FLOAT_REGISTER_ACCESSOR(ft, engine, endSize);
- FLOAT_REGISTER_ACCESSOR(ft, engine, sx);
- FLOAT_REGISTER_ACCESSOR(ft, engine, sy);
+ FLOAT_REGISTER_ACCESSOR(ft, engine, vx);
+ FLOAT_REGISTER_ACCESSOR(ft, engine, vy);
FLOAT_REGISTER_ACCESSOR(ft, engine, ax);
FLOAT_REGISTER_ACCESSOR(ft, engine, ay);
FLOAT_REGISTER_ACCESSOR(ft, engine, xx);
@@ -165,6 +189,12 @@ 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, curX);
+ FLOAT_REGISTER_ACCESSOR(ft, engine, curVX);
+ FLOAT_REGISTER_ACCESSOR(ft, engine, curAX);
+ FLOAT_REGISTER_ACCESSOR(ft, engine, curY);
+ FLOAT_REGISTER_ACCESSOR(ft, engine, curVY);
+ FLOAT_REGISTER_ACCESSOR(ft, engine, curAY);
constructor = qPersistentNew(ft->GetFunction());
}
diff --git a/src/declarative/particles/qsgwander.cpp b/src/declarative/particles/qsgwander.cpp
index 849f2880a6..2d04d62eba 100644
--- a/src/declarative/particles/qsgwander.cpp
+++ b/src/declarative/particles/qsgwander.cpp
@@ -131,12 +131,12 @@ bool QSGWanderAffector::affectParticle(QSGParticleData* data, qreal dt)
break;
default:
case Velocity:
- newX = data->curSX() + dx;
+ newX = data->curVX() + dx;
if (m_xVariance > qAbs(newX) )
- data->setInstantaneousSX(newX);
- newY = data->curSY() + dy;
+ data->setInstantaneousVX(newX);
+ newY = data->curVY() + dy;
if (m_yVariance > qAbs(newY) )
- data->setInstantaneousSY(newY);
+ data->setInstantaneousVY(newY);
break;
case Acceleration:
newX = data->ax + dx;