VTK  9.3.20240424
vtkOpenVROverlay.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
13#ifndef vtkOpenVROverlay_h
14#define vtkOpenVROverlay_h
15
16#include "vtkNew.h" // for ivars
17#include "vtkObject.h"
18#include "vtkRenderingOpenVRModule.h" // For export macro
19#include "vtkWeakPointer.h" // for ivars
20#include <map> // ivars
21#include <openvr.h> // for ivars
22#include <vector> // ivars
23
24VTK_ABI_NAMESPACE_BEGIN
25class vtkJPEGReader;
30class vtkOpenVRCamera;
32
33class VTKRENDERINGOPENVR_EXPORT vtkOpenVROverlay : public vtkObject
34{
35public:
38 void PrintSelf(ostream& os, vtkIndent indent) override;
39
43 virtual void Render();
44
48 virtual void Create(vtkOpenVRRenderWindow* rw);
49
53 vr::VROverlayHandle_t GetOverlayHandle() { return this->OverlayHandle; }
54
58 vtkTextureObject* GetOverlayTexture() { return this->OverlayTexture.Get(); }
59
61
64 virtual void MouseMoved(int x, int y);
65 virtual void MouseButtonPress(int x, int y);
66 virtual void MouseButtonRelease(int x, int y);
68
69 vtkOpenVROverlaySpot* GetLastSpot() { return this->LastSpot; }
70
71 std::vector<vtkOpenVROverlaySpot>& GetSpots() { return this->Spots; }
72
73 /***
74 * update the texture because this spot has changed
75 */
76 virtual void UpdateSpot(vtkOpenVROverlaySpot* spot);
77
79
82 void SetSessionName(const std::string& name) { this->SessionName = name; }
83 std::string GetSessionName() { return this->SessionName; }
85
87
90 void SetDashboardImageFileName(VTK_FILEPATH const std::string& name)
91 {
92 this->DashboardImageFileName = name;
93 }
94 VTK_FILEPATH std::string GetDashboardImageFileName() { return this->DashboardImageFileName; }
96
99 virtual void WriteCameraPoses(ostream& os);
100 virtual void WriteCameraPoses();
101 virtual void ReadCameraPoses();
102 virtual void ReadCameraPoses(istream& is);
104 virtual void SaveCameraPose(int num);
105 virtual void LoadCameraPose(int num);
106 virtual void LoadNextCameraPose();
107 virtual std::map<int, vtkOpenVRCameraPose>& GetSavedCameraPoses()
108 {
109 return this->SavedCameraPoses;
110 }
111
112 // not used for dashboard overlays
113 void Show();
114 void Hide();
115
116protected:
119
120 virtual void SetupSpots() {}
121
122 vr::IVRSystem* VRSystem;
123
124 // for the overlay
125 vr::VROverlayHandle_t OverlayHandle;
126 vr::VROverlayHandle_t OverlayThumbnailHandle;
128
130
131 // std::vector<vtkOpenVRActiveSpot> ActiveSpots;
132 unsigned char* OriginalTextureData;
133 unsigned char* CurrentTextureData;
134
135 std::vector<vtkOpenVROverlaySpot> Spots;
137
138 std::string SessionName;
140 std::map<int, vtkOpenVRCameraPose> SavedCameraPoses;
141
144
147
148private:
149 vtkOpenVROverlay(const vtkOpenVROverlay&) = delete;
150 void operator=(const vtkOpenVROverlay&) = delete;
151};
152
153VTK_ABI_NAMESPACE_END
154#endif
a simple class to control print indentation
Definition vtkIndent.h:108
read JPEG files
Allocate and hold a VTK object.
Definition vtkNew.h:160
abstract base class for most VTK objects
Definition vtkObject.h:162
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.
a weak reference to a vtkObject.
Represents an XML element and those nested inside.
#define VTK_FILEPATH