VTK  9.2.5
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  */
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:
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 
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
a virtual camera for 3D rendering
Definition: vtkCamera.h:161
a simple class to control print indentation
Definition: vtkIndent.h:119
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:151
adds support for 3D events to vtkRenderWindowInteractor.
abstract specification for renderers
Definition: vtkRenderer.h:182
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 HandleGripEvents(vtkEventData *ed)
Handle multitouch events.
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 multitouch gesture.
void RecognizeComplexGesture(vtkEventDataDevice3D *edata)
Handle multitouch events.
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()
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.
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:496
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:26
const int vtkEventDataNumberOfDevices
Definition: vtkEventData.h:36