Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qopenxrcamera_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QOPENXRCAMERA_H
5#define QOPENXRCAMERA_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 <QObject>
22#include <QtQuick3D/private/qquick3dcamera_p.h>
23
25
26class Q_QUICK3DXR_EXPORT QOpenXREyeCamera : public QQuick3DCamera
27{
29 Q_PROPERTY(float leftTangent READ leftTangent WRITE setLeftTangent NOTIFY leftTangentChanged)
30 Q_PROPERTY(float rightTangent READ rightTangent WRITE setRightTangent NOTIFY rightTangentChanged)
31 Q_PROPERTY(float upTangent READ upTangent WRITE setUpTangent NOTIFY upTangentChanged)
32 Q_PROPERTY(float downTangent READ downTangent WRITE setDownTangent NOTIFY downTangentChanged)
33 Q_PROPERTY(float clipNear READ clipNear WRITE setClipNear NOTIFY clipNearChanged)
34 Q_PROPERTY(float clipFar READ clipFar WRITE setClipFar NOTIFY clipFarChanged)
35
36public:
37 QOpenXREyeCamera(QQuick3DNode *parent = nullptr);
38
39 float leftTangent() const;
40 float rightTangent() const;
41 float upTangent() const;
42 float downTangent() const;
43 float clipNear() const;
44 float clipFar() const;
45
46public Q_SLOTS:
47 void setLeftTangent(float leftTangent);
48 void setRightTangent(float rightTangent);
49 void setUpTangent(float upTangent);
50 void setDownTangent(float downTangent);
51 void setClipNear(float clipNear);
52 void setClipFar(float clipFar);
53
55 void leftTangentChanged(float leftTangent);
56 void rightTangentChanged(float rightTangent);
57 void upTangentChanged(float upTangent);
58 void downTangentChanged(float downTangent);
59 void clipNearChanged(float clipNear);
60 void clipFarChanged(float clipFar);
61
62public:
63 QMatrix4x4 m_projection;
64
65protected:
66 QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
67
69 void markProjectionDirty();
70 void maybeUpdateProjection();
71 float m_leftTangent = -0.017455064928218f; // tan(-1)
72 float m_rightTangent = 0.017455064928218f; // tan(1)
73 float m_upTangent = 0.017455064928218f; // tan(1)
74 float m_downTangent = -0.017455064928218f; // tan(-1)
75 float m_clipNear = 1.0f;
76 float m_clipFar = 10000.0f;
77 bool m_projectionDirty = true;
78};
79
80class Q_QUICK3DXR_EXPORT QOpenXRCamera : public QQuick3DNode
81{
83 Q_PROPERTY(float clipNear READ clipNear WRITE setClipNear NOTIFY clipNearChanged)
84 Q_PROPERTY(float clipFar READ clipFar WRITE setClipFar NOTIFY clipFarChanged)
85 QML_NAMED_ELEMENT(XrCamera)
86
87public:
88 QOpenXRCamera(QQuick3DNode *parent = nullptr);
90 float clipNear() const;
91 float clipFar() const;
92
93public Q_SLOTS:
94 void setClipNear(float clipNear);
95 void setClipFar(float clipFar);
96
98 void clipNearChanged(float clipNear);
99 void clipFarChanged(float clipFar);
100
101private:
102 float m_clipNear = 1.0f;
103 float m_clipFar = 10000.0f;
104};
105
106
108
109#endif // QOPENXRCAMERA_H
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
Combined button and popup list for selecting options.
GLfloat GLfloat f
#define QML_NAMED_ELEMENT(NAME)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS