VTK  9.3.0
vtkVRCamera.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 vtkVRCamera_h
12#define vtkVRCamera_h
13
14#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_2_0
15#include "vtkNew.h" // for iavr
16#include "vtkOpenGLCamera.h"
17#include "vtkRenderingVRModule.h" // For export macro
18
19VTK_ABI_NAMESPACE_BEGIN
20class vtkMatrix4x4;
22
23class VTKRENDERINGVR_EXPORT vtkVRCamera : public vtkOpenGLCamera
24{
25public:
27
33 VTK_DEPRECATED_IN_9_2_0("use GetPhysicalToProjectionMatrix instead")
34 virtual void GetTrackingToDCMatrix(vtkMatrix4x4*& physicalToProjectionMatrix)
35 {
36 this->GetPhysicalToProjectionMatrix(physicalToProjectionMatrix);
37 };
38 virtual void GetPhysicalToProjectionMatrix(vtkMatrix4x4*& physicalToProjectionMatrix) = 0;
39
40 // A pose in VR includes more than just the basic camera values.
41 // It includes all the properties needed to reproduce a view
42 // in physical space when requested from a different physical space
43 // This class stores those properties
44 // As the VR code is still being rearchitected this signature
45 // may change slightly through the end of 2021.
46 class Pose
47 {
48 public:
49 double Position[3];
50 double PhysicalViewUp[3];
51 double PhysicalViewDirection[3];
52 double ViewDirection[3];
53 double Translation[3];
54 double Distance;
55 double MotionFactor = 1.0;
56 };
57
58 // Fill in a Pose object based on the current camera and physical space
59 // settings. As the VR code is still being rearchitected this signature
60 // may change slightly through the end of 2021.
62
63 // Reproduce a pose using the current camera and render window. That is, try
64 // to make the viewer's current view look like the original saved pose.
65 // This is complicated by the fact that the viewer may now occupy a very
66 // different position and orientation in the physical space than when the
67 // pose was saved. This method accounts for this and adjusts the phjsical
68 // space to best fit the requested pose.
69 // As the VR code is still being rearchitected this signature
70 // may change slightly through the end of 2021.
72
73 // Set the camera's ivars based on a user provided matrix. The goal here
74 // is to make it so that the camera is consistent with the provided matrix
75 // and when the world to pose/view matrix is requested would return the
76 // same matrix as provided.
79
80protected:
82 ~vtkVRCamera() override;
83
85
86private:
87 vtkVRCamera(const vtkVRCamera&) = delete;
88 void operator=(const vtkVRCamera&) = delete;
89};
90
91VTK_ABI_NAMESPACE_END
92#endif
93/* VTK-HeaderTest-Exclude: vtkVRCamera.h */
represent and manipulate 4x4 transformation matrices
Allocate and hold a VTK object.
Definition vtkNew.h:51
OpenGL camera.
VR camera.
Definition vtkVRCamera.h:24
void SetPoseFromCamera(Pose *pose, vtkVRRenderWindow *win)
void SetCameraFromDeviceToWorldMatrix(vtkMatrix4x4 *mat, double distance)
void SetCameraFromWorldToDeviceMatrix(vtkMatrix4x4 *mat, double distance)
~vtkVRCamera() override
void ApplyPoseToCamera(Pose *pose, vtkVRRenderWindow *win)
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition vtkVRCamera.h:84
virtual void GetPhysicalToProjectionMatrix(vtkMatrix4x4 *&physicalToProjectionMatrix)=0
VR rendering window.
#define VTK_DEPRECATED_IN_9_2_0(reason)