VTK  9.6.20260412
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
10
11#ifndef vtkVRRenderWindowInteractor_h
12#define vtkVRRenderWindowInteractor_h
13
14#include "vtkEventData.h" // for ivar
15#include "vtkNew.h" // for ivar
17#include "vtkRenderingVRModule.h" // for export macro
18#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
19
20#include <string> // for ivar
21
22VTK_ABI_NAMESPACE_BEGIN
23class vtkMatrix4x4;
25
28{
29public:
31 void PrintSelf(ostream& os, vtkIndent indent) override;
32
36 void Initialize() override;
37
42 void ProcessEvents() override;
43
47 virtual void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) = 0;
48
50
56 static void SetClassExitMethod(void (*f)(void*), void* arg);
57 static void SetClassExitMethodArgDelete(void (*f)(void*));
59
63 void ExitCallback() override;
64
66
69 void SetPhysicalViewDirection(double, double, double) override;
70 double* GetPhysicalViewDirection() override;
72
74
77 void SetPhysicalViewUp(double, double, double) override;
78 double* GetPhysicalViewUp() override;
80
82
85 void SetPhysicalTranslation(vtkCamera*, double, double, double) override;
88
90
93 void SetPhysicalScale(double) override;
94 double GetPhysicalScale() override;
96
97 /*
98 * Return the pointer index as a device.
99 */
101
102 /*
103 * Convert a device pose to a world coordinate position and orientation.
104 * \param pos Output world position
105 * \param wxyz Output world orientation quaternion
106 * \param ppos Output physical position
107 * \param wdir Output world view direction (-Z)
108 */
109 void ConvertPoseToWorldCoordinates(vtkMatrix4x4* poseInTrackingCoordinates, double pos[3],
110 double wxyz[4], double ppos[3], double wdir[3]);
111
113
119 virtual void AddAction(const std::string& path, const vtkCommand::EventIds&, bool isAnalog) = 0;
120 virtual void AddAction(
121 const std::string& path, bool isAnalog, const std::function<void(vtkEventData*)>&) = 0;
123
125
130 vtkGetMacro(ActionManifestFileName, std::string);
131 vtkSetMacro(ActionManifestFileName, std::string);
133
135
139 vtkGetMacro(ActionManifestDirectory, std::string);
140 vtkSetMacro(ActionManifestDirectory, std::string);
142
144
147 vtkGetMacro(ActionSetName, std::string);
148 vtkSetMacro(ActionSetName, std::string);
150
152
173
175
187
189
201
202protected:
205
207
211 int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
212 int InternalDestroyTimer(int platformTimerId) override;
214
219 void StartEventLoop() override;
220
222
226 static void (*ClassExitMethod)(void*);
227 static void (*ClassExitMethodArgDelete)(void*);
228 static void* ClassExitMethodArg;
230
232
235
236 std::string ActionSetName;
237
238private:
240 void operator=(const vtkVRRenderWindowInteractor&) = delete;
241};
242
243VTK_ABI_NAMESPACE_END
244#endif
a virtual camera for 3D rendering
Definition vtkCamera.h:151
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 4x4 transformation matrices
abstract specification for renderers
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
#define VTK_MARSHALAUTO