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)
168  static bool GetDefaultRenderEventPropagation()
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);
327 
328 
329  vtkGetVector2Macro(ReducedImageSize, int);
331 
334  void TileWindows(int xsize, int ysize, int nColumns);
335 
337 
339  vtkSetMacro(UseRGBA, int);
340  vtkGetMacro(UseRGBA, int);
342 
344 
347  vtkSetMacro(ForceRenderWindowSize, int);
348  vtkGetMacro(ForceRenderWindowSize, int);
350 
352 
354  vtkSetVector2Macro(ForcedRenderWindowSize, int);
355  vtkGetVector2Macro(ForcedRenderWindowSize, int);
357 
358 //BTX
359  enum Tags {
360  RENDER_RMI_TAG=34532,
361  COMPUTE_VISIBLE_PROP_BOUNDS_RMI_TAG=54636,
362  WIN_INFO_TAG=87834,
363  REN_INFO_TAG=87836,
364  LIGHT_INFO_TAG=87838,
365  REN_ID_TAG=58794,
366  BOUNDS_TAG=23543
367  };
368 
369  virtual void CheckForAbortRender() {}
370  virtual int CheckForAbortComposite() {return 0;}
371 //ETX
372 
373 // Disable warnings about qualifiers on return types.
374 #if defined(_COMPILER_VERSION)
375 # pragma set woff 3303
376 #endif
377 #if defined(__INTEL_COMPILER)
378 # pragma warning (push)
379 # pragma warning (disable:858)
380 #endif
381 
382 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
383 # define StartServiceA StartService
384 # define StartServiceW StartService
385 #endif
386 
389  VTK_LEGACY(virtual void StartService());
390 
391 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
392 # undef StartServiceW
393 # undef StartServiceA
394  //BTX
395  VTK_LEGACY(virtual void StartServiceA());
396  VTK_LEGACY(virtual void StartServiceW());
397  //ETX
398 #endif
399 
400 // Reset disabled warning about qualifiers on return types.
401 #if defined(__INTEL_COMPILER)
402 # pragma warning (pop)
403 #endif
404 #if defined(_COMPILER_VERSION)
405 # pragma reset woff 3303
406 #endif
407 
409 
413  vtkSetMacro(UseBackBuffer, int);
414  vtkGetMacro(UseBackBuffer, int);
415  vtkBooleanMacro(UseBackBuffer, int);
417 
419 
423  vtkSetMacro(SynchronizeTileProperties, int);
424  vtkGetMacro(SynchronizeTileProperties, int);
425  vtkBooleanMacro(SynchronizeTileProperties, int);
427 
429 
431  virtual void GenericStartRenderCallback();
432  virtual void GenericEndRenderCallback();
434 
435 //BTX
436 protected:
439 
440 
442 
443  void AddRenderWindowEventHandlers();
444  void RemoveRenderWindowEventHandlers();
446 
450 
451  virtual vtkRendererCollection *GetRenderers();
452 
454  int ForcedRenderWindowSize[2];
455 
463 
466 
467  unsigned long StartRenderTag;
468  unsigned long EndRenderTag;
469  unsigned long ResetCameraTag;
471  unsigned long AbortRenderCheckTag;
472 
476 
480 
481  int UseRGBA;
483  int FullImageSize[2];
484  int ReducedImageSize[2];
485 
488 
492 
494 
495  int Lock;
500 
502 
503  double RenderTime;
505 
509 
511 
515  virtual void SendWindowInformation() {}
516  virtual void ReceiveWindowInformation() {}
520 
522 
529  virtual bool ProcessWindowInformation(vtkMultiProcessStream&)
530  { return true; }
531  virtual void CollectRendererInformation(vtkRenderer*,
533  virtual bool ProcessRendererInformation(vtkRenderer*,
534  vtkMultiProcessStream&) { return true; }
536 
538 
540  virtual void PreRenderProcessing() = 0;
541  virtual void PostRenderProcessing() = 0;
543 
546  virtual void SetRenderWindowSize();
547 
551  virtual void LocalComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
552 
554  virtual void MagnifyReducedImage();
555 
557  virtual void WriteFullImage();
558 
560  virtual void ReadReducedImage();
561 
564  virtual int LastRenderInFrontBuffer();
565 
567  virtual int ChooseBuffer();
568 
570 
571  virtual void SetRenderWindowPixelData(vtkUnsignedCharArray *pixels,
572  const int pixelDimensions[2]);
574 
579  virtual int ImageReduceRenderer(vtkRenderer *) { return 1; }
580 
582  {
583  int FullSize[2];
584  int ReducedSize[2];
587  int TileScale[2];
590  double TileViewport[4];
591 
592  // Save/restore the struct to/from a stream.
593  void Save(vtkMultiProcessStream& stream);
594  bool Restore(vtkMultiProcessStream& stream);
595  };
596 
598  {
599  int Draw;
601  double Viewport[4];
602  double CameraPosition[3];
603  double CameraFocalPoint[3];
604  double CameraViewUp[3];
605  double WindowCenter[2];
606  double CameraClippingRange[2];
608  double Background[3];
609  double Background2[3];
611 
613 
614  // Save/restore the struct to/from a stream.
615  void Save(vtkMultiProcessStream& stream);
616  bool Restore(vtkMultiProcessStream& stream);
617  };
618 
619  struct LightInfo
620  {
621  double Position[3];
622  double FocalPoint[3];
623  double Type;
624  // Save/restore the struct to/from a stream.
625  void Save(vtkMultiProcessStream& stream);
626  bool Restore(vtkMultiProcessStream& stream);
627  };
628 
630  unsigned long RenderRMIId;
631  unsigned long BoundsRMIId;
633 
635 
636 private:
637  vtkParallelRenderManager(const vtkParallelRenderManager &); //Not implemented
638  void operator=(const vtkParallelRenderManager &); //Not implemented
639 //ETX
640 };
641 
642 #endif //__vtkParalleRenderManager_h