VTK
vtkOpenVROverlay.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 =========================================================================*/
21 #ifndef vtkOpenVROverlay_h
22 #define vtkOpenVROverlay_h
23 
24 #include "vtkRenderingOpenVRModule.h" // For export macro
25 #include "vtkObject.h"
26 #include <openvr.h> // for ivars
27 #include <vector> // ivars
28 #include "vtkNew.h" // for ivars
29 #include "vtkWeakPointer.h" // for ivars
30 
33 class vtkTextureObject;
35 class vtkOpenVRCamera;
36 
37 class VTKRENDERINGOPENVR_EXPORT vtkOpenVROverlay : public vtkObject
38 {
39 public:
40  static vtkOpenVROverlay *New();
41  vtkTypeMacro(vtkOpenVROverlay, vtkObject);
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
47  virtual void Render();
48 
52  virtual void Create(vtkOpenVRRenderWindow *rw);
53 
57  vr::VROverlayHandle_t GetOverlayHandle() {
58  return this->OverlayHandle; }
59 
64  return this->OverlayTexture.Get(); }
65 
67 
70  virtual void MouseMoved(int x, int y);
71  virtual void MouseButtonPress(int x, int y);
72  virtual void MouseButtonRelease(int x, int y);
74 
76  return this->LastSpot; }
77 
78  std::vector<vtkOpenVROverlaySpot> &GetSpots() {
79  return this->Spots; }
80 
81  /***
82  * update the texture because this spot has changed
83  */
84  virtual void UpdateSpot(vtkOpenVROverlaySpot *spot);
85 
87 
91  this->SessionName = name; }
93  return this->SessionName; }
95 
97 
101  this->DashboardImageFileName = name; }
103  return this->DashboardImageFileName; }
105 
106  vtkOpenVRCameraPose *GetSavedCameraPose(size_t i);
107  virtual void WriteCameraPoses(ostream& os);
108  virtual void WriteCameraPoses();
109  virtual void ReadCameraPoses();
110  virtual void ReadCameraPoses(istream &is);
111  virtual void SaveCameraPose(int num);
112  virtual void LoadCameraPose(int num);
113  virtual void LoadNextCameraPose();
114 
115  // not used for dashboard overlays
116  void Show();
117  void Hide();
118 
119 protected:
121  ~vtkOpenVROverlay();
122 
123  virtual void SetupSpots() {};
124 
125  vr::IVRSystem *VRSystem;
126 
127  // for the overlay
128  vr::VROverlayHandle_t OverlayHandle;
129  vr::VROverlayHandle_t OverlayThumbnailHandle;
131 
132  // std::vector<vtkOpenVRActiveSpot> ActiveSpots;
133  unsigned char *OriginalTextureData;
134  unsigned char *CurrentTextureData;
135 
136  std::vector<vtkOpenVROverlaySpot> Spots;
138 
141  std::vector<vtkOpenVRCameraPose> SavedCameraPoses;
142 
145 
148 
149 private:
150  vtkOpenVROverlay(const vtkOpenVROverlay&) = delete;
151  void operator=(const vtkOpenVROverlay&) = delete;
152 };
153 
154 #endif
std::string DashboardImageFileName
vtkWeakPointer< vtkOpenVRRenderWindow > Window
OpenVR camera.
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkTextureObject * GetOverlayTexture()
Get handle to the overlay texture.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkOpenVROverlaySpot * LastSpot
unsigned char * CurrentTextureData
a simple class to control print indentation
Definition: vtkIndent.h:33
std::string GetDashboardImageFileName()
Set/Get a file for the dashboard image.
void SetDashboardImageFileName(const std::string &name)
Set/Get a file for the dashboard image.
vtkNew< vtkTextureObject > OverlayTexture
OpenVR overlay.
vr::VROverlayHandle_t OverlayHandle
std::string SessionName
unsigned char * OriginalTextureData
vtkOpenVROverlaySpot * GetLastSpot()
vr::VROverlayHandle_t OverlayThumbnailHandle
std::vector< vtkOpenVROverlaySpot > & GetSpots()
abstracts an OpenGL texture object.
OpenVR rendering window.
std::vector< vtkOpenVROverlaySpot > Spots
std::vector< vtkOpenVRCameraPose > SavedCameraPoses
vr::VROverlayHandle_t GetOverlayHandle()
Get handle to the overlay.
void SetSessionName(const std::string &name)
Set/Get a prefix for saving camera poses.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
std::string GetSessionName()
Set/Get a prefix for saving camera poses.