VTK
vtkSynchronizedRenderers.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkSynchronizedRenderers.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
33#ifndef vtkSynchronizedRenderers_h
34#define vtkSynchronizedRenderers_h
35
36#include "vtkRenderingParallelModule.h" // For export macro
37#include "vtkObject.h"
38#include "vtkUnsignedCharArray.h" // needed for vtkUnsignedCharArray.
39#include "vtkSmartPointer.h" // needed for vtkSmartPointer.
40
41class vtkFXAAOptions;
42class vtkRenderer;
47
48class VTKRENDERINGPARALLEL_EXPORT vtkSynchronizedRenderers : public vtkObject
49{
50public:
53 void PrintSelf(ostream& os, vtkIndent indent);
54
56
62 virtual void SetRenderer(vtkRenderer*);
65
67
72 vtkGetObjectMacro(ParallelController, vtkMultiProcessController);
74
76
80 vtkSetMacro(ParallelRendering, bool);
81 vtkGetMacro(ParallelRendering, bool);
82 vtkBooleanMacro(ParallelRendering, bool);
84
86
89 vtkSetClampMacro(ImageReductionFactor, int, 1, 50);
90 vtkGetMacro(ImageReductionFactor, int);
92
94
99 vtkSetMacro(WriteBackImages, bool);
100 vtkGetMacro(WriteBackImages, bool);
101 vtkBooleanMacro(WriteBackImages, bool);
103
105
109 vtkSetMacro(UseFXAA, bool)
110 vtkGetMacro(UseFXAA, bool)
111 vtkBooleanMacro(UseFXAA, bool)
113
115
118 vtkGetObjectMacro(FXAAOptions, vtkFXAAOptions)
119 virtual void SetFXAAOptions(vtkFXAAOptions*);
121
123
128 vtkSetMacro(RootProcessId, int);
129 vtkGetMacro(RootProcessId, int);
131
139 void CollectiveExpandForVisiblePropBounds(double bounds[6]);
140
142
146 virtual void SetCaptureDelegate(vtkSynchronizedRenderers*);
147 vtkGetObjectMacro(CaptureDelegate, vtkSynchronizedRenderers);
149
151
158 vtkSetMacro(AutomaticEventHandling, bool);
159 vtkGetMacro(AutomaticEventHandling, bool);
160 vtkBooleanMacro(AutomaticEventHandling, bool);
162
163 enum
164 {
165 SYNC_RENDERER_TAG = 15101,
166 RESET_CAMERA_TAG = 15102,
167 COMPUTE_BOUNDS_TAG = 15103
168 };
169
172 struct VTKRENDERINGPARALLEL_EXPORT vtkRawImage
173 {
174 public:
176 {
177 this->Valid = false;
178 this->Size[0] = this->Size[1] = 0;
180 }
181
182 void Resize(int dx, int dy, int numcomps)
183 {
184 this->Valid = false;
185 this->Allocate(dx, dy, numcomps);
186 }
187
191 void Initialize(int dx, int dy, vtkUnsignedCharArray* data);
192
193 void MarkValid() { this->Valid = true; }
194 void MarkInValid() { this->Valid = false; }
195
196 bool IsValid() { return this->Valid; }
197 int GetWidth() { return this->Size[0];}
198 int GetHeight() { return this->Size[1];}
200 { return this->Data; }
201
202 // Pushes the image to the viewport.
204
205 // This is a raw version of PushToViewport() that assumes that the
206 // glViewport() has already been setup externally.
207 // the argument is optional for backwards compat with old OpenGL
209
210 // Captures the image from the viewport.
211 // This doesn't trigger a render, just captures what's currently there in
212 // the active buffer.
214
215 // Save the image as a png. Useful for debugging.
216 void SaveAsPNG(const char* filename);
217
218 private:
219 bool Valid;
220 int Size[2];
222
223 void Allocate(int dx, int dy, int numcomps);
224 };
225
226protected:
229
231 {
233 int Draw;
235 double Viewport[4];
236 double CameraPosition[3];
237 double CameraFocalPoint[3];
238 double CameraViewUp[3];
239 double CameraWindowCenter[2];
240 double CameraClippingRange[2];
243 double EyeTransformMatrix[16];
244 double ModelTransformMatrix[16];
245
246 // Save/restore the struct to/from a stream.
249
252 };
253
257
258 // These methods are called on all processes as a consequence of corresponding
259 // events being called on the renderer.
260 virtual void HandleStartRender();
261 virtual void HandleEndRender();
262 virtual void HandleAbortRender() {}
263
264 virtual void MasterStartRender();
265 virtual void SlaveStartRender();
266
267 virtual void MasterEndRender();
268 virtual void SlaveEndRender();
269
272
281
287 virtual void PushImageToScreen();
288
292
298
299private:
300 vtkSynchronizedRenderers(const vtkSynchronizedRenderers&) VTK_DELETE_FUNCTION;
301 void operator=(const vtkSynchronizedRenderers&) VTK_DELETE_FUNCTION;
302
303 class vtkObserver;
304 vtkObserver* Observer;
305 friend class vtkObserver;
306
307 double LastViewport[4];
308};
309
310#endif
311
Configuration for FXAA implementations.
a simple class to control print indentation
Definition: vtkIndent.h:40
Multiprocessing communication superclass.
stream used to pass data across processes using vtkMultiProcessController.
abstract base class for most VTK objects
Definition: vtkObject.h:60
Perform FXAA antialiasing on the current framebuffer.
OpenGL renderer.
abstract specification for renderers
Definition: vtkRenderer.h:64
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
synchronizes renderers across processes.
virtual void SetParallelController(vtkMultiProcessController *)
Set the parallel message communicator.
virtual void SlaveStartRender()
virtual void SetRenderer(vtkRenderer *)
Set the renderer to be synchronized by this instance.
static vtkSynchronizedRenderers * New()
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual vtkRawImage & CaptureRenderedImage()
Can be used in HandleEndRender(), MasterEndRender() or SlaveEndRender() calls to capture the rendered...
virtual void HandleStartRender()
vtkSynchronizedRenderers * CaptureDelegate
virtual void HandleEndRender()
virtual vtkRenderer * GetRenderer()
vtkMultiProcessController * ParallelController
virtual void MasterEndRender()
vtkOpenGLFXAAFilter * FXAAFilter
virtual void SlaveEndRender()
virtual void MasterStartRender()
virtual void PushImageToScreen()
Can be used in HandleEndRender(), MasterEndRender() or SlaveEndRender() calls to paste back the image...
dynamic, self-adjusting array of unsigned char
@ data
Definition: vtkX3D.h:315
bool Restore(vtkMultiProcessStream &stream)
void Save(vtkMultiProcessStream &stream)
vtkRawImage can be used to make it easier to deal with images for compositing/communicating over clie...
void Initialize(int dx, int dy, vtkUnsignedCharArray *data)
Create the buffer from an image data.
void SaveAsPNG(const char *filename)
bool PushToFrameBuffer(vtkRenderer *ren=NULL)
void Resize(int dx, int dy, int numcomps)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.