VTK  9.6.2
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
31VTK_ABI_NAMESPACE_BEGIN
32class vtkFXAAOptions;
33class vtkRenderer;
38
39class VTKRENDERINGPARALLEL_EXPORT vtkSynchronizedRenderers : public vtkObject
40{
41public:
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
47
53 virtual void SetRenderer(vtkRenderer*);
56
58
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
113
115
122
124
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 {
166 };
167
170 struct VTKRENDERINGPARALLEL_EXPORT vtkRawImage
171 {
172 public:
174 {
175 this->Valid = false;
176 this->Size[0] = this->Size[1] = 0;
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.
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];
229
230 void Allocate(int dx, int dy, int numcomps);
231 };
232
233protected:
236
238 {
240 int Draw;
242 double Viewport[4];
243 double CameraPosition[3];
245 double CameraViewUp[3];
252
253 // Save/restore the struct to/from a stream.