VTK  9.3.0
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
10#ifndef vtkOpenVROverlay_h
11#define vtkOpenVROverlay_h
12
13#include "vtkNew.h" // for ivars
14#include "vtkObject.h"
15#include "vtkRenderingOpenVRModule.h" // For export macro
16#include "vtkWeakPointer.h" // for ivars
17#include <map> // ivars
18#include <openvr.h> // for ivars
19#include <vector> // ivars
20
21VTK_ABI_NAMESPACE_BEGIN
22class vtkJPEGReader;
27class vtkOpenVRCamera;
29
30class VTKRENDERINGOPENVR_EXPORT vtkOpenVROverlay : public vtkObject
31{
32public:
35 void PrintSelf(ostream& os, vtkIndent indent) override;
36
40 virtual void Render();
41
45 virtual void Create(vtkOpenVRRenderWindow* rw);
46
50 vr::VROverlayHandle_t GetOverlayHandle() { return this->OverlayHandle; }
51
55 vtkTextureObject* GetOverlayTexture() { return this->OverlayTexture.Get(); }
56
58
61 virtual void MouseMoved(int x, int y);
62 virtual void MouseButtonPress(int x, int y);
63 virtual void MouseButtonRelease(int x, int y);
65
66 vtkOpenVROverlaySpot* GetLastSpot() { return this->LastSpot; }
67
68 std::vector<vtkOpenVROverlaySpot>& GetSpots() { return this->Spots; }
69
70 /***
71 * update the texture because this spot has changed
72 */
73 virtual void UpdateSpot(vtkOpenVROverlaySpot* spot);
74
76
79 void SetSessionName(const std::string& name) { this->SessionName = name; }
80 std::string GetSessionName() { return this->SessionName; }
82
84
87 void SetDashboardImageFileName(VTK_FILEPATH const std::string& name)
88 {
89 this->DashboardImageFileName = name;
90 }
91 VTK_FILEPATH std::string GetDashboardImageFileName() { return this->DashboardImageFileName; }
93
96 virtual void WriteCameraPoses(ostream& os);
97 virtual void WriteCameraPoses();
98 virtual void ReadCameraPoses();
99 virtual void ReadCameraPoses(istream& is);
101 virtual void SaveCameraPose(int num);
102 virtual void LoadCameraPose(int num);
103 virtual void LoadNextCameraPose();
104 virtual std::map<int, vtkOpenVRCameraPose>& GetSavedCameraPoses()
105 {
106 return this->SavedCameraPoses;
107 }
108
109 // not used for dashboard overlays
110 void Show();
111 void Hide();
112
113protected:
116
117 virtual void SetupSpots() {}
118
119 vr::IVRSystem* VRSystem;
120
121 // for the overlay
122 vr::VROverlayHandle_t OverlayHandle;
123 vr::VROverlayHandle_t OverlayThumbnailHandle;
125
127
128 // std::vector<vtkOpenVRActiveSpot> ActiveSpots;
129 unsigned char* OriginalTextureData;
130 unsigned char* CurrentTextureData;
131
132 std::vector<vtkOpenVROverlaySpot> Spots;
134
135 std::string SessionName;
137 std::map<int, vtkOpenVRCameraPose> SavedCameraPoses;
138
141
144
145private:
146 vtkOpenVROverlay(const vtkOpenVROverlay&) = delete;
147 void operator=(const vtkOpenVROverlay&) = delete;
148};
149
150VTK_ABI_NAMESPACE_END
151#endif
a simple class to control print indentation
Definition vtkIndent.h:29
read JPEG files
Allocate and hold a VTK object.
Definition vtkNew.h:51
abstract base class for most VTK objects
Definition vtkObject.h:49
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