• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Parallel/vtkParallelRenderManager.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkParallelRenderManager.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010   Copyright 2003 Sandia Corporation. Under the terms of Contract
00011   DE-AC04-94AL85000, there is a non-exclusive license for use of this work by
00012   or on behalf of the U.S. Government. Redistribution and use in source and
00013   binary forms, with or without modification, are permitted provided that this
00014   Notice and any statement of authorship are reproduced on all copies.
00015 
00016      This software is distributed WITHOUT ANY WARRANTY; without even
00017      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00018      PURPOSE.  See the above copyright notice for more information.
00019 
00020 =========================================================================*/
00049 #ifndef __vtkParallelRenderManager_h
00050 #define __vtkParallelRenderManager_h
00051 
00052 #include "vtkObject.h"
00053 
00054 class vtkDoubleArray;
00055 class vtkMultiProcessController;
00056 class vtkMultiProcessStream;
00057 class vtkRenderer;
00058 class vtkRendererCollection;
00059 class vtkRenderWindow;
00060 class vtkTimerLog;
00061 class vtkUnsignedCharArray;
00062 
00063 class VTK_PARALLEL_EXPORT vtkParallelRenderManager : public vtkObject
00064 {
00065 public:
00066   vtkTypeRevisionMacro(vtkParallelRenderManager, vtkObject);
00067   virtual void PrintSelf(ostream &os, vtkIndent indent);
00068 
00074   virtual vtkRenderWindow *MakeRenderWindow();
00075 
00080   virtual vtkRenderer *MakeRenderer();
00081 
00083 
00085   vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00086   virtual void SetRenderWindow(vtkRenderWindow *renWin);
00088 
00090 
00092   vtkGetObjectMacro(Controller, vtkMultiProcessController);
00093   virtual void SetController(vtkMultiProcessController *controller);
00095 
00098   virtual void InitializePieces();
00099 
00105   virtual void InitializeOffScreen();
00106 
00111   virtual void StartInteractor();
00112 
00115   virtual void StartServices();
00116 
00118   virtual void StopServices();
00119 
00121 
00122   virtual void StartRender();
00123   virtual void EndRender();
00124   virtual void SatelliteStartRender();
00125   virtual void SatelliteEndRender();
00126   virtual void RenderRMI();
00127   virtual void ResetCamera(vtkRenderer *ren);
00128   virtual void ResetCameraClippingRange(vtkRenderer *ren);
00129   virtual void ComputeVisiblePropBoundsRMI(int renderId);
00131 
00132   virtual void InitializeRMIs();
00133 
00137   virtual void ResetAllCameras();
00138 
00140   virtual void ComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
00141 
00143 
00147   vtkSetMacro(ParallelRendering, int);
00148   vtkGetMacro(ParallelRendering, int);
00149   vtkBooleanMacro(ParallelRendering, int);
00151 
00153 
00157   vtkSetMacro(RenderEventPropagation, int);
00158   vtkGetMacro(RenderEventPropagation, int);
00159   vtkBooleanMacro(RenderEventPropagation, int);
00161 
00163 
00166   static void SetDefaultRenderEventPropagation(bool val)
00167     { vtkParallelRenderManager::DefaultRenderEventPropagation = val; }
00168   static bool GetDefaultRenderEventPropagation()
00169     { return vtkParallelRenderManager::DefaultRenderEventPropagation; }
00171 
00173 
00176   vtkSetMacro(UseCompositing, int);
00177   vtkGetMacro(UseCompositing, int);
00178   vtkBooleanMacro(UseCompositing, int);
00180 
00182 
00193   virtual void SetImageReductionFactor(double factor);
00194   vtkGetMacro(ImageReductionFactor, double);
00196 
00197   vtkSetMacro(MaxImageReductionFactor, double);
00198   vtkGetMacro(MaxImageReductionFactor, double);
00199 
00205   virtual void SetImageReductionFactorForUpdateRate(double DesiredUpdateRate);
00206 
00208 
00211   vtkSetMacro(AutoImageReductionFactor, int);
00212   vtkGetMacro(AutoImageReductionFactor, int);
00213   vtkBooleanMacro(AutoImageReductionFactor, int);
00215 
00217 
00218   vtkGetMacro(RenderTime, double);
00219   vtkGetMacro(ImageProcessingTime, double);
00221 
00223 
00231   vtkGetMacro(SyncRenderWindowRenderers, int);
00232   vtkSetMacro(SyncRenderWindowRenderers, int);
00233   vtkBooleanMacro(SyncRenderWindowRenderers, int);
00234   virtual void AddRenderer(vtkRenderer *);
00235   virtual void RemoveRenderer(vtkRenderer *);
00236   virtual void RemoveAllRenderers();
00238 
00240 
00247   vtkSetMacro(WriteBackImages, int);
00248   vtkGetMacro(WriteBackImages, int);
00249   vtkBooleanMacro(WriteBackImages, int);
00251 
00253 
00256   vtkSetMacro(MagnifyImages, int);
00257   vtkGetMacro(MagnifyImages, int);
00258   vtkBooleanMacro(MagnifyImages, int);
00260 
00261 //BTX
00262   enum { NEAREST, LINEAR };
00263 //ETX
00264 
00266 
00269   virtual void SetMagnifyImageMethod(int method);
00270   vtkGetMacro(MagnifyImageMethod, int);
00271   void SetMagnifyImageMethodToNearest() {
00272     this->SetMagnifyImageMethod(NEAREST);
00273   }
00274   void SetMagnifyImageMethodToLinear() {
00275     this->SetMagnifyImageMethod(LINEAR);
00276   }
00278 
00280 
00281   virtual void MagnifyImage(vtkUnsignedCharArray *fullImage,
00282                             const int fullImageSize[2],
00283                             vtkUnsignedCharArray *reducedImage,
00284                             const int reducedImageSize[2],
00285                             const int fullImageViewport[4] = NULL,
00286                             const int reducedImageViewport[4] = NULL);
00287   static void MagnifyImageNearest(vtkUnsignedCharArray *fullImage,
00288                                   const int fullImageSize[2],
00289                                   vtkUnsignedCharArray *reducedImage,
00290                                   const int reducedImageSize[2],
00291                                   const int fullImageViewport[4] = NULL,
00292                                   const int reducedImageViewport[4] = NULL);
00293   static void MagnifyImageLinear(vtkUnsignedCharArray *fullImage,
00294                                  const int fullImageSize[2],
00295                                  vtkUnsignedCharArray *reducedImage,
00296                                  const int reducedImageSize[2],
00297                                  const int fullImageViewport[4] = NULL,
00298                                  const int reducedImageViewport[4] = NULL);
00300 
00302 
00307   virtual void GetPixelData(vtkUnsignedCharArray *data);
00308   virtual void GetPixelData(int x1, int y1, int x2, int y2,
00309           vtkUnsignedCharArray *data);
00311 
00313 
00318   virtual void GetReducedPixelData(vtkUnsignedCharArray *data);
00319   virtual void GetReducedPixelData(int x1, int y1, int x2, int y2,
00320            vtkUnsignedCharArray *data);
00322 
00324 
00325   vtkGetVector2Macro(FullImageSize, int);
00326   // Description:
00327   // Returns the reduced image size calculated at the last render.
00328   vtkGetVector2Macro(ReducedImageSize, int);
00330 
00333   void TileWindows(int xsize, int ysize, int nColumns);
00334 
00336 
00338   vtkSetMacro(UseRGBA, int);
00339   vtkGetMacro(UseRGBA, int);
00341 
00343 
00346   vtkSetMacro(ForceRenderWindowSize, int);
00347   vtkGetMacro(ForceRenderWindowSize, int);
00349 
00351 
00353   vtkSetVector2Macro(ForcedRenderWindowSize, int);
00354   vtkGetVector2Macro(ForcedRenderWindowSize, int);
00356 
00357 //BTX
00358   enum Tags {
00359     RENDER_RMI_TAG=34532,
00360     COMPUTE_VISIBLE_PROP_BOUNDS_RMI_TAG=54636,
00361     WIN_INFO_TAG=87834,
00362     REN_INFO_TAG=87836,
00363     LIGHT_INFO_TAG=87838,
00364     REN_ID_TAG=58794,
00365     BOUNDS_TAG=23543
00366   };
00367 
00368   virtual void CheckForAbortRender() {}
00369   virtual int CheckForAbortComposite() {return 0;}  
00370 //ETX
00371 
00372 // Disable warnings about qualifiers on return types.
00373 #if defined(_COMPILER_VERSION)
00374 # pragma set woff 3303
00375 #endif
00376 #if defined(__INTEL_COMPILER)
00377 # pragma warning (push)
00378 # pragma warning (disable:858)
00379 #endif
00380 
00381 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
00382 # define StartServiceA StartService
00383 # define StartServiceW StartService
00384 #endif
00385 
00388   VTK_LEGACY(virtual void StartService());
00389 
00390 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
00391 # undef StartServiceW
00392 # undef StartServiceA
00393   //BTX
00394   VTK_LEGACY(virtual void StartServiceA());
00395   VTK_LEGACY(virtual void StartServiceW());
00396   //ETX
00397 #endif
00398 
00399 // Reset disabled warning about qualifiers on return types.
00400 #if defined(__INTEL_COMPILER)
00401 # pragma warning (pop)
00402 #endif
00403 #if defined(_COMPILER_VERSION)
00404 # pragma reset woff 3303
00405 #endif
00406 
00408 
00412   vtkSetMacro(UseBackBuffer, int);
00413   vtkGetMacro(UseBackBuffer, int);
00414   vtkBooleanMacro(UseBackBuffer, int);
00416 
00418 
00422   vtkSetMacro(SynchronizeTileProperties, int);
00423   vtkGetMacro(SynchronizeTileProperties, int);
00424   vtkBooleanMacro(SynchronizeTileProperties, int);
00426 
00428 
00430   virtual void GenericStartRenderCallback();
00431   virtual void GenericEndRenderCallback();
00433 
00434 //BTX
00435 protected:
00436   vtkParallelRenderManager();
00437   ~vtkParallelRenderManager();
00438 
00439 
00441 
00442   void AddRenderWindowEventHandlers();
00443   void RemoveRenderWindowEventHandlers();
00445 
00446   vtkRenderWindow *RenderWindow;
00447   vtkMultiProcessController *Controller;
00448   vtkRendererCollection *Renderers;
00449 
00450   virtual vtkRendererCollection *GetRenderers();
00451 
00452   int ForceRenderWindowSize;
00453   int ForcedRenderWindowSize[2];
00454 
00461   int RootProcessId;
00462 
00463   int ObservingRenderWindow;
00464   int ObservingAbort;
00465 
00466   unsigned long StartRenderTag;
00467   unsigned long EndRenderTag;
00468   unsigned long ResetCameraTag;
00469   unsigned long ResetCameraClippingRangeTag;
00470   unsigned long AbortRenderCheckTag;
00471 
00472   double ImageReductionFactor;
00473   double MaxImageReductionFactor;
00474   int AutoImageReductionFactor;
00475 
00476   int WriteBackImages;
00477   int MagnifyImages;
00478   int MagnifyImageMethod;
00479 
00480   int UseRGBA;
00481   int SynchronizeTileProperties;
00482   int FullImageSize[2];
00483   int ReducedImageSize[2];
00484 
00485   vtkUnsignedCharArray *FullImage;
00486   vtkUnsignedCharArray *ReducedImage;
00487 
00488   int FullImageUpToDate;
00489   int ReducedImageUpToDate;
00490   int RenderWindowImageUpToDate;
00491 
00492   vtkDoubleArray *Viewports;
00493 
00494   int Lock;
00495   int ParallelRendering;
00496   int RenderEventPropagation;
00497   int UseCompositing;
00498   int SyncRenderWindowRenderers;
00499 
00500   vtkTimerLog *Timer;
00501 
00502   double RenderTime;
00503   double ImageProcessingTime;
00504 
00507   double AverageTimePerPixel;
00508 
00510 
00514   virtual void SendWindowInformation() {}
00515   virtual void ReceiveWindowInformation() {}
00516   virtual void SendRendererInformation(vtkRenderer *) {};
00517   virtual void ReceiveRendererInformation(vtkRenderer *) {};
00519 
00521 
00527   virtual void CollectWindowInformation(vtkMultiProcessStream&) {}
00528   virtual bool ProcessWindowInformation(vtkMultiProcessStream&) 
00529     { return true; }
00530   virtual void CollectRendererInformation(vtkRenderer*,
00531     vtkMultiProcessStream&) {}
00532   virtual bool ProcessRendererInformation(vtkRenderer*,
00533     vtkMultiProcessStream&) { return true; }
00535 
00537 
00539   virtual void PreRenderProcessing() = 0;
00540   virtual void PostRenderProcessing() = 0;
00542 
00545   virtual void SetRenderWindowSize();
00546 
00550   virtual void LocalComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
00551 
00553   virtual void MagnifyReducedImage();
00554 
00556   virtual void WriteFullImage();
00557 
00559   virtual void ReadReducedImage();
00560 
00563   virtual int LastRenderInFrontBuffer();
00564 
00566   virtual int ChooseBuffer();
00567   
00569 
00570   virtual void SetRenderWindowPixelData(vtkUnsignedCharArray *pixels,
00571           const int pixelDimensions[2]);
00573 
00578   virtual int ImageReduceRenderer(vtkRenderer *) { return 1; }
00579 
00580   struct RenderWindowInfo
00581   {
00582     int FullSize[2];
00583     int ReducedSize[2];
00584     int NumberOfRenderers;
00585     int UseCompositing;
00586     int TileScale[2];
00587     double ImageReductionFactor;
00588     double DesiredUpdateRate;
00589     double TileViewport[4];
00590 
00591     // Save/restore the struct to/from a stream.
00592     void Save(vtkMultiProcessStream& stream);
00593     bool Restore(vtkMultiProcessStream& stream);
00594   };
00595 
00596   struct RendererInfo
00597   {
00598     int Draw;
00599     int NumberOfLights;
00600     double Viewport[4];
00601     double CameraPosition[3];
00602     double CameraFocalPoint[3];
00603     double CameraViewUp[3];
00604     double WindowCenter[2];
00605     double CameraClippingRange[2];
00606     double CameraViewAngle;
00607     double Background[3];
00608     double ParallelScale;
00609 
00610     // Save/restore the struct to/from a stream.
00611     void Save(vtkMultiProcessStream& stream);
00612     bool Restore(vtkMultiProcessStream& stream);
00613   };
00614   
00615   struct LightInfo
00616   {
00617     double Position[3];
00618     double FocalPoint[3];
00619     double Type;
00620     // Save/restore the struct to/from a stream.
00621     void Save(vtkMultiProcessStream& stream);
00622     bool Restore(vtkMultiProcessStream& stream);
00623   };
00624 
00625   int AddedRMIs;
00626   unsigned long RenderRMIId;
00627   unsigned long BoundsRMIId;
00628   int UseBackBuffer;
00629 
00630   static bool DefaultRenderEventPropagation;
00631 
00632 private:
00633   vtkParallelRenderManager(const vtkParallelRenderManager &); //Not implemented
00634   void operator=(const vtkParallelRenderManager &);  //Not implemented
00635 //ETX
00636 };
00637 
00638 #endif //__vtkParalleRenderManager_h

Generated by  doxygen 1.7.1