VTK
vtkParallelRenderManager.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkParallelRenderManager.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 Copyright 2003 Sandia Corporation. Under the terms of Contract
11 DE-AC04-94AL85000, there is a non-exclusive license for use of this work by
12 or on behalf of the U.S. Government. Redistribution and use in source and
13 binary forms, with or without modification, are permitted provided that this
14 Notice and any statement of authorship are reproduced on all copies.
15
16 This software is distributed WITHOUT ANY WARRANTY; without even
17 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 PURPOSE. See the above copyright notice for more information.
19
20=========================================================================*/
47#ifndef vtkParallelRenderManager_h
48#define vtkParallelRenderManager_h
49
50#include "vtkRenderingParallelModule.h" // For export macro
51#include "vtkObject.h"
52
53class vtkDoubleArray;
56class vtkRenderer;
58class vtkRenderWindow;
59class vtkTimerLog;
61
62class VTKRENDERINGPARALLEL_EXPORT vtkParallelRenderManager : public vtkObject
63{
64public:
66 virtual void PrintSelf(ostream &os, vtkIndent indent);
67
76
84
86
90 vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
91 virtual void SetRenderWindow(vtkRenderWindow *renWin);
93
95
99 vtkGetObjectMacro(Controller, vtkMultiProcessController);
100 virtual void SetController(vtkMultiProcessController *controller);
102
107 virtual void InitializePieces();
108
116 virtual void InitializeOffScreen();
117
124 virtual void StartInteractor();
125
130 virtual void StartServices();
131
135 virtual void StopServices();
136
138
141 virtual void StartRender();
142 virtual void EndRender();
143 virtual void SatelliteStartRender();
144 virtual void SatelliteEndRender();
145 virtual void RenderRMI();
146 virtual void ResetCamera(vtkRenderer *ren);
148 virtual void ComputeVisiblePropBoundsRMI(int renderId);
150
151 virtual void InitializeRMIs();
152
158 virtual void ResetAllCameras();
159
163 virtual void ComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
164
166
172 vtkSetMacro(ParallelRendering, int);
173 vtkGetMacro(ParallelRendering, int);
174 vtkBooleanMacro(ParallelRendering, int);
176
178
184 vtkSetMacro(RenderEventPropagation, int);
185 vtkGetMacro(RenderEventPropagation, int);
186 vtkBooleanMacro(RenderEventPropagation, int);
188
198
200
205 vtkSetMacro(UseCompositing, int);
206 vtkGetMacro(UseCompositing, int);
207 vtkBooleanMacro(UseCompositing, int);
209
211
224 virtual void SetImageReductionFactor(double factor);
225 vtkGetMacro(ImageReductionFactor, double);
227
228 vtkSetMacro(MaxImageReductionFactor, double);
229 vtkGetMacro(MaxImageReductionFactor, double);
230
237 virtual void SetImageReductionFactorForUpdateRate(double DesiredUpdateRate);
238
240
245 vtkSetMacro(AutoImageReductionFactor, int);
246 vtkGetMacro(AutoImageReductionFactor, int);
247 vtkBooleanMacro(AutoImageReductionFactor, int);
249
251
254 vtkGetMacro(RenderTime, double);
255 vtkGetMacro(ImageProcessingTime, double);
257
259
268 vtkGetMacro(SyncRenderWindowRenderers, int);
269 vtkSetMacro(SyncRenderWindowRenderers, int);
270 vtkBooleanMacro(SyncRenderWindowRenderers, int);
271 virtual void AddRenderer(vtkRenderer *);
273 virtual void RemoveAllRenderers();
275
277
286 vtkSetMacro(WriteBackImages, int);
287 vtkGetMacro(WriteBackImages, int);
288 vtkBooleanMacro(WriteBackImages, int);
290
292
297 vtkSetMacro(MagnifyImages, int);
298 vtkGetMacro(MagnifyImages, int);
299 vtkBooleanMacro(MagnifyImages, int);
301
302 enum { NEAREST, LINEAR };
303
305
310 virtual void SetMagnifyImageMethod(int method);
311 vtkGetMacro(MagnifyImageMethod, int);
313 this->SetMagnifyImageMethod(NEAREST);
314 }
316 this->SetMagnifyImageMethod(LINEAR);
317 }
319
321
324 virtual void MagnifyImage(vtkUnsignedCharArray *fullImage,
325 const int fullImageSize[2],
326 vtkUnsignedCharArray *reducedImage,
327 const int reducedImageSize[2],
328 const int fullImageViewport[4] = NULL,
329 const int reducedImageViewport[4] = NULL);
331 const int fullImageSize[2],
332 vtkUnsignedCharArray *reducedImage,
333 const int reducedImageSize[2],
334 const int fullImageViewport[4] = NULL,
335 const int reducedImageViewport[4] = NULL);
337 const int fullImageSize[2],
338 vtkUnsignedCharArray *reducedImage,
339 const int reducedImageSize[2],
340 const int fullImageViewport[4] = NULL,
341 const int reducedImageViewport[4] = NULL);
343
345
353 virtual void GetPixelData(int x1, int y1, int x2, int y2,
356
358
366 virtual void GetReducedPixelData(int x1, int y1, int x2, int y2,
369
371
374 vtkGetVector2Macro(FullImageSize, int);
376
377
380 vtkGetVector2Macro(ReducedImageSize, int);
382
387 void TileWindows(int xsize, int ysize, int nColumns);
388
390
394 vtkSetMacro(UseRGBA, int);
395 vtkGetMacro(UseRGBA, int);
397
399
403 vtkSetMacro(ForceRenderWindowSize, int);
404 vtkGetMacro(ForceRenderWindowSize, int);
406
408
412 vtkSetVector2Macro(ForcedRenderWindowSize, int);
413 vtkGetVector2Macro(ForcedRenderWindowSize, int);
415
416 enum Tags {
417 RENDER_RMI_TAG=34532,
418 COMPUTE_VISIBLE_PROP_BOUNDS_RMI_TAG=54636,
419 WIN_INFO_TAG=87834,
420 REN_INFO_TAG=87836,
421 LIGHT_INFO_TAG=87838,
422 REN_ID_TAG=58794,
423 BOUNDS_TAG=23543
424 };
425
426 virtual void CheckForAbortRender() {}
427 virtual int CheckForAbortComposite() {return 0;}
428
430
436 vtkSetMacro(UseBackBuffer, int);
437 vtkGetMacro(UseBackBuffer, int);
438 vtkBooleanMacro(UseBackBuffer, int);
440
442
447 vtkSetMacro(SynchronizeTileProperties, int);
448 vtkGetMacro(SynchronizeTileProperties, int);
449 vtkBooleanMacro(SynchronizeTileProperties, int);
451
453
461
462protected:
465
466
468
474
478
480
482 int ForcedRenderWindowSize[2];
483
493
496
497 unsigned long StartRenderTag;
498 unsigned long EndRenderTag;
499 unsigned long ResetCameraTag;
501 unsigned long AbortRenderCheckTag;
502
506
510
513 int FullImageSize[2];
514 int ReducedImageSize[2];
515
518
522
524
525 int Lock;
530
532
535
541
548 virtual void SendWindowInformation() {}
549 virtual void ReceiveWindowInformation() {}
552
563 { return true; }
567 vtkMultiProcessStream&) { return true; }
568
570
574 virtual void PreRenderProcessing() = 0;
575 virtual void PostRenderProcessing() = 0;
577
582 virtual void SetRenderWindowSize();
583
589 virtual void LocalComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
590
594 virtual void MagnifyReducedImage();
595
599 virtual void WriteFullImage();
600
604 virtual void ReadReducedImage();
605
611
615 virtual int ChooseBuffer();
616
621 const int pixelDimensions[2]);
622
629 virtual int ImageReduceRenderer(vtkRenderer *) { return 1; }
630
632 {
633 int FullSize[2];
634 int ReducedSize[2];
637 int TileScale[2];
640 double TileViewport[4];
641
642 // Save/restore the struct to/from a stream.
645 };
646
648 {
649 int Draw;
651 double Viewport[4];
652 double CameraPosition[3];
653 double CameraFocalPoint[3];
654 double CameraViewUp[3];
655 double WindowCenter[2];
656 double CameraClippingRange[2];
658 double Background[3];
659 double Background2[3];
661
663
664 // Save/restore the struct to/from a stream.
667 };
668
670 {
671 double Position[3];
672 double FocalPoint[3];
673 double Type;
674 // Save/restore the struct to/from a stream.
677 };
678
680 unsigned long RenderRMIId;
681 unsigned long BoundsRMIId;
683
685
686private:
687 vtkParallelRenderManager(const vtkParallelRenderManager &) VTK_DELETE_FUNCTION;
688 void operator=(const vtkParallelRenderManager &) VTK_DELETE_FUNCTION;
689
690};
691
692#endif //vtkParalleRenderManager_h
dynamic, self-adjusting array of double
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
An object to control parallel rendering.
virtual vtkRenderer * MakeRenderer()
Builds a vtkRenderer compatible with this render manager.
void RemoveRenderWindowEventHandlers()
virtual void PreRenderProcessing()=0
Here is a good place to handle processing of data before and after render.
virtual void EndRender()
virtual int ImageReduceRenderer(vtkRenderer *)
Returns true if the image for the given renderer should be rendered at a reduced size to be magnified...
virtual void ComputeVisiblePropBoundsRMI(int renderId)
virtual void ResetCameraClippingRange(vtkRenderer *ren)
virtual void SendRendererInformation(vtkRenderer *)
virtual void InitializeOffScreen()
Make all rendering windows not viewable set as off screen rendering.
virtual void MagnifyReducedImage()
When called, fills FullImage.
virtual void SendWindowInformation()
Used to synchronize rendering information per frame.
virtual bool ProcessWindowInformation(vtkMultiProcessStream &)
virtual bool ProcessRendererInformation(vtkRenderer *, vtkMultiProcessStream &)
virtual void GetPixelData(vtkUnsignedCharArray *data)
The most appropriate way to retrieve full size image data after a render.
virtual vtkRenderWindow * MakeRenderWindow()
Builds a vtkRenderWindow compatible with this render manager.
virtual int LastRenderInFrontBuffer()
Returns 1 if the RenderWindow's last image is in the front buffer, 0 if it is in the back.
virtual void RenderRMI()
virtual void SetImageReductionFactor(double factor)
Set/Get the reduction factor (for sort-last based parallel renderers).
virtual void MagnifyImage(vtkUnsignedCharArray *fullImage, const int fullImageSize[2], vtkUnsignedCharArray *reducedImage, const int reducedImageSize[2], const int fullImageViewport[4]=NULL, const int reducedImageViewport[4]=NULL)
Convenience functions for magnifying images.
virtual void GetReducedPixelData(int x1, int y1, int x2, int y2, vtkUnsignedCharArray *data)
virtual void PostRenderProcessing()=0
virtual void InitializePieces()
This method sets the piece and number of pieces for each actor with a polydata mapper.
virtual void SetRenderWindowPixelData(vtkUnsignedCharArray *pixels, const int pixelDimensions[2])
Sets the current render window's pixel data.
virtual void ReceiveRendererInformation(vtkRenderer *)
virtual void WriteFullImage()
Write the full image back to the RenderWindow.
virtual void GetPixelData(int x1, int y1, int x2, int y2, vtkUnsignedCharArray *data)
virtual void GenericEndRenderCallback()
virtual void ReadReducedImage()
Reads in the reduced image from the RenderWindow.
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkRendererCollection * Renderers
virtual void CollectWindowInformation(vtkMultiProcessStream &)
Subclass should override these methods (instead of SendWindowInformation/ReceiveWindowInformation or ...
static void SetDefaultRenderEventPropagation(bool val)
Get/Set the default value used for RenderEventPropagation when a new instance of vtkParallelRenderMan...
virtual void InitializeRMIs()
virtual void AddRenderer(vtkRenderer *)
static void MagnifyImageLinear(vtkUnsignedCharArray *fullImage, const int fullImageSize[2], vtkUnsignedCharArray *reducedImage, const int reducedImageSize[2], const int fullImageViewport[4]=NULL, const int reducedImageViewport[4]=NULL)
virtual void RemoveAllRenderers()
vtkUnsignedCharArray * ReducedImage
void TileWindows(int xsize, int ysize, int nColumns)
Given the x and y size of the render windows, reposition them in a tile of n columns.
double AverageTimePerPixel
Used by SetImageReductionFactorForUpdateRate to smooth transitions transitions between image reductio...
virtual void GetReducedPixelData(vtkUnsignedCharArray *data)
The most appropriate way to retrieve reduced size image data after a render.
virtual void ResetAllCameras()
Resets the camera of each renderer contained in the RenderWindow.
virtual void SetRenderWindowSize()
Called in satellites to set the render window size to the current FullImageSize and ReducedImageSize ...
int RootProcessId
The "root" node's process id.
virtual void SetImageReductionFactorForUpdateRate(double DesiredUpdateRate)
Sets the ReductionFactor based on the given desired update rate and the rendering metrics taken from ...
virtual void SetRenderWindow(vtkRenderWindow *renWin)
vtkMultiProcessController * Controller
virtual void CollectRendererInformation(vtkRenderer *, vtkMultiProcessStream &)
static void MagnifyImageNearest(vtkUnsignedCharArray *fullImage, const int fullImageSize[2], vtkUnsignedCharArray *reducedImage, const int reducedImageSize[2], const int fullImageViewport[4]=NULL, const int reducedImageViewport[4]=NULL)
virtual void SatelliteStartRender()
virtual void GenericStartRenderCallback()
INTERNAL METHODS (DON NOT USE).
void AddRenderWindowEventHandlers()
Add/Remove event handlers for the render window.
vtkUnsignedCharArray * FullImage
virtual void SetMagnifyImageMethod(int method)
Sets the method used to magnify images.
virtual void StartServices()
If on node other than root, starts serving RMI requests for parallel renders.
virtual void StartInteractor()
Initializes the RMIs and then, if on root node, starts the interactor on the attached render window.
virtual void SatelliteEndRender()
virtual void ComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6])
Calculates the bounds by gathering information from all processes.
virtual void SetController(vtkMultiProcessController *controller)
virtual void StopServices()
If on root node, stops the RMI processing on all service nodes.
virtual void LocalComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6])
Called by ComputeVisiblePropBoundsRMI to get the bounds of a local renderer.
virtual vtkRendererCollection * GetRenderers()
virtual void StartRender()
Callbacks that initialize and finish rendering and other tasks.
virtual void RemoveRenderer(vtkRenderer *)
virtual int ChooseBuffer()
Select buffer to read from / render into.
virtual void ResetCamera(vtkRenderer *ren)
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:64
Timer support and logging.
Definition: vtkTimerLog.h:81
dynamic, self-adjusting array of unsigned char
@ Background
Definition: vtkX3D.h:71
@ data
Definition: vtkX3D.h:315
void Save(vtkMultiProcessStream &stream)
bool Restore(vtkMultiProcessStream &stream)
bool Restore(vtkMultiProcessStream &stream)
void Save(vtkMultiProcessStream &stream)
void Save(vtkMultiProcessStream &stream)
bool Restore(vtkMultiProcessStream &stream)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.