|
VR-Engage
2.2
|
This abstract base class defines the interface and common functionality for VR controller event management. It maintains the current state of all connected controllers, processes events from the VR system, and dispatches these events to registered event processors.
Specific VR platforms (Oculus, OpenVR, etc.) implement derived classes that handle the platform-specific details of retrieving controller state information.
#include <DtVirtualRealityEventManager.h>
Public Types | |
| using | ControllerStateMap = std::map<unsigned int, DtVirtualRealityControllerState*> |
Public Member Functions | |
| virtual | ~DtVirtualRealityEventManager () override |
| virtual void | addEventProcessorToFront (DtVirtualRealityEventProcessorInterface *processor) |
| virtual void | addEventProcessorToBack (DtVirtualRealityEventProcessorInterface *processor) |
| virtual void | removeEventProcessor (DtVirtualRealityEventProcessorInterface *processor) |
| virtual const EventProcessorList & | eventProccesorList () const |
| virtual EventProcessorList & | eventProccesorList () |
| const ControllerStateMap & | controllerStateMap () const |
Static Public Member Functions | |
| static DtVirtualRealityEventManager & | instance (DtDe &de) |
Protected Member Functions | |
| DtVirtualRealityEventManager (DtDe &de) | |
| virtual void | dispatchControllerEvent (DtVirtualRealityControllerEvent &event) |
| virtual void | tick () |
| virtual void | processVrEvents ()=0 |
Protected Attributes | |
| DtDe & | myDe |
| DtVirtualRealityDriver * | myVrDriver |
| EventProcessorList | myEventProcessors |
| ControllerStateMap | myControllerStates |
Private Member Functions | |
| DtVirtualRealityEventManager () | |
| using makVrv::DtVirtualRealityEventManager::ControllerStateMap = std::map<unsigned int, DtVirtualRealityControllerState*> |
Map type that associates controller IDs with their state objects.
This map associates controller identifiers (unsigned integers) with pointers to controller state objects that contain the controller's position, orientation, and input states.
|
private |
Unused default constructor.
Private constructor to prevent direct instantiation. Use the instance() method to get the singleton instance instead.
Referenced by makVrv::DtOculusEventManager::instance(), makVrv::DtOpenVREventManager::instance(), and instance().
|
overridevirtual |
Virtual destructor.
Cleans up event manager resources, including all registered event processors and controller state objects.
|
protected |
CTOR.
References de().
|
static |
Gets the singleton instance of the appropriate event manager.
| de | Reference to the display engine |
| DtCorruptedState | if it is unable to get the instance |
Returns the singleton instance of the appropriate VR event manager for the current VR system (e.g., Oculus, OpenVR), creating it if it doesn't already exist. This method is called by the VR driver during initialization.
References de(), and DtVirtualRealityEventManager().
|
virtual |
Registers an event processor at the front of the event processing queue.
| processor | Pointer to the event processor to register |
Adds the specified event processor to the front of the event processing queue. Event processors at the front of the queue receive events before those at the back. This is useful when an event processor needs to handle events before others, potentially intercepting and canceling events for other processors.
|
virtual |
Registers an event processor at the back of the event processing queue.
| processor | Pointer to the event processor to register |
Adds the specified event processor to the back of the event processing queue. Event processors at the back of the queue receive events after those at the front. This is the default and most common way to register event processors.
|
virtual |
Unregisters an event processor.
| processor | Pointer to the event processor to unregister |
Removes the specified event processor from the event processing queue. After removal, the processor will no longer receive controller events. If the processor is not in the queue, this method has no effect.
|
virtual |
const access the event processor list
|
virtual |
non-const access to the event processor list
| const ControllerStateMap & makVrv::DtVirtualRealityEventManager::controllerStateMap | ( | ) | const |
Access the Controller State map containing the most recent state of all controllers. Map is indexed by controller id.
|
protectedvirtual |
dispatch controller event to any active event handlers
|
protectedvirtual |
called every frame by the system. Calls the processVREvents for the specific system
|
protectedpure virtual |
collects and dispatches events from the VR system to any active event processors.
Implemented in makVrv::DtOculusEventManager, and makVrv::DtOpenVREventManager.
|
protected |
|
protected |
|
protected |
|
protected |