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
11#ifndef vtkOpenVRRenderWindowInteractor_h
12#define vtkOpenVRRenderWindowInteractor_h
13
14#include "vtkEventData.h" // for ivar
15#include "vtkRenderingOpenVRModule.h" // For export macro
17
18#include <functional> // for ivar
19#include <map> // for ivar
20#include <openvr.h> // for ivar
21#include <string> // for ivar
22
23VTK_ABI_NAMESPACE_BEGIN
24class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindowInteractor : public vtkVRRenderWindowInteractor
25{
26public:
29
33 void Initialize() override;
34
38 void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) override;
39
41
44 void AddAction(std::string path, vtkCommand::EventIds, bool isAnalog);
45 void AddAction(std::string path, bool isAnalog, std::function<void(vtkEventData*)>);
47
48protected:
56
58 {
59 public:
60 vr::VRActionHandle_t ActionHandle;
62 std::function<void(vtkEventData*)> Function;
63 bool UseFunction = false;
64 bool IsAnalog = false;
65 };
66
67 std::map<std::string, ActionData> ActionMap;
68 vr::VRActionSetHandle_t ActionsetVTK = vr::k_ulInvalidActionSetHandle;
69
71 {
72 LEFT_HAND = 0,
75 NUMBER_OF_TRACKERS
76 };
77
79 {
80 vr::VRInputValueHandle_t Source = vr::k_ulInvalidInputValueHandle;
81 vr::TrackedDevicePose_t LastPose;
82 };
83
84 TrackerActions Trackers[NUMBER_OF_TRACKERS];
85
86private:
88 void operator=(const vtkOpenVRRenderWindowInteractor&) = delete;
89};
90
91VTK_ABI_NAMESPACE_END
92#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:59
Implements VR specific functions required by vtkRenderWindowInteractor.
VR rendering window.