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

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 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 StartService();
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(int factor);
00182   vtkGetMacro(ImageReductionFactor, int);
00184 
00185   vtkSetMacro(MaxImageReductionFactor, int);
00186   vtkGetMacro(MaxImageReductionFactor, int);
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 
00280 //BTX
00281   enum Tags {
00282     RENDER_RMI_TAG=34532,
00283     COMPUTE_VISIBLE_PROP_BOUNDS_RMI_TAG=54636,
00284     WIN_INFO_INT_TAG=87834,
00285     WIN_INFO_DOUBLE_TAG=87835,
00286     REN_INFO_INT_TAG=87836,
00287     REN_INFO_DOUBLE_TAG=87837,
00288     LIGHT_INFO_DOUBLE_TAG=87838,
00289     REN_ID_TAG=58794,
00290     BOUNDS_TAG=23543
00291   };
00292 
00293   virtual void CheckForAbortRender() {}
00294 //ETX
00295 
00296 protected:
00297   vtkParallelRenderManager();
00298   ~vtkParallelRenderManager();
00299 
00300   vtkRenderWindow *RenderWindow;
00301   vtkMultiProcessController *Controller;
00302 
00309   int RootProcessId;
00310 
00311   int ObservingRenderWindow;
00312   int ObservingRenderer;
00313   int ObservingAbort;
00314 
00315   unsigned long StartRenderTag;
00316   unsigned long EndRenderTag;
00317   unsigned long ResetCameraTag;
00318   unsigned long ResetCameraClippingRangeTag;
00319   unsigned long AbortRenderCheckTag;
00320 
00321   int ImageReductionFactor;
00322   int MaxImageReductionFactor;
00323   int AutoImageReductionFactor;
00324 
00325   int WriteBackImages;
00326   int MagnifyImages;
00327   int MagnifyImageMethod;
00328 
00329   int FullImageSize[2];
00330   int ReducedImageSize[2];
00331 
00332   vtkUnsignedCharArray *FullImage;
00333   vtkUnsignedCharArray *ReducedImage;
00334 
00335   int FullImageUpToDate;
00336   int ReducedImageUpToDate;
00337   int RenderWindowImageUpToDate;
00338 
00339   vtkDoubleArray *Viewports;
00340 
00341   int Lock;
00342   int ParallelRendering;
00343   int RenderEventPropagation;
00344   int UseCompositing;
00345 
00346   vtkTimerLog *Timer;
00347 
00348   double RenderTime;
00349   double ImageProcessingTime;
00350 
00353   double AverageTimePerPixel;
00354 
00356 
00357   virtual void SendWindowInformation() {}
00358   virtual void ReceiveWindowInformation() {}
00359   virtual void SendRendererInformation(vtkRenderer *) {};
00360   virtual void ReceiveRendererInformation(vtkRenderer *) {};
00362 
00364 
00366   virtual void PreRenderProcessing() = 0;
00367   virtual void PostRenderProcessing() = 0;
00369 
00372   virtual void SetRenderWindowSize();
00373 
00377   virtual void LocalComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
00378 
00380   virtual void MagnifyReducedImage();
00381 
00383   virtual void WriteFullImage();
00384 
00386   virtual void ReadReducedImage();
00387 
00390   virtual int LastRenderInFrontBuffer();
00391 
00393   virtual int ChooseBuffer();
00394   
00396 
00397   virtual void SetRenderWindowPixelData(vtkUnsignedCharArray *pixels,
00398           const int pixelDimensions[2]);
00400 
00401 //BTX
00402   struct RenderWindowInfoInt
00403   {
00404     int FullSize[2];
00405     int ReducedSize[2];
00406     int NumberOfRenderers;
00407     int ImageReductionFactor;
00408     int UseCompositing;
00409   };
00410 
00411   struct RenderWindowInfoDouble
00412   {
00413     double DesiredUpdateRate;
00414   };
00415   
00416   struct RendererInfoInt
00417   {
00418     int NumberOfLights;
00419   };
00420 
00421   struct RendererInfoDouble
00422   {
00423     double Viewport[4];
00424     double CameraPosition[3];
00425     double CameraFocalPoint[3];
00426     double CameraViewUp[3];
00427     double CameraClippingRange[2];
00428     double Background[3];
00429     double ParallelScale;
00430   };
00431   
00432   struct LightInfoDouble
00433   {
00434     double Position[3];
00435     double FocalPoint[3];
00436     double Type;
00437   };
00438 
00439   static const int WIN_INFO_INT_SIZE;
00440   static const int WIN_INFO_DOUBLE_SIZE;
00441   static const int REN_INFO_INT_SIZE;
00442   static const int REN_INFO_DOUBLE_SIZE;
00443   static const int LIGHT_INFO_DOUBLE_SIZE;
00444 //ETX
00445 
00446 private:
00447   vtkParallelRenderManager(const vtkParallelRenderManager &); //Not implemented
00448   void operator=(const vtkParallelRenderManager &);  //Not implemented
00449 };
00450 
00451 #endif //__vtkParalleRenderManager_h