VTK  9.5.2
vtkVRRenderWindowInteractor.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
7
8#ifndef vtkVRRenderWindowInteractor_h
9#define vtkVRRenderWindowInteractor_h
10
11#include "vtkEventData.h" // for ivar
12#include "vtkNew.h" // for ivar
14#include "vtkRenderingVRModule.h" // for export macro
15
16#include <string> // for ivar
17
18VTK_ABI_NAMESPACE_BEGIN
19class vtkMatrix4x4;
21
22class VTKRENDERINGVR_EXPORT vtkVRRenderWindowInteractor : public vtkRenderWindowInteractor3D
23{
24public:
26 void PrintSelf(ostream& os, vtkIndent indent) override;
27
31 void Initialize() override;
32
37 void ProcessEvents() override;
38
42 virtual void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) = 0;
43
45
51 static void SetClassExitMethod(void (*f)(void*), void* arg);
52 static void SetClassExitMethodArgDelete(void (*f)(void*));
54
58 void ExitCallback() override;
59
61
64 void SetPhysicalViewDirection(double, double, double) override;
65 double* GetPhysicalViewDirection() override;
67
69
72 void SetPhysicalViewUp(double, double, double) override;
73 double* GetPhysicalViewUp() override;
75
77
80 void SetPhysicalTranslation(vtkCamera*, double, double, double) override;
83
85
88 void SetPhysicalScale(double) override;
89 double GetPhysicalScale() override;
91
92 /*
93 * Return the pointer index as a device.
94 */
96
97 /*
98 * Convert a device pose to a world coordinate position and orientation.
99 * \param pos Output world position
100 * \param wxyz Output world orientation quaternion
101 * \param ppos Output physical position
102 * \param wdir Output world view direction (-Z)
103 */
104 void ConvertPoseToWorldCoordinates(vtkMatrix4x4* poseInTrackingCoordinates, double pos[3],
105 double wxyz[4], double ppos[3], double wdir[3]);
106
108
114 virtual void AddAction(const std::string& path, const vtkCommand::EventIds&, bool isAnalog) = 0;
115 virtual void AddAction(
116 const std::string& path, bool isAnalog, const std::function<void(vtkEventData*)>&) = 0;
118
120
125 vtkGetMacro(ActionManifestFileName, std::string);
126 vtkSetMacro(ActionManifestFileName, std::string);
128
130
134 vtkGetMacro(ActionManifestDirectory, std::string);
135 vtkSetMacro(ActionManifestDirectory, std::string);
137
139
142 vtkGetMacro(ActionSetName, std::string);
143 vtkSetMacro(ActionSetName, std::string);
145
147
168
170
182
184
196
197protected:
200
202
206 int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
207 int InternalDestroyTimer(int platformTimerId) override;
209
214 void StartEventLoop() override;
215
217
221 static void (*ClassExitMethod)(void*);
222 static void (*ClassExitMethodArgDelete)(void*);
223 static void* ClassExitMethodArg;
225
227
230
231 std::string ActionSetName;
232
233private:
235 void operator=(const vtkVRRenderWindowInteractor&) = delete;
236};
237
238VTK_ABI_NAMESPACE_END
239#endif
a virtual camera for 3D rendering
Definition vtkCamera.h:42
a simple class to control print indentation
Definition vtkIndent.h:29
represent and manipulate 4x4 transformation matrices
abstract specification for renderers
Definition vtkRenderer.h:60
int GetDeviceInputDownCount(vtkEventDataDevice device) const
When handling complex gestures you can query this value to determine how many input device are down f...
void ProcessEvents() override
Run the event loop and return.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void AddAction(const std::string &path, const vtkCommand::EventIds &, bool isAnalog)=0
Assign an event or std::function to an event path.
static void(* ClassExitMethod)(void *)
Class variables so an exit method can be defined for this class (used to set different exit methods f...
void SetPhysicalScale(double) override
Set/get the physical scale (world / physical distance ratio).
static void(* ClassExitMethodArgDelete)(void *)
Class variables so an exit method can be defined for this class (used to set different exit methods f...
void SetDeviceInputDownCount(vtkEventDataDevice device, int count)
You can set this value when defining a custom heuristic for recognizing complex gestures,...
double GetPhysicalScale() override
Set/get the physical scale (world / physical distance ratio).
void Initialize() override
Initialize the event handler.
static void * ClassExitMethodArg
Class variables so an exit method can be defined for this class (used to set different exit methods f...
double * GetPhysicalViewDirection() override
Set/get the direction of the physical coordinate system -Z axis in world coordinates.
double * GetPhysicalTranslation(vtkCamera *) override
Set/get position of the physical coordinate system origin in world coordinates.
int DeviceInputDownCount[vtkEventDataNumberOfDevices]
void ExitCallback() override
This method corresponds to the Exit callback, allowing for the style to invoke it.
int InternalDestroyTimer(int platformTimerId) override
internal timer methods.
int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override
internal timer methods.
vtkEventDataDevice GetPointerDevice()
virtual void AddAction(const std::string &path, bool isAnalog, const std::function< void(vtkEventData *)> &)=0
Assign an event or std::function to an event path.
virtual void RecognizeComplexGesture(vtkEventDataDevice3D *edata)
Handle complex gesture events.
void SetPhysicalTranslation(vtkCamera *, double, double, double) override
Set/get position of the physical coordinate system origin in world coordinates.
void SetPhysicalViewUp(double, double, double) override
Set/get the direction of the physical coordinate system +Y axis in world coordinates.
static void SetClassExitMethodArgDelete(void(*f)(void *))
Methods to set the default exit method for the class.
double * GetPhysicalViewUp() override
Set/get the direction of the physical coordinate system +Y axis in world coordinates.
~vtkVRRenderWindowInteractor() override
virtual void HandleComplexGestureEvents(vtkEventData *ed)
Handle complex gesture events.
void StartEventLoop() override
This will start up the event loop and never return.
void ConvertPoseToWorldCoordinates(vtkMatrix4x4 *poseInTrackingCoordinates, double pos[3], double wxyz[4], double ppos[3], double wdir[3])
virtual void DoOneEvent(vtkVRRenderWindow *renWin, vtkRenderer *ren)=0
Implements the event loop.
void SetPhysicalViewDirection(double, double, double) override
Set/get the direction of the physical coordinate system -Z axis in world coordinates.
static void SetClassExitMethod(void(*f)(void *), void *arg)
Methods to set the default exit method for the class.
VR rendering window.
vtkEventDataDevice
platform-independent event data structures
const int vtkEventDataNumberOfDevices