VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
19 
20 #include <string> // for ivar
21 
22 VTK_ABI_NAMESPACE_BEGIN
23 class vtkMatrix4x4;
24 class vtkVRRenderWindow;
25 
26 class VTKRENDERINGVR_EXPORT VTK_MARSHALAUTO vtkVRRenderWindowInteractor
28 {
29 public:
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;
86  double* GetPhysicalTranslation(vtkCamera*) override;
88 
90 
93  void SetPhysicalScale(double) override;
94  double GetPhysicalScale() override;
96 
97  /*
98  * Return the pointer index as a device.
99  */
100  vtkEventDataDevice GetPointerDevice();
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 
170  virtual void HandleComplexGestureEvents(vtkEventData* ed);
171  virtual void RecognizeComplexGesture(vtkEventDataDevice3D* edata);
173 
175 
185  int GetDeviceInputDownCount(vtkEventDataDevice device) const;
187 
189 
199  void SetDeviceInputDownCount(vtkEventDataDevice device, int count);
201 
202 protected:
204  ~vtkVRRenderWindowInteractor() override;
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 
231  int DeviceInputDownCount[vtkEventDataNumberOfDevices];
232 
235 
237 
238 private:
240  void operator=(const vtkVRRenderWindowInteractor&) = delete;
241 };
242 
243 VTK_ABI_NAMESPACE_END
244 #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:31
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:63
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:41
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)
#define VTK_MARSHALAUTO