VTK  9.0.1
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 "vtkOpenGLCamera.h"
27 #include "vtkRenderingOpenVRModule.h" // For export macro
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
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 eves from
69  // the openvr library
70  void GetHMDEyePoses(vtkRenderer*);
71  void GetHMDEyeProjections(vtkRenderer*);
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
OpenVR camera.
static vtkOpenGLCamera * New()
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
vtkMatrix4x4 * LeftEyeTCDCMatrix
abstract specification for renderers
Definition: vtkRenderer.h:67
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
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:33
vtkTransform * GetPhysicalToWorldTransform()
vtkMatrix4x4 * RightEyeProjection
vtkMatrix4x4 * RightEyeTCDCMatrix
OpenVR rendering window.
vtkMatrix4x4 * LeftEyeProjection
vtkNew< vtkTransform > PoseTransform
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:33
OpenGL camera.