aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles
diff options
context:
space:
mode:
Diffstat (limited to 'src/particles')
-rw-r--r--src/particles/CMakeLists.txt187
-rw-r--r--src/particles/particles.qrc22
-rw-r--r--src/particles/qquickage.cpp40
-rw-r--r--src/particles/qquickage_p.h44
-rw-r--r--src/particles/qquickangledirection.cpp40
-rw-r--r--src/particles/qquickangledirection_p.h45
-rw-r--r--src/particles/qquickcumulativedirection.cpp42
-rw-r--r--src/particles/qquickcumulativedirection_p.h45
-rw-r--r--src/particles/qquickcustomaffector.cpp86
-rw-r--r--src/particles/qquickcustomaffector_p.h46
-rw-r--r--src/particles/qquickdirection.cpp40
-rw-r--r--src/particles/qquickdirection_p.h46
-rw-r--r--src/particles/qquickellipseextruder.cpp40
-rw-r--r--src/particles/qquickellipseextruder_p.h44
-rw-r--r--src/particles/qquickfriction.cpp40
-rw-r--r--src/particles/qquickfriction_p.h44
-rw-r--r--src/particles/qquickgravity.cpp48
-rw-r--r--src/particles/qquickgravity_p.h44
-rw-r--r--src/particles/qquickgroupgoal.cpp40
-rw-r--r--src/particles/qquickgroupgoal_p.h44
-rw-r--r--src/particles/qquickimageparticle.cpp252
-rw-r--r--src/particles/qquickimageparticle_p.h50
-rw-r--r--src/particles/qquickitemparticle.cpp109
-rw-r--r--src/particles/qquickitemparticle_p.h54
-rw-r--r--src/particles/qquicklineextruder.cpp42
-rw-r--r--src/particles/qquicklineextruder_p.h44
-rw-r--r--src/particles/qquickmaskextruder.cpp46
-rw-r--r--src/particles/qquickmaskextruder_p.h46
-rw-r--r--src/particles/qquickparticleaffector.cpp72
-rw-r--r--src/particles/qquickparticleaffector_p.h48
-rw-r--r--src/particles/qquickparticleemitter.cpp98
-rw-r--r--src/particles/qquickparticleemitter_p.h46
-rw-r--r--src/particles/qquickparticleextruder.cpp40
-rw-r--r--src/particles/qquickparticleextruder_p.h46
-rw-r--r--src/particles/qquickparticleflatset_p.h156
-rw-r--r--src/particles/qquickparticlegroup.cpp42
-rw-r--r--src/particles/qquickparticlegroup_p.h45
-rw-r--r--src/particles/qquickparticlepainter.cpp54
-rw-r--r--src/particles/qquickparticlepainter_p.h44
-rw-r--r--src/particles/qquickparticlesmodule.cpp84
-rw-r--r--src/particles/qquickparticlesmodule_p.h66
-rw-r--r--src/particles/qquickparticlesystem.cpp279
-rw-r--r--src/particles/qquickparticlesystem_p.h155
-rw-r--r--src/particles/qquickpointattractor.cpp104
-rw-r--r--src/particles/qquickpointattractor_p.h44
-rw-r--r--src/particles/qquickpointdirection.cpp40
-rw-r--r--src/particles/qquickpointdirection_p.h44
-rw-r--r--src/particles/qquickrectangleextruder.cpp40
-rw-r--r--src/particles/qquickrectangleextruder_p.h44
-rw-r--r--src/particles/qquickspritegoal.cpp40
-rw-r--r--src/particles/qquickspritegoal_p.h44
-rw-r--r--src/particles/qquicktargetdirection.cpp40
-rw-r--r--src/particles/qquicktargetdirection_p.h44
-rw-r--r--src/particles/qquicktrailemitter.cpp86
-rw-r--r--src/particles/qquicktrailemitter_p.h48
-rw-r--r--src/particles/qquickturbulence.cpp42
-rw-r--r--src/particles/qquickturbulence_p.h48
-rw-r--r--src/particles/qquickv4particledata.cpp305
-rw-r--r--src/particles/qquickv4particledata_p.h147
-rw-r--r--src/particles/qquickwander.cpp40
-rw-r--r--src/particles/qquickwander_p.h44
-rw-r--r--src/particles/qtquickparticlesglobal_p.h55
-rwxr-xr-xsrc/particles/shaders_ng/compile.bat64
-rw-r--r--src/particles/shaders_ng/imageparticle.frag7
-rw-r--r--src/particles/shaders_ng/imageparticle.vert22
-rw-r--r--src/particles/shaders_ng/imageparticle_colored.frag.qsbbin1676 -> 0 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_colored.vert.qsbbin4026 -> 0 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_coloredpoint.frag.qsbbin1663 -> 0 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_coloredpoint.vert.qsbbin3526 -> 0 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_deformed.frag.qsbbin1689 -> 0 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_deformed.vert.qsbbin5389 -> 0 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_simplepoint.frag.qsbbin1655 -> 0 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_simplepoint.vert.qsbbin3474 -> 0 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_sprite.frag.qsbbin1988 -> 0 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_sprite.vert.qsbbin6028 -> 0 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_tabled.frag.qsbbin1875 -> 0 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_tabled.vert.qsbbin5694 -> 0 bytes
77 files changed, 938 insertions, 3399 deletions
diff --git a/src/particles/CMakeLists.txt b/src/particles/CMakeLists.txt
index 538e1e5bae..9746349d81 100644
--- a/src/particles/CMakeLists.txt
+++ b/src/particles/CMakeLists.txt
@@ -1,12 +1,18 @@
-# Generated from particles.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QuickParticles Module:
#####################################################################
-qt_internal_add_module(QuickParticles
+qt_internal_add_qml_module(QuickParticlesPrivate
+ URI "QtQuick.Particles"
+ VERSION "${PROJECT_VERSION}"
+ PLUGIN_TARGET particlesplugin
+ CLASS_NAME QtQuick2ParticlesPlugin
+ DEPENDENCIES
+ QtQuick/auto
INTERNAL_MODULE
- GENERATE_METATYPES
SOURCES
qquickage.cpp qquickage_p.h
qquickangledirection.cpp qquickangledirection_p.h
@@ -24,10 +30,8 @@ qt_internal_add_module(QuickParticles
qquickparticleaffector.cpp qquickparticleaffector_p.h
qquickparticleemitter.cpp qquickparticleemitter_p.h
qquickparticleextruder.cpp qquickparticleextruder_p.h
- qquickparticleflatset_p.h
qquickparticlegroup.cpp qquickparticlegroup_p.h
qquickparticlepainter.cpp qquickparticlepainter_p.h
- qquickparticlesmodule.cpp qquickparticlesmodule_p.h
qquickparticlesystem.cpp qquickparticlesystem_p.h
qquickpointattractor.cpp qquickpointattractor_p.h
qquickpointdirection.cpp qquickpointdirection_p.h
@@ -39,6 +43,18 @@ qt_internal_add_module(QuickParticles
qquickv4particledata.cpp qquickv4particledata_p.h
qquickwander.cpp qquickwander_p.h
qtquickparticlesglobal_p.h
+ NO_PCH_SOURCES
+ # these undef QT_NO_FOREACH
+ qquickcumulativedirection.cpp
+ qquickimageparticle.cpp
+ qquickitemparticle.cpp
+ qquickparticleaffector.cpp
+ qquickparticleemitter.cpp
+ qquickparticlegroup.cpp
+ qquickparticlepainter.cpp
+ qquicktrailemitter.cpp
+ qquickturbulence.cpp
+ # end undef QT_NO_FOREACH
DEFINES
QT_NO_INTEGER_EVENT_COORDINATES
QT_NO_URL_CAST_FROM_STRING
@@ -47,7 +63,8 @@ qt_internal_add_module(QuickParticles
Qt::GuiPrivate
Qt::QmlPrivate
Qt::QuickPrivate
-)
+ GENERATE_CPP_EXPORTS
+ )
# Resources:
set(particles_resource_files
@@ -57,46 +74,142 @@ set(particles_resource_files
"particleresources/star.png"
)
-qt_internal_add_resource(QuickParticles "particles"
+qt_internal_add_resource(QuickParticlesPrivate "particles"
PREFIX
"/"
FILES
${particles_resource_files}
)
-set(particles1_resource_files
- "shaders_ng/imageparticle_colored.frag.qsb"
- "shaders_ng/imageparticle_colored.vert.qsb"
- "shaders_ng/imageparticle_coloredpoint.frag.qsb"
- "shaders_ng/imageparticle_coloredpoint.vert.qsb"
- "shaders_ng/imageparticle_deformed.frag.qsb"
- "shaders_ng/imageparticle_deformed.vert.qsb"
- "shaders_ng/imageparticle_simplepoint.frag.qsb"
- "shaders_ng/imageparticle_simplepoint.vert.qsb"
- "shaders_ng/imageparticle_sprite.frag.qsb"
- "shaders_ng/imageparticle_sprite.vert.qsb"
- "shaders_ng/imageparticle_tabled.frag.qsb"
- "shaders_ng/imageparticle_tabled.vert.qsb"
+
+qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders1"
+ SILENT
+ BATCHABLE
+ PRECOMPILE
+ OPTIMIZED
+ MULTIVIEW
+ GLSL
+ "150,120,100es,300es"
+ PREFIX
+ "/particles"
+ FILES
+ "shaders_ng/imageparticle.vert"
+ "shaders_ng/imageparticle.frag"
+ OUTPUTS
+ "shaders_ng/imageparticle_simplepoint.vert.qsb"
+ "shaders_ng/imageparticle_simplepoint.frag.qsb"
+ DEFINES
+ POINT
+)
+
+qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders2"
+ SILENT
+ BATCHABLE
+ PRECOMPILE
+ OPTIMIZED
+ MULTIVIEW
+ GLSL
+ "150,120,100es,300es"
+ PREFIX
+ "/particles"
+ FILES
+ "shaders_ng/imageparticle.vert"
+ "shaders_ng/imageparticle.frag"
+ OUTPUTS
+ "shaders_ng/imageparticle_coloredpoint.vert.qsb"
+ "shaders_ng/imageparticle_coloredpoint.frag.qsb"
+ DEFINES
+ POINT
+ COLOR
)
-qt_internal_add_resource(QuickParticles "particles1"
+qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders3"
+ SILENT
+ BATCHABLE
+ PRECOMPILE
+ OPTIMIZED
+ MULTIVIEW
+ GLSL
+ "150,120,100es,300es"
PREFIX
"/particles"
FILES
- ${particles1_resource_files}
+ "shaders_ng/imageparticle.vert"
+ "shaders_ng/imageparticle.frag"
+ OUTPUTS
+ "shaders_ng/imageparticle_colored.vert.qsb"
+ "shaders_ng/imageparticle_colored.frag.qsb"
+ DEFINES
+ COLOR
)
+qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders4"
+ SILENT
+ BATCHABLE
+ PRECOMPILE
+ OPTIMIZED
+ GLSL
+ "150,120,100es,300es"
+ PREFIX
+ "/particles"
+ FILES
+ "shaders_ng/imageparticle.vert"
+ "shaders_ng/imageparticle.frag"
+ OUTPUTS
+ "shaders_ng/imageparticle_deformed.vert.qsb"
+ "shaders_ng/imageparticle_deformed.frag.qsb"
+ DEFINES
+ DEFORM
+ COLOR
+)
-#### Keys ignored in scope 1:.:.:particles.pro:<TRUE>:
-# MODULE = "quickparticles"
-# QMLTYPES_FILENAME = "plugins.qmltypes"
-# QMLTYPES_INSTALL_DIR = "$$[QT_INSTALL_QML]/QtQuick/Particles"
-# QML_IMPORT_NAME = "QtQuick.Particles"
-# QML_IMPORT_VERSION = "$$QT_VERSION"
+qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders5"
+ SILENT
+ BATCHABLE
+ PRECOMPILE
+ OPTIMIZED
+ MULTIVIEW
+ GLSL
+ "150,120,100es,300es"
+ PREFIX
+ "/particles"
+ FILES
+ "shaders_ng/imageparticle.vert"
+ "shaders_ng/imageparticle.frag"
+ OUTPUTS
+ "shaders_ng/imageparticle_tabled.vert.qsb"
+ "shaders_ng/imageparticle_tabled.frag.qsb"
+ DEFINES
+ TABLE
+ DEFORM
+ COLOR
+)
-## Scopes:
-#####################################################################
+qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders6"
+ SILENT
+ BATCHABLE
+ PRECOMPILE
+ OPTIMIZED
+ MULTIVIEW
+ GLSL
+ "150,120,100es,300es"
+ PREFIX
+ "/particles"
+ FILES
+ "shaders_ng/imageparticle.vert"
+ "shaders_ng/imageparticle.frag"
+ OUTPUTS
+ "shaders_ng/imageparticle_sprite.vert.qsb"
+ "shaders_ng/imageparticle_sprite.frag.qsb"
+ DEFINES
+ SPRITE
+ TABLE
+ DEFORM
+ COLOR
+ ZORDER_LOC
+ 8
+)
-qt_internal_extend_target(QuickParticles CONDITION MSVC
+qt_internal_extend_target(QuickParticlesPrivate CONDITION MSVC
DEFINES
_CRT_SECURE_NO_WARNINGS
)
@@ -104,7 +217,7 @@ qt_internal_extend_target(QuickParticles CONDITION MSVC
#### Keys ignored in scope 3:.:.:particles.pro:solaris-cc_x_:
# QMAKE_CXXFLAGS_RELEASE = "--O2"
-qt_internal_extend_target(QuickParticles CONDITION EXISTS "qqml_enable_gcov"
+qt_internal_extend_target(QuickParticlesPrivate CONDITION EXISTS "qqml_enable_gcov"
LIBRARIES
gcov
COMPILE_OPTIONS
@@ -112,13 +225,3 @@ qt_internal_extend_target(QuickParticles CONDITION EXISTS "qqml_enable_gcov"
-fprofile-arcs
-ftest-coverage
)
-
-set_target_properties(QuickParticles PROPERTIES
- QT_QML_MODULE_INSTALL_QMLTYPES TRUE
- QT_QML_MODULE_VERSION ${CMAKE_PROJECT_VERSION}
- QT_QML_MODULE_URI QtQuick.Particles
- QT_QMLTYPES_FILENAME plugins.qmltypes
- QT_QML_MODULE_INSTALL_DIR "${INSTALL_QMLDIR}/QtQuick/Particles"
-)
-
-qt6_qml_type_registration(QuickParticles)
diff --git a/src/particles/particles.qrc b/src/particles/particles.qrc
deleted file mode 100644
index a21d149447..0000000000
--- a/src/particles/particles.qrc
+++ /dev/null
@@ -1,22 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>particleresources/noise.png</file>
- <file>particleresources/fuzzydot.png</file>
- <file>particleresources/glowdot.png</file>
- <file>particleresources/star.png</file>
- </qresource>
- <qresource prefix="/particles">
- <file>shaders_ng/imageparticle_simplepoint.vert.qsb</file>
- <file>shaders_ng/imageparticle_simplepoint.frag.qsb</file>
- <file>shaders_ng/imageparticle_coloredpoint.vert.qsb</file>
- <file>shaders_ng/imageparticle_coloredpoint.frag.qsb</file>
- <file>shaders_ng/imageparticle_colored.vert.qsb</file>
- <file>shaders_ng/imageparticle_colored.frag.qsb</file>
- <file>shaders_ng/imageparticle_deformed.vert.qsb</file>
- <file>shaders_ng/imageparticle_deformed.frag.qsb</file>
- <file>shaders_ng/imageparticle_tabled.vert.qsb</file>
- <file>shaders_ng/imageparticle_tabled.frag.qsb</file>
- <file>shaders_ng/imageparticle_sprite.vert.qsb</file>
- <file>shaders_ng/imageparticle_sprite.frag.qsb</file>
- </qresource>
-</RCC>
diff --git a/src/particles/qquickage.cpp b/src/particles/qquickage.cpp
index e8f760b37c..07345dc2ec 100644
--- a/src/particles/qquickage.cpp
+++ b/src/particles/qquickage.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickage_p.h"
#include "qquickparticleemitter_p.h"
diff --git a/src/particles/qquickage_p.h b/src/particles/qquickage_p.h
index 1730c25c28..a465e04d53 100644
--- a/src/particles/qquickage_p.h
+++ b/src/particles/qquickage_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef KILLAFFECTOR_H
#define KILLAFFECTOR_H
@@ -54,7 +18,7 @@
QT_BEGIN_NAMESPACE
-class QQuickAgeAffector : public QQuickParticleAffector
+class Q_QUICKPARTICLES_EXPORT QQuickAgeAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(int lifeLeft READ lifeLeft WRITE setLifeLeft NOTIFY lifeLeftChanged)
@@ -63,7 +27,7 @@ class QQuickAgeAffector : public QQuickParticleAffector
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickAgeAffector(QQuickItem *parent = 0);
+ explicit QQuickAgeAffector(QQuickItem *parent = nullptr);
int lifeLeft() const
{
diff --git a/src/particles/qquickangledirection.cpp b/src/particles/qquickangledirection.cpp
index bc84865804..d514eee864 100644
--- a/src/particles/qquickangledirection.cpp
+++ b/src/particles/qquickangledirection.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickangledirection_p.h"
#include <QRandomGenerator>
diff --git a/src/particles/qquickangledirection_p.h b/src/particles/qquickangledirection_p.h
index 9ec9e49d1a..f22f78a5e4 100644
--- a/src/particles/qquickangledirection_p.h
+++ b/src/particles/qquickangledirection_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQuickANGLEDDIRECTION_H
#define QQuickANGLEDDIRECTION_H
@@ -51,11 +15,12 @@
// We mean it.
//
#include "qquickdirection_p.h"
+#include <QtQuickParticles/qtquickparticlesexports.h>
#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
-class QQuickAngleDirection : public QQuickDirection
+class Q_QUICKPARTICLES_EXPORT QQuickAngleDirection : public QQuickDirection
{
Q_OBJECT
Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
@@ -65,7 +30,7 @@ class QQuickAngleDirection : public QQuickDirection
QML_NAMED_ELEMENT(AngleDirection)
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickAngleDirection(QObject *parent = 0);
+ explicit QQuickAngleDirection(QObject *parent = nullptr);
QPointF sample(const QPointF &from) override;
qreal angle() const
{
diff --git a/src/particles/qquickcumulativedirection.cpp b/src/particles/qquickcumulativedirection.cpp
index e37435e960..a4577efbe4 100644
--- a/src/particles/qquickcumulativedirection.cpp
+++ b/src/particles/qquickcumulativedirection.cpp
@@ -1,41 +1,7 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qquickcumulativedirection_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/particles/qquickcumulativedirection_p.h b/src/particles/qquickcumulativedirection_p.h
index 0a54d5dd22..dd871d3db5 100644
--- a/src/particles/qquickcumulativedirection_p.h
+++ b/src/particles/qquickcumulativedirection_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQuickCUMULATIVEDIRECTION_P_H
#define QQuickCUMULATIVEDIRECTION_P_H
@@ -53,10 +17,11 @@
#include "qquickdirection_p.h"
#include <QQmlListProperty>
#include <QtQml/qqml.h>
+#include <QtQuickParticles/qtquickparticlesexports.h>
QT_BEGIN_NAMESPACE
-class QQuickCumulativeDirection : public QQuickDirection
+class Q_QUICKPARTICLES_EXPORT QQuickCumulativeDirection : public QQuickDirection
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<QQuickDirection> directions READ directions)
@@ -64,7 +29,7 @@ class QQuickCumulativeDirection : public QQuickDirection
QML_NAMED_ELEMENT(CumulativeDirection)
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickCumulativeDirection(QObject *parent = 0);
+ explicit QQuickCumulativeDirection(QObject *parent = nullptr);
QQmlListProperty<QQuickDirection> directions();
QPointF sample(const QPointF &from) override;
private:
diff --git a/src/particles/qquickcustomaffector.cpp b/src/particles/qquickcustomaffector.cpp
index c447ff440e..2ba7b4c536 100644
--- a/src/particles/qquickcustomaffector.cpp
+++ b/src/particles/qquickcustomaffector.cpp
@@ -1,62 +1,28 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickcustomaffector_p.h"
-#include <private/qqmlengine_p.h>
+
+#include <private/qquickv4particledata_p.h>
#include <private/qqmlglobal_p.h>
-#include <private/qjsvalue_p.h>
-#include <QQmlEngine>
-#include <QDebug>
+
+#include <QtCore/qdebug.h>
+
QT_BEGIN_NAMESPACE
//TODO: Move docs (and inheritence) to real base when docs can propagate. Currently this pretends to be the base class!
/*!
\qmlsignal QtQuick.Particles::Affector::affectParticles(Array particles, real dt)
- This signal is emitted when particles are selected to be affected. particles contains
- an array of particle objects which can be directly manipulated.
+ This signal is emitted when particles are selected to be affected.
+ \a particles is an array of particle objects which can be directly
+ manipulated.
- dt is the time since the last time it was affected. Use dt to normalize
- trajectory manipulations to real time.
+ \a dt is the time since the last time it was affected. Use \a dt to
+ normalize trajectory manipulations to real time.
- Note that JavaScript is slower to execute, so it is not recommended to use this in
- high-volume particle systems.
+ \note JavaScript is slower to execute, so it is not recommended to use
+ this in high-volume particle systems.
*/
/*!
@@ -101,7 +67,9 @@ QQuickCustomAffector::QQuickCustomAffector(QQuickItem *parent) :
bool QQuickCustomAffector::isAffectConnected()
{
- IS_SIGNAL_CONNECTED(this, QQuickCustomAffector, affectParticles, (const QJSValue &, qreal));
+ IS_SIGNAL_CONNECTED(
+ this, QQuickCustomAffector, affectParticles,
+ (const QList<QQuickV4ParticleData> &, qreal));
}
void QQuickCustomAffector::affectSystem(qreal dt)
@@ -120,7 +88,7 @@ void QQuickCustomAffector::affectSystem(qreal dt)
updateOffsets();
QList<QQuickParticleData*> toAffect;
- for (const QQuickParticleGroupData *gd : qAsConst(m_system->groupData)) {
+ for (const QQuickParticleGroupData *gd : std::as_const(m_system->groupData)) {
if (activeGroup(gd->index)) {
for (QQuickParticleData *d : gd->data) {
if (shouldAffect(d)) {
@@ -134,7 +102,7 @@ void QQuickCustomAffector::affectSystem(qreal dt)
return;
if (justAffected) {
- for (const QQuickParticleData *d : qAsConst(toAffect)) {//Not postAffect to avoid saying the particle changed
+ for (const QQuickParticleData *d : std::as_const(toAffect)) {//Not postAffect to avoid saying the particle changed
if (m_onceOff)
m_onceOffed << qMakePair(d->groupId, d->index);
emit affected(d->curX(m_system), d->curY(m_system));
@@ -145,19 +113,13 @@ void QQuickCustomAffector::affectSystem(qreal dt)
if (m_onceOff)
dt = 1.0;
- QQmlEngine *qmlEngine = ::qmlEngine(this);
- QV4::ExecutionEngine *v4 = qmlEngine->handle();
-
- QV4::Scope scope(v4);
- QV4::ScopedArrayObject array(scope, v4->newArrayObject(toAffect.size()));
- QV4::ScopedValue v(scope);
- for (int i=0; i<toAffect.size(); i++)
- array->put(i, (v = toAffect[i]->v4Value(m_system)));
+ QList<QQuickV4ParticleData> particles;
+ particles.reserve(toAffect.size());
+ for (QQuickParticleData *data: std::as_const(toAffect))
+ particles.push_back(data->v4Value(m_system));
const auto doAffect = [&](qreal dt) {
affectProperties(toAffect, dt);
- QJSValue particles;
- QJSValuePrivate::setValue(&particles, array);
emit affectParticles(particles, dt);
};
@@ -176,7 +138,7 @@ void QQuickCustomAffector::affectSystem(qreal dt)
doAffect(dt);
}
- for (QQuickParticleData *d : qAsConst(toAffect))
+ for (QQuickParticleData *d : std::as_const(toAffect))
if (d->update == 1.0)
postAffect(d);
}
diff --git a/src/particles/qquickcustomaffector_p.h b/src/particles/qquickcustomaffector_p.h
index 4506ae9d62..1280e2b4dd 100644
--- a/src/particles/qquickcustomaffector_p.h
+++ b/src/particles/qquickcustomaffector_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef CUSTOMAFFECTOR_H
#define CUSTOMAFFECTOR_H
@@ -60,7 +24,7 @@
QT_BEGIN_NAMESPACE
-class QQuickCustomAffector : public QQuickParticleAffector
+class Q_QUICKPARTICLES_EXPORT QQuickCustomAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(bool relative READ relative WRITE setRelative NOTIFY relativeChanged)
@@ -71,7 +35,7 @@ class QQuickCustomAffector : public QQuickParticleAffector
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickCustomAffector(QQuickItem *parent = 0);
+ explicit QQuickCustomAffector(QQuickItem *parent = nullptr);
void affectSystem(qreal dt) override;
QQuickDirection * position() const
@@ -111,7 +75,7 @@ public:
Q_SIGNALS:
- void affectParticles(const QJSValue &particles, qreal dt);
+ void affectParticles(const QList<QQuickV4ParticleData> &particles, qreal dt);
void positionChanged(QQuickDirection * arg);
diff --git a/src/particles/qquickdirection.cpp b/src/particles/qquickdirection.cpp
index 2688b560cb..6c79acb12c 100644
--- a/src/particles/qquickdirection.cpp
+++ b/src/particles/qquickdirection.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickdirection_p.h"
diff --git a/src/particles/qquickdirection_p.h b/src/particles/qquickdirection_p.h
index e671868ed2..0d78ca3c1a 100644
--- a/src/particles/qquickdirection_p.h
+++ b/src/particles/qquickdirection_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef VARYINGVECTOR_H
#define VARYINGVECTOR_H
@@ -54,10 +18,12 @@
#include <QObject>
#include <QPointF>
#include <QtQml/qqml.h>
+#include <QtCore/private/qglobal_p.h>
+#include <QtQuickParticles/qtquickparticlesexports.h>
QT_BEGIN_NAMESPACE
-class QQuickDirection : public QObject
+class Q_QUICKPARTICLES_EXPORT QQuickDirection : public QObject
{
Q_OBJECT
QML_NAMED_ELEMENT(NullVector)
@@ -65,7 +31,7 @@ class QQuickDirection : public QObject
QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.")
public:
- explicit QQuickDirection(QObject *parent = 0);
+ explicit QQuickDirection(QObject *parent = nullptr);
virtual QPointF sample(const QPointF &from);
Q_SIGNALS:
diff --git a/src/particles/qquickellipseextruder.cpp b/src/particles/qquickellipseextruder.cpp
index c7aa138ff0..857b4f937b 100644
--- a/src/particles/qquickellipseextruder.cpp
+++ b/src/particles/qquickellipseextruder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickellipseextruder_p.h"
#include <qmath.h>
diff --git a/src/particles/qquickellipseextruder_p.h b/src/particles/qquickellipseextruder_p.h
index 3268923480..f3b38e8bef 100644
--- a/src/particles/qquickellipseextruder_p.h
+++ b/src/particles/qquickellipseextruder_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ELLIPSEEXTRUDER_H
#define ELLIPSEEXTRUDER_H
@@ -54,14 +18,14 @@
QT_BEGIN_NAMESPACE
-class QQuickEllipseExtruder : public QQuickParticleExtruder
+class Q_QUICKPARTICLES_EXPORT QQuickEllipseExtruder : public QQuickParticleExtruder
{
Q_OBJECT
Q_PROPERTY(bool fill READ fill WRITE setFill NOTIFY fillChanged)//###Use base class? If it's still box
QML_NAMED_ELEMENT(EllipseShape)
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickEllipseExtruder(QObject *parent = 0);
+ explicit QQuickEllipseExtruder(QObject *parent = nullptr);
QPointF extrude(const QRectF &) override;
bool contains(const QRectF &bounds, const QPointF &point) override;
diff --git a/src/particles/qquickfriction.cpp b/src/particles/qquickfriction.cpp
index 0b46b94d10..6b791c525a 100644
--- a/src/particles/qquickfriction.cpp
+++ b/src/particles/qquickfriction.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickfriction_p.h"
#include <qmath.h>
diff --git a/src/particles/qquickfriction_p.h b/src/particles/qquickfriction_p.h
index 952f47b141..4d51888de8 100644
--- a/src/particles/qquickfriction_p.h
+++ b/src/particles/qquickfriction_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef FRICTIONAFFECTOR_H
#define FRICTIONAFFECTOR_H
@@ -54,7 +18,7 @@
QT_BEGIN_NAMESPACE
-class QQuickFrictionAffector : public QQuickParticleAffector
+class Q_QUICKPARTICLES_EXPORT QQuickFrictionAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(qreal factor READ factor WRITE setFactor NOTIFY factorChanged)
@@ -62,7 +26,7 @@ class QQuickFrictionAffector : public QQuickParticleAffector
QML_NAMED_ELEMENT(Friction)
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickFrictionAffector(QQuickItem *parent = 0);
+ explicit QQuickFrictionAffector(QQuickItem *parent = nullptr);
qreal factor() const
{
diff --git a/src/particles/qquickgravity.cpp b/src/particles/qquickgravity.cpp
index 6def43896d..155f727327 100644
--- a/src/particles/qquickgravity.cpp
+++ b/src/particles/qquickgravity.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtQml/qqmlinfo.h>
+#include <QtCore/QtMath>
#include "qquickgravity_p.h"
-#include <cmath>
QT_BEGIN_NAMESPACE
-const qreal CONV = 0.017453292520444443;
+
/*!
\qmltype Gravity
\instantiates QQuickGravityAffector
@@ -122,8 +86,8 @@ bool QQuickGravityAffector::affectParticle(QQuickParticleData *d, qreal dt)
return false;
if (m_needRecalc) {
m_needRecalc = false;
- m_dx = m_magnitude * std::cos(m_angle * CONV);
- m_dy = m_magnitude * std::sin(m_angle * CONV);
+ m_dx = m_magnitude * qCos(qDegreesToRadians(m_angle));
+ m_dy = m_magnitude * qSin(qDegreesToRadians(m_angle));
}
d->setInstantaneousVX(d->curVX(m_system) + m_dx*dt, m_system);
diff --git a/src/particles/qquickgravity_p.h b/src/particles/qquickgravity_p.h
index 351cbb93b1..81e0ebf9c9 100644
--- a/src/particles/qquickgravity_p.h
+++ b/src/particles/qquickgravity_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GRAVITYAFFECTOR_H
#define GRAVITYAFFECTOR_H
@@ -55,7 +19,7 @@
QT_BEGIN_NAMESPACE
-class QQuickGravityAffector : public QQuickParticleAffector
+class Q_QUICKPARTICLES_EXPORT QQuickGravityAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(qreal magnitude READ magnitude WRITE setMagnitude NOTIFY magnitudeChanged)
@@ -64,7 +28,7 @@ class QQuickGravityAffector : public QQuickParticleAffector
QML_NAMED_ELEMENT(Gravity)
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickGravityAffector(QQuickItem *parent = 0);
+ explicit QQuickGravityAffector(QQuickItem *parent = nullptr);
qreal magnitude() const;
qreal angle() const;
diff --git a/src/particles/qquickgroupgoal.cpp b/src/particles/qquickgroupgoal.cpp
index 85abf2ff31..7c8c4963e7 100644
--- a/src/particles/qquickgroupgoal.cpp
+++ b/src/particles/qquickgroupgoal.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickgroupgoal_p.h"
#include <private/qquickspriteengine_p.h>
diff --git a/src/particles/qquickgroupgoal_p.h b/src/particles/qquickgroupgoal_p.h
index 5589483aa6..dedf9a47fb 100644
--- a/src/particles/qquickgroupgoal_p.h
+++ b/src/particles/qquickgroupgoal_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GROUPGOALAFFECTOR_H
#define GROUPGOALAFFECTOR_H
@@ -56,7 +20,7 @@ QT_BEGIN_NAMESPACE
class QQuickStochasticEngine;
-class QQuickGroupGoalAffector : public QQuickParticleAffector
+class Q_QUICKPARTICLES_EXPORT QQuickGroupGoalAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(QString goalState READ goalState WRITE setGoalState NOTIFY goalStateChanged)
@@ -64,7 +28,7 @@ class QQuickGroupGoalAffector : public QQuickParticleAffector
QML_NAMED_ELEMENT(GroupGoal)
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickGroupGoalAffector(QQuickItem *parent = 0);
+ explicit QQuickGroupGoalAffector(QQuickItem *parent = nullptr);
QString goalState() const
{
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index 884edc3390..855726c20a 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -1,41 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include <QtQuick/private/qsgcontext_p.h>
#include <private/qsgadaptationlayer_p.h>
@@ -52,16 +18,16 @@
#include <QtQuick/private/qsgplaintexture_p.h>
#include <private/qqmlglobal_p.h>
#include <QtQml/qqmlinfo.h>
+#include <QtCore/QtMath>
+#include <rhi/qrhi.h>
+
#include <cmath>
-#include <QtGui/private/qrhi_p.h>
QT_BEGIN_NAMESPACE
// Must match the shader code
#define UNIFORM_ARRAY_SIZE 64
-const qreal CONV = 0.017453292519943295;
-
class ImageMaterialData
{
public:
@@ -88,41 +54,45 @@ class ImageMaterialData
class TabledMaterialRhiShader : public QSGMaterialShader
{
public:
- TabledMaterialRhiShader()
+ TabledMaterialRhiShader(int viewCount)
{
- setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_tabled.vert.qsb"));
- setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_tabled.frag.qsb"));
+ setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_tabled.vert.qsb"), viewCount);
+ setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_tabled.frag.qsb"), viewCount);
}
bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
+ const int shaderMatrixCount = newMaterial->viewCount();
+ const int matrixCount = qMin(renderState.projectionMatrixCount(), shaderMatrixCount);
- if (renderState.isMatrixDirty()) {
- const QMatrix4x4 m = renderState.combinedMatrix();
- memcpy(buf->data(), m.constData(), 64);
+ for (int viewIndex = 0; viewIndex < matrixCount; ++viewIndex) {
+ if (renderState.isMatrixDirty()) {
+ const QMatrix4x4 m = renderState.combinedMatrix(viewIndex);
+ memcpy(buf->data() + 64 * viewIndex, m.constData(), 64);
+ }
}
if (renderState.isOpacityDirty()) {
const float opacity = renderState.opacity();
- memcpy(buf->data() + 64, &opacity, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount, &opacity, 4);
}
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
float entry = float(state->entry);
- memcpy(buf->data() + 68, &entry, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 4, &entry, 4);
float timestamp = float(state->timestamp);
- memcpy(buf->data() + 72, &timestamp, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 8, &timestamp, 4);
- float *p = reinterpret_cast<float *>(buf->data() + 80);
+ float *p = reinterpret_cast<float *>(buf->data() + 64 * shaderMatrixCount + 16);
for (int i = 0; i < UNIFORM_ARRAY_SIZE; ++i) {
*p = state->sizeTable[i];
p += 4;
}
- p = reinterpret_cast<float *>(buf->data() + 80 + (UNIFORM_ARRAY_SIZE * 4 * 4));
+ p = reinterpret_cast<float *>(buf->data() + 64 * shaderMatrixCount + 16 + (UNIFORM_ARRAY_SIZE * 4 * 4));
for (int i = 0; i < UNIFORM_ARRAY_SIZE; ++i) {
*p = state->opacityTable[i];
p += 4;
@@ -150,7 +120,7 @@ class TabledMaterial : public ImageMaterial
public:
QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override {
Q_UNUSED(renderMode);
- return new TabledMaterialRhiShader;
+ return new TabledMaterialRhiShader(viewCount());
}
QSGMaterialType *type() const override { return &m_type; }
@@ -166,34 +136,38 @@ QSGMaterialType TabledMaterial::m_type;
class DeformableMaterialRhiShader : public QSGMaterialShader
{
public:
- DeformableMaterialRhiShader()
+ DeformableMaterialRhiShader(int viewCount)
{
- setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_deformed.vert.qsb"));
- setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_deformed.frag.qsb"));
+ setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_deformed.vert.qsb"), viewCount);
+ setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_deformed.frag.qsb"), viewCount);
}
bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
+ const int shaderMatrixCount = newMaterial->viewCount();
+ const int matrixCount = qMin(renderState.projectionMatrixCount(), shaderMatrixCount);
- if (renderState.isMatrixDirty()) {
- const QMatrix4x4 m = renderState.combinedMatrix();
- memcpy(buf->data(), m.constData(), 64);
+ for (int viewIndex = 0; viewIndex < matrixCount; ++viewIndex) {
+ if (renderState.isMatrixDirty()) {
+ const QMatrix4x4 m = renderState.combinedMatrix(viewIndex);
+ memcpy(buf->data() + 64 * viewIndex, m.constData(), 64);
+ }
}
if (renderState.isOpacityDirty()) {
const float opacity = renderState.opacity();
- memcpy(buf->data() + 64, &opacity, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount, &opacity, 4);
}
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
float entry = float(state->entry);
- memcpy(buf->data() + 68, &entry, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 4, &entry, 4);
float timestamp = float(state->timestamp);
- memcpy(buf->data() + 72, &timestamp, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 8, &timestamp, 4);
return true;
}
@@ -214,7 +188,7 @@ class DeformableMaterial : public ImageMaterial
public:
QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override {
Q_UNUSED(renderMode);
- return new DeformableMaterialRhiShader;
+ return new DeformableMaterialRhiShader(viewCount());
}
QSGMaterialType *type() const override { return &m_type; }
@@ -230,41 +204,45 @@ QSGMaterialType DeformableMaterial::m_type;
class ParticleSpriteMaterialRhiShader : public QSGMaterialShader
{
public:
- ParticleSpriteMaterialRhiShader()
+ ParticleSpriteMaterialRhiShader(int viewCount)
{
- setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_sprite.vert.qsb"));
- setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_sprite.frag.qsb"));
+ setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_sprite.vert.qsb"), viewCount);
+ setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_sprite.frag.qsb"), viewCount);
}
bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
+ const int shaderMatrixCount = newMaterial->viewCount();
+ const int matrixCount = qMin(renderState.projectionMatrixCount(), shaderMatrixCount);
- if (renderState.isMatrixDirty()) {
- const QMatrix4x4 m = renderState.combinedMatrix();
- memcpy(buf->data(), m.constData(), 64);
+ for (int viewIndex = 0; viewIndex < matrixCount; ++viewIndex) {
+ if (renderState.isMatrixDirty()) {
+ const QMatrix4x4 m = renderState.combinedMatrix(viewIndex);
+ memcpy(buf->data() + 64 * viewIndex, m.constData(), 64);
+ }
}
if (renderState.isOpacityDirty()) {
const float opacity = renderState.opacity();
- memcpy(buf->data() + 64, &opacity, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount, &opacity, 4);
}
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
float entry = float(state->entry);
- memcpy(buf->data() + 68, &entry, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 4, &entry, 4);
float timestamp = float(state->timestamp);
- memcpy(buf->data() + 72, &timestamp, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 8, &timestamp, 4);
- float *p = reinterpret_cast<float *>(buf->data() + 80);
+ float *p = reinterpret_cast<float *>(buf->data() + 64 * shaderMatrixCount + 16);
for (int i = 0; i < UNIFORM_ARRAY_SIZE; ++i) {
*p = state->sizeTable[i];
p += 4;
}
- p = reinterpret_cast<float *>(buf->data() + 80 + (UNIFORM_ARRAY_SIZE * 4 * 4));
+ p = reinterpret_cast<float *>(buf->data() + 64 * shaderMatrixCount + 16 + (UNIFORM_ARRAY_SIZE * 4 * 4));
for (int i = 0; i < UNIFORM_ARRAY_SIZE; ++i) {
*p = state->opacityTable[i];
p += 4;
@@ -292,7 +270,7 @@ class SpriteMaterial : public ImageMaterial
public:
QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override {
Q_UNUSED(renderMode);
- return new ParticleSpriteMaterialRhiShader;
+ return new ParticleSpriteMaterialRhiShader(viewCount());
}
QSGMaterialType *type() const override { return &m_type; }
@@ -308,37 +286,41 @@ QSGMaterialType SpriteMaterial::m_type;
class ColoredPointMaterialRhiShader : public QSGMaterialShader
{
public:
- ColoredPointMaterialRhiShader()
+ ColoredPointMaterialRhiShader(int viewCount)
{
- setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_coloredpoint.vert.qsb"));
- setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_coloredpoint.frag.qsb"));
+ setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_coloredpoint.vert.qsb"), viewCount);
+ setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_coloredpoint.frag.qsb"), viewCount);
}
bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
+ const int shaderMatrixCount = newMaterial->viewCount();
+ const int matrixCount = qMin(renderState.projectionMatrixCount(), shaderMatrixCount);
- if (renderState.isMatrixDirty()) {
- const QMatrix4x4 m = renderState.combinedMatrix();
- memcpy(buf->data(), m.constData(), 64);
+ for (int viewIndex = 0; viewIndex < matrixCount; ++viewIndex) {
+ if (renderState.isMatrixDirty()) {
+ const QMatrix4x4 m = renderState.combinedMatrix(viewIndex);
+ memcpy(buf->data() + 64 * viewIndex, m.constData(), 64);
+ }
}
if (renderState.isOpacityDirty()) {
const float opacity = renderState.opacity();
- memcpy(buf->data() + 64, &opacity, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount, &opacity, 4);
}
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
float entry = float(state->entry);
- memcpy(buf->data() + 68, &entry, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 4, &entry, 4);
float timestamp = float(state->timestamp);
- memcpy(buf->data() + 72, &timestamp, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 8, &timestamp, 4);
float dpr = float(state->dpr);
- memcpy(buf->data() + 76, &dpr, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 12, &dpr, 4);
return true;
}
@@ -359,7 +341,7 @@ class ColoredPointMaterial : public ImageMaterial
public:
QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override {
Q_UNUSED(renderMode);
- return new ColoredPointMaterialRhiShader;
+ return new ColoredPointMaterialRhiShader(viewCount());
}
QSGMaterialType *type() const override { return &m_type; }
@@ -375,10 +357,11 @@ QSGMaterialType ColoredPointMaterial::m_type;
class ColoredMaterialRhiShader : public ColoredPointMaterialRhiShader
{
public:
- ColoredMaterialRhiShader()
+ ColoredMaterialRhiShader(int viewCount)
+ : ColoredPointMaterialRhiShader(viewCount)
{
- setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_colored.vert.qsb"));
- setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_colored.frag.qsb"));
+ setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_colored.vert.qsb"), viewCount);
+ setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_colored.frag.qsb"), viewCount);
}
};
@@ -387,7 +370,7 @@ class ColoredMaterial : public ImageMaterial
public:
QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override {
Q_UNUSED(renderMode);
- return new ColoredMaterialRhiShader;
+ return new ColoredMaterialRhiShader(viewCount());
}
QSGMaterialType *type() const override { return &m_type; }
@@ -403,37 +386,41 @@ QSGMaterialType ColoredMaterial::m_type;
class SimplePointMaterialRhiShader : public QSGMaterialShader
{
public:
- SimplePointMaterialRhiShader()
+ SimplePointMaterialRhiShader(int viewCount)
{
- setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_simplepoint.vert.qsb"));
- setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_simplepoint.frag.qsb"));
+ setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_simplepoint.vert.qsb"), viewCount);
+ setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_simplepoint.frag.qsb"), viewCount);
}
bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
+ const int shaderMatrixCount = newMaterial->viewCount();
+ const int matrixCount = qMin(renderState.projectionMatrixCount(), shaderMatrixCount);
- if (renderState.isMatrixDirty()) {
- const QMatrix4x4 m = renderState.combinedMatrix();
- memcpy(buf->data(), m.constData(), 64);
+ for (int viewIndex = 0; viewIndex < matrixCount; ++viewIndex) {
+ if (renderState.isMatrixDirty()) {
+ const QMatrix4x4 m = renderState.combinedMatrix(viewIndex);
+ memcpy(buf->data() + 64 * viewIndex, m.constData(), 64);
+ }
}
if (renderState.isOpacityDirty()) {
const float opacity = renderState.opacity();
- memcpy(buf->data() + 64, &opacity, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount, &opacity, 4);
}
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
float entry = float(state->entry);
- memcpy(buf->data() + 68, &entry, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 4, &entry, 4);
float timestamp = float(state->timestamp);
- memcpy(buf->data() + 72, &timestamp, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 8, &timestamp, 4);
float dpr = float(state->dpr);
- memcpy(buf->data() + 76, &dpr, 4);
+ memcpy(buf->data() + 64 * shaderMatrixCount + 12, &dpr, 4);
return true;
}
@@ -454,7 +441,7 @@ class SimplePointMaterial : public ImageMaterial
public:
QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override {
Q_UNUSED(renderMode);
- return new SimplePointMaterialRhiShader;
+ return new SimplePointMaterialRhiShader(viewCount());
}
QSGMaterialType *type() const override { return &m_type; }
@@ -687,13 +674,12 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size)
For fine-grained control, see sizeTable and opacityTable.
Acceptable values are
- \list
- \li ImageParticle.None: Particles just appear and disappear.
- \li ImageParticle.Fade: Particles fade in from 0 opacity at the start of their life, and fade out to 0 at the end.
- \li ImageParticle.Scale: Particles scale in from 0 size at the start of their life, and scale back to 0 at the end.
- \endlist
- Default value is Fade.
+ \value ImageParticle.None Particles just appear and disappear.
+ \value ImageParticle.Fade Particles fade in from 0 opacity at the start of their life, and fade out to 0 at the end.
+ \value ImageParticle.Scale Particles scale in from 0 size at the start of their life, and scale back to 0 at the end.
+
+ The default value is \c ImageParticle.Fade.
*/
/*!
\qmlproperty bool QtQuick.Particles::ImageParticle::spritesInterpolate
@@ -766,6 +752,7 @@ void QQuickImageParticle::sceneGraphInvalidated()
m_material = nullptr;
delete m_outgoingNode;
m_outgoingNode = nullptr;
+ m_apiChecked = false;
}
void QQuickImageParticle::setImage(const QUrl &image)
@@ -1017,7 +1004,7 @@ void QQuickImageParticle::resetColor()
{
m_explicitColor = false;
for (auto groupId : groupIds()) {
- for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) {
+ for (QQuickParticleData* d : std::as_const(m_system->groupData[groupId]->data)) {
if (d->colorOwner == this) {
d->colorOwner = nullptr;
}
@@ -1036,7 +1023,7 @@ void QQuickImageParticle::resetRotation()
{
m_explicitRotation = false;
for (auto groupId : groupIds()) {
- for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) {
+ for (QQuickParticleData* d : std::as_const(m_system->groupData[groupId]->data)) {
if (d->rotationOwner == this) {
d->rotationOwner = nullptr;
}
@@ -1053,7 +1040,7 @@ void QQuickImageParticle::resetDeformation()
{
m_explicitDeformation = false;
for (auto groupId : groupIds()) {
- for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) {
+ for (QQuickParticleData* d : std::as_const(m_system->groupData[groupId]->data)) {
if (d->deformationOwner == this) {
d->deformationOwner = nullptr;
}
@@ -1074,14 +1061,20 @@ void QQuickImageParticle::reset()
update();
}
+
+void QQuickImageParticle::invalidateSceneGraph()
+{
+ reset();
+}
+
void QQuickImageParticle::createEngine()
{
if (m_spriteEngine)
delete m_spriteEngine;
- if (m_sprites.count()) {
+ if (m_sprites.size()) {
m_spriteEngine = new QQuickSpriteEngine(m_sprites, this);
- connect(m_spriteEngine, SIGNAL(stateChanged(int)),
- this, SLOT(spriteAdvance(int)), Qt::DirectConnection);
+ connect(m_spriteEngine, &QQuickStochasticEngine::stateChanged,
+ this, &QQuickImageParticle::spriteAdvance, Qt::DirectConnection);
m_explicitAnimation = true;
} else {
m_spriteEngine = nullptr;
@@ -1280,7 +1273,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
m_debugMode = m_system->m_debugMode;
- if (m_sprites.count() || m_bypassOptimizations) {
+ if (m_sprites.size() || m_bypassOptimizations) {
perfLevel = Sprites;
} else if (m_colorTable || m_sizeTable || m_opacityTable) {
perfLevel = Tabled;
@@ -1297,7 +1290,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
for (auto groupId : groupIds()) {
//For sharing higher levels, need to have highest used so it renders
- for (QQuickParticlePainter* p : qAsConst(m_system->groupData[groupId]->painters)) {
+ for (QQuickParticlePainter* p : std::as_const(m_system->groupData[groupId]->painters)) {
QQuickImageParticle* other = qobject_cast<QQuickImageParticle*>(p);
if (other){
if (other->perfLevel > perfLevel) {
@@ -1652,7 +1645,7 @@ void QQuickImageParticle::spritesUpdate(qreal time)
ImageMaterialData *state = getState(m_material);
// Sprite progression handled CPU side, so as to have per-frame control.
for (auto groupId : groupIds()) {
- for (QQuickParticleData* mainDatum : qAsConst(m_system->groupData[groupId]->data)) {
+ for (QQuickParticleData* mainDatum : std::as_const(m_system->groupData[groupId]->data)) {
QSGGeometryNode *node = m_nodes[groupId];
if (!node)
continue;
@@ -1660,7 +1653,7 @@ void QQuickImageParticle::spritesUpdate(qreal time)
// This is particularly important for cut-up sprites.
QQuickParticleData* datum = (mainDatum->animationOwner == this ? mainDatum : getShadowDatum(mainDatum));
int spriteIdx = 0;
- for (int i = 0; i<m_startsIdx.count(); i++) {
+ for (int i = 0; i<m_startsIdx.size(); i++) {
if (m_startsIdx[i].second == groupId){
spriteIdx = m_startsIdx[i].first + datum->index;
break;
@@ -1713,12 +1706,12 @@ void QQuickImageParticle::spritesUpdate(qreal time)
void QQuickImageParticle::spriteAdvance(int spriteIdx)
{
- if (!m_startsIdx.count())//Probably overly defensive
+ if (!m_startsIdx.size())//Probably overly defensive
return;
int gIdx = -1;
int i;
- for (i = 0; i<m_startsIdx.count(); i++) {
+ for (i = 0; i<m_startsIdx.size(); i++) {
if (spriteIdx < m_startsIdx[i].first) {
gIdx = m_startsIdx[i-1].second;
break;
@@ -1825,10 +1818,13 @@ void QQuickImageParticle::initialize(int gIdx, int pIdx)
if (m_explicitRotation){
if (!datum->rotationOwner)
datum->rotationOwner = this;
- rotation =
- (m_rotation + (m_rotationVariation - 2*QRandomGenerator::global()->bounded(m_rotationVariation)) ) * CONV;
- rotationVelocity =
- (m_rotationVelocity + (m_rotationVelocityVariation - 2*QRandomGenerator::global()->bounded(m_rotationVelocityVariation)) ) * CONV;
+ rotation = qDegreesToRadians(
+ m_rotation + (m_rotationVariation
+ - 2 * QRandomGenerator::global()->bounded(m_rotationVariation)));
+ rotationVelocity = qDegreesToRadians(
+ m_rotationVelocity
+ + (m_rotationVelocityVariation
+ - 2 * QRandomGenerator::global()->bounded(m_rotationVelocityVariation)));
autoRotate = m_autoRotation ? 1 : 0;
if (datum->rotationOwner == this) {
datum->rotation = rotation;
@@ -1850,15 +1846,17 @@ void QQuickImageParticle::initialize(int gIdx, int pIdx)
if (m_explicitColor) {
if (!datum->colorOwner)
datum->colorOwner = this;
- color.r = m_color.red() * (1 - redVariation) + QRandomGenerator::global()->bounded(256) * redVariation;
- color.g = m_color.green() * (1 - greenVariation) + QRandomGenerator::global()->bounded(256) * greenVariation;
- color.b = m_color.blue() * (1 - blueVariation) + QRandomGenerator::global()->bounded(256) * blueVariation;
- color.a = m_alpha * m_color.alpha() * (1 - m_alphaVariation) + QRandomGenerator::global()->bounded(256) * m_alphaVariation;
+ const auto rgbColor = m_color.toRgb();
+ color.r = rgbColor.red() * (1 - redVariation) + QRandomGenerator::global()->bounded(256) * redVariation;
+ color.g = rgbColor.green() * (1 - greenVariation) + QRandomGenerator::global()->bounded(256) * greenVariation;
+ color.b = rgbColor.blue() * (1 - blueVariation) + QRandomGenerator::global()->bounded(256) * blueVariation;
+ color.a = m_alpha * rgbColor.alpha() * (1 - m_alphaVariation) + QRandomGenerator::global()->bounded(256) * m_alphaVariation;
if (datum->colorOwner == this)
datum->color = color;
else
getShadowDatum(datum)->color = color;
}
+ break;
default:
break;
}
diff --git a/src/particles/qquickimageparticle_p.h b/src/particles/qquickimageparticle_p.h
index 19000f6c9b..f0bfb8a1d6 100644
--- a/src/particles/qquickimageparticle_p.h
+++ b/src/particles/qquickimageparticle_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKIMAGEPARTICLE_P_H
#define QQUICKIMAGEPARTICLE_P_H
@@ -53,7 +17,7 @@
#include "qquickparticlepainter_p.h"
#include "qquickdirection_p.h"
-#include <private/qquickpixmapcache_p.h>
+#include <private/qquickpixmap_p.h>
#include <QQmlListProperty>
#include <QtGui/qcolor.h>
#include <QtQuick/qsgmaterial.h>
@@ -182,7 +146,7 @@ public:
virtual ImageMaterialData *state() = 0;
};
-class QQuickImageParticle : public QQuickParticlePainter
+class Q_QUICKPARTICLES_EXPORT QQuickImageParticle : public QQuickParticlePainter
{
Q_OBJECT
Q_PROPERTY(QUrl source READ image WRITE setImage NOTIFY imageChanged)
@@ -224,7 +188,7 @@ class QQuickImageParticle : public QQuickParticlePainter
QML_NAMED_ELEMENT(ImageParticle)
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickImageParticle(QQuickItem *parent = 0);
+ explicit QQuickImageParticle(QQuickItem *parent = nullptr);
virtual ~QQuickImageParticle();
enum Status { Null, Ready, Loading, Error };
@@ -394,7 +358,8 @@ private Q_SLOTS:
void spriteAdvance(int spriteIndex);
void spritesUpdate(qreal time = 0 );
void mainThreadFetchImageData();
- void finishBuildParticleNodes(QSGNode **n);
+ void invalidateSceneGraph();
+
private:
struct ImageData {
QUrl source;
@@ -406,6 +371,7 @@ private:
QScopedPointer<ImageData> m_opacityTable;
bool loadingSomething();
+ void finishBuildParticleNodes(QSGNode **n);
QColor m_color;
qreal m_color_variation;
diff --git a/src/particles/qquickitemparticle.cpp b/src/particles/qquickitemparticle.cpp
index 60d368a2a3..f2cd08ab5d 100644
--- a/src/particles/qquickitemparticle.cpp
+++ b/src/particles/qquickitemparticle.cpp
@@ -1,41 +1,7 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qquickitemparticle_p.h"
#include <QtQuick/qsgnode.h>
@@ -130,7 +96,11 @@ QQuickItemParticle::QQuickItemParticle(QQuickItem *parent) :
{
setFlag(QQuickItem::ItemHasContents);
clock = new Clock(this);
- clock->start();
+ connect(this, &QQuickItemParticle::systemChanged, this, &QQuickItemParticle::reconnectSystem);
+ connect(this, &QQuickItemParticle::parentChanged, this, &QQuickItemParticle::reconnectParent);
+ connect(this, &QQuickItemParticle::enabledChanged, this, &QQuickItemParticle::updateClock);
+ reconnectSystem(m_system);
+ reconnectParent(parent);
}
QQuickItemParticle::~QQuickItemParticle()
@@ -161,7 +131,7 @@ void QQuickItemParticle::take(QQuickItem *item, bool prioritize)
void QQuickItemParticle::give(QQuickItem *item)
{
for (auto groupId : groupIds()) {
- for (QQuickParticleData* data : qAsConst(m_system->groupData[groupId]->data)) {
+ for (QQuickParticleData* data : std::as_const(m_system->groupData[groupId]->data)) {
if (data->delegate == item){
m_deletables << item;
data->delegate = nullptr;
@@ -209,7 +179,7 @@ void QQuickItemParticle::tick(int time)
Q_UNUSED(time);//only needed because QTickAnimationProxy expects one
processDeletables();
for (auto groupId : groupIds()) {
- for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) {
+ for (QQuickParticleData* d : std::as_const(m_system->groupData[groupId]->data)) {
if (!d->delegate && d->t != -1 && d->stillAlive(m_system)) {
QQuickItem* parentItem = nullptr;
if (!m_pendingItems.isEmpty()){
@@ -250,7 +220,7 @@ void QQuickItemParticle::reset()
// but leave it alone if the logical particle is maintained
QSet<QQuickItem*> lost = QSet<QQuickItem*>(m_managed.cbegin(), m_managed.cend());
for (auto groupId : groupIds()) {
- for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) {
+ for (QQuickParticleData* d : std::as_const(m_system->groupData[groupId]->data)) {
lost.remove(d->delegate);
}
}
@@ -266,9 +236,10 @@ QSGNode* QQuickItemParticle::updatePaintNode(QSGNode* n, UpdatePaintNodeData* d)
if (m_pleaseReset)
m_pleaseReset = false;
- prepareNextFrame();
-
- update();//Get called again
+ if (clockShouldUpdate()) {
+ prepareNextFrame();
+ update(); //Get called again
+ }
if (n)
n->markDirty(QSGNode::DirtyMaterial);
return QQuickItem::updatePaintNode(n,d);
@@ -287,7 +258,7 @@ void QQuickItemParticle::prepareNextFrame()
//TODO: Size, better fade?
for (auto groupId : groupIds()) {
- for (QQuickParticleData* data : qAsConst(m_system->groupData[groupId]->data)) {
+ for (QQuickParticleData* data : std::as_const(m_system->groupData[groupId]->data)) {
QQuickItem* item = data->delegate;
if (!item)
continue;
@@ -321,6 +292,52 @@ QQuickItemParticleAttached *QQuickItemParticle::qmlAttachedProperties(QObject *o
return new QQuickItemParticleAttached(object);
}
+bool QQuickItemParticle::clockShouldUpdate() const
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ return (m_system && m_system->isRunning() && !m_system->isPaused() && m_system->isEnabled()
+ && ((parentItem && parentItem->isEnabled()) || !parentItem) && isEnabled());
+}
+
+void QQuickItemParticle::reconnectParent(QQuickItem *parentItem)
+{
+ updateClock();
+ disconnect(m_parentEnabledStateConnection);
+ if (parentItem) {
+ m_parentEnabledStateConnection = connect(parentItem, &QQuickParticleSystem::enabledChanged,
+ this, &QQuickItemParticle::updateClock);
+ }
+}
+
+void QQuickItemParticle::reconnectSystem(QQuickParticleSystem *system)
+{
+ updateClock();
+ disconnect(m_systemRunStateConnection);
+ disconnect(m_systemPauseStateConnection);
+ disconnect(m_systemEnabledStateConnection);
+ if (system) {
+ m_systemRunStateConnection = connect(m_system, &QQuickParticleSystem::runningChanged, this, [this](){
+ QQuickItemParticle::updateClock();
+ });
+ m_systemPauseStateConnection = connect(m_system, &QQuickParticleSystem::pausedChanged, this, [this](){
+ QQuickItemParticle::updateClock();
+ });
+ m_systemEnabledStateConnection = connect(m_system, &QQuickParticleSystem::enabledChanged, this,
+ &QQuickItemParticle::updateClock);
+ }
+}
+
+void QQuickItemParticle::updateClock()
+{
+ if (clockShouldUpdate()) {
+ if (!clock->isRunning())
+ clock->start();
+ } else {
+ if (clock->isRunning())
+ clock->pause();
+ }
+}
+
QT_END_NAMESPACE
#include "moc_qquickitemparticle_p.cpp"
diff --git a/src/particles/qquickitemparticle_p.h b/src/particles/qquickitemparticle_p.h
index 4fe5f9c031..4f8d81a8df 100644
--- a/src/particles/qquickitemparticle_p.h
+++ b/src/particles/qquickitemparticle_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ITEMPARTICLE_H
#define ITEMPARTICLE_H
@@ -58,7 +22,7 @@ QT_BEGIN_NAMESPACE
class QQuickItemParticleAttached;
-class QQuickItemParticle : public QQuickParticlePainter
+class Q_QUICKPARTICLES_EXPORT QQuickItemParticle : public QQuickParticlePainter
{
Q_OBJECT
Q_PROPERTY(bool fade READ fade WRITE setFade NOTIFY fadeChanged)
@@ -67,7 +31,7 @@ class QQuickItemParticle : public QQuickParticlePainter
QML_ADDED_IN_VERSION(2, 0)
QML_ATTACHED(QQuickItemParticleAttached)
public:
- explicit QQuickItemParticle(QQuickItem *parent = 0);
+ explicit QQuickItemParticle(QQuickItem *parent = nullptr);
~QQuickItemParticle();
bool fade() const { return m_fade; }
@@ -107,6 +71,10 @@ protected:
void initialize(int gIdx, int pIdx) override;
void prepareNextFrame();
private:
+ bool clockShouldUpdate() const;
+ void updateClock();
+ void reconnectSystem(QQuickParticleSystem *system);
+ void reconnectParent(QQuickItem *parent);
void processDeletables();
void tick(int time = 0);
QSet<QQuickItem* > m_deletables;
@@ -121,12 +89,16 @@ private:
typedef QTickAnimationProxy<QQuickItemParticle, &QQuickItemParticle::tick> Clock;
Clock *clock;
+ QMetaObject::Connection m_systemRunStateConnection;
+ QMetaObject::Connection m_systemPauseStateConnection;
+ QMetaObject::Connection m_systemEnabledStateConnection;
+ QMetaObject::Connection m_parentEnabledStateConnection;
};
class QQuickItemParticleAttached : public QObject
{
Q_OBJECT
- Q_PROPERTY(QQuickItemParticle* particle READ particle CONSTANT);
+ Q_PROPERTY(QQuickItemParticle* particle READ particle CONSTANT FINAL);
public:
QQuickItemParticleAttached(QObject* parent)
: QObject(parent), m_mp(0), m_parentItem(nullptr)
diff --git a/src/particles/qquicklineextruder.cpp b/src/particles/qquicklineextruder.cpp
index 0fdba02734..5a95eceb71 100644
--- a/src/particles/qquicklineextruder.cpp
+++ b/src/particles/qquicklineextruder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquicklineextruder_p.h"
#include <QRandomGenerator>
#include <cmath>
@@ -44,7 +8,7 @@
\qmltype LineShape
\instantiates QQuickLineExtruder
\inqmlmodule QtQuick.Particles
- \inherits Shape
+ \inherits ParticleExtruder
\brief Represents a line for affectors and emitters.
\ingroup qtquick-particles
diff --git a/src/particles/qquicklineextruder_p.h b/src/particles/qquicklineextruder_p.h
index a337324c6a..c815e429b9 100644
--- a/src/particles/qquicklineextruder_p.h
+++ b/src/particles/qquicklineextruder_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef LINEEXTRUDER_H
#define LINEEXTRUDER_H
@@ -52,7 +16,7 @@
//
#include "qquickparticleextruder_p.h"
-class QQuickLineExtruder : public QQuickParticleExtruder
+class Q_QUICKPARTICLES_EXPORT QQuickLineExtruder : public QQuickParticleExtruder
{
Q_OBJECT
//Default is topleft to bottom right. Flipped makes it topright to bottom left
@@ -61,7 +25,7 @@ class QQuickLineExtruder : public QQuickParticleExtruder
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickLineExtruder(QObject *parent = 0);
+ explicit QQuickLineExtruder(QObject *parent = nullptr);
QPointF extrude(const QRectF &) override;
bool mirrored() const
{
diff --git a/src/particles/qquickmaskextruder.cpp b/src/particles/qquickmaskextruder.cpp
index f1726a51d4..51d8798ac8 100644
--- a/src/particles/qquickmaskextruder.cpp
+++ b/src/particles/qquickmaskextruder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickmaskextruder_p.h"
#include <QtQml/qqml.h>
@@ -105,9 +69,9 @@ void QQuickMaskExtruder::finishMaskLoading()
QPointF QQuickMaskExtruder::extrude(const QRectF &r)
{
ensureInitialized(r);
- if (!m_mask.count() || m_img.isNull())
+ if (!m_mask.size() || m_img.isNull())
return r.topLeft();
- const QPointF p = m_mask[QRandomGenerator::global()->bounded(int(m_mask.count()))];
+ const QPointF p = m_mask[QRandomGenerator::global()->bounded(m_mask.size())];
//### Should random sub-pixel positioning be added?
return p + r.topLeft();
}
@@ -142,7 +106,7 @@ void QQuickMaskExtruder::ensureInitialized(const QRectF &rf)
// Image will in all likelyhood be in this format already, so
// no extra memory or conversion takes place
if (m_img.format() != QImage::Format_ARGB32 && m_img.format() != QImage::Format_ARGB32_Premultiplied)
- m_img = m_img.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ m_img = std::move(m_img).convertToFormat(QImage::Format_ARGB32_Premultiplied);
// resample on the fly using 16-bit
int sx = (m_img.width() << 16) / r.width();
diff --git a/src/particles/qquickmaskextruder_p.h b/src/particles/qquickmaskextruder_p.h
index 0d3fa9c15a..50153672fa 100644
--- a/src/particles/qquickmaskextruder_p.h
+++ b/src/particles/qquickmaskextruder_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef MASKEXTRUDER_H
#define MASKEXTRUDER_H
@@ -51,20 +15,20 @@
// We mean it.
//
#include "qquickparticleextruder_p.h"
-#include <private/qquickpixmapcache_p.h>
+#include <private/qquickpixmap_p.h>
#include <QUrl>
#include <QImage>
QT_BEGIN_NAMESPACE
-class QQuickMaskExtruder : public QQuickParticleExtruder
+class Q_QUICKPARTICLES_EXPORT QQuickMaskExtruder : public QQuickParticleExtruder
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
QML_NAMED_ELEMENT(MaskShape)
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickMaskExtruder(QObject *parent = 0);
+ explicit QQuickMaskExtruder(QObject *parent = nullptr);
QPointF extrude(const QRectF &) override;
bool contains(const QRectF &bounds, const QPointF &point) override;
diff --git a/src/particles/qquickparticleaffector.cpp b/src/particles/qquickparticleaffector.cpp
index aefaa2c399..bf28cffde6 100644
--- a/src/particles/qquickparticleaffector.cpp
+++ b/src/particles/qquickparticleaffector.cpp
@@ -1,41 +1,7 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qquickparticleaffector_p.h"
#include <QDebug>
@@ -44,7 +10,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Affector
- \instantiates QQuickParticleAffector
+//! \instantiates QQuickParticleAffector
\inqmlmodule QtQuick.Particles
\brief Applies alterations to the attributes of logical particles at any
point in their lifetime.
@@ -53,22 +19,26 @@ QT_BEGIN_NAMESPACE
The base Affector does not alter any attributes, but can be used to emit a signal
when a particle meets certain conditions.
- If an affector has a defined size, then it will only affect particles within its size and position on screen.
+ If an affector has a defined size, then it will only affect particles within its size and
+position on screen.
- Affectors have different performance characteristics to the other particle system elements. In particular,
- they have some simplifications to try to maintain a simulation at real-time or faster. When running a system
- with Affectors, irregular frame timings that grow too large ( > one second per frame) will cause the Affectors
- to try and cut corners with a faster but less accurate simulation. If the system has multiple affectors the order
- in which they are applied is not guaranteed, and when simulating larger time shifts they will simulate the whole
- shift each, which can lead to different results compared to smaller time shifts.
+ Affectors have different performance characteristics to the other particle system elements. In
+particular, they have some simplifications to try to maintain a simulation at real-time or faster.
+When running a system with Affectors, irregular frame timings that grow too large ( > one second per
+frame) will cause the Affectors to try and cut corners with a faster but less accurate simulation.
+If the system has multiple affectors the order in which they are applied is not guaranteed, and when
+simulating larger time shifts they will simulate the whole shift each, which can lead to different
+results compared to smaller time shifts.
- Accurate simulation for large numbers of particles (hundreds) with multiple affectors may be possible on some hardware,
- but on less capable hardware you should expect small irregularties in the simulation as simulates with worse granularity.
+ Accurate simulation for large numbers of particles (hundreds) with multiple affectors may be
+possible on some hardware, but on less capable hardware you should expect small irregularties in the
+simulation as simulates with worse granularity.
*/
/*!
\qmlproperty ParticleSystem QtQuick.Particles::Affector::system
This is the system which will be affected by the element.
- If the Affector is a direct child of a ParticleSystem, it will automatically be associated with it.
+ If the Affector is a direct child of a ParticleSystem, it will automatically be associated with
+ it.
*/
/*!
\qmlproperty list<string> QtQuick.Particles::Affector::groups
@@ -209,9 +179,9 @@ void QQuickParticleAffector::affectSystem(qreal dt)
updateOffsets();//### Needed if an ancestor is transformed.
if (m_onceOff)
dt = 1.0;
- for (QQuickParticleGroupData* gd : qAsConst(m_system->groupData)) {
+ for (QQuickParticleGroupData* gd : std::as_const(m_system->groupData)) {
if (activeGroup(gd->index)) {
- for (QQuickParticleData* d : qAsConst(gd->data)) {
+ for (QQuickParticleData* d : std::as_const(gd->data)) {
if (shouldAffect(d)) {
bool affected = false;
qreal myDt = dt;
diff --git a/src/particles/qquickparticleaffector_p.h b/src/particles/qquickparticleaffector_p.h
index 4f60389e04..5bd7c81940 100644
--- a/src/particles/qquickparticleaffector_p.h
+++ b/src/particles/qquickparticleaffector_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef PARTICLEAFFECTOR_H
#define PARTICLEAFFECTOR_H
@@ -52,14 +16,14 @@
//
#include <QObject>
+#include <QSet>
#include "qquickparticlesystem_p.h"
#include "qquickparticleextruder_p.h"
#include "qtquickparticlesglobal_p.h"
-#include "qquickparticleflatset_p.h"
QT_BEGIN_NAMESPACE
-class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleAffector : public QQuickItem
+class Q_QUICKPARTICLES_EXPORT QQuickParticleAffector : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
@@ -74,7 +38,7 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleAffector : public QQuickItem
QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.")
public:
- explicit QQuickParticleAffector(QQuickItem *parent = 0);
+ explicit QQuickParticleAffector(QQuickItem *parent = nullptr);
virtual void affectSystem(qreal dt);
virtual void reset(QQuickParticleData*);//As some store their own data per particle?
QQuickParticleSystem* system() const
@@ -197,7 +161,7 @@ protected:
static const qreal simulationCutoff;
QPointF m_offset;
- QtQuickParticlesPrivate::QFlatSet<QPair<int, int>> m_onceOffed;
+ QSet<QPair<int, int>> m_onceOffed;
private:
QSet<int> m_groupIds;
bool m_updateIntSet;
diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp
index 625670c4a3..ff5336a73d 100644
--- a/src/particles/qquickparticleemitter.cpp
+++ b/src/particles/qquickparticleemitter.cpp
@@ -1,53 +1,20 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qquickparticleemitter_p.h"
-#include <private/qqmlengine_p.h>
+
#include <private/qqmlglobal_p.h>
-#include <private/qjsvalue_p.h>
-#include <QRandomGenerator>
-QT_BEGIN_NAMESPACE
+#include <private/qquickv4particledata_p.h>
+
+#include <QtCore/qrandom.h>
+QT_BEGIN_NAMESPACE
/*!
\qmltype Emitter
- \instantiates QQuickParticleEmitter
+//! \instantiates QQuickParticleEmitter
\inqmlmodule QtQuick.Particles
\brief Emits logical particles.
\ingroup qtquick-particles
@@ -64,7 +31,6 @@ QT_BEGIN_NAMESPACE
ParticleSystem. This includes attributes like lifespan.
*/
-
/*!
\qmlproperty ParticleSystem QtQuick.Particles::Emitter::system
@@ -243,10 +209,10 @@ QQuickParticleEmitter::QQuickParticleEmitter(QQuickItem *parent) :
{
//TODO: Reset velocity/acc back to null vector? Or allow null pointer?
- connect(this, SIGNAL(particlesPerSecondChanged(qreal)),
- this, SIGNAL(particleCountChanged()));
- connect(this, SIGNAL(particleDurationChanged(int)),
- this, SIGNAL(particleCountChanged()));
+ connect(this, &QQuickParticleEmitter::particlesPerSecondChanged,
+ this, &QQuickParticleEmitter::particleCountChanged);
+ connect(this, &QQuickParticleEmitter::particleDurationChanged,
+ this, &QQuickParticleEmitter::particleCountChanged);
}
QQuickParticleEmitter::~QQuickParticleEmitter()
@@ -257,7 +223,8 @@ QQuickParticleEmitter::~QQuickParticleEmitter()
bool QQuickParticleEmitter::isEmitConnected()
{
- IS_SIGNAL_CONNECTED(this, QQuickParticleEmitter, emitParticles, (const QJSValue &));
+ IS_SIGNAL_CONNECTED(
+ this, QQuickParticleEmitter, emitParticles, (const QList<QQuickV4ParticleData> &));
}
void QQuickParticleEmitter::reclaculateGroupId() const
@@ -317,15 +284,15 @@ void QQuickParticleEmitter::setMaxParticleCount(int arg)
{
if (m_maxParticleCount != arg) {
if (arg < 0 && m_maxParticleCount >= 0){
- connect(this, SIGNAL(particlesPerSecondChanged(qreal)),
- this, SIGNAL(particleCountChanged()));
- connect(this, SIGNAL(particleDurationChanged(int)),
- this, SIGNAL(particleCountChanged()));
- }else if (arg >= 0 && m_maxParticleCount < 0){
- disconnect(this, SIGNAL(particlesPerSecondChanged(qreal)),
- this, SIGNAL(particleCountChanged()));
- disconnect(this, SIGNAL(particleDurationChanged(int)),
- this, SIGNAL(particleCountChanged()));
+ connect(this, &QQuickParticleEmitter::particlesPerSecondChanged,
+ this, &QQuickParticleEmitter::particleCountChanged);
+ connect(this, &QQuickParticleEmitter::particleDurationChanged,
+ this, &QQuickParticleEmitter::particleCountChanged);
+ } else if (arg >= 0 && m_maxParticleCount < 0){
+ disconnect(this, &QQuickParticleEmitter::particlesPerSecondChanged,
+ this, &QQuickParticleEmitter::particleCountChanged);
+ disconnect(this, &QQuickParticleEmitter::particleDurationChanged,
+ this, &QQuickParticleEmitter::velocityFromMovementChanged);
}
m_overwrite = arg < 0;
m_maxParticleCount = arg;
@@ -485,19 +452,14 @@ void QQuickParticleEmitter::emitWindow(int timeStamp)
m_system->emitParticle(d, this);
if (isEmitConnected()) {
- QQmlEngine *qmlEngine = ::qmlEngine(this);
- QV4::ExecutionEngine *v4 = qmlEngine->handle();
- QV4::Scope scope(v4);
-
//Done after emitParticle so that the Painter::load is done first, this allows you to customize its static variables
//We then don't need to request another reload, because the first reload isn't scheduled until we get back to the render thread
- QV4::ScopedArrayObject array(scope, v4->newArrayObject(toEmit.size()));
- QV4::ScopedValue v(scope);
- for (int i=0; i<toEmit.size(); i++)
- array->put(i, (v = toEmit[i]->v4Value(m_system)));
- QJSValue particles;
- QJSValuePrivate::setValue(&particles, array);
+ QList<QQuickV4ParticleData> particles;
+ particles.reserve(toEmit.size());
+ for (QQuickParticleData *particle : std::as_const(toEmit))
+ particles.push_back(particle->v4Value(m_system));
+
emit emitParticles(particles);//A chance for arbitrary JS changes
}
diff --git a/src/particles/qquickparticleemitter_p.h b/src/particles/qquickparticleemitter_p.h
index 0455b97d3e..60c942a221 100644
--- a/src/particles/qquickparticleemitter_p.h
+++ b/src/particles/qquickparticleemitter_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef PARTICLEEMITTER_H
#define PARTICLEEMITTER_H
@@ -62,7 +26,7 @@
#include <QPointF>
QT_BEGIN_NAMESPACE
-class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleEmitter : public QQuickItem
+class Q_QUICKPARTICLES_EXPORT QQuickParticleEmitter : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
@@ -87,7 +51,7 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleEmitter : public QQuickItem
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickParticleEmitter(QQuickItem *parent = 0);
+ explicit QQuickParticleEmitter(QQuickItem *parent = nullptr);
virtual ~QQuickParticleEmitter();
virtual void emitWindow(int timeStamp);
@@ -137,7 +101,7 @@ public:
void setVelocityFromMovement(qreal s);
void componentComplete() override;
Q_SIGNALS:
- void emitParticles(const QJSValue &particles);
+ void emitParticles(const QList<QQuickV4ParticleData> &particles);
void particlesPerSecondChanged(qreal);
void particleDurationChanged(int);
void enabledChanged(bool);
diff --git a/src/particles/qquickparticleextruder.cpp b/src/particles/qquickparticleextruder.cpp
index ea64a79563..82ae0a80ed 100644
--- a/src/particles/qquickparticleextruder.cpp
+++ b/src/particles/qquickparticleextruder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickparticleextruder_p.h"
#include <QRandomGenerator>
diff --git a/src/particles/qquickparticleextruder_p.h b/src/particles/qquickparticleextruder_p.h
index 0249ecd3aa..bff9d854a1 100644
--- a/src/particles/qquickparticleextruder_p.h
+++ b/src/particles/qquickparticleextruder_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef PARTICLEEXTRUDER_H
#define PARTICLEEXTRUDER_H
@@ -55,10 +19,12 @@
#include <QRectF>
#include <QPointF>
#include <QtQml/qqml.h>
+#include <QtCore/private/qglobal_p.h>
+#include <QtQuickParticles/qtquickparticlesexports.h>
QT_BEGIN_NAMESPACE
-class QQuickParticleExtruder : public QObject
+class Q_QUICKPARTICLES_EXPORT QQuickParticleExtruder : public QObject
{
Q_OBJECT
@@ -67,7 +33,7 @@ class QQuickParticleExtruder : public QObject
QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.")
public:
- explicit QQuickParticleExtruder(QObject *parent = 0);
+ explicit QQuickParticleExtruder(QObject *parent = nullptr);
virtual QPointF extrude(const QRectF &);
virtual bool contains(const QRectF &bounds, const QPointF &point);
};
diff --git a/src/particles/qquickparticleflatset_p.h b/src/particles/qquickparticleflatset_p.h
deleted file mode 100644
index 6d0650a12b..0000000000
--- a/src/particles/qquickparticleflatset_p.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQuick module of the Qt Toolkit.
-**
-** $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 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 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.
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef QQUICKPARTICLEFLATSET_P_H
-#define QQUICKPARTICLEFLATSET_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGlobal>
-
-#include <vector>
-#include <algorithm>
-#include <iterator>
-
-QT_BEGIN_NAMESPACE
-
-// Minimal API, just for the consumption of Qt Quick Particles.
-// For extra safety, it's in a private namespace
-
-namespace QtQuickParticlesPrivate {
-
-template <typename T>
-class QFlatSet
-{
-public:
- using iterator = typename std::vector<T>::iterator;
- using const_iterator = typename std::vector<T>::const_iterator;
- using value_type = typename std::vector<T>::value_type;
- using size_type = int;
-
- iterator find(const T &t)
- {
- return std::find(begin(), end(), t);
- }
-
- const_iterator find(const T &t) const
- {
- return std::find(begin(), end(), t);
- }
-
- bool contains(const T &t) const
- {
- return find(t) != end();
- }
-
- void clear()
- {
- m_data.clear();
- }
-
- void reserve(int capacity)
- {
- m_data.reserve(capacity);
- }
-
- iterator insert(const T &t)
- {
- auto i = find(t);
- if (i != end())
- return i;
- T copy = t;
- m_data.push_back(std::move(copy));
- return std::prev(m_data.end());
- }
-
- iterator insert(T &&t)
- {
- auto i = find(t);
- if (i != end())
- return i;
- m_data.push_back(std::move(t));
- return std::prev(m_data.end());
- }
-
- size_type remove(const T &t)
- {
- auto i = std::find(m_data.begin(), m_data.end(), t);
- if (i != m_data.end()) {
- m_data.erase(i);
- return 1;
- }
- return 0;
- }
-
- iterator operator<<(const T &t)
- {
- return insert(t);
- }
-
- iterator operator<<(T &&t)
- {
- return insert(std::move(t));
- }
-
- iterator begin() { return m_data.begin(); }
- const_iterator begin() const { return m_data.begin(); }
- const_iterator cbegin() const { return m_data.cbegin(); }
-
- iterator end() { return m_data.end(); }
- const_iterator end() const { return m_data.end(); }
- const_iterator cend() const { return m_data.cend(); }
-
-private:
- std::vector<T> m_data;
-};
-
-} // namespace QtQuickParticlesPrivate
-
-QT_END_NAMESPACE
-
-#endif // QQUICKPARTICLEFLATSET_P_H
diff --git a/src/particles/qquickparticlegroup.cpp b/src/particles/qquickparticlegroup.cpp
index 902c23331d..d916fc0a2d 100644
--- a/src/particles/qquickparticlegroup.cpp
+++ b/src/particles/qquickparticlegroup.cpp
@@ -1,41 +1,7 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qquickparticlegroup_p.h"
diff --git a/src/particles/qquickparticlegroup_p.h b/src/particles/qquickparticlegroup_p.h
index 6df1e61563..6b24ff3cd3 100644
--- a/src/particles/qquickparticlegroup_p.h
+++ b/src/particles/qquickparticlegroup_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQuickPARTICLEGROUP
#define QQuickPARTICLEGROUP
@@ -55,7 +19,8 @@
QT_BEGIN_NAMESPACE
-class QQuickParticleGroup : public QQuickStochasticState, public QQmlParserStatus
+class Q_QUICKPARTICLES_EXPORT QQuickParticleGroup : public QQuickStochasticState,
+ public QQmlParserStatus
{
Q_OBJECT
Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
@@ -68,7 +33,7 @@ class QQuickParticleGroup : public QQuickStochasticState, public QQmlParserStatu
Q_INTERFACES(QQmlParserStatus)
public:
- explicit QQuickParticleGroup(QObject* parent = 0);
+ explicit QQuickParticleGroup(QObject *parent = nullptr);
QQmlListProperty<QObject> particleChildren();
diff --git a/src/particles/qquickparticlepainter.cpp b/src/particles/qquickparticlepainter.cpp
index dfd637b415..ee5942d7fd 100644
--- a/src/particles/qquickparticlepainter.cpp
+++ b/src/particles/qquickparticlepainter.cpp
@@ -1,41 +1,7 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qquickparticlepainter_p.h"
#include <QQuickWindow>
@@ -78,12 +44,16 @@ QQuickParticlePainter::QQuickParticlePainter(QQuickItem *parent)
void QQuickParticlePainter::itemChange(ItemChange change, const ItemChangeData &data)
{
if (change == QQuickItem::ItemSceneChange) {
- if (m_window)
- disconnect(m_window, SIGNAL(sceneGraphInvalidated()), this, SLOT(sceneGraphInvalidated()));
+ if (m_window) {
+ disconnect(m_window, &QQuickWindow::sceneGraphInvalidated,
+ this, &QQuickParticlePainter::sceneGraphInvalidated);
+ }
m_window = data.window;
m_windowChanged = true;
- if (m_window)
- connect(m_window, SIGNAL(sceneGraphInvalidated()), this, SLOT(sceneGraphInvalidated()), Qt::DirectConnection);
+ if (m_window) {
+ connect(m_window, &QQuickWindow::sceneGraphInvalidated,
+ this, &QQuickParticlePainter::sceneGraphInvalidated, Qt::DirectConnection);
+ }
}
QQuickItem::itemChange(change, data);
}
diff --git a/src/particles/qquickparticlepainter_p.h b/src/particles/qquickparticlepainter_p.h
index 5236bb6569..577d64b053 100644
--- a/src/particles/qquickparticlepainter_p.h
+++ b/src/particles/qquickparticlepainter_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef PARTICLE_H
#define PARTICLE_H
@@ -58,7 +22,7 @@
QT_BEGIN_NAMESPACE
-class QQuickParticlePainter : public QQuickItem
+class Q_QUICKPARTICLES_EXPORT QQuickParticlePainter : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
@@ -72,7 +36,7 @@ public: // data
typedef QQuickParticleVarLengthArray<QQuickParticleGroupData::ID, 4> GroupIDs;
public:
- explicit QQuickParticlePainter(QQuickItem *parent = 0);
+ explicit QQuickParticlePainter(QQuickItem *parent = nullptr);
//Data Interface to system
void load(QQuickParticleData*);
void reload(QQuickParticleData*);
diff --git a/src/particles/qquickparticlesmodule.cpp b/src/particles/qquickparticlesmodule.cpp
deleted file mode 100644
index 8b535d85c7..0000000000
--- a/src/particles/qquickparticlesmodule.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
-
-#include <private/qtquickglobal_p.h>
-
-#include "qquickangledirection_p.h"
-#include "qquickellipseextruder_p.h"
-#include "qquicktrailemitter_p.h"
-#include "qquickfriction_p.h"
-#include "qquickgravity_p.h"
-#include "qquickimageparticle_p.h"
-#include "qquickitemparticle_p.h"
-#include "qquickage_p.h"
-#include "qquicklineextruder_p.h"
-#include "qquickmaskextruder_p.h"
-#include "qquickparticleaffector_p.h"
-#include "qquickparticleemitter_p.h"
-#include "qquickparticleextruder_p.h"
-#include "qquickparticlepainter_p.h"
-#include "qquickparticlesmodule_p.h"
-#include "qquickparticlesystem_p.h"
-#include "qquickpointattractor_p.h"
-#include "qquickpointdirection_p.h"
-#include "qquickspritegoal_p.h"
-#include "qquickdirection_p.h"
-#include "qquicktargetdirection_p.h"
-#include "qquickturbulence_p.h"
-#include "qquickwander_p.h"
-#include "qquickcumulativedirection_p.h"
-#include "qquickcustomaffector_p.h"
-#include "qquickrectangleextruder_p.h"
-#include "qquickparticlegroup_p.h"
-#include "qquickgroupgoal_p.h"
-
-static void initResources()
-{
- Q_INIT_RESOURCE(particles);
-}
-
-QT_BEGIN_NAMESPACE
-
-void QQuickParticlesModule::defineModule()
-{
- initResources();
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/particles/qquickparticlesmodule_p.h b/src/particles/qquickparticlesmodule_p.h
deleted file mode 100644
index 92033be262..0000000000
--- a/src/particles/qquickparticlesmodule_p.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef QQUICKPARTICLESMODULE_H
-#define QQUICKPARTICLESMODULE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qtquickparticlesglobal_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticlesModule
-{
-public:
- static void defineModule();
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKPARTICLESMODULE_H
diff --git a/src/particles/qquickparticlesystem.cpp b/src/particles/qquickparticlesystem.cpp
index 4eabbde970..6631574648 100644
--- a/src/particles/qquickparticlesystem.cpp
+++ b/src/particles/qquickparticlesystem.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickparticlesystem_p.h"
#include <QtQuick/qsgnode.h>
@@ -50,6 +14,7 @@
#include "qquicktrailemitter_p.h"//###For auto-follow on states, perhaps should be in emitter?
#include <private/qqmlengine_p.h>
#include <private/qqmlglobal_p.h>
+#include <private/qqmlvaluetypewrapper_p.h>
#include <cmath>
#include <QDebug>
@@ -100,7 +65,7 @@ DEFINE_BOOL_CONFIG_OPTION(qmlParticlesDebug, QML_PARTICLES_DEBUG)
/*!
\qmltype ParticleSystem
- \instantiates QQuickParticleSystem
+//! \instantiates QQuickParticleSystem
\inqmlmodule QtQuick.Particles
\brief A system which includes particle painter, emitter, and affector types.
\ingroup qtquick-particles
@@ -214,7 +179,7 @@ QQuickParticleDataHeap::QQuickParticleDataHeap()
void QQuickParticleDataHeap::grow() //###Consider automatic growth vs resize() calls from GroupData
{
- m_data.resize(1 << ++m_size);
+ m_data.resize(qsizetype(1) << ++m_size);
}
void QQuickParticleDataHeap::insert(QQuickParticleData* data)
@@ -240,8 +205,7 @@ void QQuickParticleDataHeap::insertTimed(QQuickParticleData* data, int time)
int QQuickParticleDataHeap::top()
{
- if (m_end == 0)
- return 1 << 30;
+ Q_ASSERT(!isEmpty());
return m_data[0].time;
}
@@ -324,7 +288,7 @@ QQuickParticleGroupData::QQuickParticleGroupData(const QString &name, QQuickPart
QQuickParticleGroupData::~QQuickParticleGroupData()
{
- for (QQuickParticleData *d : qAsConst(data))
+ for (QQuickParticleData *d : std::as_const(data))
delete d;
}
@@ -347,7 +311,7 @@ void QQuickParticleGroupData::setSize(int newSize)
}
int delta = newSize - m_size;
m_size = newSize;
- for (QQuickParticlePainter *p : qAsConst(painters))
+ for (QQuickParticlePainter *p : std::as_const(painters))
p->setCount(p->count() + delta);
}
@@ -360,7 +324,7 @@ void QQuickParticleGroupData::kill(QQuickParticleData* d)
{
Q_ASSERT(d->groupId == index);
d->lifeSpan = 0;//Kill off
- for (QQuickParticlePainter *p : qAsConst(painters))
+ for (QQuickParticlePainter *p : std::as_const(painters))
p->reload(d);
freeList.free(d->index);
}
@@ -391,7 +355,7 @@ bool QQuickParticleGroupData::recycle()
{
m_latestAliveParticles.clear();
- while (dataHeap.top() <= m_system->timeInt) {
+ while (!dataHeap.isEmpty() && dataHeap.top() <= m_system->timeInt) {
for (QQuickParticleData *datum : dataHeap.pop()) {
if (!datum->stillAlive(m_system)) {
freeList.free(datum->index);
@@ -420,113 +384,9 @@ void QQuickParticleGroupData::prepareRecycler(QQuickParticleData* d)
}
}
-QQuickParticleData::QQuickParticleData()
- : index(0)
- , systemIndex(-1)
- , groupId(0)
- , colorOwner(nullptr)
- , rotationOwner(nullptr)
- , deformationOwner(nullptr)
- , animationOwner(nullptr)
- , v8Datum(nullptr)
+QQuickV4ParticleData QQuickParticleData::v4Value(QQuickParticleSystem *particleSystem)
{
- x = 0;
- y = 0;
- t = -1;
- lifeSpan = 0;
- size = 0;
- endSize = 0;
- vx = 0;
- vy = 0;
- ax = 0;
- ay = 0;
- xx = 1;
- xy = 0;
- yx = 0;
- yy = 1;
- rotation = 0;
- rotationVelocity = 0;
- autoRotate = 0;
- animIdx = 0;
- frameDuration = 1;
- frameAt = -1;
- frameCount = 1;
- animT = -1;
- animX = 0;
- animY = 0;
- animWidth = 1;
- animHeight = 1;
- color.r = 255;
- color.g = 255;
- color.b = 255;
- color.a = 255;
- delegate = nullptr;
-}
-
-QQuickParticleData::~QQuickParticleData()
-{
- delete v8Datum;
-}
-
-QQuickParticleData::QQuickParticleData(const QQuickParticleData &other)
-{
- *this = other;
-}
-
-QQuickParticleData &QQuickParticleData::operator=(const QQuickParticleData &other)
-{
- clone(other);
-
- groupId = other.groupId;
- index = other.index;
- systemIndex = other.systemIndex;
- // Lazily initialized
- v8Datum = nullptr;
-
- return *this;
-}
-
-void QQuickParticleData::clone(const QQuickParticleData& other)
-{
- x = other.x;
- y = other.y;
- t = other.t;
- lifeSpan = other.lifeSpan;
- size = other.size;
- endSize = other.endSize;
- vx = other.vx;
- vy = other.vy;
- ax = other.ax;
- ay = other.ay;
- xx = other.xx;
- xy = other.xy;
- yx = other.yx;
- yy = other.yy;
- rotation = other.rotation;
- rotationVelocity = other.rotationVelocity;
- autoRotate = other.autoRotate;
- animIdx = other.animIdx;
- frameDuration = other.frameDuration;
- frameCount = other.frameCount;
- animT = other.animT;
- animX = other.animX;
- animY = other.animY;
- animWidth = other.animWidth;
- animHeight = other.animHeight;
- color = other.color;
- delegate = other.delegate;
-
- colorOwner = other.colorOwner;
- rotationOwner = other.rotationOwner;
- deformationOwner = other.deformationOwner;
- animationOwner = other.animationOwner;
-}
-
-QV4::ReturnedValue QQuickParticleData::v4Value(QQuickParticleSystem* particleSystem)
-{
- if (!v8Datum)
- v8Datum = new QQuickV4ParticleData(qmlEngine(particleSystem)->handle(), this, particleSystem);
- return v8Datum->v4Value();
+ return QQuickV4ParticleData(this, particleSystem);
}
void QQuickParticleData::debugDump(QQuickParticleSystem* particleSystem) const
@@ -579,7 +439,7 @@ QQuickParticleSystem::QQuickParticleSystem(QQuickItem *parent) :
QQuickParticleSystem::~QQuickParticleSystem()
{
- for (QQuickParticleGroupData *gd : qAsConst(groupData))
+ for (QQuickParticleGroupData *gd : std::as_const(groupData))
delete gd;
}
@@ -593,10 +453,10 @@ void QQuickParticleSystem::initGroups()
groupIds.clear();
nextFreeGroupId = 0;
- for (auto e : qAsConst(m_emitters)) {
+ for (auto e : std::as_const(m_emitters)) {
e->reclaculateGroupId();
}
- for (QQuickParticlePainter *p : qAsConst(m_painters)) {
+ for (QQuickParticlePainter *p : std::as_const(m_painters)) {
p->recalculateGroupIds();
}
@@ -625,12 +485,12 @@ void QQuickParticleSystem::registerParticleEmitter(QQuickParticleEmitter* e)
void QQuickParticleSystem::finishRegisteringParticleEmitter(QQuickParticleEmitter* e)
{
- connect(e, SIGNAL(particleCountChanged()),
- this, SLOT(emittersChanged()));
- connect(e, SIGNAL(groupChanged(QString)),
- this, SLOT(emittersChanged()));
+ connect(e, &QQuickParticleEmitter::particleCountChanged,
+ this, &QQuickParticleSystem::emittersChanged);
+ connect(e, &QQuickParticleEmitter::groupChanged,
+ this, &QQuickParticleSystem::emittersChanged);
if (m_componentComplete)
- emittersChanged();
+ emitterAdded(e);
e->reset();//Start, so that starttime factors appropriately
}
@@ -668,7 +528,7 @@ void QQuickParticleSystem::setPaused(bool arg) {
if (m_animation && m_animation->state() != QAbstractAnimation::Stopped)
m_paused ? m_animation->pause() : m_animation->resume();
if (!m_paused) {
- for (QQuickParticlePainter *p : qAsConst(m_painters)) {
+ for (QQuickParticlePainter *p : std::as_const(m_painters)) {
if (p) {
p->update();
}
@@ -767,10 +627,9 @@ void QQuickParticleSystem::reset()
timeInt = 0;
//Clear guarded pointers which have been deleted
- int cleared = 0;
- cleared += m_emitters.removeAll(nullptr);
- cleared += m_painters.removeAll(nullptr);
- cleared += m_affectors.removeAll(nullptr);
+ m_emitters.removeAll(nullptr);
+ m_painters.removeAll(nullptr);
+ m_affectors.removeAll(nullptr);
bySysIdx.resize(0);
initGroups();//Also clears all logical particles
@@ -778,12 +637,12 @@ void QQuickParticleSystem::reset()
if (!m_running)
return;
- for (QQuickParticleEmitter *e : qAsConst(m_emitters))
+ for (QQuickParticleEmitter *e : std::as_const(m_emitters))
e->reset();
emittersChanged();
- for (QQuickParticlePainter *p : qAsConst(m_painters)) {
+ for (QQuickParticlePainter *p : std::as_const(m_painters)) {
loadPainter(p);
p->reset();
}
@@ -844,7 +703,7 @@ void QQuickParticleSystem::emittersChanged()
}
// Populate groups and set sizes.
- for (int i = 0; i < m_emitters.count(); ) {
+ for (int i = 0; i < m_emitters.size(); ) {
QQuickParticleEmitter *e = m_emitters.at(i);
if (!e) {
m_emitters.removeAt(i);
@@ -870,19 +729,24 @@ void QQuickParticleSystem::emittersChanged()
particleCount += groupData[i]->size();
}
+ postProcessEmitters();
+}
+
+void QQuickParticleSystem::postProcessEmitters()
+{
if (m_debugMode)
qDebug() << "Particle system emitters changed. New particle count: " << particleCount << "in" << groupData.size() << "groups.";
if (particleCount > bySysIdx.size())//New datum requests haven't updated it
bySysIdx.resize(particleCount);
- for (QQuickParticleAffector *a : qAsConst(m_affectors)) {//Groups may have changed
+ for (QQuickParticleAffector *a : std::as_const(m_affectors)) {//Groups may have changed
if (a) {
a->m_updateIntSet = true;
}
}
- for (QQuickParticlePainter *p : qAsConst(m_painters))
+ for (QQuickParticlePainter *p : std::as_const(m_painters))
loadPainter(p);
if (!m_groups.isEmpty())
@@ -890,6 +754,30 @@ void QQuickParticleSystem::emittersChanged()
}
+void QQuickParticleSystem::emitterAdded(QQuickParticleEmitter *e)
+{
+ if (!m_componentComplete)
+ return;
+
+ // Populate group and set size.
+ const int groupId = e->groupId();
+ if (groupId == QQuickParticleGroupData::InvalidID) {
+ QQuickParticleGroupData *group = new QQuickParticleGroupData(e->group(), this);
+ group->setSize(e->particleCount());
+ } else {
+ QQuickParticleGroupData *group = groupData[groupId];
+ group->setSize(group->size() + e->particleCount());
+ }
+
+ // groupData can have changed independently, so we still have to iterate it all
+ // to count the particles.
+ particleCount = 0;
+ for (int i = 0, ei = groupData.size(); i != ei; ++i)
+ particleCount += groupData[i]->size();
+
+ postProcessEmitters();
+}
+
void QQuickParticleSystem::createEngine()
{
if (!m_componentComplete)
@@ -897,7 +785,7 @@ void QQuickParticleSystem::createEngine()
if (stateEngine && m_debugMode)
qDebug() << "Resetting Existing Sprite Engine...";
//### Solve the losses if size/states go down
- for (QQuickParticleGroup *group : qAsConst(m_groups)) {
+ for (QQuickParticleGroup *group : std::as_const(m_groups)) {
bool exists = false;
for (auto it = groupIds.keyBegin(), end = groupIds.keyEnd(); it != end; ++it) {
if (group->name() == *it) {
@@ -910,14 +798,14 @@ void QQuickParticleSystem::createEngine()
}
}
- if (m_groups.count()) {
+ if (m_groups.size()) {
//Reorder groups List so as to have the same order as groupData
// TODO: can't we just merge the two lists?
QList<QQuickParticleGroup*> newList;
for (int i = 0, ei = groupData.size(); i != ei; ++i) {
bool exists = false;
QString name = groupData[i]->name();
- for (QQuickParticleGroup *existing : qAsConst(m_groups)) {
+ for (QQuickParticleGroup *existing : std::as_const(m_groups)) {
if (existing->name() == name) {
newList << existing;
exists = true;
@@ -930,8 +818,8 @@ void QQuickParticleSystem::createEngine()
}
m_groups = newList;
QList<QQuickStochasticState*> states;
- states.reserve(m_groups.count());
- for (QQuickParticleGroup *g : qAsConst(m_groups))
+ states.reserve(m_groups.size());
+ for (QQuickParticleGroup *g : std::as_const(m_groups))
states << (QQuickStochasticState*)g;
if (!stateEngine)
@@ -939,8 +827,8 @@ void QQuickParticleSystem::createEngine()
stateEngine->setCount(particleCount);
stateEngine->m_states = states;
- connect(stateEngine, SIGNAL(stateChanged(int)),
- this, SLOT(particleStateChange(int)));
+ connect(stateEngine, &QQuickStochasticEngine::stateChanged,
+ this, &QQuickParticleSystem::particleStateChange);
} else {
if (stateEngine)
@@ -960,11 +848,10 @@ void QQuickParticleSystem::moveGroups(QQuickParticleData *d, int newGIdx)
if (!d || newGIdx == d->groupId)
return;
- QQuickParticleData* pd = newDatum(newGIdx, false, d->systemIndex);
+ QQuickParticleData *pd = newDatum(newGIdx, false, d->systemIndex, d);
if (!pd)
return;
- pd->clone(*d);
finishNewDatum(pd);
d->systemIndex = -1;
@@ -987,14 +874,28 @@ int QQuickParticleSystem::nextSystemIndex()
return m_nextIndex++;
}
-QQuickParticleData* QQuickParticleSystem::newDatum(int groupId, bool respectLimits, int sysIndex)
+QQuickParticleData *QQuickParticleSystem::newDatum(
+ int groupId, bool respectLimits, int sysIndex,
+ const QQuickParticleData *cloneFrom)
{
- Q_ASSERT(groupId < groupData.count());//XXX shouldn't really be an assert
+ Q_ASSERT(groupId < groupData.size());//XXX shouldn't really be an assert
- QQuickParticleData* ret = groupData[groupId]->newDatum(respectLimits);
- if (!ret) {
+ QQuickParticleData *ret = groupData[groupId]->newDatum(respectLimits);
+ if (!ret)
return nullptr;
+
+ if (cloneFrom) {
+ // We need to retain the "identity" information of the new particle data since it may be
+ // "recycled" and still be tracked.
+ const int retainedIndex = ret->index;
+ const int retainedGroupId = ret->groupId;
+ const int retainedSystemIndex = ret->systemIndex;
+ *ret = *cloneFrom;
+ ret->index = retainedIndex;
+ ret->groupId = retainedGroupId;
+ ret->systemIndex = retainedSystemIndex;
}
+
if (sysIndex == -1) {
if (ret->systemIndex == -1)
ret->systemIndex = nextSystemIndex();
@@ -1036,10 +937,10 @@ void QQuickParticleSystem::finishNewDatum(QQuickParticleData *pd)
Q_ASSERT(pd);
groupData[pd->groupId]->prepareRecycler(pd);
- for (QQuickParticleAffector *a : qAsConst(m_affectors))
+ for (QQuickParticleAffector *a : std::as_const(m_affectors))
if (a && a->m_needsReset)
a->reset(pd);
- for (QQuickParticlePainter *p : qAsConst(groupData[pd->groupId]->painters))
+ for (QQuickParticlePainter *p : std::as_const(groupData[pd->groupId]->painters))
if (p)
p->load(pd);
}
@@ -1062,18 +963,18 @@ void QQuickParticleSystem::updateCurrentTime( int currentTime )
bool oldClear = m_empty;
m_empty = true;
- for (QQuickParticleGroupData *gd : qAsConst(groupData))//Recycle all groups and see if they're out of live particles
+ for (QQuickParticleGroupData *gd : std::as_const(groupData))//Recycle all groups and see if they're out of live particles
m_empty = gd->recycle() && m_empty;
if (stateEngine)
stateEngine->updateSprites(timeInt);
- for (QQuickParticleEmitter *emitter : qAsConst(m_emitters))
+ for (QQuickParticleEmitter *emitter : std::as_const(m_emitters))
emitter->emitWindow(timeInt);
- for (QQuickParticleAffector *a : qAsConst(m_affectors))
+ for (QQuickParticleAffector *a : std::as_const(m_affectors))
a->affectSystem(dt);
for (QQuickParticleData *d : needsReset)
- for (QQuickParticlePainter *p : qAsConst(groupData[d->groupId]->painters))
+ for (QQuickParticlePainter *p : std::as_const(groupData[d->groupId]->painters))
p->reload(d);
if (oldClear != m_empty)
diff --git a/src/particles/qquickparticlesystem_p.h b/src/particles/qquickparticlesystem_p.h
index 2f2e10d264..0b79722696 100644
--- a/src/particles/qquickparticlesystem_p.h
+++ b/src/particles/qquickparticlesystem_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef PARTICLESYSTEM_H
#define PARTICLESYSTEM_H
@@ -54,7 +18,9 @@
#include <QtQuick/QQuickItem>
#include <QElapsedTimer>
#include <QVector>
+#include <QVarLengthArray>
#include <QHash>
+#include <QSet>
#include <QPointer>
#include <private/qquicksprite_p.h>
#include <QAbstractAnimation>
@@ -62,8 +28,7 @@
#include <private/qv4util_p.h>
#include <private/qv4global_p.h>
#include <private/qv4staticvalue_p.h>
-#include "qtquickparticlesglobal_p.h"
-#include "qquickparticleflatset_p.h"
+#include <private/qtquickparticlesglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -108,7 +73,7 @@ struct QQuickParticleDataHeapNode{
QSet<QQuickParticleData*> data;//Set ptrs instead?
};
-class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleDataHeap {
+class Q_QUICKPARTICLES_EXPORT QQuickParticleDataHeap {
//Idea is to do a binary heap, but which also stores a set of int,Node* so that if the int already exists, you can
//add it to the data* list. Pops return the whole list at once.
public:
@@ -118,6 +83,8 @@ public:
int top();
+ bool isEmpty() const { return m_end == 0; }
+
QSet<QQuickParticleData*> pop();
void clear();
@@ -135,7 +102,7 @@ private:
QHash<int,int> m_lookups;
};
-class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleGroupData {
+class Q_QUICKPARTICLES_EXPORT QQuickParticleGroupData {
class FreeList
{
public:
@@ -243,15 +210,9 @@ struct Color4ub {
uchar a;
};
-class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleData {
+class Q_QUICKPARTICLES_EXPORT QQuickParticleData
+{
public:
- //TODO: QObject like memory management (without the cost, just attached to system)
- QQuickParticleData();
- ~QQuickParticleData();
-
- QQuickParticleData(const QQuickParticleData &other);
- QQuickParticleData &operator=(const QQuickParticleData &other);
-
//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.
@@ -278,55 +239,55 @@ public:
float curAY() const { return ay; }
float curAY(QQuickParticleSystem *) const { return ay; } // used by the macros in qquickv4particledata.cpp
- int index;
- int systemIndex;
+ int index = 0;
+ int systemIndex = -1;
//General Position Stuff
- float x;
- float y;
- float t;
- float lifeSpan;
- float size;
- float endSize;
- float vx;
- float vy;
- float ax;
- float ay;
+ float x = 0;
+ float y = 0;
+ float t = -1;
+ float lifeSpan = 0;
+ float size = 0;
+ float endSize = 0;
+ float vx = 0;
+ float vy = 0;
+ float ax = 0;
+ float ay = 0;
//Painter-specific stuff, now universally shared
//Used by ImageParticle color mode
- Color4ub color;
+ Color4ub color = { 255, 255, 255, 255};
//Used by ImageParticle deform mode
- float xx;
- float xy;
- float yx;
- float yy;
- float rotation;
- float rotationVelocity;
- uchar autoRotate; // Basically a bool
+ float xx = 1;
+ float xy = 0;
+ float yx = 0;
+ float yy = 1;
+ float rotation = 0;
+ float rotationVelocity = 0;
+ uchar autoRotate = 0; // Basically a bool
//Used by ImageParticle Sprite mode
- float animIdx;
- float frameDuration;
- float frameAt;//Used for duration -1
- float frameCount;
- float animT;
- float animX;
- float animY;
- float animWidth;
- float animHeight;
-
- QQuickParticleGroupData::ID groupId;
+ float animIdx = 0;
+ float frameDuration = 1;
+ float frameAt = -1;//Used for duration -1
+ float frameCount = 1;
+ float animT = -1;
+ float animX = 0;
+ float animY = 0;
+ float animWidth = 1;
+ float animHeight = 1;
+
+ QQuickParticleGroupData::ID groupId = 0;
//Used by ImageParticle data shadowing
- QQuickImageParticle* colorOwner;
- QQuickImageParticle* rotationOwner;
- QQuickImageParticle* deformationOwner;
- QQuickImageParticle* animationOwner;
+ QQuickImageParticle* colorOwner = nullptr;
+ QQuickImageParticle* rotationOwner = nullptr;
+ QQuickImageParticle* deformationOwner = nullptr;
+ QQuickImageParticle* animationOwner = nullptr;
//Used by ItemParticle
- QQuickItem* delegate;
+ QQuickItem* delegate = nullptr;
//Used by custom affectors
- float update;
+ float update = 0;
void debugDump(QQuickParticleSystem *particleSystem) const;
bool stillAlive(QQuickParticleSystem *particleSystem) const; //Only checks end, because usually that's all you need and it's a little faster.
@@ -334,17 +295,17 @@ public:
float lifeLeft(QQuickParticleSystem *particleSystem) const;
float curSize(QQuickParticleSystem *particleSystem) const;
- void clone(const QQuickParticleData& other);//Not =, leaves meta-data like index
- QV4::ReturnedValue v4Value(QQuickParticleSystem *particleSystem);
+
+ QQuickV4ParticleData v4Value(QQuickParticleSystem *particleSystem);
void extendLife(float time, QQuickParticleSystem *particleSystem);
static inline constexpr float EPSILON() noexcept { return 0.001f; }
-
-private:
- QQuickV4ParticleData* v8Datum;
};
-class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleSystem : public QQuickItem
+static_assert(std::is_trivially_copyable_v<QQuickParticleData>);
+static_assert(std::is_trivially_destructible_v<QQuickParticleData>);
+
+class Q_QUICKPARTICLES_EXPORT QQuickParticleSystem : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
@@ -403,7 +364,9 @@ private Q_SLOTS:
public:
//These can be called multiple times per frame, performance critical
void emitParticle(QQuickParticleData* p, QQuickParticleEmitter *particleEmitter);
- QQuickParticleData* newDatum(int groupId, bool respectLimits = true, int sysIdx = -1);
+ QQuickParticleData *newDatum(
+ int groupId, bool respectLimits = true, int sysIdx = -1,
+ const QQuickParticleData *cloneFrom = nullptr);
void finishNewDatum(QQuickParticleData*);
void moveGroups(QQuickParticleData *d, int newGIdx);
int nextSystemIndex();
@@ -412,7 +375,7 @@ public:
int systemSync(QQuickParticlePainter* p);
//Data members here for ease of related class and auto-test usage. Not "public" API. TODO: d_ptrize
- QtQuickParticlesPrivate::QFlatSet<QQuickParticleData*> needsReset;
+ QSet<QQuickParticleData*> needsReset;
QVector<QQuickParticleData*> bySysIdx; //Another reference to the data (data owned by group), but by sysIdx
QQuickStochasticEngine* stateEngine;
@@ -453,6 +416,8 @@ private:
void searchNextFreeGroupId();
private:
+ void emitterAdded(QQuickParticleEmitter *e);
+ void postProcessEmitters();
void initializeSystem();
void initGroups();
QList<QPointer<QQuickParticleEmitter> > m_emitters;
diff --git a/src/particles/qquickpointattractor.cpp b/src/particles/qquickpointattractor.cpp
index cbc16f3a06..a7df598f6b 100644
--- a/src/particles/qquickpointattractor.cpp
+++ b/src/particles/qquickpointattractor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickpointattractor_p.h"
#include <cmath>
@@ -47,61 +11,57 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Particles
\ingroup qtquick-particles
\inherits Affector
- \brief For attracting particles towards a specific point.
+ \brief Attracts particles towards a specific point.
- Note that the size and position of this element affects which particles it affects.
- The size of the point attracted to is always 0x0, and the location of that point
- is specified by the pointX and pointY properties.
+ Like other affectors, Attractor has the standard properties x, y, width,
+ and height that represent the affected area. The size and position of the
+ Attractor item determine the affected particles.
- Note that Attractor has the standard Item x,y,width and height properties.
- Like other affectors, these represent the affected area. They
- do not represent the 0x0 point which is the target of the attraction.
+ The size of the attracting point is always 0x0, and its location is
+ specified by \l pointX and \l pointY properties.
*/
/*!
- \qmlproperty real QtQuick.Particles::PointAttractor::pointX
+ \qmlproperty real QtQuick.Particles::Attractor::pointX
- The x coordinate of the attracting point. This is relative
- to the x coordinate of the Attractor.
+ The x coordinate of the attracting point, relative
+ to the x coordinate of the Attractor item.
*/
/*!
- \qmlproperty real QtQuick.Particles::PointAttractor::pointY
+ \qmlproperty real QtQuick.Particles::Attractor::pointY
- The y coordinate of the attracting point. This is relative
- to the y coordinate of the Attractor.
+ The y coordinate of the attracting point, relative
+ to the y coordinate of the Attractor item.
*/
/*!
- \qmlproperty real QtQuick.Particles::PointAttractor::strength
+ \qmlproperty real QtQuick.Particles::Attractor::strength
The pull, in units per second, to be exerted on an item one pixel away.
- Depending on how the attraction is proportionalToDistance this may have to
- be very high or very low to have a reasonable effect on particles at a
- distance.
+ Strength, together with the value of \l proportionalToDistance property,
+ determine the exact amount of pull exerted on particles at a distance.
*/
/*!
- \qmlproperty AffectableParameter QtQuick.Particles::Attractor::affectedParameter
-
- What attribute of particles is directly affected.
- \list
- \li Attractor.Position
- \li Attractor.Velocity
- \li Attractor.Acceleration
- \endlist
+ \qmlproperty enumeration QtQuick.Particles::Attractor::affectedParameter
+
+ The attribute of particles that is directly affected.
+
+ \value Attractor.Position Position
+ \value Attractor.Velocity Velocity
+ \value Attractor.Acceleration Acceleration
*/
/*!
- \qmlproperty Proportion QtQuick.Particles::Attractor::proportionalToDistance
+ \qmlproperty enumeration QtQuick.Particles::Attractor::proportionalToDistance
- How the distance from the particle to the point affects the strength of the attraction.
+ The relation between the \l strength of the attraction and the distance from
+ the particle to the attracting point.
- \list
- \li Attractor.Constant
- \li Attractor.Linear
- \li Attractor.InverseLinear
- \li Attractor.Quadratic
- \li Attractor.InverseQuadratic
- \endlist
+ \value Attractor.Constant Constant
+ \value Attractor.Linear Linear
+ \value Attractor.InverseLinear Inverse linear
+ \value Attractor.Quadratic Quadratic
+ \value Attractor.InverseQuadratic Inverse quadratic
*/
diff --git a/src/particles/qquickpointattractor_p.h b/src/particles/qquickpointattractor_p.h
index b3314f1a96..9bdd281382 100644
--- a/src/particles/qquickpointattractor_p.h
+++ b/src/particles/qquickpointattractor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ATTRACTORAFFECTOR_H
#define ATTRACTORAFFECTOR_H
@@ -54,7 +18,7 @@
QT_BEGIN_NAMESPACE
-class QQuickAttractorAffector : public QQuickParticleAffector
+class Q_QUICKPARTICLES_EXPORT QQuickAttractorAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged)
@@ -82,7 +46,7 @@ public:
};
Q_ENUM(AffectableParameters)
- explicit QQuickAttractorAffector(QQuickItem *parent = 0);
+ explicit QQuickAttractorAffector(QQuickItem *parent = nullptr);
qreal strength() const
{
diff --git a/src/particles/qquickpointdirection.cpp b/src/particles/qquickpointdirection.cpp
index 7b47fedf6b..74946dc320 100644
--- a/src/particles/qquickpointdirection.cpp
+++ b/src/particles/qquickpointdirection.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickpointdirection_p.h"
#include <QRandomGenerator>
diff --git a/src/particles/qquickpointdirection_p.h b/src/particles/qquickpointdirection_p.h
index 39109d8331..48863a1343 100644
--- a/src/particles/qquickpointdirection_p.h
+++ b/src/particles/qquickpointdirection_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef POINTVECTOR_H
#define POINTVECTOR_H
@@ -54,7 +18,7 @@
QT_BEGIN_NAMESPACE
-class QQuickPointDirection : public QQuickDirection
+class Q_QUICKPARTICLES_EXPORT QQuickPointDirection : public QQuickDirection
{
Q_OBJECT
Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
@@ -64,7 +28,7 @@ class QQuickPointDirection : public QQuickDirection
QML_NAMED_ELEMENT(PointDirection)
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickPointDirection(QObject *parent = 0);
+ explicit QQuickPointDirection(QObject *parent = nullptr);
QPointF sample(const QPointF &from) override;
qreal x() const
{
diff --git a/src/particles/qquickrectangleextruder.cpp b/src/particles/qquickrectangleextruder.cpp
index 35207d34d2..50a6c7b756 100644
--- a/src/particles/qquickrectangleextruder.cpp
+++ b/src/particles/qquickrectangleextruder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickrectangleextruder_p.h"
#include <QRandomGenerator>
diff --git a/src/particles/qquickrectangleextruder_p.h b/src/particles/qquickrectangleextruder_p.h
index f6f39579c4..5ae59d04e0 100644
--- a/src/particles/qquickrectangleextruder_p.h
+++ b/src/particles/qquickrectangleextruder_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef RECTANGLEEXTRUDER_H
#define RECTANGLEEXTRUDER_H
@@ -55,7 +19,7 @@
QT_BEGIN_NAMESPACE
-class QQuickRectangleExtruder : public QQuickParticleExtruder
+class Q_QUICKPARTICLES_EXPORT QQuickRectangleExtruder : public QQuickParticleExtruder
{
Q_OBJECT
Q_PROPERTY(bool fill READ fill WRITE setFill NOTIFY fillChanged)
@@ -63,7 +27,7 @@ class QQuickRectangleExtruder : public QQuickParticleExtruder
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickRectangleExtruder(QObject *parent = 0);
+ explicit QQuickRectangleExtruder(QObject *parent = nullptr);
QPointF extrude(const QRectF &) override;
bool contains(const QRectF &bounds, const QPointF &point) override;
bool fill() const
diff --git a/src/particles/qquickspritegoal.cpp b/src/particles/qquickspritegoal.cpp
index 43caeace52..bc8fb27516 100644
--- a/src/particles/qquickspritegoal.cpp
+++ b/src/particles/qquickspritegoal.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickspritegoal_p.h"
#include <private/qquickspriteengine_p.h>
diff --git a/src/particles/qquickspritegoal_p.h b/src/particles/qquickspritegoal_p.h
index efd9b1ab39..143a61d709 100644
--- a/src/particles/qquickspritegoal_p.h
+++ b/src/particles/qquickspritegoal_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SPRITEGOALAFFECTOR_H
#define SPRITEGOALAFFECTOR_H
@@ -57,7 +21,7 @@ QT_BEGIN_NAMESPACE
class QQuickStochasticEngine;
-class QQuickSpriteGoalAffector : public QQuickParticleAffector
+class Q_QUICKPARTICLES_EXPORT QQuickSpriteGoalAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(QString goalState READ goalState WRITE setGoalState NOTIFY goalStateChanged)
@@ -66,7 +30,7 @@ class QQuickSpriteGoalAffector : public QQuickParticleAffector
QML_NAMED_ELEMENT(SpriteGoal)
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickSpriteGoalAffector(QQuickItem *parent = 0);
+ explicit QQuickSpriteGoalAffector(QQuickItem *parent = nullptr);
QString goalState() const
{
diff --git a/src/particles/qquicktargetdirection.cpp b/src/particles/qquicktargetdirection.cpp
index 5aa813be6f..e650e50b6c 100644
--- a/src/particles/qquicktargetdirection.cpp
+++ b/src/particles/qquicktargetdirection.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquicktargetdirection_p.h"
#include "qquickparticleemitter_p.h"
diff --git a/src/particles/qquicktargetdirection_p.h b/src/particles/qquicktargetdirection_p.h
index ea6ac24893..a83b3121ec 100644
--- a/src/particles/qquicktargetdirection_p.h
+++ b/src/particles/qquicktargetdirection_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DIRECTEDVECTOR_H
#define DIRECTEDVECTOR_H
@@ -56,7 +20,7 @@
QT_BEGIN_NAMESPACE
class QQuickItem;
-class QQuickTargetDirection : public QQuickDirection
+class Q_QUICKPARTICLES_EXPORT QQuickTargetDirection : public QQuickDirection
{
Q_OBJECT
Q_PROPERTY(qreal targetX READ targetX WRITE setTargetX NOTIFY targetXChanged)
@@ -74,7 +38,7 @@ class QQuickTargetDirection : public QQuickDirection
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickTargetDirection(QObject *parent = 0);
+ explicit QQuickTargetDirection(QObject *parent = nullptr);
QPointF sample(const QPointF &from) override;
qreal targetX() const
diff --git a/src/particles/qquicktrailemitter.cpp b/src/particles/qquicktrailemitter.cpp
index 05afdf9d1f..e5cd0891a5 100644
--- a/src/particles/qquicktrailemitter.cpp
+++ b/src/particles/qquicktrailemitter.cpp
@@ -1,48 +1,17 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qquicktrailemitter_p.h"
-#include <private/qqmlengine_p.h>
+
#include <private/qqmlglobal_p.h>
-#include <private/qjsvalue_p.h>
-#include <QRandomGenerator>
+#include <private/qquickv4particledata_p.h>
+
+#include <QtCore/qrandom.h>
+
#include <cmath>
+
QT_BEGIN_NAMESPACE
/*!
@@ -67,12 +36,12 @@ QQuickTrailEmitter::QQuickTrailEmitter(QQuickItem *parent) :
, m_defaultEmissionExtruder(new QQuickParticleExtruder(this))
{
//TODO: If followed increased their size
- connect(this, SIGNAL(followChanged(QString)),
- this, SLOT(recalcParticlesPerSecond()));
- connect(this, SIGNAL(particleDurationChanged(int)),
- this, SLOT(recalcParticlesPerSecond()));
- connect(this, SIGNAL(particlesPerParticlePerSecondChanged(int)),
- this, SLOT(recalcParticlesPerSecond()));
+ connect(this, &QQuickTrailEmitter::followChanged,
+ this, &QQuickTrailEmitter::recalcParticlesPerSecond);
+ connect(this, &QQuickTrailEmitter::particleDurationChanged,
+ this, &QQuickTrailEmitter::recalcParticlesPerSecond);
+ connect(this, &QQuickTrailEmitter::particlesPerParticlePerSecondChanged,
+ this, &QQuickTrailEmitter::recalcParticlesPerSecond);
}
/*!
@@ -128,8 +97,9 @@ QQuickTrailEmitter::QQuickTrailEmitter(QQuickItem *parent) :
bool QQuickTrailEmitter::isEmitFollowConnected()
{
- IS_SIGNAL_CONNECTED(this, QQuickTrailEmitter, emitFollowParticles,
- (const QJSValue &, const QJSValue &));
+ IS_SIGNAL_CONNECTED(
+ this, QQuickTrailEmitter, emitFollowParticles,
+ (const QList<QQuickV4ParticleData> &, const QQuickV4ParticleData &));
}
void QQuickTrailEmitter::recalcParticlesPerSecond(){
@@ -183,7 +153,7 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
int gId = m_system->groupIds[m_follow];
int gId2 = groupId();
- for (int i=0; i<m_system->groupData[gId]->data.count(); i++) {
+ for (int i=0; i<m_system->groupData[gId]->data.size(); i++) {
QQuickParticleData *d = m_system->groupData[gId]->data[i];
if (!d->stillAlive(m_system)){
m_lastEmission[i] = time; //Should only start emitting when it returns to life
@@ -268,21 +238,15 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
m_system->emitParticle(d, this);
if (isEmitConnected() || isEmitFollowConnected()) {
- QQmlEngine *qmlEngine = ::qmlEngine(this);
- QV4::ExecutionEngine *v4 = qmlEngine->handle();
- QV4::Scope scope(v4);
- QV4::ScopedArrayObject array(scope, v4->newArrayObject(toEmit.size()));
- QV4::ScopedValue v(scope);
- for (int i=0; i<toEmit.size(); i++)
- array->put(i, (v = toEmit[i]->v4Value(m_system)));
+ QList<QQuickV4ParticleData> particles;
+ particles.reserve(toEmit.size());
+ for (QQuickParticleData *particle : std::as_const(toEmit))
+ particles.push_back(particle->v4Value(m_system));
- QJSValue particles;
- QJSValuePrivate::setValue(&particles, array);
if (isEmitFollowConnected()) {
//A chance for many arbitrary JS changes
- emit emitFollowParticles(
- particles, QJSValuePrivate::fromReturnedValue(d->v4Value(m_system)));
+ emit emitFollowParticles(particles, d->v4Value(m_system));
} else if (isEmitConnected()) {
emit emitParticles(particles);//A chance for arbitrary JS changes
}
diff --git a/src/particles/qquicktrailemitter_p.h b/src/particles/qquicktrailemitter_p.h
index 6cf2dc0c98..1fee0738d1 100644
--- a/src/particles/qquicktrailemitter_p.h
+++ b/src/particles/qquicktrailemitter_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef FOLLOWEMITTER_H
#define FOLLOWEMITTER_H
@@ -55,7 +19,7 @@
QT_BEGIN_NAMESPACE
-class QQuickTrailEmitter : public QQuickParticleEmitter
+class Q_QUICKPARTICLES_EXPORT QQuickTrailEmitter : public QQuickParticleEmitter
{
Q_OBJECT
Q_PROPERTY(QString follow READ follow WRITE setFollow NOTIFY followChanged)
@@ -72,7 +36,7 @@ public:
ParticleSize = -2//Anything less than 0 will do
};
Q_ENUM(EmitSize)
- explicit QQuickTrailEmitter(QQuickItem *parent = 0);
+ explicit QQuickTrailEmitter(QQuickItem *parent = nullptr);
void emitWindow(int timeStamp) override;
void reset() override;
@@ -102,7 +66,9 @@ public:
}
Q_SIGNALS:
- void emitFollowParticles(const QJSValue &particles, const QJSValue &followed);
+ void emitFollowParticles(
+ const QList<QQuickV4ParticleData> &particles,
+ const QQuickV4ParticleData &followed);
void particlesPerParticlePerSecondChanged(int arg);
diff --git a/src/particles/qquickturbulence.cpp b/src/particles/qquickturbulence.cpp
index 11301ca9cb..ff892983f6 100644
--- a/src/particles/qquickturbulence.cpp
+++ b/src/particles/qquickturbulence.cpp
@@ -1,41 +1,7 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qquickturbulence_p.h"
#include "qquickparticlepainter_p.h"//TODO: Why was this needed again?
diff --git a/src/particles/qquickturbulence_p.h b/src/particles/qquickturbulence_p.h
index a4aef063de..bf18aa617a 100644
--- a/src/particles/qquickturbulence_p.h
+++ b/src/particles/qquickturbulence_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef TURBULENCEAFFECTOR_H
#define TURBULENCEAFFECTOR_H
@@ -57,7 +21,7 @@ QT_BEGIN_NAMESPACE
class QQuickParticlePainter;
-class QQuickTurbulenceAffector : public QQuickParticleAffector
+class Q_QUICKPARTICLES_EXPORT QQuickTurbulenceAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged)
@@ -66,7 +30,7 @@ class QQuickTurbulenceAffector : public QQuickParticleAffector
QML_ADDED_IN_VERSION(2, 0)
public:
- explicit QQuickTurbulenceAffector(QQuickItem *parent = 0);
+ explicit QQuickTurbulenceAffector(QQuickItem *parent = nullptr);
~QQuickTurbulenceAffector();
void affectSystem(qreal dt) override;
@@ -83,7 +47,7 @@ Q_SIGNALS:
void strengthChanged(qreal arg);
- void noiseSourceChanged(QUrl arg);
+ void noiseSourceChanged(const QUrl &arg);
public Q_SLOTS:
@@ -95,7 +59,7 @@ public Q_SLOTS:
}
}
- void setNoiseSource(QUrl arg)
+ void setNoiseSource(const QUrl &arg)
{
if (m_noiseSource != arg) {
m_noiseSource = arg;
diff --git a/src/particles/qquickv4particledata.cpp b/src/particles/qquickv4particledata.cpp
index d1f47da1c0..14b327d04a 100644
--- a/src/particles/qquickv4particledata.cpp
+++ b/src/particles/qquickv4particledata.cpp
@@ -1,45 +1,8 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <math.h>
#include "qquickv4particledata_p.h"
-#include "qquickparticlesystem_p.h"//for QQuickParticleData
#include <QDebug>
#include <private/qv4engine_p.h>
#include <private/qv4functionobject_p.h>
@@ -267,268 +230,4 @@ QT_BEGIN_NAMESPACE
The currentSize of the particle, interpolating between startSize and endSize based on the currentTime.
*/
-namespace QV4 {
-namespace Heap {
-struct QV4ParticleData : QV4::Object::Data {
- void init(QQuickParticleData *datum, QQuickParticleSystem* particleSystem)
- {
- Object::init();
- this->datum = datum;
- this->particleSystem = particleSystem;
- }
- QQuickParticleData* datum;//TODO: Guard needed?
- QQuickParticleSystem* particleSystem;
-};
-}
-}
-
-//### Particle data handles are not locked to within certain scopes like QQuickContext2D, but there's no way to reload either...
-struct QV4ParticleData : public QV4::Object
-{
- V4_OBJECT2(QV4ParticleData, QV4::Object)
-};
-
-DEFINE_OBJECT_VTABLE(QV4ParticleData);
-
-class QV4ParticleDataDeletable : public QV4::ExecutionEngine::Deletable
-{
-public:
- QV4ParticleDataDeletable(QV4::ExecutionEngine *engine);
- ~QV4ParticleDataDeletable() override;
-
- QV4::PersistentValue proto;
-};
-
-static QV4::ReturnedValue particleData_discard(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int)
-{
- QV4::Scope scope(b);
- QV4::Scoped<QV4ParticleData> r(scope, *thisObject);
-
- if (!r || !r->d()->datum)
- RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object")));
-
- r->d()->datum->lifeSpan = 0; //Don't kill(), because it could still be in the middle of being created
- RETURN_RESULT(QV4::Encode::undefined());
-}
-
-static QV4::ReturnedValue particleData_lifeLeft(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int)
-{
- QV4::Scope scope(b);
- QV4::Scoped<QV4ParticleData> r(scope, *thisObject);
-
- if (!r || !r->d()->datum)
- RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object")));
-
- RETURN_RESULT(QV4::Encode(r->d()->datum->lifeLeft(r->d()->particleSystem)));
-}
-
-static QV4::ReturnedValue particleData_curSize(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int)
-{
- QV4::Scope scope(b);
- QV4::Scoped<QV4ParticleData> r(scope, *thisObject);
-
- if (!r || !r->d()->datum)
- RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object")));
-
- RETURN_RESULT(QV4::Encode(r->d()->datum->curSize(r->d()->particleSystem)));
-}
-#define COLOR_GETTER_AND_SETTER(VAR, NAME) static QV4::ReturnedValue particleData_get_ ## NAME (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) \
-{ \
- QV4::Scope scope(b); \
- QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
- if (!r || !r->d()->datum) \
- RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object"))); \
-\
- RETURN_RESULT(QV4::Encode((r->d()->datum->color. VAR )/255.0));\
-}\
-\
-static QV4::ReturnedValue particleData_set_ ## NAME (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)\
-{\
- QV4::Scope scope(b); \
- QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
- if (!r || !r->d()->datum)\
- RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object")));\
-\
- double d = argc ? argv[0].toNumber() : 0; \
- r->d()->datum->color. VAR = qMin(255, qMax(0, (int)::floor(d * 255.0)));\
- RETURN_UNDEFINED(); \
-}
-
-
-#define SEMIBOOL_GETTER_AND_SETTER(VARIABLE) static QV4::ReturnedValue particleData_get_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) \
-{ \
- QV4::Scope scope(b); \
- QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
- if (!r || !r->d()->datum) \
- RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object"))); \
-\
- RETURN_RESULT(QV4::Encode(r->d()->datum-> VARIABLE));\
-}\
-\
-static QV4::ReturnedValue particleData_set_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)\
-{\
- QV4::Scope scope(b); \
- QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
- if (!r || !r->d()->datum)\
- RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object")));\
-\
- r->d()->datum-> VARIABLE = (argc && argv[0].toBoolean()) ? 1.0 : 0.0;\
- RETURN_UNDEFINED(); \
-}
-
-#define FLOAT_GETTER_AND_SETTER(VARIABLE) static QV4::ReturnedValue particleData_get_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) \
-{ \
- QV4::Scope scope(b); \
- QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
- if (!r || !r->d()->datum) \
- RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object"))); \
-\
- RETURN_RESULT(QV4::Encode(r->d()->datum-> VARIABLE));\
-}\
-\
-static QV4::ReturnedValue particleData_set_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)\
-{\
- QV4::Scope scope(b); \
- QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
- if (!r || !r->d()->datum)\
- RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object")));\
-\
- r->d()->datum-> VARIABLE = argc ? argv[0].toNumber() : qt_qnan();\
- RETURN_UNDEFINED(); \
-}
-
-#define FAKE_FLOAT_GETTER_AND_SETTER(VARIABLE, GETTER, SETTER) static QV4::ReturnedValue particleData_get_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) \
-{ \
- QV4::Scope scope(b); \
- QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
- if (!r || !r->d()->datum) \
- RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object"))); \
-\
- RETURN_RESULT(QV4::Encode(r->d()->datum-> GETTER (r->d()->particleSystem)));\
-}\
-\
-static QV4::ReturnedValue particleData_set_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)\
-{\
- QV4::Scope scope(b); \
- QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
- if (!r || !r->d()->datum)\
- RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object")));\
-\
- r->d()->datum-> SETTER (argc ? argv[0].toNumber() : qt_qnan(), r->d()->particleSystem);\
- RETURN_UNDEFINED(); \
-}
-
-#define REGISTER_ACCESSOR(PROTO, ENGINE, VARIABLE, NAME) \
- PROTO ->defineAccessorProperty( QStringLiteral( #NAME ), particleData_get_ ## VARIABLE , particleData_set_ ## VARIABLE )
-
-COLOR_GETTER_AND_SETTER(r, red)
-COLOR_GETTER_AND_SETTER(g, green)
-COLOR_GETTER_AND_SETTER(b, blue)
-COLOR_GETTER_AND_SETTER(a, alpha)
-SEMIBOOL_GETTER_AND_SETTER(autoRotate)
-SEMIBOOL_GETTER_AND_SETTER(update)
-FLOAT_GETTER_AND_SETTER(x)
-FLOAT_GETTER_AND_SETTER(y)
-FLOAT_GETTER_AND_SETTER(t)
-FLOAT_GETTER_AND_SETTER(lifeSpan)
-FLOAT_GETTER_AND_SETTER(size)
-FLOAT_GETTER_AND_SETTER(endSize)
-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)
-FLOAT_GETTER_AND_SETTER(xy)
-FLOAT_GETTER_AND_SETTER(yx)
-FLOAT_GETTER_AND_SETTER(yy)
-FLOAT_GETTER_AND_SETTER(rotation)
-FLOAT_GETTER_AND_SETTER(rotationVelocity)
-FLOAT_GETTER_AND_SETTER(animIdx)
-FLOAT_GETTER_AND_SETTER(frameDuration)
-FLOAT_GETTER_AND_SETTER(frameAt)
-FLOAT_GETTER_AND_SETTER(frameCount)
-FLOAT_GETTER_AND_SETTER(animT)
-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)
-
-QV4ParticleDataDeletable::QV4ParticleDataDeletable(QV4::ExecutionEngine *v4)
-{
- QV4::Scope scope(v4);
- QV4::ScopedObject p(scope, v4->newObject());
-
- p->defineDefaultProperty(QStringLiteral("discard"), particleData_discard);
- p->defineDefaultProperty(QStringLiteral("lifeLeft"), particleData_lifeLeft);
- p->defineDefaultProperty(QStringLiteral("currentSize"), particleData_curSize);
-
- REGISTER_ACCESSOR(p, v4, x, initialX);
- REGISTER_ACCESSOR(p, v4, y, initialY);
- REGISTER_ACCESSOR(p, v4, t, t);
- REGISTER_ACCESSOR(p, v4, lifeSpan, lifeSpan);
- REGISTER_ACCESSOR(p, v4, size, startSize);
- REGISTER_ACCESSOR(p, v4, endSize, endSize);
- REGISTER_ACCESSOR(p, v4, vx, initialVX);
- REGISTER_ACCESSOR(p, v4, vy, initialVY);
- REGISTER_ACCESSOR(p, v4, ax, initialAX);
- REGISTER_ACCESSOR(p, v4, ay, initialAY);
- REGISTER_ACCESSOR(p, v4, xx, xDeformationVectorX);
- REGISTER_ACCESSOR(p, v4, xy, xDeformationVectorY);
- REGISTER_ACCESSOR(p, v4, yx, yDeformationVectorX);
- REGISTER_ACCESSOR(p, v4, yy, yDeformationVectorY);
- REGISTER_ACCESSOR(p, v4, rotation, rotation);
- REGISTER_ACCESSOR(p, v4, rotationVelocity, rotationVelocity);
- REGISTER_ACCESSOR(p, v4, autoRotate, autoRotate);
- REGISTER_ACCESSOR(p, v4, animIdx, animationIndex);
- REGISTER_ACCESSOR(p, v4, frameDuration, frameDuration);
- REGISTER_ACCESSOR(p, v4, frameAt, frameAt);
- REGISTER_ACCESSOR(p, v4, frameCount, frameCount);
- REGISTER_ACCESSOR(p, v4, animT, animationT);
- REGISTER_ACCESSOR(p, v4, update, update);
- REGISTER_ACCESSOR(p, v4, curX, x);
- REGISTER_ACCESSOR(p, v4, curVX, vx);
- REGISTER_ACCESSOR(p, v4, curAX, ax);
- REGISTER_ACCESSOR(p, v4, curY, y);
- REGISTER_ACCESSOR(p, v4, curVY, vy);
- REGISTER_ACCESSOR(p, v4, curAY, ay);
- REGISTER_ACCESSOR(p, v4, red, red);
- REGISTER_ACCESSOR(p, v4, green, green);
- REGISTER_ACCESSOR(p, v4, blue, blue);
- REGISTER_ACCESSOR(p, v4, alpha, alpha);
-
- proto = p;
-}
-
-QV4ParticleDataDeletable::~QV4ParticleDataDeletable()
-{
-}
-
-V4_DEFINE_EXTENSION(QV4ParticleDataDeletable, particleV4Data);
-
-
-QQuickV4ParticleData::QQuickV4ParticleData(QV4::ExecutionEngine* v4, QQuickParticleData* datum,
- QQuickParticleSystem *system)
-{
- if (!v4 || !datum)
- return;
-
- QV4::Scope scope(v4);
- QV4ParticleDataDeletable *d = particleV4Data(scope.engine);
- QV4::ScopedObject o(scope, v4->memoryManager->allocate<QV4ParticleData>(datum, system));
- QV4::ScopedObject p(scope, d->proto.value());
- o->setPrototypeUnchecked(p);
- m_v4Value = o;
-}
-
-QQuickV4ParticleData::~QQuickV4ParticleData()
-{
-}
-
-QV4::ReturnedValue QQuickV4ParticleData::v4Value() const
-{
- return m_v4Value.value();
-}
-
QT_END_NAMESPACE
diff --git a/src/particles/qquickv4particledata_p.h b/src/particles/qquickv4particledata_p.h
index e41700f7c2..d51c4871e8 100644
--- a/src/particles/qquickv4particledata_p.h
+++ b/src/particles/qquickv4particledata_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQuickV8PARTICLEDATA_H
#define QQuickV8PARTICLEDATA_H
@@ -51,20 +15,109 @@
// We mean it.
//
-#include <private/qv4persistent_p.h>
-#include <private/qv4value_p.h>
+#include <private/qquickparticlesystem_p.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
-class QQuickParticleData;
-class QQuickParticleSystem;
-class QQuickV4ParticleData {
+class QQuickV4ParticleData
+{
+ Q_GADGET
+ QML_VALUE_TYPE(particle)
+ QML_ADDED_IN_VERSION(6, 7)
+
+#define Q_QUICK_PARTICLE_ACCESSOR(TYPE, VARIABLE, NAME) \
+ Q_PROPERTY(TYPE NAME READ NAME WRITE set_ ## NAME FINAL) \
+ TYPE NAME() const { return datum ? datum->VARIABLE : TYPE(); } \
+ void set_ ## NAME(TYPE a) { if (datum) datum->VARIABLE = a; }
+
+ Q_QUICK_PARTICLE_ACCESSOR(float, x, initialX)
+ Q_QUICK_PARTICLE_ACCESSOR(float, vx, initialVX)
+ Q_QUICK_PARTICLE_ACCESSOR(float, ax, initialAX)
+ Q_QUICK_PARTICLE_ACCESSOR(float, y, initialY)
+ Q_QUICK_PARTICLE_ACCESSOR(float, vy, initialVY)
+ Q_QUICK_PARTICLE_ACCESSOR(float, ay, initialAY)
+ Q_QUICK_PARTICLE_ACCESSOR(float, t, t)
+ Q_QUICK_PARTICLE_ACCESSOR(float, size, startSize)
+ Q_QUICK_PARTICLE_ACCESSOR(float, endSize, endSize)
+ Q_QUICK_PARTICLE_ACCESSOR(float, lifeSpan, lifeSpan)
+ Q_QUICK_PARTICLE_ACCESSOR(float, rotation, rotation)
+ Q_QUICK_PARTICLE_ACCESSOR(float, rotationVelocity, rotationVelocity)
+ Q_QUICK_PARTICLE_ACCESSOR(bool, autoRotate, autoRotate)
+ Q_QUICK_PARTICLE_ACCESSOR(bool, update, update)
+ Q_QUICK_PARTICLE_ACCESSOR(float, xx, xDeformationVectorX)
+ Q_QUICK_PARTICLE_ACCESSOR(float, yx, yDeformationVectorX)
+ Q_QUICK_PARTICLE_ACCESSOR(float, xy, xDeformationVectorY)
+ Q_QUICK_PARTICLE_ACCESSOR(float, yy, yDeformationVectorY)
+
+ // Undocumented?
+ Q_QUICK_PARTICLE_ACCESSOR(float, animIdx, animationIndex)
+ Q_QUICK_PARTICLE_ACCESSOR(float, frameDuration, frameDuration)
+ Q_QUICK_PARTICLE_ACCESSOR(float, frameAt, frameAt)
+ Q_QUICK_PARTICLE_ACCESSOR(float, frameCount, frameCount)
+ Q_QUICK_PARTICLE_ACCESSOR(float, animT, animationT)
+
+#undef Q_QUICK_PARTICLE_ACCESSOR
+
+#define Q_QUICK_PARTICLE_SYSTEM_ACCESSOR(GETTER, SETTER, NAME) \
+ Q_PROPERTY(float NAME READ NAME WRITE set_ ## NAME) \
+ float NAME() const { return (datum && particleSystem) ? datum->GETTER(particleSystem) : 0; } \
+ void set_ ## NAME(float a) { if (datum && particleSystem) datum->SETTER(a, particleSystem); }
+
+ Q_QUICK_PARTICLE_SYSTEM_ACCESSOR(curX, setInstantaneousX, x)
+ Q_QUICK_PARTICLE_SYSTEM_ACCESSOR(curVX, setInstantaneousVX, vx)
+ Q_QUICK_PARTICLE_SYSTEM_ACCESSOR(curAX, setInstantaneousAX, ax)
+ Q_QUICK_PARTICLE_SYSTEM_ACCESSOR(curY, setInstantaneousY, y)
+ Q_QUICK_PARTICLE_SYSTEM_ACCESSOR(curVY, setInstantaneousVY, vy)
+ Q_QUICK_PARTICLE_SYSTEM_ACCESSOR(curAY, setInstantaneousAY, ay)
+
+#undef Q_QUICK_PARTICLE_SYSTEM_ACCESSOR
+
+#define Q_QUICK_PARTICLE_COLOR_ACCESSOR(VAR, NAME) \
+ Q_PROPERTY(float NAME READ NAME WRITE set_ ## NAME) \
+ float NAME() const { return datum ? datum->color.VAR / 255.0 : 0.0; } \
+ void set_ ## NAME(float a)\
+ {\
+ if (datum)\
+ datum->color.VAR = qMin(255, qMax(0, (int)::floor(a * 255.0)));\
+ }
+
+ Q_QUICK_PARTICLE_COLOR_ACCESSOR(r, red)
+ Q_QUICK_PARTICLE_COLOR_ACCESSOR(g, green)
+ Q_QUICK_PARTICLE_COLOR_ACCESSOR(b, blue)
+ Q_QUICK_PARTICLE_COLOR_ACCESSOR(a, alpha)
+
+#undef Q_QUICK_PARTICLE_COLOR_ACCESSOR
+
+ Q_PROPERTY(float lifeLeft READ lifeLeft)
+ Q_PROPERTY(float currentSize READ currentSize)
+
public:
- QQuickV4ParticleData(QV4::ExecutionEngine*, QQuickParticleData*, QQuickParticleSystem *system);
- ~QQuickV4ParticleData();
- QV4::ReturnedValue v4Value() const;
+ QQuickV4ParticleData() = default;
+ QQuickV4ParticleData(QQuickParticleData *datum, QQuickParticleSystem *system)
+ : datum(datum)
+ , particleSystem(system)
+ {}
+
+ Q_INVOKABLE void discard()
+ {
+ if (datum)
+ datum->lifeSpan = 0;
+ }
+
+ float lifeLeft() const
+ {
+ return (datum && particleSystem) ? datum->lifeLeft(particleSystem) : 0.0;
+ }
+
+ float currentSize() const
+ {
+ return (datum && particleSystem) ? datum->curSize(particleSystem) : 0.0;
+ }
+
private:
- QV4::PersistentValue m_v4Value;
+ QQuickParticleData *datum = nullptr;
+ QQuickParticleSystem *particleSystem = nullptr;
};
diff --git a/src/particles/qquickwander.cpp b/src/particles/qquickwander.cpp
index 182bf4a099..648a2e4097 100644
--- a/src/particles/qquickwander.cpp
+++ b/src/particles/qquickwander.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwander_p.h"
#include "qquickparticlesystem_p.h"//for ParticlesVertices
diff --git a/src/particles/qquickwander_p.h b/src/particles/qquickwander_p.h
index 174b780562..e05e91a11e 100644
--- a/src/particles/qquickwander_p.h
+++ b/src/particles/qquickwander_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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: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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WANDERAFFECTOR_H
#define WANDERAFFECTOR_H
@@ -64,7 +28,7 @@ struct WanderData{
qreal y_var;
};
-class QQuickWanderAffector : public QQuickParticleAffector
+class Q_QUICKPARTICLES_EXPORT QQuickWanderAffector : public QQuickParticleAffector
{
Q_OBJECT
Q_PROPERTY(qreal pace READ pace WRITE setPace NOTIFY paceChanged)
@@ -82,7 +46,7 @@ public:
};
Q_ENUM(AffectableParameters)
- explicit QQuickWanderAffector(QQuickItem *parent = 0);
+ explicit QQuickWanderAffector(QQuickItem *parent = nullptr);
~QQuickWanderAffector();
// virtual void reset(int systemIdx);
diff --git a/src/particles/qtquickparticlesglobal_p.h b/src/particles/qtquickparticlesglobal_p.h
index 927bc29050..6df7f93429 100644
--- a/src/particles/qtquickparticlesglobal_p.h
+++ b/src/particles/qtquickparticlesglobal_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQuickParticles module of the Qt Toolkit.
-**
-** $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 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 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.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTQUICKPARTICLESGLOBAL_P_H
#define QTQUICKPARTICLESGLOBAL_P_H
@@ -52,19 +16,6 @@
//
#include <QtCore/qglobal.h>
-
-// We only have private exports from this library
-
-#ifndef QT_STATIC
-# if defined(QT_BUILD_QUICKPARTICLES_LIB)
-# define Q_QUICKPARTICLES_PRIVATE_EXPORT Q_DECL_EXPORT
-# else
-# define Q_QUICKPARTICLES_PRIVATE_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define Q_QUICKPARTICLES_PRIVATE_EXPORT
-#endif
-
-void Q_QUICKPARTICLES_PRIVATE_EXPORT qml_register_types_QtQuick_Particles();
+#include <QtQuickParticles/qtquickparticlesexports.h>
#endif // QTQUICKPARTICLESGLOBAL_P_H
diff --git a/src/particles/shaders_ng/compile.bat b/src/particles/shaders_ng/compile.bat
deleted file mode 100755
index cc6ecb68d3..0000000000
--- a/src/particles/shaders_ng/compile.bat
+++ /dev/null
@@ -1,64 +0,0 @@
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-::
-:: Copyright (C) 2019 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: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 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 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.
-::
-:: 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$
-::
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:: For HLSL we invoke fxc.exe (-c argument) and store the resulting intermediate format
-:: instead of HLSL source, so this needs to be run on Windows from a developer command prompt.
-
-:: For SPIR-V the optimizer is requested (-O argument) which means spirv-opt must be
-:: invokable (e.g. because it's in the PATH from the Vulkan SDK)
-
-qsb -DPOINT -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_simplepoint.vert.qsb imageparticle.vert
-qsb -DPOINT --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_simplepoint.frag.qsb imageparticle.frag
-
-qsb -DPOINT -DCOLOR -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_coloredpoint.vert.qsb imageparticle.vert
-qsb -DPOINT -DCOLOR --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_coloredpoint.frag.qsb imageparticle.frag
-
-qsb -DCOLOR -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_colored.vert.qsb imageparticle.vert
-qsb -DCOLOR --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_colored.frag.qsb imageparticle.frag
-
-qsb -DDEFORM -DCOLOR -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_deformed.vert.qsb imageparticle.vert
-qsb -DDEFORM -DCOLOR --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_deformed.frag.qsb imageparticle.frag
-
-qsb -DTABLE -DDEFORM -DCOLOR -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_tabled.vert.qsb imageparticle.vert
-qsb -DTABLE -DDEFORM -DCOLOR --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_tabled.frag.qsb imageparticle.frag
-
-qsb -DSPRITE -DTABLE -DDEFORM -DCOLOR -b --zorder-loc 8 --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_sprite.vert.qsb imageparticle.vert
-qsb -DSPRITE -DTABLE -DDEFORM -DCOLOR --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_sprite.frag.qsb imageparticle.frag
-
-
diff --git a/src/particles/shaders_ng/imageparticle.frag b/src/particles/shaders_ng/imageparticle.frag
index 90b79e6ea9..2134f54e1b 100644
--- a/src/particles/shaders_ng/imageparticle.frag
+++ b/src/particles/shaders_ng/imageparticle.frag
@@ -1,3 +1,6 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
#version 440
#if defined(TABLE)
@@ -19,7 +22,11 @@ layout(location = 2) in float fFade;
layout(location = 0) out vec4 fragColor;
layout(std140, binding = 0) uniform buf {
+#if QSHADER_VIEW_COUNT >= 2
+ mat4 matrix[QSHADER_VIEW_COUNT];
+#else
mat4 matrix;
+#endif
float opacity;
float entry;
float timestamp;
diff --git a/src/particles/shaders_ng/imageparticle.vert b/src/particles/shaders_ng/imageparticle.vert
index da3533dc40..52e4a59d62 100644
--- a/src/particles/shaders_ng/imageparticle.vert
+++ b/src/particles/shaders_ng/imageparticle.vert
@@ -44,7 +44,11 @@ layout(location = 2) out float fFade;
#endif
layout(std140, binding = 0) uniform buf {
+#if QSHADER_VIEW_COUNT >= 2
+ mat4 matrix[QSHADER_VIEW_COUNT];
+#else
mat4 matrix;
+#endif
float opacity;
float entry;
float timestamp;
@@ -53,18 +57,22 @@ layout(std140, binding = 0) uniform buf {
float opacitytable[64];
} ubuf;
-out gl_PerVertex { vec4 gl_Position; float gl_PointSize; };
-
void main()
{
float t = (ubuf.timestamp - vData.x) / vData.y;
+#if QSHADER_VIEW_COUNT >= 2
+ mat4 matrix = ubuf.matrix[gl_ViewIndex];
+#else
+ mat4 matrix = ubuf.matrix;
+#endif
+
if (t < 0. || t > 1.) {
#if defined(DEFORM)
- gl_Position = ubuf.matrix * vec4(vPosRot.x, vPosRot.y, 0., 1.);
+ gl_Position = matrix * vec4(vPosRot.x, vPosRot.y, 0., 1.);
#elif defined(POINT)
gl_PointSize = 0.;
#else
- gl_Position = ubuf.matrix * vec4(vPos.x, vPos.y, 0., 1.);
+ gl_Position = matrix * vec4(vPos.x, vPos.y, 0., 1.);
#endif
} else {
#if defined(SPRITE)
@@ -96,11 +104,11 @@ void main()
if (currentSize <= 0.) {
#if defined(DEFORM)
- gl_Position = ubuf.matrix * vec4(vPosRot.x, vPosRot.y, 0., 1.);
+ gl_Position = matrix * vec4(vPosRot.x, vPosRot.y, 0., 1.);
#elif defined(POINT)
gl_PointSize = 0.;
#else
- gl_Position = ubuf.matrix * vec4(vPos.x, vPos.y, 0., 1.);
+ gl_Position = matrix * vec4(vPos.x, vPos.y, 0., 1.);
#endif
} else {
@@ -146,7 +154,7 @@ void main()
+ vVec.xy * t * vData.y // apply velocity
+ 0.5 * vVec.zw * pow(t * vData.y, 2.); // apply acceleration
#endif
- gl_Position = ubuf.matrix * vec4(pos.x, pos.y, 0, 1);
+ gl_Position = matrix * vec4(pos.x, pos.y, 0, 1);
#if defined(COLOR)
fColor = vColor * fade;
diff --git a/src/particles/shaders_ng/imageparticle_colored.frag.qsb b/src/particles/shaders_ng/imageparticle_colored.frag.qsb
deleted file mode 100644
index 5dfc5d1d97..0000000000
--- a/src/particles/shaders_ng/imageparticle_colored.frag.qsb
+++ /dev/null
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_colored.vert.qsb b/src/particles/shaders_ng/imageparticle_colored.vert.qsb
deleted file mode 100644
index b2548042ca..0000000000
--- a/src/particles/shaders_ng/imageparticle_colored.vert.qsb
+++ /dev/null
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_coloredpoint.frag.qsb b/src/particles/shaders_ng/imageparticle_coloredpoint.frag.qsb
deleted file mode 100644
index 6e0373fd3b..0000000000
--- a/src/particles/shaders_ng/imageparticle_coloredpoint.frag.qsb
+++ /dev/null
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_coloredpoint.vert.qsb b/src/particles/shaders_ng/imageparticle_coloredpoint.vert.qsb
deleted file mode 100644
index 09b31c77c3..0000000000
--- a/src/particles/shaders_ng/imageparticle_coloredpoint.vert.qsb
+++ /dev/null
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_deformed.frag.qsb b/src/particles/shaders_ng/imageparticle_deformed.frag.qsb
deleted file mode 100644
index 3df7e49cd0..0000000000
--- a/src/particles/shaders_ng/imageparticle_deformed.frag.qsb
+++ /dev/null
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_deformed.vert.qsb b/src/particles/shaders_ng/imageparticle_deformed.vert.qsb
deleted file mode 100644
index 121e35fbb0..0000000000
--- a/src/particles/shaders_ng/imageparticle_deformed.vert.qsb
+++ /dev/null
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_simplepoint.frag.qsb b/src/particles/shaders_ng/imageparticle_simplepoint.frag.qsb
deleted file mode 100644
index 6199c48589..0000000000
--- a/src/particles/shaders_ng/imageparticle_simplepoint.frag.qsb
+++ /dev/null
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_simplepoint.vert.qsb b/src/particles/shaders_ng/imageparticle_simplepoint.vert.qsb
deleted file mode 100644
index ff8a5403d6..0000000000
--- a/src/particles/shaders_ng/imageparticle_simplepoint.vert.qsb
+++ /dev/null
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_sprite.frag.qsb b/src/particles/shaders_ng/imageparticle_sprite.frag.qsb
deleted file mode 100644
index 2df0734683..0000000000
--- a/src/particles/shaders_ng/imageparticle_sprite.frag.qsb
+++ /dev/null
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_sprite.vert.qsb b/src/particles/shaders_ng/imageparticle_sprite.vert.qsb
deleted file mode 100644
index 5ef575a868..0000000000
--- a/src/particles/shaders_ng/imageparticle_sprite.vert.qsb
+++ /dev/null
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_tabled.frag.qsb b/src/particles/shaders_ng/imageparticle_tabled.frag.qsb
deleted file mode 100644
index 08a82fe8ab..0000000000
--- a/src/particles/shaders_ng/imageparticle_tabled.frag.qsb
+++ /dev/null
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_tabled.vert.qsb b/src/particles/shaders_ng/imageparticle_tabled.vert.qsb
deleted file mode 100644
index febe5a495a..0000000000
--- a/src/particles/shaders_ng/imageparticle_tabled.vert.qsb
+++ /dev/null
Binary files differ