Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QQUICK3DPARTICLEGRAVITY_H
5#define QQUICK3DPARTICLEGRAVITY_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 <QtQuick3DParticles/private/qquick3dparticleaffector_p.h>
20
22
23class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleGravity : public QQuick3DParticleAffector
24{
26 Q_PROPERTY(float magnitude READ magnitude WRITE setMagnitude NOTIFY magnitudeChanged)
27 Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged)
28 QML_NAMED_ELEMENT(Gravity3D)
30
31public:
32 QQuick3DParticleGravity(QQuick3DNode *parent = nullptr);
33
34 float magnitude() const;
35 const QVector3D &direction() const;
36
37public Q_SLOTS:
38 void setDirection(const QVector3D &direction);
39 void setMagnitude(float magnitude);
40
42 void magnitudeChanged();
43 void directionChanged();
44
45protected:
46 void affectParticle(const QQuick3DParticleData &sd, QQuick3DParticleDataCurrent *d, float time) override;
47
49 float m_magnitude = 100.0f;
50 QVector3D m_direction = {0.0f, -1.0f, 0.0f};
51 QVector3D m_directionNormalized = {0.0f, -1.0f, 0.0f};
52};
53
55
56#endif // QQUICK3DPARTICLEGRAVITY_H
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
direction
Combined button and popup list for selecting options.
GLfloat GLfloat f
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS