Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3dxrcontroller_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DXRCONTROLLER_H
5#define QQUICK3DXRCONTROLLER_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 <QtQuick3DXr/qtquick3dxrglobal.h>
21#include <QtQuick3D/private/qquick3dnode_p.h>
22#include <QtQml/QQmlEngine>
23
25
26class QQuaternion;
28
29class Q_QUICK3DXR_EXPORT QQuick3DXrController : public QQuick3DNode
30{
31 Q_OBJECT
32 Q_PROPERTY(Controller controller READ controller WRITE setController NOTIFY controllerChanged FINAL)
33 Q_PROPERTY(bool isActive READ isActive NOTIFY isActiveChanged FINAL)
34 Q_PROPERTY(HandPoseSpace poseSpace READ poseSpace WRITE setPoseSpace NOTIFY poseSpaceChanged FINAL)
35
36 Q_PROPERTY(QVector3D pokePosition READ pokePosition NOTIFY pokePositionChanged FINAL)
37 Q_PROPERTY(QList<QVector3D> jointPositions READ jointPositions NOTIFY jointPositionsChanged FINAL)
38 Q_PROPERTY(QList<QQuaternion> jointRotations READ jointRotations NOTIFY jointRotationsChanged FINAL)
39
40 QML_NAMED_ELEMENT(XrController)
41 QML_ADDED_IN_VERSION(6, 8)
42public:
43 enum Controller {
44 ControllerLeft = 0,
45 ControllerRight = 1,
46 ControllerNone = 2,
47 LeftController = ControllerLeft,
48 RightController = ControllerRight,
49 LeftHand = ControllerLeft,
50 RightHand = ControllerRight,
51 UnknownController = ControllerNone,
52 };
53 Q_ENUM(Controller)
54
55 enum class HandPoseSpace {
56 GripPose,
57 AimPose
58 };
59 Q_ENUM(HandPoseSpace)
60
61 QQuick3DXrController();
62
63 QQuick3DXrController::Controller controller() const;
64 void setController(QQuick3DXrController::Controller newController);
65
66 QQuick3DXrHandInput *handInput() const;
67
68 HandPoseSpace poseSpace() const;
69 void setPoseSpace(HandPoseSpace newPoseSpace);
70
71 QVector3D pokePosition() const;
72
73 QList<QVector3D> jointPositions() const;
74 QList<QQuaternion> jointRotations() const;
75
76 bool isActive() const;
77
78Q_SIGNALS:
79 void controllerChanged();
80 void actionMapperChanged();
81
82 void poseSpaceChanged();
83
84 void pokePositionChanged();
85
86 void jointPositionsChanged();
87 void jointRotationsChanged();
88 void jointDataUpdated();
89
90 void isActiveChanged();
91
92private:
93 QPointer<QQuick3DXrInputManager> m_inputManager;
94 Controller m_controller = ControllerNone;
95 QMetaObject::Connection m_isActiveConnection;
96 HandPoseSpace m_poseSpace = HandPoseSpace::AimPose;
97 QVector3D m_pokePosition;
98 bool m_isActive;
99};
100
101namespace QtQuick3DXr
102{
103QtQuick3DXr::Hand handForController(QQuick3DXrController::Controller controller);
104QtQuick3DXr::HandPoseSpace pose_cast(QQuick3DXrController::HandPoseSpace poseSpace);
105}
106
107QT_END_NAMESPACE
108
109#endif // QQUICK3DXRCONTROLLER_H
static void registerAction(QQuick3DXrInputAction *action)
static void handleInput(QQuick3DXrInputAction::Action id, QQuick3DXrInputAction::Controller hand, const char *shortName, float value)
static QList< QPointer< QQuick3DXrHapticFeedback > > getHapticEffects(QQuick3DXrInputAction::Controller hand)
static void registerHapticEffect(QPointer< QQuick3DXrHapticFeedback >)
static void removeHapticEffect(QQuick3DXrHapticFeedback *action)
static void removeAction(QQuick3DXrInputAction *action)
void setIsHandTrackingActive(bool newIsHandTracking)
void setIsActive(bool isActive)
void isHandTrackingChanged()
void jointPositionsChanged()
void jointRotationsChanged()
void setJointPositionsAndRotations(const QList< QVector3D > &newJointPositions, const QList< QQuaternion > &newJointRotations)
QVector3D pokePosition() const
QList< QQuaternion > jointRotations() const
QList< QVector3D > jointPositions() const
void setPokePosition(const QVector3D &newPokePosition)
Hand hand() const
\qmlproperty enumeration XrHandModel::hand
void setHand(Hand newHand)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void classBegin() override
Invoked after class creation, but before any properties have been set.
void setCondition(enum Condition newCondition)
void setController(Controller newController)
enum Condition condition() const
\qmlproperty enumeration QtQuick3D.Xr::XrHapticFeedback::condition
void stop()
\qmlmethod void XrHapticFeedback::stop
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void setHapticEffect(QQuick3DXrAbstractHapticEffect *newHapticEffect)
QQuick3DXrAbstractHapticEffect * hapticEffect() const
\qmlproperty XrHapticEffect XrHapticFeedback::hapticEffect
Controller controller() const
\qmlproperty enumeration QtQuick3D.Xr::XrHapticFeedback::controller
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
bool pressed() const
\qmlproperty bool XrInputAction::pressed
void classBegin() override
Invoked after class creation, but before any properties have been set.
Controller controller() const
\qmlproperty enumeration QtQuick3D.Xr::XrInputAction::controller
void setPressed(bool newPressed)
QList< Action > actionId() const
\qmlproperty List<enumeration> XrInputAction::actionId
void setActionId(const QList< Action > &newActionId)
bool enabled() const
\qmlproperty bool XrInputAction::enabled
void setActionName(const QString &newActionName)
QString actionName() const
\qmlproperty string XrInputAction::actionName
float value() const
\qmlproperty real XrInputAction::value
void setEnabled(bool newEnabled)
void setController(Controller newController)
Controller hand() const
\qmlproperty enumeration QtQuick3D.Xr::XrInputAction::hand
void setValue(float newValue)
\qmltype XrInputAction \inherits QtObject \inqmlmodule QtQuick3D.Xr
void setHand(Controller newHand)
void init(XrInstance instance, XrSession session)
XrHandJointVelocityEXT jointVelocities[2][XR_HAND_JOINT_COUNT_EXT]
bool isPoseInUse(Hand hand, HandPoseSpace poseSpace)
void updatePoses(XrTime predictedDisplayTime, XrSpace appSpace)
PFN_xrDestroyHandTrackerEXT xrDestroyHandTrackerEXT_
void setPosePositionAndRotation(Hand hand, HandPoseSpace poseSpace, const QVector3D &position, const QQuaternion &rotation)
QQuick3DXrHandInput * rightHandInput() const
static QQuick3DXrInputManagerPrivate * get(QQuick3DXrInputManager *inputManager)
void updateHandtracking(XrTime predictedDisplayTime, XrSpace appSpace, bool aimExtensionEnabled)
QQuick3DXrInputManagerPrivate(QQuick3DXrInputManager &manager)
void setupHandModel(QQuick3DXrHandModel *model)
void registerController(QQuick3DXrController *controller)
PFN_xrCreateHandTrackerEXT xrCreateHandTrackerEXT_
QQuick3DXrHandInput * leftHandInput() const
XrHandJointLocationEXT jointLocations[2][XR_HAND_JOINT_COUNT_EXT]
void unregisterController(QQuick3DXrController *controller)
XrSpace handSpace(Hand hand, HandPoseSpace poseSpace)
PFN_xrLocateHandJointsEXT xrLocateHandJointsEXT_
void registerController(QQuick3DXrController *controller)
void unregisterController(QQuick3DXrController *controller)
QQuick3DXrHandInput * leftHandInput() const
QQuick3DXrHandInput * rightHandInput() const
static QQuick3DXrInputManager * instance()
QtQuick3DXr::Hand handForController(QQuick3DXrController::Controller controller)
QtQuick3DXr::HandPoseSpace pose_cast(QQuick3DXrController::HandPoseSpace poseSpace)
static QMatrix4x4 transformMatrix(const QVector3D &position, const QQuaternion &rotation)