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
qquick3dparticlemodelparticle_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 QQUICK3DPARTICLEMODELPARTICLE_H
7#define QQUICK3DPARTICLEMODELPARTICLE_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 <QColor>
21#include <QVector4D>
22#include <QtQuick3D/private/qquick3dnode_p.h>
23#include <QtQuick3D/private/qquick3dmodel_p.h>
24#include <QtQuick3D/qquick3dinstancing.h>
25
26#include <QtQuick3DParticles/private/qquick3dparticle_p.h>
27#include <QtQuick3DParticles/private/qquick3dparticlesystem_p.h>
28#include <QtQuick3DParticles/private/qquick3dparticledata_p.h>
29
30#include <QtCore/qpointer.h>
31
33
34class QQmlInstanceModel;
35class QQmlChangeSet;
37
38class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleModelParticle : public QQuick3DParticle
39{
40 Q_OBJECT
41 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
42 Q_PROPERTY(QQuick3DInstancing *instanceTable READ instanceTable NOTIFY instanceTableChanged)
43
44 QML_NAMED_ELEMENT(ModelParticle3D)
45 Q_CLASSINFO("DefaultProperty", "delegate")
46 QML_ADDED_IN_VERSION(6, 2)
47
48public:
49 QQuick3DParticleModelParticle(QQuick3DNode *parent = nullptr);
50
51 QQmlComponent *delegate() const;
52 QQuick3DInstancing *instanceTable() const;
53
54public Q_SLOTS:
55 void setDelegate(QQmlComponent *delegate);
56
57Q_SIGNALS:
58 void delegateChanged();
59 void instanceTableChanged();
60
61protected:
62 void componentComplete() override;
63 void itemChange(ItemChange change, const ItemChangeData &value) override;
64
65 void setDepthBias(float bias) override
66 {
67 QQuick3DParticle::setDepthBias(bias);
68 if (m_node)
69 updateDepthBias(bias);
70 }
71private:
72 void regenerate();
73 void handleMaxAmountChanged(int amount);
74 void handleSortModeChanged(QQuick3DParticle::SortMode mode);
75
76 friend class QQuick3DParticleSystem;
77 friend class QQuick3DParticleEmitter;
78
79 void clearInstanceTable();
80 void addInstance(const QVector3D &position, const QVector3D &scale,
81 const QVector3D &eulerRotation, const QColor &color,
82 float age);
83 void commitInstance();
84 void updateDepthBias(float bias);
85
86 QPointer<QQmlComponent> m_delegate;
87 QPointer<QQuick3DNode> m_node;
88 QQuick3DParticleInstanceTable *m_instanceTable = nullptr;
89
90 QVector3D m_initialScale;
91};
92
93QT_END_NAMESPACE
94
95#endif // QQUICK3DPARTICLEMODELPARTICLE_H
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:27
Combined button and popup list for selecting options.
static QVector3D reflect(const QVector3D &I, QVector3D &N)
static QMatrix4x4 rotationFromNormal(const QVector3D &n)