1 | // Copyright (C) 2014 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_CUBOIDGEOMETRYVIEW_H |
5 | #define QT3DEXTRAS_CUBOIDGEOMETRYVIEW_H |
6 | |
7 | #include <Qt3DExtras/qt3dextras_global.h> |
8 | #include <Qt3DCore/qgeometryview.h> |
9 | #include <QtCore/QSize> |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | namespace Qt3DExtras { |
14 | |
15 | class Q_3DEXTRASSHARED_EXPORT QCuboidGeometryView : public Qt3DCore::QGeometryView |
16 | { |
17 | Q_OBJECT |
18 | |
19 | Q_PROPERTY(float xExtent READ xExtent WRITE setXExtent NOTIFY xExtentChanged) |
20 | Q_PROPERTY(float yExtent READ yExtent WRITE setYExtent NOTIFY yExtentChanged) |
21 | Q_PROPERTY(float zExtent READ zExtent WRITE setZExtent NOTIFY zExtentChanged) |
22 | Q_PROPERTY(QSize yzMeshResolution READ yzMeshResolution WRITE setYZMeshResolution NOTIFY yzMeshResolutionChanged) |
23 | Q_PROPERTY(QSize xzMeshResolution READ xzMeshResolution WRITE setXZMeshResolution NOTIFY xzMeshResolutionChanged) |
24 | Q_PROPERTY(QSize xyMeshResolution READ xyMeshResolution WRITE setXYMeshResolution NOTIFY xyMeshResolutionChanged) |
25 | |
26 | public: |
27 | explicit QCuboidGeometryView(Qt3DCore::QNode *parent = nullptr); |
28 | ~QCuboidGeometryView(); |
29 | |
30 | float xExtent() const; |
31 | float yExtent() const; |
32 | float zExtent() const; |
33 | QSize yzMeshResolution() const; |
34 | QSize xzMeshResolution() const; |
35 | QSize xyMeshResolution() const; |
36 | |
37 | public Q_SLOTS: |
38 | void setXExtent(float xExtent); |
39 | void setYExtent(float yExtent); |
40 | void setZExtent(float zExtent); |
41 | void setYZMeshResolution(const QSize &resolution); |
42 | void setXZMeshResolution(const QSize &resolution); |
43 | void setXYMeshResolution(const QSize &resolution); |
44 | |
45 | Q_SIGNALS: |
46 | void xExtentChanged(float xExtent); |
47 | void yExtentChanged(float yExtent); |
48 | void zExtentChanged(float zExtent); |
49 | |
50 | void yzMeshResolutionChanged(const QSize &yzMeshResolution); |
51 | void xzMeshResolutionChanged(const QSize &xzMeshResolution); |
52 | void xyMeshResolutionChanged(const QSize &xyMeshResolution); |
53 | |
54 | private: |
55 | // As this is a default provided geometry renderer, no one should be able |
56 | // to modify the QGeometryRenderer's properties |
57 | |
58 | void setInstanceCount(int instanceCount); |
59 | void setVertexCount(int vertexCount); |
60 | void setIndexOffset(int indexOffset); |
61 | void setFirstInstance(int firstInstance); |
62 | void setRestartIndexValue(int index); |
63 | void setPrimitiveRestartEnabled(bool enabled); |
64 | void setGeometry(Qt3DCore::QGeometry *geometry); |
65 | void setPrimitiveType(PrimitiveType primitiveType); |
66 | }; |
67 | |
68 | } // namespace Qt3DExtras |
69 | |
70 | QT_END_NAMESPACE |
71 | |
72 | #endif // QT3DEXTRAS_CUBOIDGEOMETRYVIEW_H |
73 |