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
qquick3dparticleshape_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 QQUICK3DPARTICLESHAPE_H
7#define QQUICK3DPARTICLESHAPE_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
21#include <QVector3D>
22
24
25class QQuick3DParticleSystem;
26class QQuick3DModel;
27
28class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleShape : public QQuick3DParticleAbstractShape
29{
30 Q_OBJECT
31 Q_PROPERTY(bool fill READ fill WRITE setFill NOTIFY fillChanged)
32 Q_PROPERTY(ShapeType type READ type WRITE setType NOTIFY typeChanged)
33 Q_PROPERTY(QVector3D extents READ extents WRITE setExtents NOTIFY extentsChanged)
34
35 QML_NAMED_ELEMENT(ParticleShape3D)
36 QML_ADDED_IN_VERSION(6, 2)
37
38public:
39 enum ShapeType
40 {
41 Cube = 0,
42 Sphere,
43 Cylinder
44 };
45 Q_ENUM(ShapeType)
46
47 QQuick3DParticleShape(QObject *parent = nullptr);
48
49 bool fill() const;
50 ShapeType type() const;
51 QVector3D extents() const;
52
53 // Returns point inside this shape
54 QVector3D getPosition(int particleIndex) override;
55 Q_REVISION(6, 10) QVector3D getSurfaceNormal(int particleIndex) override;
56
57public Q_SLOTS:
58 void setFill(bool fill);
59 void setType(QQuick3DParticleShape::ShapeType type);
60 void setExtents(QVector3D extends);
61
62Q_SIGNALS:
63 void fillChanged();
64 void typeChanged();
65 void extentsChanged();
66
67private:
68 QVector3D randomPositionCube(int particleIndex) const;
69 QVector3D randomPositionSphere(int particleIndex) const;
70 QVector3D randomPositionCylinder(int particleIndex) const;
71
72 bool m_fill = true;
73 ShapeType m_type = ShapeType::Cube;
74 QVector3D m_extents = QVector3D(50, 50, 50);
75 QVector3D m_cachedPosition;
76 int m_cachedIndex = -1;
77};
78
79QT_END_NAMESPACE
80
81#endif // QQUICK3DPARTICLESHAPE_H
Combined button and popup list for selecting options.
#define M_PI
Definition qmath.h:200
#define QPSIN
#define QPCOS