VTK  9.3.0
vtkOpenVRRenderWindowInteractor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
20#ifndef vtkOpenVRRenderWindowInteractor_h
21#define vtkOpenVRRenderWindowInteractor_h
22
23#include "vtkEventData.h" // for ivar
24#include "vtkRenderingOpenVRModule.h" // For export macro
26
27#include <functional> // for ivar
28#include <map> // for ivar
29#include <openvr.h> // for ivar
30#include <string> // for ivar
31
32VTK_ABI_NAMESPACE_BEGIN
33class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindowInteractor : public vtkVRRenderWindowInteractor
34{
35public:
38
42 void Initialize() override;
43
47 void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) override;
48
50
53 void AddAction(std::string path, vtkCommand::EventIds, bool isAnalog);
54 void AddAction(std::string path, bool isAnalog, std::function<void(vtkEventData*)>);
56
57protected:
65
67 {
68 public:
69 vr::VRActionHandle_t ActionHandle;
71 std::function<void(vtkEventData*)> Function;
72 bool UseFunction = false;
73 bool IsAnalog = false;
74 };
75
76 std::map<std::string, ActionData> ActionMap;
77 vr::VRActionSetHandle_t ActionsetVTK = vr::k_ulInvalidActionSetHandle;
78
80 {
81 LEFT_HAND = 0,
84 NUMBER_OF_TRACKERS
85 };
86
88 {
89 vr::VRInputValueHandle_t Source = vr::k_ulInvalidInputValueHandle;
90 vr::TrackedDevicePose_t LastPose;
91 };
92
93 TrackerActions Trackers[NUMBER_OF_TRACKERS];
94
95private:
97 void operator=(const vtkOpenVRRenderWindowInteractor&) = delete;
98};
99
100VTK_ABI_NAMESPACE_END
101#endif
Implements OpenVR specific functions required by vtkVRRenderWindowInteractor.
void AddAction(std::string path, bool isAnalog, std::function< void(vtkEventData *)>)
Assign an event or std::function to an event path.
void DoOneEvent(vtkVRRenderWindow *renWin, vtkRenderer *ren) override
Implements the event loop.
~vtkOpenVRRenderWindowInteractor() override=default
void Initialize() override
Initialize the event handler.
static vtkOpenVRRenderWindowInteractor * New()
std::map< std::string, ActionData > ActionMap
vtkOpenVRRenderWindowInteractor()
Create and set the openvr style on this Set ActionManifestFileName to vtk_openvr_actions....
void AddAction(std::string path, vtkCommand::EventIds, bool isAnalog)
Assign an event or std::function to an event path.
abstract specification for renderers
Definition vtkRenderer.h:68
Implements VR specific functions required by vtkRenderWindowInteractor.
VR rendering window.