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 =========================================================================*/
22 #ifndef vtkOpenVRCamera_h
23 #define vtkOpenVRCamera_h
24 
25 #include "vtkRenderingOpenVRModule.h" // For export macro
26 #include "vtkOpenGLCamera.h"
27 #include "vtkNew.h" // ivars
28 #include "vtkTransform.h" // ivars
29 
30 class vtkOpenVRRenderer;
32 class vtkMatrix3x3;
33 class vtkMatrix4x4;
34 
35 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRCamera : public vtkOpenGLCamera
36 {
37 public:
38  static vtkOpenVRCamera *New();
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
45  virtual void Render(vtkRenderer *ren);
46 
47  virtual void GetKeyMatrices(vtkRenderer *ren, vtkMatrix4x4 *&WCVCMatrix,
48  vtkMatrix3x3 *&normalMatrix, vtkMatrix4x4 *&VCDCMatrix, vtkMatrix4x4 *&WCDCMatrix);
49 
54  virtual void GetTrackingToDCMatrix(vtkMatrix4x4 *&TCDCMatrix);
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(vtkOpenVRRenderWindow *, bool left, double factor);
60 
61  // Get the OpenVR Physical Space to World coordinate matrix
63  return this->PoseTransform.Get(); }
64 
65 protected:
67  ~vtkOpenVRCamera();
68 
69  // gets the pose and projections for the left and right eves from
70  // the openvr library
71  void GetHMDEyePoses(vtkRenderer *);
72  void GetHMDEyeProjections(vtkRenderer *);
73 
74  double LeftEyePose[3];
75  double RightEyePose[3];
78 
81 
82  // used to translate the
83  // View to the HMD space
85 
86 private:
87  vtkOpenVRCamera(const vtkOpenVRCamera&) = delete;
88  void operator=(const vtkOpenVRCamera&) = delete;
89 };
90 
91 #endif
vtkOpenGLCamera.h
vtkOpenVRCamera::PoseTransform
vtkNew< vtkTransform > PoseTransform
Definition: vtkOpenVRCamera.h:84
vtkOpenVRCamera::LeftEyeProjection
vtkMatrix4x4 * LeftEyeProjection
Definition: vtkOpenVRCamera.h:76
vtkOpenVRRenderer
OpenVR renderer.
Definition: vtkOpenVRRenderer.h:30
vtkOpenVRCamera::RightEyeTCDCMatrix
vtkMatrix4x4 * RightEyeTCDCMatrix
Definition: vtkOpenVRCamera.h:80
vtkOpenVRCamera::RightEyeProjection
vtkMatrix4x4 * RightEyeProjection
Definition: vtkOpenVRCamera.h:77
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
vtkMatrix3x3
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:33
vtkOpenVRCamera::GetPhysicalToWorldTransform
vtkTransform * GetPhysicalToWorldTransform()
Definition: vtkOpenVRCamera.h:62
vtkOpenGLCamera::GetKeyMatrices
virtual void GetKeyMatrices(vtkRenderer *ren, vtkMatrix4x4 *&WCVCMatrix, vtkMatrix3x3 *&normalMatrix, vtkMatrix4x4 *&VCDCMatrix, vtkMatrix4x4 *&WCDCMatrix)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkOpenVRRenderWindow
OpenVR rendering window.
Definition: vtkOpenVRRenderWindow.h:57
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
vtkNew< vtkTransform >
vtkOpenGLCamera::Render
void Render(vtkRenderer *ren) override
Implement base class method.
vtkOpenGLCamera
OpenGL camera.
Definition: vtkOpenGLCamera.h:32
vtkNew.h
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:57
vtkOpenVRCamera
OpenVR camera.
Definition: vtkOpenVRCamera.h:35
vtkOpenVRCamera::LeftEyeTCDCMatrix
vtkMatrix4x4 * LeftEyeTCDCMatrix
Definition: vtkOpenVRCamera.h:79
vtkOpenGLCamera::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTransform.h
vtkOpenGLCamera::New
static vtkOpenGLCamera * New()