VTK  9.4.20241222
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
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
19#include <string> // for ivar
20
21VTK_ABI_NAMESPACE_BEGIN
22class vtkMatrix4x4;
24
25class VTKRENDERINGVR_EXPORT vtkVRRenderWindowInteractor : public vtkRenderWindowInteractor3D
26{
27public:
29 void PrintSelf(ostream& os, vtkIndent indent) override;
30
34 void Initialize() override;
35
40 void ProcessEvents() override;
41
45 virtual void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) = 0;
46
48
54 static void SetClassExitMethod(void (*f)(void*), void* arg);
55 static void SetClassExitMethodArgDelete(void (*f)(void*));
57
61 void ExitCallback() override;
62
64
67 void SetPhysicalViewDirection(double, double, double) override;
68 double* GetPhysicalViewDirection() override;
70
72
75 void SetPhysicalViewUp(double, double, double) override;
76 double* GetPhysicalViewUp() override;
78
80
83 void SetPhysicalTranslation(vtkCamera*, double, double, double) override;
86
88
91 void SetPhysicalScale(double) override;
92 double GetPhysicalScale() override;
94
95 /*
96 * Return the pointer index as a device.
97 */
99
100 /*
101 * Convert a device pose to a world coordinate position and orientation.
102 * \param pos Output world position
103 * \param wxyz Output world orientation quaternion
104 * \param ppos Output physical position
105 * \param wdir Output world view direction (-Z)
106 */
107 void ConvertPoseToWorldCoordinates(vtkMatrix4x4* poseInTrackingCoordinates, double pos[3],
108 double wxyz[4], double ppos[3], double wdir[3]);
109
111
117 virtual void AddAction(const std::string& path, const vtkCommand::EventIds&, bool isAnalog) = 0;
118 virtual void AddAction(
119 const std::string& path, bool isAnalog, const std::function<void(vtkEventData*)>&) = 0;
121
123
128 vtkGetMacro(ActionManifestFileName, std::string);
129 vtkSetMacro(ActionManifestFileName, std::string);
131
133
137 vtkGetMacro(ActionManifestDirectory, std::string);
138 vtkSetMacro(ActionManifestDirectory, std::string);
140
142
145 vtkGetMacro(ActionSetName, std::string);
146 vtkSetMacro(ActionSetName, std::string);
148
150
171
173
185
187
199
200protected:
203
205
209 int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
210 int InternalDestroyTimer(int platformTimerId) override;
212
217 void StartEventLoop() override;
218
220
224 static void (*ClassExitMethod)(void*);
225 static void (*ClassExitMethodArgDelete)(void*);
226 static void* ClassExitMethodArg;
228
229 int DeviceInputDownCount[vtkEventDataNumberOfDevices];
230
233
234 std::string ActionSetName;
235
236private:
238 void operator=(const vtkVRRenderWindowInteractor&) = delete;
239};
240
241VTK_ABI_NAMESPACE_END
242#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
adds support for 3D events to vtkRenderWindowInteractor.
abstract specification for renderers
Implements VR specific functions required by vtkRenderWindowInteractor.
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.
void SetPhysicalScale(double) override
Set/get the physical scale (world / physical distance ratio)
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.
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