1 | // Copyright (C) 2018 The Qt Company Ltd. |
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 QWAVEFRONTMESH_P_H |
5 | #define QWAVEFRONTMESH_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include "qqmlwavefrontmeshglobal_p.h" |
19 | |
20 | #include <QtQuick/private/qquickshadereffectmesh_p.h> |
21 | |
22 | #include <QtCore/qurl.h> |
23 | #include <QtGui/qvector3d.h> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class QWavefrontMeshPrivate; |
28 | class Q_LABSWAVEFRONTMESH_PRIVATE_EXPORT QWavefrontMesh : public QQuickShaderEffectMesh |
29 | { |
30 | Q_OBJECT |
31 | Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged FINAL) |
32 | Q_PROPERTY(Error lastError READ lastError NOTIFY lastErrorChanged FINAL) |
33 | Q_PROPERTY(QVector3D projectionPlaneV READ projectionPlaneV WRITE setProjectionPlaneV NOTIFY projectionPlaneVChanged FINAL) |
34 | Q_PROPERTY(QVector3D projectionPlaneW READ projectionPlaneW WRITE setProjectionPlaneW NOTIFY projectionPlaneWChanged FINAL) |
35 | QML_NAMED_ELEMENT(WavefrontMesh) |
36 | QML_ADDED_IN_VERSION(1, 0) |
37 | |
38 | public: |
39 | enum Error { |
40 | NoError, |
41 | InvalidSourceError, |
42 | UnsupportedFaceShapeError, |
43 | UnsupportedIndexSizeError, |
44 | FileNotFoundError, |
45 | NoAttributesError, |
46 | MissingPositionAttributeError, |
47 | MissingTextureCoordinateAttributeError, |
48 | MissingPositionAndTextureCoordinateAttributesError, |
49 | TooManyAttributesError, |
50 | InvalidPlaneDefinitionError |
51 | }; |
52 | Q_ENUM(Error) |
53 | |
54 | QWavefrontMesh(QObject *parent = nullptr); |
55 | ~QWavefrontMesh() override; |
56 | |
57 | QUrl source() const; |
58 | void setSource(const QUrl &url); |
59 | |
60 | Error lastError() const; |
61 | void setLastError(Error lastError); |
62 | |
63 | bool validateAttributes(const QList<QByteArray> &attributes, int *posIndex) override; |
64 | QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex, |
65 | const QRectF &srcRect, const QRectF &rect) override; |
66 | QString log() const override; |
67 | |
68 | QVector3D projectionPlaneV() const; |
69 | void setProjectionPlaneV(const QVector3D &projectionPlaneV); |
70 | |
71 | QVector3D projectionPlaneW() const; |
72 | void setProjectionPlaneW(const QVector3D &projectionPlaneW); |
73 | |
74 | Q_SIGNALS: |
75 | void sourceChanged(); |
76 | void lastErrorChanged(); |
77 | void projectionPlaneVChanged(); |
78 | void projectionPlaneWChanged(); |
79 | |
80 | protected Q_SLOTS: |
81 | void readData(); |
82 | |
83 | private: |
84 | Q_DISABLE_COPY(QWavefrontMesh) |
85 | Q_DECLARE_PRIVATE(QWavefrontMesh) |
86 | }; |
87 | |
88 | QT_END_NAMESPACE |
89 | |
90 | #endif // QWAVEFRONTMESH_P_H |
91 | |
92 | |