1// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QT3DEXTRAS_QPLANEGEOMETRY_H
5#define QT3DEXTRAS_QPLANEGEOMETRY_H
6
7#include <Qt3DExtras/qt3dextras_global.h>
8#include <Qt3DCore/qgeometry.h>
9#include <QtCore/QSize>
10
11QT_BEGIN_NAMESPACE
12
13namespace Qt3DCore {
14
15class QAttribute;
16
17} // Qt3DCore
18
19namespace Qt3DExtras {
20
21class QPlaneGeometryPrivate;
22
23class Q_3DEXTRASSHARED_EXPORT QPlaneGeometry : public Qt3DCore::QGeometry
24{
25 Q_OBJECT
26 Q_PROPERTY(float width READ width WRITE setWidth NOTIFY widthChanged)
27 Q_PROPERTY(float height READ height WRITE setHeight NOTIFY heightChanged)
28 Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged)
29 Q_PROPERTY(bool mirrored READ mirrored WRITE setMirrored NOTIFY mirroredChanged REVISION 9)
30 Q_PROPERTY(Qt3DCore::QAttribute *positionAttribute READ positionAttribute CONSTANT)
31 Q_PROPERTY(Qt3DCore::QAttribute *normalAttribute READ normalAttribute CONSTANT)
32 Q_PROPERTY(Qt3DCore::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
33 Q_PROPERTY(Qt3DCore::QAttribute *tangentAttribute READ tangentAttribute CONSTANT)
34 Q_PROPERTY(Qt3DCore::QAttribute *indexAttribute READ indexAttribute CONSTANT)
35
36public:
37 explicit QPlaneGeometry(QNode *parent = nullptr);
38 ~QPlaneGeometry();
39
40 void updateVertices();
41 void updateIndices();
42
43 QSize resolution() const;
44 float width() const;
45 float height() const;
46 bool mirrored() const;
47
48 Qt3DCore::QAttribute *positionAttribute() const;
49 Qt3DCore::QAttribute *normalAttribute() const;
50 Qt3DCore::QAttribute *texCoordAttribute() const;
51 Qt3DCore::QAttribute *tangentAttribute() const;
52 Qt3DCore::QAttribute *indexAttribute() const;
53
54public Q_SLOTS:
55 void setResolution(const QSize &resolution);
56 void setWidth(float width);
57 void setHeight(float height);
58 void setMirrored(bool mirrored);
59
60Q_SIGNALS:
61 void resolutionChanged(const QSize &resolution);
62 void widthChanged(float width);
63 void heightChanged(float height);
64 void mirroredChanged(bool mirrored);
65
66protected:
67 QPlaneGeometry(QPlaneGeometryPrivate &dd, QNode *parent = nullptr);
68
69private:
70 Q_DECLARE_PRIVATE(QPlaneGeometry)
71};
72
73} // Qt3DExpoerimental
74
75QT_END_NAMESPACE
76
77#endif // QT3DEXTRAS_QPLANEGEOMETRY_H
78

source code of qt3d/src/extras/geometries/qplanegeometry.h