-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathvtkLookingGlassRenderWindowImpl.h
219 lines (181 loc) · 6.23 KB
/
vtkLookingGlassRenderWindowImpl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/*=========================================================================
Copyright (c) 2020 Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* This header includes code common to all OS specific RenderWindows
*/
#include "vtkLookingGlassInterface.h"
#include "vtkObjectFactory.h"
#include "vtkRenderingOpenGLConfigure.h" // for VTK_USE_COCOA
vtkStandardNewMacro(className);
//------------------------------------------------------------------------------
className::className()
{
InitializeInterface();
}
//------------------------------------------------------------------------------
void className::InitializeInterface()
{
if (!this->Interface)
{
this->Interface = vtkLookingGlassInterface::New();
}
this->Interface->Initialize();
this->Interface->GetDisplaySize(this->Size[0], this->Size[1]);
this->Interface->GetDisplayPosition(this->Position[0], this->Position[1]);
this->BordersOff();
#ifdef VTK_USE_COCOA
this->FullScreenOn();
#endif
}
//------------------------------------------------------------------------------
className::~className()
{
this->Finalize();
this->Interface->Delete();
}
//------------------------------------------------------------------------------
void className::ReleaseGraphicsResources(vtkWindow* renWin)
{
this->Interface->ReleaseGraphicsResources(renWin);
this->Superclass::ReleaseGraphicsResources(renWin);
}
//------------------------------------------------------------------------------
// We override this method to render the tiles required by the looking glass
// display then render the resulting lightfield to the window
void className::DoStereoRender()
{
this->StereoUpdate();
int renderSize[2];
this->Interface->GetRenderSize(renderSize);
int origSize[2] = { this->Size[0], this->Size[1] };
this->InStereoRender = true;
this->Size[0] = renderSize[0];
this->Size[1] = renderSize[1];
this->Interface->RenderQuilt(this);
this->InStereoRender = false;
this->Size[0] = origSize[0];
this->Size[1] = origSize[1];
this->Interface->DrawLightField(this);
}
//------------------------------------------------------------------------------
// Get the current size of the window (or when rendering tiles the tile size)
int* className::GetSize(void)
{
// when rendering to a tile we have a different size already set
// just return the ivar unchanged
if (this->InStereoRender)
{
return this->Size;
}
return this->Superclass::GetSize();
}
//------------------------------------------------------------------------------
void className::SetLGDeviceIndex(int index)
{
this->Interface->SetDeviceIndex(index);
}
//------------------------------------------------------------------------------
void className::SaveQuilt(const char* fileName)
{
this->Interface->SaveQuilt(fileName);
}
//------------------------------------------------------------------------------
void className::StartRecordingQuilt(const char* fileName)
{
this->Interface->StartRecordingQuilt(fileName);
}
//------------------------------------------------------------------------------
void className::StopRecordingQuilt()
{
this->Interface->StopRecordingQuilt();
}
//------------------------------------------------------------------------------
const char* className::MovieFileExtension()
{
return vtkLookingGlassInterface::MovieFileExtension();
}
//------------------------------------------------------------------------------
std::string className::QuiltFileSuffix() const
{
return this->Interface->QuiltFileSuffix();
}
//------------------------------------------------------------------------------
void className::SetUseClippingLimits(bool b)
{
this->Interface->SetUseClippingLimits(b);
}
//------------------------------------------------------------------------------
bool className::GetUseClippingLimits() const
{
return this->Interface->GetUseClippingLimits();
}
//------------------------------------------------------------------------------
void className::SetFarClippingLimit(double d)
{
this->Interface->SetFarClippingLimit(d);
}
//------------------------------------------------------------------------------
double className::GetFarClippingLimit() const
{
return this->Interface->GetFarClippingLimit();
}
//------------------------------------------------------------------------------
void className::SetNearClippingLimit(double d)
{
this->Interface->SetNearClippingLimit(d);
}
//------------------------------------------------------------------------------
double className::GetNearClippingLimit() const
{
return this->Interface->GetNearClippingLimit();
}
//------------------------------------------------------------------------------
bool className::IsRecordingQuilt() const
{
return this->Interface->IsRecordingQuilt();
}
//------------------------------------------------------------------------------
void className::SetDeviceIndex(int i)
{
this->Interface->SetDeviceIndex(i);
}
//------------------------------------------------------------------------------
int className::GetDeviceIndex() const
{
return this->Interface->GetDeviceIndex();
}
//------------------------------------------------------------------------------
void className::SetDeviceType(const std::string& t)
{
// Must re-build the interface from scratch
if (this->Interface)
{
this->Interface->ReleaseGraphicsResources(this);
this->Interface->Delete();
this->Interface = nullptr;
}
this->Interface = vtkLookingGlassInterface::New();
this->Interface->SetDeviceType(t);
InitializeInterface();
}
//------------------------------------------------------------------------------
std::string className::GetDeviceType() const
{
return this->Interface->GetDeviceType();
}
//------------------------------------------------------------------------------
std::vector<std::string> className::GetDeviceTypes()
{
std::vector<std::string> types;
for (const auto device : vtkLookingGlassInterface::GetDevices())
{
types.push_back(device.first);
}
return types;
}