VTK: Rendering/OpenVR/vtkOpenVROverlayInternal.h Source File

| VTK 9.3.1

vtkOpenVROverlayInternal.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
3
4 #ifndef vtkPVOpenVROverlayInternal_h
5 #define vtkPVOpenVROverlayInternal_h
6
7 #include "vtkInteractorStyle3D.h"
8 #include "vtkOpenVRCamera.h"
9 #include "vtkOpenVRRenderWindow.h"
10 #include "vtkRenderWindowInteractor.h"
11 #include "vtkVectorOperators.h"
12
13 VTK_ABI_NAMESPACE_BEGIN
14 class vtkOpenVRCameraPose : public vtkVRCamera::Pose
15 {
16 public:
17 bool Loaded = false;
18
19 void Set(vtkOpenVRCamera* cam, vtkOpenVRRenderWindow* win)
20 {
21 cam->SetPoseFromCamera(this, win);
22 this->Loaded = true;
23 }
24
25 void Apply(vtkOpenVRCamera* cam, vtkOpenVRRenderWindow* win)
26 {
27 cam->ApplyPoseToCamera(this, win);
28 }
29 };
30
31 class vtkOpenVROverlaySpot
32 {
33 public:
34 vtkOpenVROverlaySpot(int x1, int x2, int y1, int y2, vtkCommand* cb)
35 {
36 this->xmin = x1;
37 this->xmax = x2;
38 this->ymin = y1;
39 this->ymax = y2;
40 this->Callback = cb;
41 cb->Register(nullptr);
42 this->Active = false;
43 }
44 ~vtkOpenVROverlaySpot()
45 {
46 if (this->Callback)
47 {
48 this->Callback->Delete();
49 this->Callback = nullptr;
50 }
51 }
52 bool Active;
53 int xmin;
54 int xmax;
55 int ymin;
56 int ymax;
57 vtkCommand* Callback;
58 std::string Group;
59 int GroupId;
60
61 vtkOpenVROverlaySpot(const vtkOpenVROverlaySpot& in)
62 {
63 this->xmin = in.xmin;
64 this->xmax = in.xmax;
65 this->ymin = in.ymin;
66 this->ymax = in.ymax;
67 this->Callback = in.Callback;
68 this->Callback->Register(nullptr);
69 this->Active = in.Active;
70 this->Group = in.Group;
71 this->GroupId = in.GroupId;
72 }
73 vtkOpenVROverlaySpot& operator=(const vtkOpenVROverlaySpot&) = delete;
74 };
75
76 VTK_ABI_NAMESPACE_END
77 #endif // vtkPVOpenVROverlayInternal_h
78
79 //****************************************************************************
80 // VTK-HeaderTest-Exclude: vtkOpenVROverlayInternal.h
vtkCommand
superclass for callback/observer methods
Definition: vtkCommand.h:384
vtkObjectBase::Register
virtual void Register(vtkObjectBase *o)
Increase the reference count (mark as used by another object).
vtkObjectBase::Delete
virtual void Delete()
Delete a VTK object.
vtkOpenVRCameraPose
Definition: vtkOpenVROverlayInternal.h:15
vtkOpenVRCameraPose::Set
void Set(vtkOpenVRCamera *cam, vtkOpenVRRenderWindow *win)
Definition: vtkOpenVROverlayInternal.h:19
vtkOpenVRCameraPose::Apply
void Apply(vtkOpenVRCamera *cam, vtkOpenVRRenderWindow *win)
Definition: vtkOpenVROverlayInternal.h:25
vtkOpenVRCameraPose::Loaded
bool Loaded
Definition: vtkOpenVROverlayInternal.h:17
vtkOpenVRCamera
OpenVR camera.
Definition: vtkOpenVRCamera.h:26
vtkOpenVROverlaySpot
Definition: vtkOpenVROverlayInternal.h:32
vtkOpenVROverlaySpot::operator=
vtkOpenVROverlaySpot & operator=(const vtkOpenVROverlaySpot &)=delete
vtkOpenVROverlaySpot::xmin
int xmin
Definition: vtkOpenVROverlayInternal.h:53
vtkOpenVROverlaySpot::Group
std::string Group
Definition: vtkOpenVROverlayInternal.h:58
vtkOpenVROverlaySpot::Callback
vtkCommand * Callback
Definition: vtkOpenVROverlayInternal.h:57
vtkOpenVROverlaySpot::Active
bool Active
Definition: vtkOpenVROverlayInternal.h:52
vtkOpenVROverlaySpot::vtkOpenVROverlaySpot
vtkOpenVROverlaySpot(int x1, int x2, int y1, int y2, vtkCommand *cb)
Definition: vtkOpenVROverlayInternal.h:34
vtkOpenVROverlaySpot::ymax
int ymax
Definition: vtkOpenVROverlayInternal.h:56
vtkOpenVROverlaySpot::vtkOpenVROverlaySpot
vtkOpenVROverlaySpot(const vtkOpenVROverlaySpot &in)
Definition: vtkOpenVROverlayInternal.h:61
vtkOpenVROverlaySpot::xmax
int xmax
Definition: vtkOpenVROverlayInternal.h:54
vtkOpenVROverlaySpot::~vtkOpenVROverlaySpot
~vtkOpenVROverlaySpot()
Definition: vtkOpenVROverlayInternal.h:44
vtkOpenVROverlaySpot::GroupId
int GroupId
Definition: vtkOpenVROverlayInternal.h:59
vtkOpenVROverlaySpot::ymin
int ymin
Definition: vtkOpenVROverlayInternal.h:55
vtkOpenVRRenderWindow
OpenVR rendering window.
Definition: vtkOpenVRRenderWindow.h:60
vtkVRCamera::Pose
Definition: vtkVRCamera.h:47
vtkVRCamera::SetPoseFromCamera
void SetPoseFromCamera(Pose *pose, vtkVRRenderWindow *win)
vtkVRCamera::ApplyPoseToCamera
void ApplyPoseToCamera(Pose *pose, vtkVRRenderWindow *win)
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkInteractorStyle3D.h
vtkOpenVRCamera.h
vtkOpenVRRenderWindow.h
vtkRenderWindowInteractor.h
vtkVectorOperators.h