VTK  9.4.20241222
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
125VTK_ABI_NAMESPACE_BEGIN
126class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindowInteractor : public vtkVRRenderWindowInteractor
127{
128public:
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;
148 const std::string& path, bool isAnalog, const std::function<void(vtkEventData*)>&) override;
150
151protected:
159
161 {
162 public:
163 vr::VRActionHandle_t ActionHandle;
165 std::function<void(vtkEventData*)> Function;
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
189private:
191 void operator=(const vtkOpenVRRenderWindowInteractor&) = delete;
192};
193
194VTK_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.
static vtkOpenVRRenderWindowInteractor * New()
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....
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
Implements VR specific functions required by vtkRenderWindowInteractor.
VR rendering window.