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 =========================================================================*/
24 #ifndef vtkOpenVROverlay_h
25 #define vtkOpenVROverlay_h
26 
27 #include "vtkNew.h" // for ivars
28 #include "vtkObject.h"
29 #include "vtkRenderingOpenVRModule.h" // For export macro
30 #include "vtkWeakPointer.h" // for ivars
31 #include <map> // ivars
32 #include <openvr.h> // for ivars
33 #include <vector> // ivars
34 
35 class vtkJPEGReader;
38 class vtkTextureObject;
40 class vtkOpenVRCamera;
41 class vtkXMLDataElement;
42 
43 class VTKRENDERINGOPENVR_EXPORT vtkOpenVROverlay : public vtkObject
44 {
45 public:
46  static vtkOpenVROverlay* New();
47  vtkTypeMacro(vtkOpenVROverlay, vtkObject);
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
53  virtual void Render();
54 
58  virtual void Create(vtkOpenVRRenderWindow* rw);
59 
63  vr::VROverlayHandle_t GetOverlayHandle() { return this->OverlayHandle; }
64 
68  vtkTextureObject* GetOverlayTexture() { return this->OverlayTexture.Get(); }
69 
71 
74  virtual void MouseMoved(int x, int y);
75  virtual void MouseButtonPress(int x, int y);
76  virtual void MouseButtonRelease(int x, int y);
78 
79  vtkOpenVROverlaySpot* GetLastSpot() { return this->LastSpot; }
80 
81  std::vector<vtkOpenVROverlaySpot>& GetSpots() { return this->Spots; }
82 
83  /***
84  * update the texture because this spot has changed
85  */
86  virtual void UpdateSpot(vtkOpenVROverlaySpot* spot);
87 
89 
92  void SetSessionName(const std::string& name) { this->SessionName = name; }
93  std::string GetSessionName() { return this->SessionName; }
95 
97 
100  void SetDashboardImageFileName(const std::string& name) { this->DashboardImageFileName = name; }
101  std::string GetDashboardImageFileName() { return this->DashboardImageFileName; }
103 
104  vtkOpenVRCameraPose* GetSavedCameraPose(int i);
105  virtual void SetSavedCameraPose(int i, vtkOpenVRCameraPose*);
106  virtual void WriteCameraPoses(ostream& os);
107  virtual void WriteCameraPoses();
108  virtual void ReadCameraPoses();
109  virtual void ReadCameraPoses(istream& is);
110  virtual void ReadCameraPoses(vtkXMLDataElement* xml);
111  virtual void SaveCameraPose(int num);
112  virtual void LoadCameraPose(int num);
113  virtual void LoadNextCameraPose();
114  virtual std::map<int, vtkOpenVRCameraPose>& GetSavedCameraPoses()
115  {
116  return this->SavedCameraPoses;
117  }
118 
119  // not used for dashboard overlays
120  void Show();
121  void Hide();
122 
123 protected:
125  ~vtkOpenVROverlay() override;
126 
127  virtual void SetupSpots() {}
128 
129  vr::IVRSystem* VRSystem;
130 
131  // for the overlay
132  vr::VROverlayHandle_t OverlayHandle;
133  vr::VROverlayHandle_t OverlayThumbnailHandle;
135 
136  virtual void SetDashboardImageData(vtkJPEGReader* rdr);
137 
138  // std::vector<vtkOpenVRActiveSpot> ActiveSpots;
139  unsigned char* OriginalTextureData;
140  unsigned char* CurrentTextureData;
141 
142  std::vector<vtkOpenVROverlaySpot> Spots;
144 
147  std::map<int, vtkOpenVRCameraPose> SavedCameraPoses;
148 
151 
154 
155 private:
156  vtkOpenVROverlay(const vtkOpenVROverlay&) = delete;
157  void operator=(const vtkOpenVROverlay&) = delete;
158 };
159 
160 #endif
std::string DashboardImageFileName
vtkWeakPointer< vtkOpenVRRenderWindow > Window
OpenVR camera.
abstract base class for most VTK objects
Definition: vtkObject.h:62
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.