VTK: Rendering/VR/vtkVRRenderWindowInteractor.h Source File

| 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
16 #include "vtkRenderWindowInteractor3D.h"
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:
28 vtkTypeMacro(vtkVRRenderWindowInteractor, vtkRenderWindowInteractor3D);
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:
143 vtkVRRenderWindowInteractor();
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
195 vtkNew<vtkMatrix4x4> StartingPhysicalToWorldMatrix;
196
197 int DeviceInputDownCount[vtkEventDataNumberOfDevices];
198
199 std::string ActionManifestFileName;
200 std::string ActionManifestDirectory;
201
202 std::string ActionSetName;
203
204 private:
205 vtkVRRenderWindowInteractor(const vtkVRRenderWindowInteractor&) = delete;
206 void operator=(const vtkVRRenderWindowInteractor&) = delete;
207 };
208
209 VTK_ABI_NAMESPACE_END
210 #endif
vtkCamera
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
vtkEventDataDevice3D
Definition: vtkEventData.h:150
vtkEventData
Definition: vtkEventData.h:58
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:40
vtkNew< vtkMatrix4x4 >
vtkRenderWindowInteractor3D
adds support for 3D events to vtkRenderWindowInteractor.
Definition: vtkRenderWindowInteractor3D.h:35
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:71
vtkVRRenderWindowInteractor
Implements VR specific functions required by vtkRenderWindowInteractor.
Definition: vtkVRRenderWindowInteractor.h:26
vtkVRRenderWindowInteractor::ActionManifestFileName
std::string ActionManifestFileName
Definition: vtkVRRenderWindowInteractor.h:199
vtkVRRenderWindowInteractor::ProcessEvents
void ProcessEvents() override
Run the event loop and return.
vtkVRRenderWindowInteractor::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkVRRenderWindowInteractor::vtkVRRenderWindowInteractor
vtkVRRenderWindowInteractor()
vtkVRRenderWindowInteractor::SetPhysicalScale
void SetPhysicalScale(double) override
Set/get the physical scale (world / physical distance ratio)
vtkVRRenderWindowInteractor::GetPhysicalScale
double GetPhysicalScale() override
Set/get the physical scale (world / physical distance ratio)
vtkVRRenderWindowInteractor::Initialize
void Initialize() override
Initialize the event handler.
vtkVRRenderWindowInteractor::ActionSetName
std::string ActionSetName
Definition: vtkVRRenderWindowInteractor.h:202
vtkVRRenderWindowInteractor::ClassExitMethodArg
static void * ClassExitMethodArg
Class variables so an exit method can be defined for this class (used to set different exit methods f...
Definition: vtkVRRenderWindowInteractor.h:189
vtkVRRenderWindowInteractor::StartingPhysicalToWorldMatrix
vtkNew< vtkMatrix4x4 > StartingPhysicalToWorldMatrix
Store physical to world matrix at the start of a complex gesture.
Definition: vtkVRRenderWindowInteractor.h:195
vtkVRRenderWindowInteractor::ExitCallback
void ExitCallback() override
This method corresponds to the Exit callback, allowing for the style to invoke it.
vtkVRRenderWindowInteractor::GetPhysicalTranslation
double * GetPhysicalTranslation(vtkCamera *) override
Set/get position of the physical coordinate system origin in world coordinates.
vtkVRRenderWindowInteractor::InternalDestroyTimer
int InternalDestroyTimer(int platformTimerId) override
internal timer methods.
vtkVRRenderWindowInteractor::InternalCreateTimer
int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override
internal timer methods.
vtkVRRenderWindowInteractor::GetPointerDevice
vtkEventDataDevice GetPointerDevice()
vtkVRRenderWindowInteractor::RecognizeComplexGesture
virtual void RecognizeComplexGesture(vtkEventDataDevice3D *edata)
Handle complex gesture events.
vtkVRRenderWindowInteractor::SetPhysicalTranslation
void SetPhysicalTranslation(vtkCamera *, double, double, double) override
Set/get position of the physical coordinate system origin in world coordinates.
vtkVRRenderWindowInteractor::SetPhysicalViewUp
void SetPhysicalViewUp(double, double, double) override
Set/get the direction of the physical coordinate system +Y axis in world coordinates.
vtkVRRenderWindowInteractor::GetStartingPhysicalToWorldMatrix
void GetStartingPhysicalToWorldMatrix(vtkMatrix4x4 *startingPhysicalToWorldMatrix)
vtkVRRenderWindowInteractor::SetClassExitMethodArgDelete
static void SetClassExitMethodArgDelete(void(*f)(void *))
Methods to set the default exit method for the class.
vtkVRRenderWindowInteractor::GetPhysicalViewDirection
double * GetPhysicalViewDirection() override
Set/get the direction of the physical coordinate system -Z axis in world coordinates.
vtkVRRenderWindowInteractor::~vtkVRRenderWindowInteractor
~vtkVRRenderWindowInteractor() override
vtkVRRenderWindowInteractor::GetPhysicalViewUp
double * GetPhysicalViewUp() override
Set/get the direction of the physical coordinate system +Y axis in world coordinates.
vtkVRRenderWindowInteractor::HandleComplexGestureEvents
virtual void HandleComplexGestureEvents(vtkEventData *ed)
Handle complex gesture events.
vtkVRRenderWindowInteractor::StartEventLoop
void StartEventLoop() override
This will start up the event loop and never return.
vtkVRRenderWindowInteractor::ConvertPoseToWorldCoordinates
void ConvertPoseToWorldCoordinates(vtkMatrix4x4 *poseInTrackingCoordinates, double pos[3], double wxyz[4], double ppos[3], double wdir[3])
vtkVRRenderWindowInteractor::DoOneEvent
virtual void DoOneEvent(vtkVRRenderWindow *renWin, vtkRenderer *ren)=0
Implements the event loop.
vtkVRRenderWindowInteractor::ActionManifestDirectory
std::string ActionManifestDirectory
Definition: vtkVRRenderWindowInteractor.h:200
vtkVRRenderWindowInteractor::SetPhysicalViewDirection
void SetPhysicalViewDirection(double, double, double) override
Set/get the direction of the physical coordinate system -Z axis in world coordinates.
vtkVRRenderWindowInteractor::SetClassExitMethod
static void SetClassExitMethod(void(*f)(void *), void *arg)
Methods to set the default exit method for the class.
vtkVRRenderWindow
VR rendering window.
Definition: vtkVRRenderWindow.h:57
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkEventData.h
vtkEventDataDevice
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:15
vtkEventDataNumberOfDevices
const int vtkEventDataNumberOfDevices
Definition: vtkEventData.h:25
vtkNew.h
vtkRenderWindowInteractor3D.h