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 =========================================================================*/
35 #ifndef vtkOpenVRRenderWindowInteractor_h
36 #define vtkOpenVRRenderWindowInteractor_h
37 
38 #include "vtkEventData.h" // for ivar
39 #include "vtkRenderingOpenVRModule.h" // For export macro
41 
42 #include <functional> // for ivar
43 #include <map> // for ivar
44 #include <openvr.h> // for ivar
45 #include <string> // for ivar
46 
47 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindowInteractor : public vtkVRRenderWindowInteractor
48 {
49 public:
52 
56  void Initialize() override;
57 
61  void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) override;
62 
64 
67  void AddAction(std::string path, vtkCommand::EventIds, bool isAnalog);
68  void AddAction(std::string path, bool isAnalog, std::function<void(vtkEventData*)>);
70 
71 protected:
73  ~vtkOpenVRRenderWindowInteractor() override = default;
74 
75  class ActionData
76  {
77  public:
78  vr::VRActionHandle_t ActionHandle;
81  bool UseFunction = false;
82  bool IsAnalog = false;
83  };
84 
85  std::map<std::string, ActionData> ActionMap;
86  vr::VRActionSetHandle_t ActionsetVTK = vr::k_ulInvalidActionSetHandle;
87 
89  {
90  LEFT_HAND = 0,
93  NUMBER_OF_TRACKERS
94  };
95 
97  {
98  vr::VRInputValueHandle_t Source = vr::k_ulInvalidInputValueHandle;
99  vr::TrackedDevicePose_t LastPose;
100  };
101 
102  TrackerActions Trackers[NUMBER_OF_TRACKERS];
103 
104 private:
106  void operator=(const vtkOpenVRRenderWindowInteractor&) = delete;
107 };
108 
109 #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:82
Implements VR specific functions required by vtkRenderWindowInteractor.
VR rendering window.
@ function
Definition: vtkX3D.h:255
@ string
Definition: vtkX3D.h:496