VTK  9.3.20240419
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
113 #ifndef vtkOpenVRRenderWindowInteractor_h
114 #define vtkOpenVRRenderWindowInteractor_h
115 
116 #include "vtkEventData.h" // for ivar
117 #include "vtkRenderingOpenVRModule.h" // For export macro
119 
120 #include <functional> // for ivar
121 #include <map> // for ivar
122 #include <openvr.h> // for ivar
123 #include <string> // for ivar
124 
125 VTK_ABI_NAMESPACE_BEGIN
126 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindowInteractor : public vtkVRRenderWindowInteractor
127 {
128 public:
131 
135  void Initialize() override;
136 
140  void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) override;
141 
143 
146  void AddAction(const std::string& path, const vtkCommand::EventIds&, bool isAnalog) override;
147  void AddAction(
148  const std::string& path, bool isAnalog, const std::function<void(vtkEventData*)>&) override;
150 
151 protected:
158  ~vtkOpenVRRenderWindowInteractor() override = default;
159 
161  {
162  public:
163  vr::VRActionHandle_t ActionHandle;
166  bool UseFunction = false;
167  bool IsAnalog = false;
168  };
169 
170  std::map<std::string, ActionData> ActionMap;
171  vr::VRActionSetHandle_t ActionsetVTK = vr::k_ulInvalidActionSetHandle;
172 
174  {
175  LEFT_HAND = 0,
178  NUMBER_OF_TRACKERS
179  };
180 
182  {
183  vr::VRInputValueHandle_t Source = vr::k_ulInvalidInputValueHandle;
184  vr::TrackedDevicePose_t LastPose;
185  };
186 
187  TrackerActions Trackers[NUMBER_OF_TRACKERS];
188 
189 private:
191  void operator=(const vtkOpenVRRenderWindowInteractor&) = delete;
192 };
193 
194 VTK_ABI_NAMESPACE_END
195 #endif
Implements OpenVR specific functions required by vtkVRRenderWindowInteractor.
void DoOneEvent(vtkVRRenderWindow *renWin, vtkRenderer *ren) override
Implements the event loop.
~vtkOpenVRRenderWindowInteractor() override=default
void Initialize() override
Initialize the event handler.
void AddAction(const std::string &path, bool isAnalog, const std::function< void(vtkEventData *)> &) override
Assign an event or std::function to an event path.
std::map< std::string, ActionData > ActionMap
vtkOpenVRRenderWindowInteractor()
Create and set the openvr style on this Set ActionManifestFileName to vtk_openvr_actions....
static vtkOpenVRRenderWindowInteractor * New()
void AddAction(const std::string &path, const vtkCommand::EventIds &, bool isAnalog) override
Assign an event or std::function to an event path.
abstract specification for renderers
Definition: vtkRenderer.h:172
Implements VR specific functions required by vtkRenderWindowInteractor.
VR rendering window.
@ function
Definition: vtkX3D.h:249
@ string
Definition: vtkX3D.h:490