VTK  9.2.6
vtkVRRenderWindowInteractor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVRRenderWindowInteractor.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
23 #ifndef vtkVRRenderWindowInteractor_h
24 #define vtkVRRenderWindowInteractor_h
25 
26 #include "vtkEventData.h" // for ivar
27 #include "vtkNew.h" // for ivar
29 #include "vtkRenderingVRModule.h" // for export macro
30 
31 #include <string> // for ivar
32 
33 class vtkMatrix4x4;
34 class vtkVRRenderWindow;
35 
36 class VTKRENDERINGVR_EXPORT vtkVRRenderWindowInteractor : public vtkRenderWindowInteractor3D
37 {
38 public:
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
45  void Initialize() override;
46 
51  void ProcessEvents() override;
52 
56  virtual void DoOneEvent(vtkVRRenderWindow* renWin, vtkRenderer* ren) = 0;
57 
59 
65  static void SetClassExitMethod(void (*f)(void*), void* arg);
66  static void SetClassExitMethodArgDelete(void (*f)(void*));
68 
72  void ExitCallback() override;
73 
75 
78  void SetPhysicalViewDirection(double, double, double) override;
79  double* GetPhysicalViewDirection() override;
81 
83 
86  void SetPhysicalViewUp(double, double, double) override;
87  double* GetPhysicalViewUp() override;
89 
91 
94  void SetPhysicalTranslation(vtkCamera*, double, double, double) override;
95  double* GetPhysicalTranslation(vtkCamera*) override;
97 
99 
102  void SetPhysicalScale(double) override;
103  double GetPhysicalScale() override;
105 
106  /*
107  * Return the pointer index as a device.
108  */
109  vtkEventDataDevice GetPointerDevice();
110 
111  /*
112  * Convert a device pose to a world coordinate position and orientation.
113  * \param pos Output world position
114  * \param wxyz Output world orientation quaternion
115  * \param ppos Output physical position
116  * \param wdir Output world view direction (-Z)
117  */
118  void ConvertPoseToWorldCoordinates(vtkMatrix4x4* poseInTrackingCoordinates, double pos[3],
119  double wxyz[4], double ppos[3], double wdir[3]);
120 
121  /*
122  * Return starting physical to world matrix.
123  */
124  void GetStartingPhysicalToWorldMatrix(vtkMatrix4x4* startingPhysicalToWorldMatrix);
125 
127 
131  vtkGetMacro(ActionManifestFileName, std::string);
132  vtkSetMacro(ActionManifestFileName, std::string);
134 
136 
139  vtkGetMacro(ActionSetName, std::string);
140  vtkSetMacro(ActionSetName, std::string);
142 
143 protected:
145  ~vtkVRRenderWindowInteractor() override;
146 
148 
152  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
153  int InternalDestroyTimer(int platformTimerId) override;
155 
160  void StartEventLoop() override;
161 
163 
167  void HandleGripEvents(vtkEventData* ed);
168  void RecognizeComplexGesture(vtkEventDataDevice3D* edata);
170 
172 
176  static void (*ClassExitMethod)(void*);
177  static void (*ClassExitMethodArgDelete)(void*);
178  static void* ClassExitMethodArg;
180 
185  int DeviceInputDownCount[vtkEventDataNumberOfDevices];
188 
189 private:
191  void operator=(const vtkVRRenderWindowInteractor&) = delete;
192 };
193 
194 #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:41
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:72
virtual double * GetPhysicalTranslation(vtkCamera *)
Set/get position of the physical coordinate system origin in world coordinates.
const int vtkEventDataNumberOfDevices
Definition: vtkEventData.h:36
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:39
virtual void ExitCallback()
These methods correspond to the Exit, User and Pick callbacks.
a virtual camera for 3D rendering
Definition: vtkCamera.h:51
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:25
virtual void ProcessEvents()
Run the event loop 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 multitouch gesture.