1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DPARTICLEVECTORDIRECTION_H
5#define QQUICK3DPARTICLEVECTORDIRECTION_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 <QVector3D>
19#include <QtQuick3DParticles/private/qquick3dparticledirection_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleVectorDirection : public QQuick3DParticleDirection
24{
25 Q_OBJECT
26 Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged)
27 Q_PROPERTY(QVector3D directionVariation READ directionVariation WRITE setDirectionVariation NOTIFY directionVariationChanged)
28 Q_PROPERTY(bool normalized READ normalized WRITE setNormalized NOTIFY normalizedChanged)
29 QML_NAMED_ELEMENT(VectorDirection3D)
30 QML_ADDED_IN_VERSION(6, 2)
31
32public:
33 QQuick3DParticleVectorDirection(QObject *parent = nullptr);
34
35 QVector3D direction() const;
36 QVector3D directionVariation() const;
37 bool normalized() const;
38
39public Q_SLOTS:
40 void setDirection(const QVector3D &direction);
41 void setDirectionVariation(const QVector3D &directionVariation);
42 void setNormalized(bool normalized);
43
44Q_SIGNALS:
45 void directionChanged();
46 void directionVariationChanged();
47 void normalizedChanged();
48
49private:
50 QVector3D sample(const QQuick3DParticleData &d) override;
51 QVector3D m_direction = {0.0f, 100.0f, 0.0f};
52 QVector3D m_directionVariation;
53 bool m_normalized = false;
54};
55
56QT_END_NAMESPACE
57
58#endif // QQUICK3DPARTICLEVECTORDIRECTION_H
59

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