VTK  9.2.6
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 =========================================================================*/
26 #ifndef vtkOpenVRRenderWindowInteractor_h
27 #define vtkOpenVRRenderWindowInteractor_h
28 
29 #include "vtkEventData.h" // for ivar
30 #include "vtkRenderingOpenVRModule.h" // For export macro
32 
33 #include <functional> // for ivar
34 #include <map> // for ivar
35 #include <openvr.h> // for ivar
36 #include <string> // for ivar
37 
38 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindowInteractor : public vtkVRRenderWindowInteractor
39 {
40 public:
43 
47  void Initialize() override;
48 
52  void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) override;
53 
55 
58  void AddAction(std::string path, vtkCommand::EventIds, bool isAnalog);
59  void AddAction(std::string path, bool isAnalog, std::function<void(vtkEventData*)>);
61 
62 protected:
64  ~vtkOpenVRRenderWindowInteractor() override = default;
65 
66  class ActionData
67  {
68  public:
69  vr::VRActionHandle_t ActionHandle;
71  std::function<void(vtkEventData*)> Function;
72  bool UseFunction = false;
73  bool IsAnalog = false;
74  };
75 
76  std::map<std::string, ActionData> ActionMap;
77  vr::VRActionSetHandle_t ActionsetVTK = vr::k_ulInvalidActionSetHandle;
78 
80  {
81  LEFT_HAND = 0,
84  NUMBER_OF_TRACKERS
85  };
86 
88  {
89  vr::VRInputValueHandle_t Source = vr::k_ulInvalidInputValueHandle;
90  vr::TrackedDevicePose_t LastPose;
91  };
92 
93  TrackerActions Trackers[NUMBER_OF_TRACKERS];
94 
95 private:
97  void operator=(const vtkOpenVRRenderWindowInteractor&) = delete;
98 };
99 
100 #endif
virtual void DoOneEvent(vtkVRRenderWindow *renWin, vtkRenderer *ren)=0
Implements the event loop.
Implements OpenVR specific functions required by vtkVRRenderWindowInteractor.
Implements VR specific functions required by vtkRenderWindowInteractor.
VR rendering window.
abstract specification for renderers
Definition: vtkRenderer.h:72
std::map< std::string, ActionData > ActionMap
void Initialize() override
Initialize the event handler.
static vtkRenderWindowInteractor3D * New()
Construct object so that light follows camera motion.