VTK  9.0.1
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 "vtkNew.h" // for ivars
25 #include "vtkObject.h"
26 #include "vtkRenderingOpenVRModule.h" // For export macro
27 #include "vtkWeakPointer.h" // for ivars
28 #include <map> // ivars
29 #include <openvr.h> // for ivars
30 #include <vector> // ivars
31 
32 class vtkJPEGReader;
35 class vtkTextureObject;
37 class vtkOpenVRCamera;
38 class vtkXMLDataElement;
39 
40 class VTKRENDERINGOPENVR_EXPORT vtkOpenVROverlay : public vtkObject
41 {
42 public:
43  static vtkOpenVROverlay* New();
44  vtkTypeMacro(vtkOpenVROverlay, vtkObject);
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  virtual void Render();
51 
55  virtual void Create(vtkOpenVRRenderWindow* rw);
56 
60  vr::VROverlayHandle_t GetOverlayHandle() { return this->OverlayHandle; }
61 
65  vtkTextureObject* GetOverlayTexture() { return this->OverlayTexture.Get(); }
66 
68 
71  virtual void MouseMoved(int x, int y);
72  virtual void MouseButtonPress(int x, int y);
73  virtual void MouseButtonRelease(int x, int y);
75 
76  vtkOpenVROverlaySpot* GetLastSpot() { return this->LastSpot; }
77 
78  std::vector<vtkOpenVROverlaySpot>& GetSpots() { return this->Spots; }
79 
80  /***
81  * update the texture because this spot has changed
82  */
83  virtual void UpdateSpot(vtkOpenVROverlaySpot* spot);
84 
86 
89  void SetSessionName(const std::string& name) { this->SessionName = name; }
90  std::string GetSessionName() { return this->SessionName; }
92 
94 
97  void SetDashboardImageFileName(const std::string& name) { this->DashboardImageFileName = name; }
98  std::string GetDashboardImageFileName() { return this->DashboardImageFileName; }
100 
101  vtkOpenVRCameraPose* GetSavedCameraPose(int i);
102  virtual void SetSavedCameraPose(int i, vtkOpenVRCameraPose*);
103  virtual void WriteCameraPoses(ostream& os);
104  virtual void WriteCameraPoses();
105  virtual void ReadCameraPoses();
106  virtual void ReadCameraPoses(istream& is);
107  virtual void ReadCameraPoses(vtkXMLDataElement* xml);
108  virtual void SaveCameraPose(int num);
109  virtual void LoadCameraPose(int num);
110  virtual void LoadNextCameraPose();
111  virtual std::map<int, vtkOpenVRCameraPose>& GetSavedCameraPoses()
112  {
113  return this->SavedCameraPoses;
114  }
115 
116  // not used for dashboard overlays
117  void Show();
118  void Hide();
119 
120 protected:
122  ~vtkOpenVROverlay() override;
123 
124  virtual void SetupSpots() {}
125 
126  vr::IVRSystem* VRSystem;
127 
128  // for the overlay
129  vr::VROverlayHandle_t OverlayHandle;
130  vr::VROverlayHandle_t OverlayThumbnailHandle;
132 
133  virtual void SetDashboardImageData(vtkJPEGReader* rdr);
134 
135  // std::vector<vtkOpenVRActiveSpot> ActiveSpots;
136  unsigned char* OriginalTextureData;
137  unsigned char* CurrentTextureData;
138 
139  std::vector<vtkOpenVROverlaySpot> Spots;
141 
144  std::map<int, vtkOpenVRCameraPose> SavedCameraPoses;
145 
148 
151 
152 private:
153  vtkOpenVROverlay(const vtkOpenVROverlay&) = delete;
154  void operator=(const vtkOpenVROverlay&) = delete;
155 };
156 
157 #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.
read JPEG files
Definition: vtkJPEGReader.h:34
Represents an XML element and those nested inside.
vtkOpenVROverlaySpot * LastSpot
std::map< int, vtkOpenVRCameraPose > SavedCameraPoses
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
vr::IVRSystem * VRSystem
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
vr::VROverlayHandle_t GetOverlayHandle()
Get handle to the overlay.
void SetSessionName(const std::string &name)
Set/Get a prefix for saving camera poses.
virtual std::map< int, vtkOpenVRCameraPose > & GetSavedCameraPoses()
virtual void SetupSpots()
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.