1 | // Copyright (C) 2022 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QQUICK3DPARTICLEREPELLER_H |
5 | #define QQUICK3DPARTICLEREPELLER_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/qquick3dparticleaffector_p.h> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleRepeller : public QQuick3DParticleAffector |
23 | { |
24 | Q_OBJECT |
25 | Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged) |
26 | Q_PROPERTY(float outerRadius READ outerRadius WRITE setOuterRadius NOTIFY outerRadiusChanged) |
27 | Q_PROPERTY(float strength READ strength WRITE setStrength NOTIFY strengthChanged) |
28 | QML_NAMED_ELEMENT(Repeller3D) |
29 | QML_ADDED_IN_VERSION(6, 4) |
30 | public: |
31 | QQuick3DParticleRepeller(QQuick3DNode *parent = nullptr); |
32 | |
33 | float radius() const; |
34 | float outerRadius() const; |
35 | float strength() const; |
36 | |
37 | public Q_SLOTS: |
38 | void setRadius(float radius); |
39 | void setOuterRadius(float radius); |
40 | void setStrength(float strength); |
41 | |
42 | Q_SIGNALS: |
43 | void radiusChanged(); |
44 | void outerRadiusChanged(); |
45 | void strengthChanged(); |
46 | |
47 | protected: |
48 | void prepareToAffect() override; |
49 | void affectParticle(const QQuick3DParticleData &sd, QQuick3DParticleDataCurrent *d, float time) override; |
50 | |
51 | private: |
52 | float m_radius = 0.0f; |
53 | float m_outerRadius = 50.0f; |
54 | float m_strength = 50.0f; |
55 | }; |
56 | |
57 | QT_END_NAMESPACE |
58 | |
59 | #endif |
60 | |