1 | // Copyright (C) 2024 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QQUICK3DXRORIGIN_H |
5 | #define QQUICK3DXRORIGIN_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 | |
19 | #include <QtQuick3DXr/qtquick3dxrglobal.h> |
20 | |
21 | #include <QtQuick3D/private/qquick3dnode_p.h> |
22 | #include <QtQuick3DXr/private/qquick3dxrcamera_p.h> |
23 | #include <QtQml/QQmlEngine> |
24 | #include <QtQml/qqml.h> |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | class QQuick3DXrView; |
29 | |
30 | class Q_QUICK3DXR_EXPORT QQuick3DXrOrigin : public QQuick3DNode |
31 | { |
32 | Q_OBJECT |
33 | Q_PROPERTY(QQuick3DXrCamera *camera READ camera WRITE setCamera NOTIFY cameraChanged) |
34 | QML_NAMED_ELEMENT(XrOrigin) |
35 | QML_ADDED_IN_VERSION(6, 8) |
36 | |
37 | public: |
38 | explicit QQuick3DXrOrigin(QQuick3DNode *parent = nullptr); |
39 | ~QQuick3DXrOrigin() override; |
40 | |
41 | QQuick3DXrCamera *camera() const; |
42 | void setCamera(QQuick3DXrCamera *newCamera); |
43 | |
44 | Q_SIGNALS: |
45 | void cameraChanged(); |
46 | |
47 | private: |
48 | QQuick3DXrEyeCamera *eyeCamera(int index) const; |
49 | |
50 | void syncCameraSettings(); |
51 | void resetCameraSettings(); |
52 | |
53 | void updateTrackedCamera(const QMatrix4x4 &transform); |
54 | void updateTrackedCamera(QVector3D position, QQuaternion rotation); |
55 | |
56 | QQuick3DXrCamera *m_camera = nullptr; |
57 | std::array<QQuick3DXrEyeCamera *, 2> m_eyeCameras; |
58 | |
59 | friend class QQuick3DXrCamera; |
60 | friend class QQuick3DXrManager; |
61 | friend class QQuick3DXrManagerPrivate; |
62 | }; |
63 | |
64 | QT_END_NAMESPACE |
65 | |
66 | #endif // QQUICK3DXRORIGIN_H |
67 | |