Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3dparticlegravity_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QQUICK3DPARTICLEGRAVITY_H
7#define QQUICK3DPARTICLEGRAVITY_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QObject>
21#include <QtQuick3DParticles/private/qquick3dparticleaffector_p.h>
22
24
25class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleGravity : public QQuick3DParticleAffector
26{
27 Q_OBJECT
28 Q_PROPERTY(float magnitude READ magnitude WRITE setMagnitude NOTIFY magnitudeChanged)
29 Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged)
30 QML_NAMED_ELEMENT(Gravity3D)
31 QML_ADDED_IN_VERSION(6, 2)
32
33public:
34 QQuick3DParticleGravity(QQuick3DNode *parent = nullptr);
35
36 float magnitude() const;
37 const QVector3D &direction() const;
38
39public Q_SLOTS:
40 void setDirection(const QVector3D &direction);
41 void setMagnitude(float magnitude);
42
43Q_SIGNALS:
44 void magnitudeChanged();
45 void directionChanged();
46
47protected:
48 void affectParticle(const QQuick3DParticleData &sd, QQuick3DParticleDataCurrent *d, float time) override;
49
50private:
51 float m_magnitude = 100.0f;
52 QVector3D m_direction = {0.0f, -1.0f, 0.0f};
53 QVector3D m_directionNormalized = {0.0f, -1.0f, 0.0f};
54};
55
56QT_END_NAMESPACE
57
58#endif // QQUICK3DPARTICLEGRAVITY_H
Combined button and popup list for selecting options.