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
30class vtkMatrix4x4;
32
33class VTKRENDERINGVR_EXPORT vtkVRCamera : public vtkOpenGLCamera
34{
35public:
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.
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.
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.
89
90protected:
92 ~vtkVRCamera() override;
93
95
96private:
97 vtkVRCamera(const vtkVRCamera&) = delete;
98 void operator=(const vtkVRCamera&) = delete;
99};
100
101#endif
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
Allocate and hold a VTK object.
Definition: vtkNew.h:62
OpenGL camera.
VR camera.
Definition: vtkVRCamera.h:34
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:94
virtual void GetPhysicalToProjectionMatrix(vtkMatrix4x4 *&physicalToProjectionMatrix)=0
VR rendering window.
#define VTK_DEPRECATED_IN_9_2_0(reason)