VTK  9.1.0
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
32class vtkJPEGReader;
37class vtkOpenVRCamera;
39
40class VTKRENDERINGOPENVR_EXPORT vtkOpenVROverlay : public vtkObject
41{
42public:
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
98 {
99 this->DashboardImageFileName = name;
100 }
101 VTK_FILEPATH std::string GetDashboardImageFileName() { return this->DashboardImageFileName; }
103
106 virtual void WriteCameraPoses(ostream& os);
107 virtual void WriteCameraPoses();
108 virtual void ReadCameraPoses();
109 virtual void ReadCameraPoses(istream& is);
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
123protected:
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
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
155private:
156 vtkOpenVROverlay(const vtkOpenVROverlay&) = delete;
157 void operator=(const vtkOpenVROverlay&) = delete;
158};
159
160#endif
a simple class to control print indentation
Definition: vtkIndent.h:113
read JPEG files
abstract base class for most VTK objects
Definition: vtkObject.h:73
OpenVR camera.
OpenVR overlay.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::map< int, vtkOpenVRCameraPose > SavedCameraPoses
vr::VROverlayHandle_t OverlayThumbnailHandle
vr::IVRSystem * VRSystem
std::string GetSessionName()
Set/Get a prefix for saving camera poses.
unsigned char * CurrentTextureData
static vtkOpenVROverlay * New()
virtual void ReadCameraPoses()
virtual std::map< int, vtkOpenVRCameraPose > & GetSavedCameraPoses()
virtual void LoadCameraPose(int num)
virtual void UpdateSpot(vtkOpenVROverlaySpot *spot)
std::vector< vtkOpenVROverlaySpot > & GetSpots()
std::string DashboardImageFileName
virtual void LoadNextCameraPose()
virtual void SetupSpots()
unsigned char * OriginalTextureData
vtkOpenVRCameraPose * GetSavedCameraPose(int i)
void SetDashboardImageFileName(VTK_FILEPATH const std::string &name)
Set/Get a file for the dashboard image.
vtkNew< vtkTextureObject > OverlayTexture
vtkOpenVROverlaySpot * LastSpot
virtual void SaveCameraPose(int num)
virtual void MouseButtonRelease(int x, int y)
methods to support events on the overlay
virtual void WriteCameraPoses()
virtual void SetDashboardImageData(vtkJPEGReader *rdr)
virtual void Create(vtkOpenVRRenderWindow *rw)
Create the overlay.
vr::VROverlayHandle_t OverlayHandle
virtual void ReadCameraPoses(istream &is)
virtual void WriteCameraPoses(ostream &os)
void SetSessionName(const std::string &name)
Set/Get a prefix for saving camera poses.
virtual void SetSavedCameraPose(int i, vtkOpenVRCameraPose *)
vtkWeakPointer< vtkOpenVRRenderWindow > Window
~vtkOpenVROverlay() override
VTK_FILEPATH std::string GetDashboardImageFileName()
Set/Get a file for the dashboard image.
virtual void ReadCameraPoses(vtkXMLDataElement *xml)
vr::VROverlayHandle_t GetOverlayHandle()
Get handle to the overlay.
virtual void Render()
Render the overlay.
vtkTextureObject * GetOverlayTexture()
Get handle to the overlay texture.
virtual void MouseMoved(int x, int y)
methods to support events on the overlay
std::string SessionName
vtkOpenVROverlaySpot * GetLastSpot()
std::vector< vtkOpenVROverlaySpot > Spots
virtual void MouseButtonPress(int x, int y)
methods to support events on the overlay
OpenVR rendering window.
abstracts an OpenGL texture object.
Represents an XML element and those nested inside.
@ name
Definition: vtkX3D.h:225
@ string
Definition: vtkX3D.h:496
#define VTK_FILEPATH