| 1 | // Copyright (C) 2021 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QQUICK3DPARTICLETRAILEMITTER_H |
| 5 | #define QQUICK3DPARTICLETRAILEMITTER_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtQuick3DParticles/private/qquick3dparticleemitter_p.h> |
| 19 | #include <QtQuick3DParticles/private/qquick3dparticle_p.h> |
| 20 | #include <QtQuick3DParticles/private/qquick3dparticledata_p.h> |
| 21 | #include <QQmlEngine> |
| 22 | #include <QList> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleTrailEmitter : public QQuick3DParticleEmitter |
| 27 | { |
| 28 | Q_OBJECT |
| 29 | Q_PROPERTY(QQuick3DParticle *follow READ follow WRITE setFollow NOTIFY followChanged) |
| 30 | QML_NAMED_ELEMENT(TrailEmitter3D) |
| 31 | QML_ADDED_IN_VERSION(6, 2) |
| 32 | |
| 33 | public: |
| 34 | QQuick3DParticleTrailEmitter(QQuick3DNode *parent = nullptr); |
| 35 | |
| 36 | QQuick3DParticle *follow() const; |
| 37 | |
| 38 | Q_INVOKABLE void burst(int count) override; |
| 39 | |
| 40 | public Q_SLOTS: |
| 41 | void setFollow(QQuick3DParticle *follow); |
| 42 | |
| 43 | Q_SIGNALS: |
| 44 | void followChanged(); |
| 45 | |
| 46 | protected: |
| 47 | friend class QQuick3DParticleSystem; |
| 48 | void emitTrailParticles(const QVector3D ¢erPos, int emitAmount, int triggerType); |
| 49 | bool hasBursts() const; |
| 50 | void clearBursts(); |
| 51 | |
| 52 | private: |
| 53 | QQuick3DParticle *m_follow = nullptr; |
| 54 | QList<QQuick3DParticleEmitBurstData> m_bursts; |
| 55 | |
| 56 | }; |
| 57 | |
| 58 | QT_END_NAMESPACE |
| 59 | |
| 60 | #endif // QQUICK3DPARTICLETRAILEMITTER_H |
| 61 | |