VR-Engage  2.3
Loading...
Searching...
No Matches
DtOpenVREventManager.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file DtOpenVREventManager.h
7//! \brief OpenVR-specific implementation of VR controller event management
8//!
9//! This file contains the OpenVR-specific implementation of the virtual reality
10//! event manager. It handles processing of SteamVR/OpenVR controller inputs and
11//! translating them into a common VR controller event format used throughout
12//! the application.
13
14#pragma once
15
18
19namespace vr
20{
21class IVRSystem;
22struct VREvent_t;
23} // namespace vr
24
25namespace makVrv
26{
27//! \brief OpenVR-specific implementation of the virtual reality event manager
28//!
29//! This class is responsible for processing SteamVR/OpenVR controller events and
30//! translating them into the common VR controller event format. It communicates
31//! with the OpenVR API to retrieve controller state information and dispatches
32//! controller events to registered event processors.
33//!
34//! \note This class is created automatically by the DtVirtualRealityDriver
35//! and is not intended to be instantiated directly by users.
37{
38private:
39 //! \brief Unused default constructor
40 //!
41 //! Private constructor to prevent direct instantiation. Use the instance()
42 //! method to get the singleton instance instead.
44
45public:
46 //! \brief Gets the singleton instance of the OpenVR event manager
47 //! \param de Reference to the display engine
48 //! \return Reference to the singleton instance
49 //! \throws DtCorruptedState if it is unable to get the instance
50 //!
51 //! Returns the singleton instance of the OpenVR event manager, creating it
52 //! if it doesn't already exist. This method is called by the VR driver
53 //! during initialization.
55
56 //! \brief Virtual destructor
57 //!
58 //! Cleans up OpenVR event manager resources and releases connections
59 //! to the OpenVR API.
60 virtual ~DtOpenVREventManager() override;
61
62 // //! \brief get/set the deadzone for the given axis of the given controller.
63 // virtual DtVector2f deadZone(DtVirtualRealityControllerState::Controller,
64 // DtVirtualRealityControllerState::Axis) const; virtual void
65 // setDeadZone(DtVirtualRealityControllerState::Controller, DtVirtualRealityControllerState::Axis, const
66 // DtVector2f&);
67
68protected:
69 //! \brief Constructor
70 //! \param de Reference to the display engine
71 //!
72 //! Initializes the OpenVR event manager with a reference to the display engine.
73 //! This constructor is only called by the registerInstance method and
74 //! should not be called directly.
76
77
78 //! \brief Collects and dispatches events from the OpenVR system
79 //!
80 //! Polls the OpenVR API for controller state updates, processes button and
81 //! analog input events, and dispatches them to registered event processors.
82 //!
83 //! \note This method is called by the DtVirtualRealityDriver during the
84 //! update cycle and is not intended to be called directly by users.
85 virtual void processVrEvents() override;
86
87 //! \brief Updates controller state for a specific controller
88 //! \param deviceId The controller identifier to update
89 //! \param state Reference to the controller state to update
90 //!
91 //! Updates the provided controller state object with the latest data from
92 //! the OpenVR controller with the specified device ID. This includes position,
93 //! orientation, button states, and analog input values.
96
97 //! \brief Determines the device type for a given controller ID
98 //! \param deviceId The controller identifier to query
99 //! \return Bitfield representing the device type
100 //!
101 //! Maps an OpenVR-specific device identifier to the common controller device
102 //! type enumeration used throughout the application.
105
106protected:
107 //! \brief Pointer to the OpenVR system interface
108 //!
109 //! This pointer is used to communicate with the OpenVR API for retrieving
110 //! controller state information and processing events.
111 vr::IVRSystem* myVrSystem;
112};
113} // namespace makVrv
Defines the base class for VR controller event management.
DtOpenVREventManager(DtDe &de)
Constructor.
static DtVirtualRealityEventManager & instance(DtDe &de)
Gets the singleton instance of the OpenVR event manager.
virtual DtVirtualRealityControllerState::Bitfield findDeviceType(DtVirtualRealityControllerState::ControllerId deviceId) const
Determines the device type for a given controller ID.
virtual ~DtOpenVREventManager() override
Virtual destructor.
virtual void updateControllerState(DtVirtualRealityControllerState::ControllerId deviceId, DtVirtualRealityControllerState &state)
Updates controller state for a specific controller.
vr::IVRSystem * myVrSystem
Pointer to the OpenVR system interface.
Definition DtOpenVREventManager.h:111
DtOpenVREventManager()
Unused default constructor.
virtual void processVrEvents() override
Collects and dispatches events from the OpenVR system.
Encapsulates the complete state of a virtual reality controller.
Definition DtVirtualRealityControllerState.h:34
unsigned long long Bitfield
Type used for bit flags throughout the class.
Definition DtVirtualRealityControllerState.h:40
unsigned int ControllerId
Type used for controller identification.
Definition DtVirtualRealityControllerState.h:45
DtVirtualRealityEventManager()
Unused default constructor.
Definition appLauncherComponent.h:28
Definition DtOpenVREventManager.h:20
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.
Main header file for the VRV Virtual Reality Controller module.