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 =========================================================================*/
49 #ifndef __vtkParallelRenderManager_h
50 #define __vtkParallelRenderManager_h
51 
52 #include "vtkObject.h"
53 
54 class vtkDoubleArray;
57 class vtkRenderer;
59 class vtkRenderWindow;
60 class vtkTimerLog;
62 
64 {
65 public:
67  virtual void PrintSelf(ostream &os, vtkIndent indent);
68 
74  virtual vtkRenderWindow *MakeRenderWindow();
75 
80  virtual vtkRenderer *MakeRenderer();
81 
83 
85  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
86  virtual void SetRenderWindow(vtkRenderWindow *renWin);
88 
90 
92  vtkGetObjectMacro(Controller, vtkMultiProcessController);
93  virtual void SetController(vtkMultiProcessController *controller);
95 
98  virtual void InitializePieces();
99 
105  virtual void InitializeOffScreen();
106 
111  virtual void StartInteractor();
112 
115  virtual void StartServices();
116 
118  virtual void StopServices();
119 
121 
122  virtual void StartRender();
123  virtual void EndRender();
124  virtual void SatelliteStartRender();
125  virtual void SatelliteEndRender();
126  virtual void RenderRMI();
127  virtual void ResetCamera(vtkRenderer *ren);
128  virtual void ResetCameraClippingRange(vtkRenderer *ren);
129  virtual void ComputeVisiblePropBoundsRMI(int renderId);
131 
132  virtual void InitializeRMIs();
133 
137  virtual void ResetAllCameras();
138 
140  virtual void ComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
141 
143 
147  vtkSetMacro(ParallelRendering, int);
148  vtkGetMacro(ParallelRendering, int);
149  vtkBooleanMacro(ParallelRendering, int);
151 
153 
157  vtkSetMacro(RenderEventPropagation, int);
158  vtkGetMacro(RenderEventPropagation, int);
159  vtkBooleanMacro(RenderEventPropagation, int);
161 
163 
166  static void SetDefaultRenderEventPropagation(bool val)
171 
173 
176  vtkSetMacro(UseCompositing, int);
177  vtkGetMacro(UseCompositing, int);
178  vtkBooleanMacro(UseCompositing, int);
180 
182 
193  virtual void SetImageReductionFactor(double factor);
194  vtkGetMacro(ImageReductionFactor, double);
196 
197  vtkSetMacro(MaxImageReductionFactor, double);
198  vtkGetMacro(MaxImageReductionFactor, double);
199 
205  virtual void SetImageReductionFactorForUpdateRate(double DesiredUpdateRate);
206 
208 
211  vtkSetMacro(AutoImageReductionFactor, int);
212  vtkGetMacro(AutoImageReductionFactor, int);
213  vtkBooleanMacro(AutoImageReductionFactor, int);
215 
217 
218  vtkGetMacro(RenderTime, double);
219  vtkGetMacro(ImageProcessingTime, double);
221 
223 
231  vtkGetMacro(SyncRenderWindowRenderers, int);
232  vtkSetMacro(SyncRenderWindowRenderers, int);
233  vtkBooleanMacro(SyncRenderWindowRenderers, int);
234  virtual void AddRenderer(vtkRenderer *);
235  virtual void RemoveRenderer(vtkRenderer *);
236  virtual void RemoveAllRenderers();
238 
240 
247  vtkSetMacro(WriteBackImages, int);
248  vtkGetMacro(WriteBackImages, int);
249  vtkBooleanMacro(WriteBackImages, int);
251 
253 
256  vtkSetMacro(MagnifyImages, int);
257  vtkGetMacro(MagnifyImages, int);
258  vtkBooleanMacro(MagnifyImages, int);
260 
261 //BTX
262  enum { NEAREST, LINEAR };
263 //ETX
264 
266 
269  virtual void SetMagnifyImageMethod(int method);
270  vtkGetMacro(MagnifyImageMethod, int);
272  this->SetMagnifyImageMethod(NEAREST);
273  }
275  this->SetMagnifyImageMethod(LINEAR);
276  }
278 
280 
281  virtual void MagnifyImage(vtkUnsignedCharArray *fullImage,
282  const int fullImageSize[2],
283  vtkUnsignedCharArray *reducedImage,
284  const int reducedImageSize[2],
285  const int fullImageViewport[4] = NULL,
286  const int reducedImageViewport[4] = NULL);
287  static void MagnifyImageNearest(vtkUnsignedCharArray *fullImage,
288  const int fullImageSize[2],
289  vtkUnsignedCharArray *reducedImage,
290  const int reducedImageSize[2],
291  const int fullImageViewport[4] = NULL,
292  const int reducedImageViewport[4] = NULL);
293  static void MagnifyImageLinear(vtkUnsignedCharArray *fullImage,
294  const int fullImageSize[2],
295  vtkUnsignedCharArray *reducedImage,
296  const int reducedImageSize[2],
297  const int fullImageViewport[4] = NULL,
298  const int reducedImageViewport[4] = NULL);
300 
302 
307  virtual void GetPixelData(vtkUnsignedCharArray *data);
308  virtual void GetPixelData(int x1, int y1, int x2, int y2,
311 
313 
318  virtual void GetReducedPixelData(vtkUnsignedCharArray *data);
319  virtual void GetReducedPixelData(int x1, int y1, int x2, int y2,
322 
324 
325  vtkGetVector2Macro(FullImageSize, int);
326  // Description:
327  // Returns the reduced image size calculated at the last render.
328  vtkGetVector2Macro(ReducedImageSize, int);
330 
333  void TileWindows(int xsize, int ysize, int nColumns);
334 
336 
338  vtkSetMacro(UseRGBA, int);
339  vtkGetMacro(UseRGBA, int);
341 
343 
346  vtkSetMacro(ForceRenderWindowSize, int);
347  vtkGetMacro(ForceRenderWindowSize, int);
349 
351 
353  vtkSetVector2Macro(ForcedRenderWindowSize, int);
354  vtkGetVector2Macro(ForcedRenderWindowSize, int);
356 
357 //BTX
358  enum Tags {
359  RENDER_RMI_TAG=34532,
360  COMPUTE_VISIBLE_PROP_BOUNDS_RMI_TAG=54636,
361  WIN_INFO_TAG=87834,
362  REN_INFO_TAG=87836,
363  LIGHT_INFO_TAG=87838,
364  REN_ID_TAG=58794,
365  BOUNDS_TAG=23543
366  };
367 
368  virtual void CheckForAbortRender() {}
369  virtual int CheckForAbortComposite() {return 0;}
370 //ETX
371 
372 // Disable warnings about qualifiers on return types.
373 #if defined(_COMPILER_VERSION)
374 # pragma set woff 3303
375 #endif
376 #if defined(__INTEL_COMPILER)
377 # pragma warning (push)
378 # pragma warning (disable:858)
379 #endif
380 
381 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
382 # define StartServiceA StartService
383 # define StartServiceW StartService
384 #endif
385 
388  VTK_LEGACY(virtual void StartService());
389 
390 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
391 # undef StartServiceW
392 # undef StartServiceA
393  //BTX
394  VTK_LEGACY(virtual void StartServiceA());
395  VTK_LEGACY(virtual void StartServiceW());
396  //ETX
397 #endif
398 
399 // Reset disabled warning about qualifiers on return types.
400 #if defined(__INTEL_COMPILER)
401 # pragma warning (pop)
402 #endif
403 #if defined(_COMPILER_VERSION)
404 # pragma reset woff 3303
405 #endif
406 
408 
412  vtkSetMacro(UseBackBuffer, int);
413  vtkGetMacro(UseBackBuffer, int);
414  vtkBooleanMacro(UseBackBuffer, int);
416 
418 
422  vtkSetMacro(SynchronizeTileProperties, int);
423  vtkGetMacro(SynchronizeTileProperties, int);
424  vtkBooleanMacro(SynchronizeTileProperties, int);
426 
428 
430  virtual void GenericStartRenderCallback();
431  virtual void GenericEndRenderCallback();
433 
434 //BTX
435 protected:
438 
439 
441 
442  void AddRenderWindowEventHandlers();
443  void RemoveRenderWindowEventHandlers();
445 
449 
450  virtual vtkRendererCollection *GetRenderers();
451 
453  int ForcedRenderWindowSize[2];
454 
462 
465 
466  unsigned long StartRenderTag;
467  unsigned long EndRenderTag;
468  unsigned long ResetCameraTag;
470  unsigned long AbortRenderCheckTag;
471 
475 
479 
480  int UseRGBA;
482  int FullImageSize[2];
483  int ReducedImageSize[2];
484 
487 
491 
493 
494  int Lock;
499 
501 
502  double RenderTime;
504 
508 
510 
514  virtual void SendWindowInformation() {}
515  virtual void ReceiveWindowInformation() {}
519 
521 
529  { return true; }
533  vtkMultiProcessStream&) { return true; }
535 
537 
539  virtual void PreRenderProcessing() = 0;
540  virtual void PostRenderProcessing() = 0;
542 
545  virtual void SetRenderWindowSize();
546 
550  virtual void LocalComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
551 
553  virtual void MagnifyReducedImage();
554 
556  virtual void WriteFullImage();
557 
559  virtual void ReadReducedImage();
560 
563  virtual int LastRenderInFrontBuffer();
564 
566  virtual int ChooseBuffer();
567 
569 
570  virtual void SetRenderWindowPixelData(vtkUnsignedCharArray *pixels,
571  const int pixelDimensions[2]);
573 
578  virtual int ImageReduceRenderer(vtkRenderer *) { return 1; }
579 
581  {
582  int FullSize[2];
583  int ReducedSize[2];
586  int TileScale[2];
589  double TileViewport[4];
590 
591  // Save/restore the struct to/from a stream.
592  void Save(vtkMultiProcessStream& stream);
593  bool Restore(vtkMultiProcessStream& stream);
594  };
595 
597  {
598  int Draw;
600  double Viewport[4];
601  double CameraPosition[3];
602  double CameraFocalPoint[3];
603  double CameraViewUp[3];
604  double WindowCenter[2];
605  double CameraClippingRange[2];
607  double Background[3];
608  double Background2[3];
610 
612 
613  // Save/restore the struct to/from a stream.
614  void Save(vtkMultiProcessStream& stream);
615  bool Restore(vtkMultiProcessStream& stream);
616  };
617 
618  struct LightInfo
619  {
620  double Position[3];
621  double FocalPoint[3];
622  double Type;
623  // Save/restore the struct to/from a stream.
624  void Save(vtkMultiProcessStream& stream);
625  bool Restore(vtkMultiProcessStream& stream);
626  };
627 
629  unsigned long RenderRMIId;
630  unsigned long BoundsRMIId;
632 
634 
635 private:
636  vtkParallelRenderManager(const vtkParallelRenderManager &); //Not implemented
637  void operator=(const vtkParallelRenderManager &); //Not implemented
638 //ETX
639 };
640 
641 #endif //__vtkParalleRenderManager_h