VTK  9.1.0
vtkOpenVRCamera.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 vtkOpenVRCamera_h
23 #define vtkOpenVRCamera_h
24 
25 #include "vtkNew.h" // ivars
26 #include "vtkRenderingOpenVRModule.h" // For export macro
27 #include "vtkTransform.h" // ivars
28 #include "vtkVRCamera.h"
29 
30 class vtkRenderer;
31 class vtkVRRenderWindow;
32 class vtkMatrix3x3;
33 class vtkMatrix4x4;
34 
35 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRCamera : public vtkVRCamera
36 {
37 public:
38  static vtkOpenVRCamera* New();
39  vtkTypeMacro(vtkOpenVRCamera, vtkVRCamera);
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
45  void Render(vtkRenderer* ren) override;
46 
47  void GetKeyMatrices(vtkRenderer* ren, vtkMatrix4x4*& WCVCMatrix, vtkMatrix3x3*& normalMatrix,
48  vtkMatrix4x4*& VCDCMatrix, vtkMatrix4x4*& WCDCMatrix) override;
49 
54  void GetTrackingToDCMatrix(vtkMatrix4x4*& TCDCMatrix) override;
55 
56  // apply the left or right eye pose to the camera
57  // position and focal point. Factor is typically
58  // 1.0 to add or -1.0 to subtract
59  void ApplyEyePose(vtkVRRenderWindow*, bool left, double factor);
60 
61  // Get the VR Physical Space to World coordinate matrix
62  vtkTransform* GetPhysicalToWorldTransform() { return this->PoseTransform.Get(); }
63 
64 protected:
66  ~vtkOpenVRCamera() override;
67 
68  // gets the pose and projections for the left and right eyes from
69  // the openvr library
72 
73  double LeftEyePose[3];
74  double RightEyePose[3];
77 
80 
81  // used to translate the
82  // View to the HMD space
84 
85 private:
86  vtkOpenVRCamera(const vtkOpenVRCamera&) = delete;
87  void operator=(const vtkOpenVRCamera&) = delete;
88 };
89 
90 #endif
a simple class to control print indentation
Definition: vtkIndent.h:34
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:34
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
OpenVR camera.
vtkMatrix4x4 * LeftEyeProjection
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMatrix4x4 * RightEyeTCDCMatrix
void Render(vtkRenderer *ren) override
Implement base class method.
vtkTransform * GetPhysicalToWorldTransform()
vtkNew< vtkTransform > PoseTransform
static vtkOpenVRCamera * New()
void GetKeyMatrices(vtkRenderer *ren, vtkMatrix4x4 *&WCVCMatrix, vtkMatrix3x3 *&normalMatrix, vtkMatrix4x4 *&VCDCMatrix, vtkMatrix4x4 *&WCDCMatrix) override
~vtkOpenVRCamera() override
vtkMatrix4x4 * LeftEyeTCDCMatrix
void GetHMDEyePoses(vtkRenderer *)
void GetTrackingToDCMatrix(vtkMatrix4x4 *&TCDCMatrix) override
Provides a matrix to go from absolute OpenVR tracking coordinates to device coordinates.
vtkMatrix4x4 * RightEyeProjection
void ApplyEyePose(vtkVRRenderWindow *, bool left, double factor)
void GetHMDEyeProjections(vtkRenderer *)
abstract specification for renderers
Definition: vtkRenderer.h:73
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:55
VR camera.
Definition: vtkVRCamera.h:32
VR rendering window.