aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles/qquicktrailemitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/particles/qquicktrailemitter.cpp')
-rw-r--r--src/particles/qquicktrailemitter.cpp55
1 files changed, 30 insertions, 25 deletions
diff --git a/src/particles/qquicktrailemitter.cpp b/src/particles/qquicktrailemitter.cpp
index 98d34e06d5..d4d2adcfb2 100644
--- a/src/particles/qquicktrailemitter.cpp
+++ b/src/particles/qquicktrailemitter.cpp
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -173,10 +179,10 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
qreal sizeAtEnd = m_particleEndSize >= 0 ? m_particleEndSize : m_particleSize;
int gId = m_system->groupIds[m_follow];
- int gId2 = m_system->groupIds[m_group];
+ int gId2 = groupId();
for (int i=0; i<m_system->groupData[gId]->data.count(); i++) {
QQuickParticleData *d = m_system->groupData[gId]->data[i];
- if (!d->stillAlive()){
+ if (!d->stillAlive(m_system)){
m_lastEmission[i] = time; //Should only start emitting when it returns to life
continue;
}
@@ -186,7 +192,8 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
if (pt + maxLife < time)//We missed so much, that we should skip emiting particles that are dead by now
pt = time - maxLife;
- if ((width() || height()) && !effectiveExtruder()->contains(QRectF(offset.x(), offset.y(), width(), height()),QPointF(d->curX(), d->curY()))){
+ if ((width() || height()) && !effectiveExtruder()->contains(QRectF(offset.x(), offset.y(), width(), height()),
+ QPointF(d->curX(m_system), d->curY(m_system)))) {
m_lastEmission[d->index] = time;//jump over this time period without emitting, because it's outside
continue;
}
@@ -196,8 +203,6 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
while (pt < time || !m_burstQueue.isEmpty()){
QQuickParticleData* datum = m_system->newDatum(gId2, !m_overwrite);
if (datum){//else, skip this emission
- datum->e = this;//###useful?
-
// Particle timestamp
datum->t = pt;
datum->lifeSpan =
@@ -209,8 +214,8 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
// Note that burst location doesn't get used for follow emitter
qreal followT = pt - d->t;
qreal followT2 = followT * followT * 0.5;
- qreal eW = m_emitterXVariation < 0 ? d->curSize() : m_emitterXVariation;
- qreal eH = m_emitterYVariation < 0 ? d->curSize() : m_emitterYVariation;
+ qreal eW = m_emitterXVariation < 0 ? d->curSize(m_system) : m_emitterXVariation;
+ qreal eH = m_emitterYVariation < 0 ? d->curSize(m_system) : m_emitterYVariation;
//Subtract offset, because PS expects this in emitter coordinates
QRectF boundsRect(d->x - offset.x() + d->vx * followT + d->ax * followT2 - eW/2,
d->y - offset.y() + d->vy * followT + d->ay * followT2 - eH/2,
@@ -245,7 +250,7 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
toEmit << datum;
- m_system->emitParticle(datum);
+ m_system->emitParticle(datum, this);
}
if (!m_burstQueue.isEmpty()){
m_burstQueue.first().first--;
@@ -257,7 +262,7 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
}
foreach (QQuickParticleData* d, toEmit)
- m_system->emitParticle(d);
+ m_system->emitParticle(d, this);
if (isEmitConnected() || isEmitFollowConnected()) {
QQmlEngine *qmlEngine = ::qmlEngine(this);
@@ -267,10 +272,10 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
QV4::ScopedArrayObject array(scope, v4->newArrayObject(toEmit.size()));
QV4::ScopedValue v(scope);
for (int i=0; i<toEmit.size(); i++)
- array->putIndexed(i, (v = toEmit[i]->v4Value()));
+ array->putIndexed(i, (v = toEmit[i]->v4Value(m_system)));
if (isEmitFollowConnected())
- emitFollowParticles(QQmlV4Handle(array), d->v4Value());//A chance for many arbitrary JS changes
+ emitFollowParticles(QQmlV4Handle(array), d->v4Value(m_system));//A chance for many arbitrary JS changes
else if (isEmitConnected())
emitParticles(QQmlV4Handle(array));//A chance for arbitrary JS changes
}