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
qquick3dparticleattractor_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 QQUICK3DPARTICLEATTRACTOR_H
7#define QQUICK3DPARTICLEATTRACTOR_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 <QtQuick3DParticles/private/qquick3dparticleaffector_p.h>
21#include <QtQuick3DParticles/private/qquick3dparticleshape_p.h>
22
24
25class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleAttractor : public QQuick3DParticleAffector
26{
27 Q_OBJECT
28 Q_PROPERTY(QVector3D positionVariation READ positionVariation WRITE setPositionVariation NOTIFY positionVariationChanged)
29 Q_PROPERTY(QQuick3DParticleAbstractShape *shape READ shape WRITE setShape NOTIFY shapeChanged)
30 Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
31 Q_PROPERTY(int durationVariation READ durationVariation WRITE setDurationVariation NOTIFY durationVariationChanged)
32 Q_PROPERTY(bool hideAtEnd READ hideAtEnd WRITE setHideAtEnd NOTIFY hideAtEndChanged)
33 Q_PROPERTY(bool useCachedPositions READ useCachedPositions WRITE setUseCachedPositions NOTIFY useCachedPositionsChanged)
34 Q_PROPERTY(int positionsAmount READ positionsAmount WRITE setPositionsAmount NOTIFY positionsAmountChanged)
35 QML_NAMED_ELEMENT(Attractor3D)
36 QML_ADDED_IN_VERSION(6, 2)
37
38public:
39 QQuick3DParticleAttractor(QQuick3DNode *parent = nullptr);
40
41 QVector3D positionVariation() const;
42 QQuick3DParticleAbstractShape *shape() const;
43 int duration() const;
44 int durationVariation() const;
45 bool hideAtEnd() const;
46 bool useCachedPositions() const;
47 int positionsAmount() const;
48
49public Q_SLOTS:
50 void setPositionVariation(const QVector3D &positionVariation);
51 void setShape(QQuick3DParticleAbstractShape *shape);
52 void setDuration(int duration);
53 void setDurationVariation(int durationVariation);
54 void setHideAtEnd(bool hideAtEnd);
55 void setUseCachedPositions(bool useCachedPositions);
56 void setPositionsAmount(int positionsAmount);
57
58Q_SIGNALS:
59 void positionVariationChanged();
60 void shapeChanged();
61 void durationChanged();
62 void durationVariationChanged();
63 void hideAtEndChanged();
64 void useCachedPositionsChanged();
65 void positionsAmountChanged();
66
67protected:
68 void prepareToAffect() override;
69 void affectParticle(const QQuick3DParticleData &sd, QQuick3DParticleDataCurrent *d, float time) override;
70
71private:
72 void updateShapePositions();
73
74 QQuick3DParticleAbstractShape *m_shape = nullptr;
75 QList<QVector3D> m_shapePositionList;
76 QVector3D m_centerPos;
77 QMatrix4x4 m_particleTransform;
78 bool m_shapeDirty = false;
79 int m_duration = -1;
80 int m_durationVariation = 0;
81 QVector3D m_positionVariation;
82 bool m_hideAtEnd = false;
83 bool m_useCachedPositions = true;
84 int m_positionsAmount = 0;
85};
86
87QT_END_NAMESPACE
88
89#endif // QQUICK3DPARTICLEATTRACTOR_H
Combined button and popup list for selecting options.
QT_BEGIN_NAMESPACE const float MIN_DURATION
\qmltype Attractor3D \inherits Affector3D \inqmlmodule QtQuick3D.Particles3D