VTK
9.6.2
Main Page
Related Pages
Topics
Namespaces
Classes
Files
File List
File Members
Rendering
Parallel
vtkSynchronizedRenderers.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
20
21
#ifndef vtkSynchronizedRenderers_h
22
#define vtkSynchronizedRenderers_h
23
24
#include "
vtkObject.h
"
25
#include "vtkRenderingParallelModule.h"
// For export macro
26
#include "
vtkSmartPointer.h
"
// needed for vtkSmartPointer.
27
#include "
vtkUnsignedCharArray.h
"
// needed for vtkUnsignedCharArray.
28
29
#include <memory>
// for std::unique_ptr
30
31
VTK_ABI_NAMESPACE_BEGIN
32
class
vtkFXAAOptions
;
33
class
vtkRenderer
;
34
class
vtkMultiProcessController
;
35
class
vtkMultiProcessStream
;
36
class
vtkOpenGLFXAAFilter
;
37
class
vtkOpenGLRenderer
;
38
39
class
VTKRENDERINGPARALLEL_EXPORT
vtkSynchronizedRenderers
:
public
vtkObject
40
{
41
public
:
42
static
vtkSynchronizedRenderers
*
New
();
43
vtkTypeMacro(
vtkSynchronizedRenderers
,
vtkObject
);
44
void
PrintSelf
(ostream& os,
vtkIndent
indent)
override
;
45
47
53
virtual
void
SetRenderer
(
vtkRenderer
*);
54
virtual
vtkRenderer
*
GetRenderer
();
56
58
62
virtual
void
SetParallelController
(
vtkMultiProcessController
*);
63
vtkGetObjectMacro(
ParallelController
,
vtkMultiProcessController
);
65
67
71
vtkSetMacro(
ParallelRendering
,
bool
);
72
vtkGetMacro(
ParallelRendering
,
bool
);
73
vtkBooleanMacro(
ParallelRendering
,
bool
);
75
77
80
vtkSetClampMacro(
ImageReductionFactor
,
int
, 1, 50);
81
vtkGetMacro(
ImageReductionFactor
,
int
);
83
85
90
vtkSetMacro(
WriteBackImages
,
bool
);
91
vtkGetMacro(
WriteBackImages
,
bool
);
92
vtkBooleanMacro(
WriteBackImages
,
bool
);
94
96
101
vtkSetMacro(
RootProcessId
,
int
);
102
vtkGetMacro(
RootProcessId
,
int
);
104
112
void
CollectiveExpandForVisiblePropBounds
(
double
bounds[6]);
113
115
119
virtual
void
SetCaptureDelegate
(
vtkSynchronizedRenderers
*);
120
vtkGetObjectMacro(
CaptureDelegate
,
vtkSynchronizedRenderers
);
122
124
128
void
EnableSynchronizableActors
(
bool
);
130
132
139
vtkSetMacro(
AutomaticEventHandling
,
bool
);
140
vtkGetMacro(
AutomaticEventHandling
,
bool
);
141
vtkBooleanMacro(
AutomaticEventHandling
,
bool
);
143
145
156
vtkSetMacro(FixBackground,
bool
);
157
vtkGetMacro(FixBackground,
bool
);
158
vtkBooleanMacro(FixBackground,
bool
);
160
161
enum
162
{
163
SYNC_RENDERER_TAG
= 15101,
164
RESET_CAMERA_TAG
= 15102,
165
COMPUTE_BOUNDS_TAG
= 15103
166
};
167
170
struct
VTKRENDERINGPARALLEL_EXPORT
vtkRawImage
171
{
172
public
:
173
vtkRawImage
()
174
{
175
this->Valid =
false
;
176
this->Size[0] = this->Size[1] = 0;
177
this->Data =
vtkSmartPointer<vtkUnsignedCharArray>::New
();
178
}
179
180
void
Resize
(
int
dx,
int
dy,
int
numcomps)
181
{
182
this->Valid =
false
;
183
this->Allocate(dx, dy, numcomps);
184
}
185
189
void
Initialize
(
int
dx,
int
dy,
vtkUnsignedCharArray
* data);
190
191
void
MarkValid
() { this->Valid =
true
; }
192
void
MarkInValid
() { this->Valid =
false
; }
193
194
bool
IsValid
() {
return
this->Valid; }
195
int
GetWidth
() {
return
this->Size[0]; }
196
int
GetHeight
() {
return
this->Size[1]; }
197
vtkUnsignedCharArray
*
GetRawPtr
() {
return
this->Data; }
198
206
bool
PushToViewport
(
vtkRenderer
* renderer,
bool
blend =
true
);
207
215
bool
PushToFrameBuffer
(
vtkRenderer
* ren,
bool
blend =
true
);
216
217
// Captures the image from the viewport.
218
// This doesn't trigger a render, just captures what's currently there in
219
// the active buffer.
220
bool
Capture
(
vtkRenderer
*);
221
222
// Save the image as a png. Useful for debugging.
223
void
SaveAsPNG
(
VTK_FILEPATH
const
char
* filename);
224
225
private
:
226
bool
Valid;
227
int
Size[2];
228
vtkSmartPointer<vtkUnsignedCharArray>
Data;
229
230
void
Allocate(
int
dx,
int
dy,
int
numcomps);
231
};
232
233
protected
:
234
vtkSynchronizedRenderers
();
235
~vtkSynchronizedRenderers
()
override
;
236
237
struct
RendererInfo
238
{
239
int
ImageReductionFactor
;
240
int
Draw
;
241
int
CameraParallelProjection
;
242
double
Viewport
[4];
243
double
CameraPosition
[3];
244
double
CameraFocalPoint
[3];
245
double
CameraViewUp
[3];
246
double
CameraWindowCenter
[2];
247
double
CameraClippingRange
[2];
248
double
CameraViewAngle
;
249
double
CameraParallelScale
;
250
double
EyeTransformMatrix
[16];
251
double
ModelTransformMatrix
[16];
252
253
// Save/restore the struct to/from a stream.
254
void
Save
(
vtkMultiProcessStream
& stream);
255
bool
Restore
(