VTK  9.7.1
vtkVRHMDCamera.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
9 #ifndef vtkVRHMDCamera_h
10 #define vtkVRHMDCamera_h
11 
12 #include "vtkNew.h" // ivars
13 #include "vtkRenderingVRModule.h" // For export macro
14 #include "vtkVRCamera.h"
15 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
16 
17 VTK_ABI_NAMESPACE_BEGIN
18 class vtkRenderer;
19 class vtkMatrix4x4;
20 
21 class VTKRENDERINGVR_EXPORT VTK_MARSHALAUTO vtkVRHMDCamera : public vtkVRCamera
22 {
23 public:
24  vtkTypeMacro(vtkVRHMDCamera, vtkVRCamera);
25  void PrintSelf(ostream& os, vtkIndent indent) override;
26 
30  void Render(vtkRenderer* ren) override;
31 
32  void GetKeyMatrices(vtkRenderer* ren, vtkMatrix4x4*& WCVCMatrix, vtkMatrix3x3*& normalMatrix,
33  vtkMatrix4x4*& VCDCMatrix, vtkMatrix4x4*& WCDCMatrix) override;
34 
40  void GetPhysicalToProjectionMatrix(vtkMatrix4x4*& physicalToProjectionMatrtix) override;
41 
42 protected:
44  ~vtkVRHMDCamera() override;
45 
46  // you must provide these two methods in your subclass
47  virtual void UpdateWorldToEyeMatrices(vtkRenderer*) = 0;
48  virtual void UpdateEyeToProjectionMatrices(vtkRenderer*) = 0;
49 
64  void ComputeProjectionTransform(double aspect, double nearz, double farz) override;
65 
66  // all the matrices below are stored in VTK convention
67  // as A = Mx where x is a column vector.
68 
69  // the physical to hmd (left and right eye) part
72 
73  // adds in the world to physical part
76 
77  // we get these from the VR system possibly with some modifications for
78  // adjusting the clipping range or zbuffer formula
81 
82  // computed using the above matrices, these matrices go from physical to
83  // projection space but that transformation will be different depending on
84  // which eye is active. So the naming is different as the start and end
85  // space is not tied to an eye, but rather some of the internal
86  // transformations
89 
91 
92 private:
93  vtkVRHMDCamera(const vtkVRHMDCamera&) = delete;
94  void operator=(const vtkVRHMDCamera&) = delete;
95 };
96 
97 VTK_ABI_NAMESPACE_END
98 #endif
VR camera.
Definition: vtkVRCamera.h:23
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:31
vtkNew< vtkMatrix4x4 > PhysicalToProjectionMatrixForRightEye
vtkNew< vtkMatrix4x4 > WorldToRightEyeMatrix
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkNew< vtkMatrix4x4 > LeftEyeToProjectionMatrix
virtual void ComputeProjectionTransform(double aspect, double nearz, double farz)
These methods should only be used within vtkCamera.cxx.
void Render(vtkRenderer *ren) override
Implement base class method.
vtkNew< vtkMatrix4x4 > PhysicalToLeftEyeMatrix
virtual void GetKeyMatrices(vtkRenderer *ren, vtkMatrix4x4 *&WCVCMatrix, vtkMatrix3x3 *&normalMatrix, vtkMatrix4x4 *&VCDCMatrix, vtkMatrix4x4 *&WCDCMatrix)
vtkNew< vtkMatrix4x4 > WorldToLeftEyeMatrix
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void GetPhysicalToProjectionMatrix(vtkMatrix4x4 *&physicalToProjectionMatrix)=0
Provides a matrix to go from physical coordinates to projection coordinates for the eye currently bei...
vtkNew< vtkMatrix4x4 > RightEyeToProjectionMatrix
vtkNew< vtkMatrix4x4 > PhysicalToProjectionMatrixForLeftEye
A superclass for HMD style cameras.
vtkNew< vtkMatrix4x4 > WorldToPhysicalMatrix
vtkNew< vtkMatrix4x4 > PhysicalToRightEyeMatrix
#define VTK_MARSHALAUTO
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:26