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
qopenxrorigin.cpp
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#include "qopenxrorigin_p.h"
5
7
9 : m_builtInCamera(new QOpenXRCamera(this))
10{
11 // These are the "real" cameras that are used for rendering.
12 auto *leftEyeCamera = new QOpenXREyeCamera;
13 leftEyeCamera->setParent(this);
14 leftEyeCamera->setParentItem(this);
15 m_eyeCameras.append(leftEyeCamera);
16
17 auto *rightEyeCamera = new QOpenXREyeCamera;
18 rightEyeCamera->setParent(this);
19 rightEyeCamera->setParentItem(this);
20 m_eyeCameras.append(rightEyeCamera);
21
22 // This is the user facing camera
23 setCamera(m_builtInCamera);
24}
25
26
28{
29 return m_camera;
30}
31
33{
34 if (m_camera == newCamera)
35 return;
36
37 if (m_camera) {
38 // connect the near/far properties to the real eye camers
39 for (auto eyeCamera : m_eyeCameras) {
40 // disconnnect the old camera
43 }
44 }
45
46 // There will always be a camera, either the built-in one or the user provided one
47 if (newCamera)
48 m_camera = newCamera;
49 else
50 m_camera = m_builtInCamera;
51
52 if (m_camera) {
53 for (auto eyeCamera : m_eyeCameras) {
54 // Set the initial value, and connect the signals
55 eyeCamera->setClipNear(m_camera->clipNear());
56 eyeCamera->setClipFar(m_camera->clipFar());
59 }
60 }
62}
63
64QOpenXREyeCamera *QOpenXROrigin::eyeCamera(int index) const
65{
66 return m_eyeCameras[index];
67}
68
70
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
void setParent(QObject *parent)
Makes the object a child of parent.
Definition qobject.cpp:2195
void clipNearChanged(float clipNear)
void clipFarChanged(float clipFar)
void setClipNear(float clipNear)
void setClipFar(float clipFar)
void cameraChanged()
QOpenXRCamera * camera
void setCamera(QOpenXRCamera *newCamera)
void append(const T &t)
#define this
Definition dialogs.cpp:9
Combined button and popup list for selecting options.
GLuint index
[2]
#define emit
myObject disconnect()
[26]