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
38class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindowInteractor : public vtkVRRenderWindowInteractor
39{
40public:
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
62protected:
65
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
95private:
97 void operator=(const vtkOpenVRRenderWindowInteractor&) = delete;
98};
99
100#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.
static vtkOpenVRRenderWindowInteractor * New()
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.
abstract specification for renderers
Definition: vtkRenderer.h:73
Implements VR specific functions required by vtkRenderWindowInteractor.
VR rendering window.