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