1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DPARTICLEWANDER_H
5#define QQUICK3DPARTICLEWANDER_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 <QObject>
19#include <QQmlEngine>
20#include <QtQuick3DParticles/private/qquick3dparticleaffector_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleWander : public QQuick3DParticleAffector
25{
26 Q_OBJECT
27 Q_PROPERTY(QVector3D globalAmount READ globalAmount WRITE setGlobalAmount NOTIFY globalAmountChanged)
28 Q_PROPERTY(QVector3D globalPace READ globalPace WRITE setGlobalPace NOTIFY globalPaceChanged)
29 Q_PROPERTY(QVector3D globalPaceStart READ globalPaceStart WRITE setGlobalPaceStart NOTIFY globalPaceStartChanged)
30 Q_PROPERTY(QVector3D uniqueAmount READ uniqueAmount WRITE setUniqueAmount NOTIFY uniqueAmountChanged)
31 Q_PROPERTY(QVector3D uniquePace READ uniquePace WRITE setUniquePace NOTIFY uniquePaceChanged)
32 Q_PROPERTY(float uniqueAmountVariation READ uniqueAmountVariation WRITE setUniqueAmountVariation NOTIFY uniqueAmountVariationChanged)
33 Q_PROPERTY(float uniquePaceVariation READ uniquePaceVariation WRITE setUniquePaceVariation NOTIFY uniquePaceVariationChanged)
34 Q_PROPERTY(int fadeInDuration READ fadeInDuration WRITE setFadeInDuration NOTIFY fadeInDurationChanged)
35 Q_PROPERTY(int fadeOutDuration READ fadeOutDuration WRITE setFadeOutDuration NOTIFY fadeOutDurationChanged)
36 QML_NAMED_ELEMENT(Wander3D)
37 QML_ADDED_IN_VERSION(6, 2)
38
39public:
40 QQuick3DParticleWander(QQuick3DNode *parent = nullptr);
41
42 const QVector3D &globalAmount() const;
43 const QVector3D &globalPace() const;
44 const QVector3D &globalPaceStart() const;
45 const QVector3D &uniqueAmount() const;
46 const QVector3D &uniquePace() const;
47 float uniqueAmountVariation() const;
48 float uniquePaceVariation() const;
49 int fadeInDuration() const;
50 int fadeOutDuration() const;
51
52public Q_SLOTS:
53 void setGlobalAmount(const QVector3D &globalAmount);
54 void setGlobalPace(const QVector3D &globalPace);
55 void setGlobalPaceStart(const QVector3D &globalPaceStart);
56 void setUniqueAmount(const QVector3D &uniqueAmount);
57 void setUniquePace(const QVector3D &uniquePace);
58 void setUniqueAmountVariation(float uniqueAmountVariation);
59 void setUniquePaceVariation(float uniquePaceVariation);
60 void setFadeInDuration(int fadeInDuration);
61 void setFadeOutDuration(int fadeOutDuration);
62
63Q_SIGNALS:
64 void globalAmountChanged();
65 void globalPaceChanged();
66 void globalPaceStartChanged();
67 void uniqueAmountChanged();
68 void uniquePaceChanged();
69 void uniqueAmountVariationChanged();
70 void uniquePaceVariationChanged();
71 void fadeInDurationChanged();
72 void fadeOutDurationChanged();
73
74protected:
75 void affectParticle(const QQuick3DParticleData &sd, QQuick3DParticleDataCurrent *d, float time) override;
76
77private:
78 QVector3D m_globalAmount;
79 QVector3D m_globalPace;
80 QVector3D m_globalPaceStart;
81 QVector3D m_uniqueAmount;
82 QVector3D m_uniquePace;
83 float m_uniqueAmountVariation = 0.0f;
84 float m_uniquePaceVariation = 0.0f;
85 int m_fadeInDuration = 0;
86 int m_fadeOutDuration = 0;
87};
88
89QT_END_NAMESPACE
90
91#endif // QQUICK3DPARTICLEWANDER_H
92

source code of qtquick3d/src/quick3dparticles/qquick3dparticlewander_p.h