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