VTK
vtkOpenVRRenderWindowInteractor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenVRRenderWindowInteractor.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 vtkOpenVRRenderWindowInteractor_h
24 #define vtkOpenVRRenderWindowInteractor_h
25 
26 #include "vtkRenderingOpenVRModule.h" // For export macro
28 
29 #include "vtkOpenVRRenderWindow.h" // ivars
30 #include "vtkNew.h" // ivars
31 #include "vtkTransform.h" // ivars
32 
33 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindowInteractor : public vtkRenderWindowInteractor3D
34 {
35 public:
40 
42  void PrintSelf(ostream& os, vtkIndent indent);
43 
47  virtual void Initialize();
48 
54  void TerminateApp(void);
55 
57 
63  static void SetClassExitMethod(void (*f)(void *), void *arg);
64  static void SetClassExitMethodArgDelete(void (*f)(void *));
66 
71  virtual void ExitCallback();
72 
74 
78  virtual void SetPhysicalTranslation(vtkCamera *, double, double, double);
79  virtual double *GetPhysicalTranslation(vtkCamera *);
80  virtual void SetPhysicalScale(double);
81  virtual double GetPhysicalScale();
83 
84  virtual void DoOneEvent(vtkOpenVRRenderWindow *renWin, vtkRenderer *ren);
85 
86  /*
87  * returns the pointer index as a device
88  */
89  vtkEventDataDevice GetPointerDevice();
90 
91  // converts a device pose to a world coordinate
92  // position and orientation
93  void ConvertPoseToWorldCoordinates(
94  const vr::TrackedDevicePose_t &tdPose,
95  double pos[3],
96  double wxyz[4],
97  double ppos[3],
98  double wdir[3]);
99 
100 protected:
103 
104  void UpdateTouchPadPosition(vr::IVRSystem *pHMD,
105  vr::TrackedDeviceIndex_t tdi);
106 
108 
113  static void (*ClassExitMethod)(void *);
114  static void (*ClassExitMethodArgDelete)(void *);
115  static void *ClassExitMethodArg;
117 
119 
123  virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
124  virtual int InternalDestroyTimer(int platformTimerId);
126 
132  virtual void StartEventLoop();
133 
134 
136 
141  int DeviceInputDown[VTKI_MAX_POINTERS][2];
142  int DeviceInputDownCount[2];
143  void RecognizeComplexGesture(vtkEventDataDevice3D* edata);
144 
145 private:
147  void operator=(const vtkOpenVRRenderWindowInteractor&) = delete;
148 };
149 
150 #endif
vtkRenderWindowInteractor::InternalCreateTimer
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
vtkOpenVRRenderWindow.h
vtkRenderWindowInteractor::StartEventLoop
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
Definition: vtkRenderWindowInteractor.h:889
vtkEventDataDevice3D
Definition: vtkEventData.h:131
vtkRenderWindowInteractor::InternalDestroyTimer
virtual int InternalDestroyTimer(int platformTimerId)
vtkRenderWindowInteractor3D
adds support for 3D events to vtkRenderWindowInteractor.
Definition: vtkRenderWindowInteractor3D.h:37
vtkRenderWindowInteractor3D::SetPhysicalScale
virtual void SetPhysicalScale(double)
Definition: vtkRenderWindowInteractor3D.h:243
vtkOpenVRRenderWindowInteractor::PoseTransform
vtkNew< vtkTransform > PoseTransform
Definition: vtkOpenVRRenderWindowInteractor.h:135
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkOpenVRRenderWindow
OpenVR rendering window.
Definition: vtkOpenVRRenderWindow.h:57
vtkCamera
a virtual camera for 3D rendering
Definition: vtkCamera.h:44
vtkNew< vtkTransform >
vtkRenderWindowInteractor3D.h
vtkRenderWindowInteractor3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRenderWindowInteractor3D::SetPhysicalTranslation
virtual void SetPhysicalTranslation(vtkCamera *, double, double, double)
Set/Get the optional scale translation to map world coordinates into the 3D physical space (meters,...
Definition: vtkRenderWindowInteractor3D.h:241
vtkRenderWindowInteractor::ExitCallback
virtual void ExitCallback()
These methods correspond to the Exit, User and Pick callbacks.
vtkEventDataDevice
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:25
vtkNew.h
vtkRenderWindowInteractor3D::GetPhysicalTranslation
virtual double * GetPhysicalTranslation(vtkCamera *)
Definition: vtkRenderWindowInteractor3D.h:242
vtkRenderWindowInteractor3D::GetPhysicalScale
virtual double GetPhysicalScale()
Definition: vtkRenderWindowInteractor3D.h:244
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:57
VTKI_MAX_POINTERS
#define VTKI_MAX_POINTERS
Definition: vtkRenderWindowInteractor.h:60
vtkRenderWindowInteractor::Initialize
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
vtkOpenVRRenderWindowInteractor
implements OpenVR specific functions required by vtkRenderWindowInteractor.
Definition: vtkOpenVRRenderWindowInteractor.h:33
vtkTransform.h
vtkRenderWindowInteractor3D::TerminateApp
void TerminateApp(void) override
OpenVR specific application terminate, calls ClassExitMethod then calls PostQuitMessage(0) to termina...
vtkOpenVRRenderWindowInteractor::ClassExitMethodArg
static void * ClassExitMethodArg
Definition: vtkOpenVRRenderWindowInteractor.h:115
vtkRenderWindowInteractor3D::New
static vtkRenderWindowInteractor3D * New()
Construct object so that light follows camera motion.