VTK  9.3.0
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 
21 VTK_ABI_NAMESPACE_BEGIN
22 class vtkMatrix4x4;
23 class vtkVRRenderWindow;
24 
25 class VTKRENDERINGVR_EXPORT vtkVRRenderWindowInteractor : public vtkRenderWindowInteractor3D
26 {
27 public:
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;
84  double* GetPhysicalTranslation(vtkCamera*) 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 
110  /*
111  * Return starting physical to world matrix.
112  */
113  void GetStartingPhysicalToWorldMatrix(vtkMatrix4x4* startingPhysicalToWorldMatrix);
114 
116 
121  vtkGetMacro(ActionManifestFileName, std::string);
122  vtkSetMacro(ActionManifestFileName, std::string);
124 
126 
130  vtkGetMacro(ActionManifestDirectory, std::string);
131  vtkSetMacro(ActionManifestDirectory, std::string);
133 
135 
138  vtkGetMacro(ActionSetName, std::string);
139  vtkSetMacro(ActionSetName, std::string);
141 
142 protected:
145 
147 
151  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
152  int InternalDestroyTimer(int platformTimerId) override;
154 
159  void StartEventLoop() override;
160 
162 
181 
183 
187  static void (*ClassExitMethod)(void*);
188  static void (*ClassExitMethodArgDelete)(void*);
189  static void* ClassExitMethodArg;
191 
196 
197  int DeviceInputDownCount[vtkEventDataNumberOfDevices];
198 
201 
203 
204 private:
206  void operator=(const vtkVRRenderWindowInteractor&) = delete;
207 };
208 
209 VTK_ABI_NAMESPACE_END
210 #endif
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
a simple class to control print indentation
Definition: vtkIndent.h:38
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:40
adds support for 3D events to vtkRenderWindowInteractor.
abstract specification for renderers
Definition: vtkRenderer.h:71
Implements VR specific functions required by vtkRenderWindowInteractor.
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.
void SetPhysicalScale(double) override
Set/get the physical scale (world / physical distance ratio)
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...
vtkNew< vtkMatrix4x4 > StartingPhysicalToWorldMatrix
Store physical to world matrix at the start of a complex gesture.
void ExitCallback() override
This method corresponds to the Exit callback, allowing for the style to invoke it.
double * GetPhysicalTranslation(vtkCamera *) override
Set/get position of the physical coordinate system origin in world coordinates.
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 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.
void GetStartingPhysicalToWorldMatrix(vtkMatrix4x4 *startingPhysicalToWorldMatrix)
static void SetClassExitMethodArgDelete(void(*f)(void *))
Methods to set the default exit method for the class.
double * GetPhysicalViewDirection() override
Set/get the direction of the physical coordinate system -Z axis in world coordinates.
~vtkVRRenderWindowInteractor() override
double * GetPhysicalViewUp() override
Set/get the direction of the physical coordinate system +Y axis in world coordinates.
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.
@ string
Definition: vtkX3D.h:490
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:15
const int vtkEventDataNumberOfDevices
Definition: vtkEventData.h:25