VTK
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 =========================================================================*/
25 #ifndef vtkOpenVRCamera_h
26 #define vtkOpenVRCamera_h
27 
28 #include "vtkRenderingOpenVRModule.h" // For export macro
29 #include "vtkOpenGLCamera.h"
30 #include "vtkNew.h" // ivars
31 #include "vtkTransform.h" // ivars
32 
33 class vtkOpenVRRenderer;
35 class vtkMatrix3x3;
36 class vtkMatrix4x4;
37 
38 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRCamera : public vtkOpenGLCamera
39 {
40 public:
41  static vtkOpenVRCamera *New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
48  virtual void Render(vtkRenderer *ren);
49 
50  virtual void GetKeyMatrices(vtkRenderer *ren, vtkMatrix4x4 *&WCVCMatrix,
51  vtkMatrix3x3 *&normalMatrix, vtkMatrix4x4 *&VCDCMatrix, vtkMatrix4x4 *&WCDCMatrix);
52 
57  virtual void GetTrackingToDCMatrix(vtkMatrix4x4 *&TCDCMatrix);
58 
59  // apply the left or right eye pose to the camera
60  // position and focal point. Factor is typically
61  // 1.0 to add or -1.0 to subtract
62  void ApplyEyePose(vtkOpenVRRenderWindow *, bool left, double factor);
63 
64  // Get the OpenVR Physical Space to World coordinate matrix
66  return this->PoseTransform.Get(); }
67 
68 protected:
70  ~vtkOpenVRCamera();
71 
72  // gets the pose and projections for the left and right eves from
73  // the openvr library
74  void GetHMDEyePoses(vtkRenderer *);
75  void GetHMDEyeProjections(vtkRenderer *);
76 
77  double LeftEyePose[3];
78  double RightEyePose[3];
81 
84 
85  // used to translate the
86  // View to the HMD space
88 
89 private:
90  vtkOpenVRCamera(const vtkOpenVRCamera&) = delete;
91  void operator=(const vtkOpenVRCamera&) = delete;
92 };
93 
94 #endif
OpenVR camera.
static vtkOpenGLCamera * New()
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
vtkMatrix4x4 * LeftEyeTCDCMatrix
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
OpenVR renderer.
void Render(vtkRenderer *ren) override
Implement base class method.
virtual void GetKeyMatrices(vtkRenderer *ren, vtkMatrix4x4 *&WCVCMatrix, vtkMatrix3x3 *&normalMatrix, vtkMatrix4x4 *&VCDCMatrix, vtkMatrix4x4 *&WCDCMatrix)
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:39
vtkTransform * GetPhysicalToWorldTransform()
vtkMatrix4x4 * RightEyeProjection
vtkMatrix4x4 * RightEyeTCDCMatrix
OpenVR rendering window.
vtkMatrix4x4 * LeftEyeProjection
vtkNew< vtkTransform > PoseTransform
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:36
OpenGL camera.