VTK  9.2.6
vtkVRCamera.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4 
5  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
22 #ifndef vtkVRCamera_h
23 #define vtkVRCamera_h
24 
25 #include "vtkDeprecation.h" // for old method sig
26 #include "vtkNew.h" // for iavr
27 #include "vtkOpenGLCamera.h"
28 #include "vtkRenderingVRModule.h" // For export macro
29 
30 class vtkMatrix4x4;
31 class vtkVRRenderWindow;
32 
33 class VTKRENDERINGVR_EXPORT vtkVRCamera : public vtkOpenGLCamera
34 {
35 public:
36  vtkTypeMacro(vtkVRCamera, vtkOpenGLCamera);
37 
43  VTK_DEPRECATED_IN_9_2_0("use GetPhysicalToProjectionMatrix instead")
44  virtual void GetTrackingToDCMatrix(vtkMatrix4x4*& physicalToProjectionMatrix)
45  {
46  this->GetPhysicalToProjectionMatrix(physicalToProjectionMatrix);
47  };
48  virtual void GetPhysicalToProjectionMatrix(vtkMatrix4x4*& physicalToProjectionMatrix) = 0;
49 
50  // A pose in VR includes more than just the basic camera values.
51  // It includes all the properties needed to reproduce a view
52  // in physical space when requested from a different physical space
53  // This class stores those properties
54  // As the VR code is still being rearchitected this signature
55  // may change slightly through the end of 2021.
56  class Pose
57  {
58  public:
59  double Position[3];
60  double PhysicalViewUp[3];
61  double PhysicalViewDirection[3];
62  double ViewDirection[3];
63  double Translation[3];
64  double Distance;
65  double MotionFactor = 1.0;
66  };
67 
68  // Fill in a Pose object based on the current camera and physical space
69  // settings. As the VR code is still being rearchitected this signature
70  // may change slightly through the end of 2021.
71  void SetPoseFromCamera(Pose* pose, vtkVRRenderWindow* win);
72 
73  // Reproduce a pose using the current camera and render window. That is, try
74  // to make the viewer's current view look like the original saved pose.
75  // This is complicated by the fact that the viewer may now occupy a very
76  // different position and orientation in the physical space than when the
77  // pose was saved. This method accounts for this and adjusts the phjsical
78  // space to best fit the requested pose.
79  // As the VR code is still being rearchitected this signature
80  // may change slightly through the end of 2021.
81  void ApplyPoseToCamera(Pose* pose, vtkVRRenderWindow* win);
82 
83  // Set the camera's ivars based on a user provided matrix. The goal here
84  // is to make it so that the camera is consistent with the provided matrix
85  // and when the world to pose/view matrix is requested would return the
86  // same matrix as provided.
87  void SetCameraFromWorldToDeviceMatrix(vtkMatrix4x4* mat, double distance);
88  void SetCameraFromDeviceToWorldMatrix(vtkMatrix4x4* mat, double distance);
89 
90 protected:
91  vtkVRCamera();
92  ~vtkVRCamera() override;
93 
95 
96 private:
97  vtkVRCamera(const vtkVRCamera&) = delete;
98  void operator=(const vtkVRCamera&) = delete;
99 };
100 
101 #endif
VR camera.
Definition: vtkVRCamera.h:33
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition: vtkVRCamera.h:94
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
#define VTK_DEPRECATED_IN_9_2_0(reason)
VR rendering window.
OpenGL camera.