VTK  9.2.5
vtkOpenVRRenderWindowInteractor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenVRRenderWindowInteractor.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
115 #ifndef vtkOpenVRRenderWindowInteractor_h
116 #define vtkOpenVRRenderWindowInteractor_h
117 
118 #include "vtkEventData.h" // for ivar
119 #include "vtkRenderingOpenVRModule.h" // For export macro
121 
122 #include <functional> // for ivar
123 #include <map> // for ivar
124 #include <openvr.h> // for ivar
125 #include <string> // for ivar
126 
127 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindowInteractor : public vtkVRRenderWindowInteractor
128 {
129 public:
132 
136  void Initialize() override;
137 
141  void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) override;
142 
144 
147  void AddAction(std::string path, vtkCommand::EventIds, bool isAnalog);
148  void AddAction(std::string path, bool isAnalog, std::function<void(vtkEventData*)>);
150 
151 protected:
153  ~vtkOpenVRRenderWindowInteractor() override = default;
154 
156  {
157  public:
158  vr::VRActionHandle_t ActionHandle;
161  bool UseFunction = false;
162  bool IsAnalog = false;
163  };
164 
165  std::map<std::string, ActionData> ActionMap;
166  vr::VRActionSetHandle_t ActionsetVTK = vr::k_ulInvalidActionSetHandle;
167 
169  {
170  LEFT_HAND = 0,
173  NUMBER_OF_TRACKERS
174  };
175 
177  {
178  vr::VRInputValueHandle_t Source = vr::k_ulInvalidInputValueHandle;
179  vr::TrackedDevicePose_t LastPose;
180  };
181 
182  TrackerActions Trackers[NUMBER_OF_TRACKERS];
183 
184 private:
186  void operator=(const vtkOpenVRRenderWindowInteractor&) = delete;
187 };
188 
189 #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
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:182
Implements VR specific functions required by vtkRenderWindowInteractor.
VR rendering window.
@ function
Definition: vtkX3D.h:255
@ string
Definition: vtkX3D.h:496