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
23 #ifndef vtkOpenVRRenderWindowInteractor_h
24 #define vtkOpenVRRenderWindowInteractor_h
25 
26 #include "vtkEventData.h" // for ivar
27 #include "vtkRenderingOpenVRModule.h" // For export macro
29 
30 #include <functional> // for ivar
31 #include <map> // for ivar
32 #include <openvr.h> // for ivar
33 #include <string> // for ivar
34 
35 VTK_ABI_NAMESPACE_BEGIN
36 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindowInteractor : public vtkVRRenderWindowInteractor
37 {
38 public:
41 
45  void Initialize() override;
46 
50  void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) override;
51 
53 
56  void AddAction(std::string path, vtkCommand::EventIds, bool isAnalog);
57  void AddAction(std::string path, bool isAnalog, std::function<void(vtkEventData*)>);
59 
60 protected:
67  ~vtkOpenVRRenderWindowInteractor() override = default;
68 
69  class ActionData
70  {
71  public:
72  vr::VRActionHandle_t ActionHandle;
75  bool UseFunction = false;
76  bool IsAnalog = false;
77  };
78 
79  std::map<std::string, ActionData> ActionMap;
80  vr::VRActionSetHandle_t ActionsetVTK = vr::k_ulInvalidActionSetHandle;
81 
83  {
84  LEFT_HAND = 0,
87  NUMBER_OF_TRACKERS
88  };
89 
91  {
92  vr::VRInputValueHandle_t Source = vr::k_ulInvalidInputValueHandle;
93  vr::TrackedDevicePose_t LastPose;
94  };
95 
96  TrackerActions Trackers[NUMBER_OF_TRACKERS];
97 
98 private:
100  void operator=(const vtkOpenVRRenderWindowInteractor&) = delete;
101 };
102 
103 VTK_ABI_NAMESPACE_END
104 #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.
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.
static vtkOpenVRRenderWindowInteractor * New()
abstract specification for renderers
Definition: vtkRenderer.h:71
Implements VR specific functions required by vtkRenderWindowInteractor.
VR rendering window.
@ function
Definition: vtkX3D.h:249
@ string
Definition: vtkX3D.h:490