00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00061 #ifndef __vtkParallelRenderManager_h
00062 #define __vtkParallelRenderManager_h
00063
00064 #include "vtkObject.h"
00065
00066 class vtkRenderWindow;
00067 class vtkRenderer;
00068 class vtkUnsignedCharArray;
00069 class vtkDoubleArray;
00070 class vtkTimerLog;
00071 class vtkMultiProcessController;
00072
00073 class VTK_PARALLEL_EXPORT vtkParallelRenderManager : public vtkObject
00074 {
00075 public:
00076 vtkTypeRevisionMacro(vtkParallelRenderManager, vtkObject);
00077 virtual void PrintSelf(ostream &os, vtkIndent indent);
00078
00084 virtual vtkRenderWindow *MakeRenderWindow();
00085
00090 virtual vtkRenderer *MakeRenderer();
00091
00093
00095 vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00096 virtual void SetRenderWindow(vtkRenderWindow *renWin);
00098
00100
00102 vtkGetObjectMacro(Controller, vtkMultiProcessController);
00103 virtual void SetController(vtkMultiProcessController *controller);
00105
00108 virtual void InitializePieces();
00109
00115 virtual void InitializeOffScreen();
00116
00121 virtual void StartInteractor();
00122
00125 virtual void StartService();
00126
00128 virtual void StopServices();
00129
00131
00132 virtual void StartRender();
00133 virtual void EndRender();
00134 virtual void SatelliteStartRender();
00135 virtual void SatelliteEndRender();
00136 virtual void RenderRMI();
00137 virtual void ResetCamera(vtkRenderer *ren);
00138 virtual void ResetCameraClippingRange(vtkRenderer *ren);
00139 virtual void ComputeVisiblePropBoundsRMI();
00141
00142 virtual void InitializeRMIs();
00143
00147 virtual void ResetAllCameras();
00148
00150 virtual void ComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
00151
00153
00157 vtkSetMacro(ParallelRendering, int);
00158 vtkGetMacro(ParallelRendering, int);
00159 vtkBooleanMacro(ParallelRendering, int);
00161
00163
00167 vtkSetMacro(RenderEventPropagation, int);
00168 vtkGetMacro(RenderEventPropagation, int);
00169 vtkBooleanMacro(RenderEventPropagation, int);
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
00230 vtkSetMacro(WriteBackImages, int);
00231 vtkGetMacro(WriteBackImages, int);
00232 vtkBooleanMacro(WriteBackImages, int);
00234
00236
00239 vtkSetMacro(MagnifyImages, int);
00240 vtkGetMacro(MagnifyImages, int);
00241 vtkBooleanMacro(MagnifyImages, int);
00243
00244
00245 enum { NEAREST, LINEAR };
00246
00247
00249
00252 virtual void SetMagnifyImageMethod(int method);
00253 vtkGetMacro(MagnifyImageMethod, int);
00254 void SetMagnifyImageMethodToNearest() {
00255 this->SetMagnifyImageMethod(NEAREST);
00256 }
00257 void SetMagnifyImageMethodToLinear() {
00258 this->SetMagnifyImageMethod(LINEAR);
00259 }
00261
00263
00268 virtual void GetPixelData(vtkUnsignedCharArray *data);
00269 virtual void GetPixelData(int x1, int y1, int x2, int y2,
00270 vtkUnsignedCharArray *data);
00272
00274
00279 virtual void GetReducedPixelData(vtkUnsignedCharArray *data);
00280 virtual void GetReducedPixelData(int x1, int y1, int x2, int y2,
00281 vtkUnsignedCharArray *data);
00283
00285
00286 vtkGetVector2Macro(FullImageSize, int);
00287
00288
00289 vtkGetVector2Macro(ReducedImageSize, int);
00291
00294 void TileWindows(int xsize, int ysize, int nColumns);
00295
00296
00297 enum Tags {
00298 RENDER_RMI_TAG=34532,
00299 COMPUTE_VISIBLE_PROP_BOUNDS_RMI_TAG=54636,
00300 WIN_INFO_INT_TAG=87834,
00301 WIN_INFO_DOUBLE_TAG=87835,
00302 REN_INFO_INT_TAG=87836,
00303 REN_INFO_DOUBLE_TAG=87837,
00304 LIGHT_INFO_DOUBLE_TAG=87838,
00305 REN_ID_TAG=58794,
00306 BOUNDS_TAG=23543
00307 };
00308
00309 virtual void CheckForAbortRender() {}
00310 virtual int CheckForAbortComposite() {return 0;}
00311
00312
00313 protected:
00314 vtkParallelRenderManager();
00315 ~vtkParallelRenderManager();
00316
00317 vtkRenderWindow *RenderWindow;
00318 vtkMultiProcessController *Controller;
00319
00326 int RootProcessId;
00327
00328 int ObservingRenderWindow;
00329 int ObservingRenderer;
00330 int ObservingAbort;
00331
00332 unsigned long StartRenderTag;
00333 unsigned long EndRenderTag;
00334 unsigned long ResetCameraTag;
00335 unsigned long ResetCameraClippingRangeTag;
00336 unsigned long AbortRenderCheckTag;
00337
00338 double ImageReductionFactor;
00339 double MaxImageReductionFactor;
00340 int AutoImageReductionFactor;
00341
00342 int WriteBackImages;
00343 int MagnifyImages;
00344 int MagnifyImageMethod;
00345
00346 int FullImageSize[2];
00347 int ReducedImageSize[2];
00348
00349 vtkUnsignedCharArray *FullImage;
00350 vtkUnsignedCharArray *ReducedImage;
00351
00352 int FullImageUpToDate;
00353 int ReducedImageUpToDate;
00354 int RenderWindowImageUpToDate;
00355
00356 vtkDoubleArray *Viewports;
00357
00358 int Lock;
00359 int ParallelRendering;
00360 int RenderEventPropagation;
00361 int UseCompositing;
00362
00363 vtkTimerLog *Timer;
00364
00365 double RenderTime;
00366 double ImageProcessingTime;
00367
00370 double AverageTimePerPixel;
00371
00373
00374 virtual void SendWindowInformation() {}
00375 virtual void ReceiveWindowInformation() {}
00376 virtual void SendRendererInformation(vtkRenderer *) {};
00377 virtual void ReceiveRendererInformation(vtkRenderer *) {};
00379
00381
00383 virtual void PreRenderProcessing() = 0;
00384 virtual void PostRenderProcessing() = 0;
00386
00389 virtual void SetRenderWindowSize();
00390
00394 virtual void LocalComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
00395
00397 virtual void MagnifyReducedImage();
00398
00400 virtual void WriteFullImage();
00401
00403 virtual void ReadReducedImage();
00404
00407 virtual int LastRenderInFrontBuffer();
00408
00410 virtual int ChooseBuffer();
00411
00413
00414 virtual void SetRenderWindowPixelData(vtkUnsignedCharArray *pixels,
00415 const int pixelDimensions[2]);
00417
00418
00419 struct RenderWindowInfoInt
00420 {
00421 int FullSize[2];
00422 int ReducedSize[2];
00423 int NumberOfRenderers;
00424 int UseCompositing;
00425 };
00426
00427 struct RenderWindowInfoDouble
00428 {
00429 double ImageReductionFactor;
00430 double DesiredUpdateRate;
00431 };
00432
00433 struct RendererInfoInt
00434 {
00435 int NumberOfLights;
00436 };
00437
00438 struct RendererInfoDouble
00439 {
00440 double Viewport[4];
00441 double CameraPosition[3];
00442 double CameraFocalPoint[3];
00443 double CameraViewUp[3];
00444 double CameraClippingRange[2];
00445 double CameraViewAngle;
00446 double Background[3];
00447 double ParallelScale;
00448 };
00449
00450 struct LightInfoDouble
00451 {
00452 double Position[3];
00453 double FocalPoint[3];
00454 double Type;
00455 };
00456
00457 static const int WIN_INFO_INT_SIZE;
00458 static const int WIN_INFO_DOUBLE_SIZE;
00459 static const int REN_INFO_INT_SIZE;
00460 static const int REN_INFO_DOUBLE_SIZE;
00461 static const int LIGHT_INFO_DOUBLE_SIZE;
00462
00463
00464 int AddedRMIs;
00465 private:
00466 vtkParallelRenderManager(const vtkParallelRenderManager &);
00467 void operator=(const vtkParallelRenderManager &);
00468 };
00469
00470 #endif //__vtkParalleRenderManager_h