Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

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 vtkRenderWindow;
00055 class vtkRenderer;
00056 class vtkUnsignedCharArray;
00057 class vtkDoubleArray;
00058 class vtkTimerLog;
00059 class vtkMultiProcessController;
00060 
00061 class VTK_PARALLEL_EXPORT vtkParallelRenderManager : public vtkObject
00062 {
00063 public:
00064   vtkTypeRevisionMacro(vtkParallelRenderManager, vtkObject);
00065   virtual void PrintSelf(ostream &os, vtkIndent indent);
00066 
00072   virtual vtkRenderWindow *MakeRenderWindow();
00073 
00078   virtual vtkRenderer *MakeRenderer();
00079 
00081 
00083   vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00084   virtual void SetRenderWindow(vtkRenderWindow *renWin);
00086 
00088 
00090   vtkGetObjectMacro(Controller, vtkMultiProcessController);
00091   virtual void SetController(vtkMultiProcessController *controller);
00093 
00096   virtual void InitializePieces();
00097 
00103   virtual void InitializeOffScreen();
00104 
00109   virtual void StartInteractor();
00110 
00113   virtual void StartServices();
00114 
00116   virtual void StopServices();
00117 
00119 
00120   virtual void StartRender();
00121   virtual void EndRender();
00122   virtual void SatelliteStartRender();
00123   virtual void SatelliteEndRender();
00124   virtual void RenderRMI();
00125   virtual void ResetCamera(vtkRenderer *ren);
00126   virtual void ResetCameraClippingRange(vtkRenderer *ren);
00127   virtual void ComputeVisiblePropBoundsRMI();
00129 
00130   virtual void InitializeRMIs();
00131 
00135   virtual void ResetAllCameras();
00136 
00138   virtual void ComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
00139 
00141 
00145   vtkSetMacro(ParallelRendering, int);
00146   vtkGetMacro(ParallelRendering, int);
00147   vtkBooleanMacro(ParallelRendering, int);
00149 
00151 
00155   vtkSetMacro(RenderEventPropagation, int);
00156   vtkGetMacro(RenderEventPropagation, int);
00157   vtkBooleanMacro(RenderEventPropagation, int);
00159 
00161 
00164   vtkSetMacro(UseCompositing, int);
00165   vtkGetMacro(UseCompositing, int);
00166   vtkBooleanMacro(UseCompositing, int);
00168 
00170 
00181   virtual void SetImageReductionFactor(double factor);
00182   vtkGetMacro(ImageReductionFactor, double);
00184 
00185   vtkSetMacro(MaxImageReductionFactor, double);
00186   vtkGetMacro(MaxImageReductionFactor, double);
00187 
00193   virtual void SetImageReductionFactorForUpdateRate(double DesiredUpdateRate);
00194 
00196 
00199   vtkSetMacro(AutoImageReductionFactor, int);
00200   vtkGetMacro(AutoImageReductionFactor, int);
00201   vtkBooleanMacro(AutoImageReductionFactor, int);
00203 
00205 
00206   vtkGetMacro(RenderTime, double);
00207   vtkGetMacro(ImageProcessingTime, double);
00209 
00211 
00218   vtkSetMacro(WriteBackImages, int);
00219   vtkGetMacro(WriteBackImages, int);
00220   vtkBooleanMacro(WriteBackImages, int);
00222 
00224 
00227   vtkSetMacro(MagnifyImages, int);
00228   vtkGetMacro(MagnifyImages, int);
00229   vtkBooleanMacro(MagnifyImages, int);
00231 
00232 //BTX
00233   enum { NEAREST, LINEAR };
00234 //ETX
00235 
00237 
00240   virtual void SetMagnifyImageMethod(int method);
00241   vtkGetMacro(MagnifyImageMethod, int);
00242   void SetMagnifyImageMethodToNearest() {
00243     this->SetMagnifyImageMethod(NEAREST);
00244   }
00245   void SetMagnifyImageMethodToLinear() {
00246     this->SetMagnifyImageMethod(LINEAR);
00247   }
00249 
00251 
00256   virtual void GetPixelData(vtkUnsignedCharArray *data);
00257   virtual void GetPixelData(int x1, int y1, int x2, int y2,
00258           vtkUnsignedCharArray *data);
00260 
00262 
00267   virtual void GetReducedPixelData(vtkUnsignedCharArray *data);
00268   virtual void GetReducedPixelData(int x1, int y1, int x2, int y2,
00269            vtkUnsignedCharArray *data);
00271 
00273 
00274   vtkGetVector2Macro(FullImageSize, int);
00275   // Description:
00276   // Returns the reduced image size calculated at the last render.
00277   vtkGetVector2Macro(ReducedImageSize, int);
00279 
00282   void TileWindows(int xsize, int ysize, int nColumns);
00283 
00285 
00287   vtkSetMacro(UseRGBA, int);
00288   vtkGetMacro(UseRGBA, int);
00290 
00291 //BTX
00292   enum Tags {
00293     RENDER_RMI_TAG=34532,
00294     COMPUTE_VISIBLE_PROP_BOUNDS_RMI_TAG=54636,
00295     WIN_INFO_INT_TAG=87834,
00296     WIN_INFO_DOUBLE_TAG=87835,
00297     REN_INFO_INT_TAG=87836,
00298     REN_INFO_DOUBLE_TAG=87837,
00299     LIGHT_INFO_DOUBLE_TAG=87838,
00300     REN_ID_TAG=58794,
00301     BOUNDS_TAG=23543
00302   };
00303 
00304   virtual void CheckForAbortRender() {}
00305   virtual int CheckForAbortComposite() {return 0;}  
00306 //ETX
00307 
00308 // Disable warnings about qualifiers on return types.
00309 #if defined(_COMPILER_VERSION)
00310 # pragma set woff 3303
00311 #endif
00312 #if defined(__INTEL_COMPILER)
00313 # pragma warning (push)
00314 # pragma warning (disable:858)
00315 #endif
00316 
00317 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
00318 # define StartServiceA StartService
00319 # define StartServiceW StartService
00320 #endif
00321 
00324   VTK_LEGACY(virtual void const StartService());
00325 
00326 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
00327 # undef StartServiceW
00328 # undef StartServiceA
00329   //BTX
00330   VTK_LEGACY(virtual void const StartServiceA());
00331   VTK_LEGACY(virtual void const StartServiceW());
00332   //ETX
00333 #endif
00334 
00335 // Reset disabled warning about qualifiers on return types.
00336 #if defined(__INTEL_COMPILER)
00337 # pragma warning (pop)
00338 #endif
00339 #if defined(_COMPILER_VERSION)
00340 # pragma reset woff 3303
00341 #endif
00342 
00343 protected:
00344   vtkParallelRenderManager();
00345   ~vtkParallelRenderManager();
00346 
00347   vtkRenderWindow *RenderWindow;
00348   vtkMultiProcessController *Controller;
00349 
00356   int RootProcessId;
00357 
00358   int ObservingRenderWindow;
00359   int ObservingRenderer;
00360   int ObservingAbort;
00361 
00362   unsigned long StartRenderTag;
00363   unsigned long EndRenderTag;
00364   unsigned long ResetCameraTag;
00365   unsigned long ResetCameraClippingRangeTag;
00366   unsigned long AbortRenderCheckTag;
00367 
00368   double ImageReductionFactor;
00369   double MaxImageReductionFactor;
00370   int AutoImageReductionFactor;
00371 
00372   int WriteBackImages;
00373   int MagnifyImages;
00374   int MagnifyImageMethod;
00375 
00376   int UseRGBA;
00377 
00378   int FullImageSize[2];
00379   int ReducedImageSize[2];
00380 
00381   vtkUnsignedCharArray *FullImage;
00382   vtkUnsignedCharArray *ReducedImage;
00383 
00384   int FullImageUpToDate;
00385   int ReducedImageUpToDate;
00386   int RenderWindowImageUpToDate;
00387 
00388   vtkDoubleArray *Viewports;
00389 
00390   int Lock;
00391   int ParallelRendering;
00392   int RenderEventPropagation;
00393   int UseCompositing;
00394 
00395   vtkTimerLog *Timer;
00396 
00397   double RenderTime;
00398   double ImageProcessingTime;
00399 
00402   double AverageTimePerPixel;
00403 
00405 
00406   virtual void SendWindowInformation() {}
00407   virtual void ReceiveWindowInformation() {}
00408   virtual void SendRendererInformation(vtkRenderer *) {};
00409   virtual void ReceiveRendererInformation(vtkRenderer *) {};
00411 
00413 
00415   virtual void PreRenderProcessing() = 0;
00416   virtual void PostRenderProcessing() = 0;
00418 
00421   virtual void SetRenderWindowSize();
00422 
00426   virtual void LocalComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
00427 
00429   virtual void MagnifyReducedImage();
00430 
00432   virtual void WriteFullImage();
00433 
00435   virtual void ReadReducedImage();
00436 
00439   virtual int LastRenderInFrontBuffer();
00440 
00442   virtual int ChooseBuffer();
00443   
00445 
00446   virtual void SetRenderWindowPixelData(vtkUnsignedCharArray *pixels,
00447           const int pixelDimensions[2]);
00449 
00450 //BTX
00451   struct RenderWindowInfoInt
00452   {
00453     int FullSize[2];
00454     int ReducedSize[2];
00455     int NumberOfRenderers;
00456     int UseCompositing;
00457   };
00458 
00459   struct RenderWindowInfoDouble
00460   {
00461     double ImageReductionFactor;
00462     double DesiredUpdateRate;
00463   };
00464   
00465   struct RendererInfoInt
00466   {
00467     int NumberOfLights;
00468   };
00469 
00470   struct RendererInfoDouble
00471   {
00472     double Viewport[4];
00473     double CameraPosition[3];
00474     double CameraFocalPoint[3];
00475     double CameraViewUp[3];
00476     double WindowCenter[2];
00477     double CameraClippingRange[2];
00478     double CameraViewAngle;
00479     double Background[3];
00480     double ParallelScale;
00481   };
00482   
00483   struct LightInfoDouble
00484   {
00485     double Position[3];
00486     double FocalPoint[3];
00487     double Type;
00488   };
00489 
00490   static const int WIN_INFO_INT_SIZE;
00491   static const int WIN_INFO_DOUBLE_SIZE;
00492   static const int REN_INFO_INT_SIZE;
00493   static const int REN_INFO_DOUBLE_SIZE;
00494   static const int LIGHT_INFO_DOUBLE_SIZE;
00495 //ETX
00496 
00497   int AddedRMIs;
00498 private:
00499   vtkParallelRenderManager(const vtkParallelRenderManager &); //Not implemented
00500   void operator=(const vtkParallelRenderManager &);  //Not implemented
00501 };
00502 
00503 #endif //__vtkParalleRenderManager_h

Generated on Mon Jan 21 23:07:33 2008 for VTK by  doxygen 1.4.3-20050530