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
14 #ifndef vtkOpenVRRenderWindowInteractor_h
15 #define vtkOpenVRRenderWindowInteractor_h
16 
17 #include "vtkEventData.h" // for ivar
18 #include "vtkRenderingOpenVRModule.h" // For export macro
20 
21 #include <functional> // for ivar
22 #include <map> // for ivar
23 #include <openvr.h> // for ivar
24 #include <string> // for ivar
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindowInteractor : public vtkVRRenderWindowInteractor
28 {
29 public:
32 
36  void Initialize() override;
37 
41  void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) override;
42 
44 
47  void AddAction(std::string path, vtkCommand::EventIds, bool isAnalog);
48  void AddAction(std::string path, bool isAnalog, std::function<void(vtkEventData*)>);
50 
51 protected:
58  ~vtkOpenVRRenderWindowInteractor() override = default;
59 
60  class ActionData
61  {
62  public:
63  vr::VRActionHandle_t ActionHandle;
66  bool UseFunction = false;
67  bool IsAnalog = false;
68  };
69 
70  std::map<std::string, ActionData> ActionMap;
71  vr::VRActionSetHandle_t ActionsetVTK = vr::k_ulInvalidActionSetHandle;
72 
74  {
75  LEFT_HAND = 0,
78  NUMBER_OF_TRACKERS
79  };
80 
82  {
83  vr::VRInputValueHandle_t Source = vr::k_ulInvalidInputValueHandle;
84  vr::TrackedDevicePose_t LastPose;
85  };
86 
87  TrackerActions Trackers[NUMBER_OF_TRACKERS];
88 
89 private:
91  void operator=(const vtkOpenVRRenderWindowInteractor&) = delete;
92 };
93 
94 VTK_ABI_NAMESPACE_END
95 #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:62
Implements VR specific functions required by vtkRenderWindowInteractor.
VR rendering window.
@ function
Definition: vtkX3D.h:249
@ string
Definition: vtkX3D.h:490