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 <map> // ivars
28 #include <vector> // ivars
29 #include "vtkNew.h" // for ivars
30 #include "vtkWeakPointer.h" // for ivars
31 
34 class vtkTextureObject;
36 class vtkOpenVRCamera;
37 class vtkXMLDataElement;
38 
39 class VTKRENDERINGOPENVR_EXPORT vtkOpenVROverlay : public vtkObject
40 {
41 public:
42  static vtkOpenVROverlay *New();
43  vtkTypeMacro(vtkOpenVROverlay, vtkObject);
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
49  virtual void Render();
50 
54  virtual void Create(vtkOpenVRRenderWindow *rw);
55 
59  vr::VROverlayHandle_t GetOverlayHandle() {
60  return this->OverlayHandle; }
61 
66  return this->OverlayTexture.Get(); }
67 
69 
72  virtual void MouseMoved(int x, int y);
73  virtual void MouseButtonPress(int x, int y);
74  virtual void MouseButtonRelease(int x, int y);
76 
78  return this->LastSpot; }
79 
80  std::vector<vtkOpenVROverlaySpot> &GetSpots() {
81  return this->Spots; }
82 
83  /***
84  * update the texture because this spot has changed
85  */
86  virtual void UpdateSpot(vtkOpenVROverlaySpot *spot);
87 
89 
93  this->SessionName = name; }
95  return this->SessionName; }
97 
99 
103  this->DashboardImageFileName = name; }
105  return this->DashboardImageFileName; }
107 
108  vtkOpenVRCameraPose *GetSavedCameraPose(int i);
109  virtual void WriteCameraPoses(ostream& os);
110  virtual void WriteCameraPoses();
111  virtual void ReadCameraPoses();
112  virtual void ReadCameraPoses(istream &is);
113  virtual void ReadCameraPoses(vtkXMLDataElement *xml);
114  virtual void SaveCameraPose(int num);
115  virtual void LoadCameraPose(int num);
116  virtual void LoadNextCameraPose();
117  virtual std::map<int, vtkOpenVRCameraPose> &GetSavedCameraPoses() {
118  return this->SavedCameraPoses; }
119 
120  // not used for dashboard overlays
121  void Show();
122  void Hide();
123 
124 protected:
126  ~vtkOpenVROverlay();
127 
128  virtual void SetupSpots() {};
129 
130  vr::IVRSystem *VRSystem;
131 
132  // for the overlay
133  vr::VROverlayHandle_t OverlayHandle;
134  vr::VROverlayHandle_t OverlayThumbnailHandle;
136 
137  // std::vector<vtkOpenVRActiveSpot> ActiveSpots;
138  unsigned char *OriginalTextureData;
139  unsigned char *CurrentTextureData;
140 
141  std::vector<vtkOpenVROverlaySpot> Spots;
143 
146  std::map<int,vtkOpenVRCameraPose> SavedCameraPoses;
147 
150 
153 
154 private:
155  vtkOpenVROverlay(const vtkOpenVROverlay&) = delete;
156  void operator=(const vtkOpenVROverlay&) = delete;
157 };
158 
159 #endif
std::string DashboardImageFileName
vtkWeakPointer< vtkOpenVRRenderWindow > Window
OpenVR camera.
abstract base class for most VTK objects
Definition: vtkObject.h:59
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.
Represents an XML element and those nested inside.
vtkOpenVROverlaySpot * LastSpot
unsigned char * CurrentTextureData
a simple class to control print indentation
Definition: vtkIndent.h:39
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
std::map< int, vtkOpenVRCameraPose > SavedCameraPoses
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()
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.