VTK  9.3.1
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  */
98  vtkEventDataDevice GetPointerDevice();
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:
144  ~vtkVRRenderWindowInteractor() override;
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 
178  virtual void HandleComplexGestureEvents(vtkEventData* ed);
179  virtual void RecognizeComplexGesture(vtkEventDataDevice3D* edata);
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
virtual void SetPhysicalTranslation(vtkCamera *, double, double, double)
Set/get position of the physical coordinate system origin in world coordinates.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:30
Implements VR specific functions required by vtkRenderWindowInteractor.
virtual int InternalDestroyTimer(int platformTimerId)
Internal methods for creating and destroying timers that must be implemented by subclasses.
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
virtual double * GetPhysicalViewUp()
Set/get the direction of the physical coordinate system +Y axis in world coordinates.
virtual double * GetPhysicalViewDirection()
Set/get the direction of the physical coordinate system -Z axis in world coordinates.
VR rendering window.
adds support for 3D events to vtkRenderWindowInteractor.
abstract specification for renderers
Definition: vtkRenderer.h:61
virtual double * GetPhysicalTranslation(vtkCamera *)
Set/get position of the physical coordinate system origin in world coordinates.
const int vtkEventDataNumberOfDevices
Definition: vtkEventData.h:25
static void * ClassExitMethodArg
Class variables so an exit method can be defined for this class (used to set different exit methods f...
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void ExitCallback()
These methods correspond to the Exit, User and Pick callbacks.
a virtual camera for 3D rendering
Definition: vtkCamera.h:40
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
virtual void SetPhysicalViewUp(double, double, double)
Set/get the direction of the physical coordinate system +Y axis in world coordinates.
virtual void SetPhysicalViewDirection(double, double, double)
Set/get the direction of the physical coordinate system -Z axis in world coordinates.
virtual double GetPhysicalScale()
Set/get the physical scale (world / physical distance ratio)
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:14
virtual void ProcessEvents()
Process all user-interaction, timer events and return.
virtual void SetPhysicalScale(double)
Set/get the physical scale (world / physical distance ratio)
vtkNew< vtkMatrix4x4 > StartingPhysicalToWorldMatrix
Store physical to world matrix at the start of a complex gesture.