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

Parallel/vtkCompositeManager.h

Go to the documentation of this file.
00001 /*=========================================================================
00002   
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkCompositeManager.h,v $
00005   Language:  C++
00006   
00007 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00008 All rights reserved.
00009 
00010 Redistribution and use in source and binary forms, with or without
00011 modification, are permitted provided that the following conditions are met:
00012 
00013  * Redistributions of source code must retain the above copyright notice,
00014    this list of conditions and the following disclaimer.
00015 
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019 
00020  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00021    of any contributors may be used to endorse or promote products derived
00022    from this software without specific prior written permission.
00023 
00024  * Modified source versions must be plainly marked as such, and must not be
00025    misrepresented as being the original software.
00026 
00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00028 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00032 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00033 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00034 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00035 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00036 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 
00038 =========================================================================*/
00058 #ifndef __vtkCompositeManager_h
00059 #define __vtkCompositeManager_h
00060 
00061 #include "vtkObject.h"
00062 #include "vtkRenderWindow.h"
00063 #include "vtkRenderWindowInteractor.h"
00064 #include "vtkRenderer.h"
00065 #include "vtkMultiProcessController.h"
00066 
00067 class vtkTimerLog;
00068 
00069 
00070 class VTK_PARALLEL_EXPORT vtkCompositeManager : public vtkObject
00071 {
00072 public:
00073   vtkTypeMacro(vtkCompositeManager,vtkObject);
00074   void PrintSelf(ostream& os, vtkIndent indent);
00075 
00077 
00079   vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00080   void SetRenderWindow(vtkRenderWindow *renWin);
00082 
00086   void InitializePieces();
00087   
00089   void InitializeOffScreen();
00090   
00092 
00093   void StartInteractor();
00094   void ExitInteractor();
00095   void StartRender();
00096   void EndRender();
00097   void RenderRMI();
00098   void ResetCamera(vtkRenderer *ren);
00099   void ResetCameraClippingRange(vtkRenderer *ren);
00100   void ComputeVisiblePropBoundsRMI();
00102   
00105   void InitializeRMIs();
00106   
00108 
00113   void SetReductionFactor(int factor);
00114   vtkGetMacro(ReductionFactor, int);
00116 
00118 
00121   vtkSetMacro(UseChar, int);
00122   vtkGetMacro(UseChar, int);
00123   vtkBooleanMacro(UseChar, int);
00125 
00127 
00128   vtkSetMacro(UseCompositing, int);
00129   vtkGetMacro(UseCompositing, int);
00130   vtkBooleanMacro(UseCompositing, int);
00132   
00134 
00136   vtkGetMacro(GetBuffersTime, double);
00137   vtkGetMacro(SetBuffersTime, double);
00138   vtkGetMacro(CompositeTime, double);
00139   vtkGetMacro(MaxRenderTime, double);
00141 
00143   float GetZ(int x, int y);
00144 
00146 
00149   vtkSetObjectMacro(Controller, vtkMultiProcessController);
00150   vtkGetObjectMacro(Controller, vtkMultiProcessController);
00152 
00153 //BTX
00154 
00155   enum Tags {
00156     RENDER_RMI_TAG=12721,
00157     COMPUTE_VISIBLE_PROP_BOUNDS_RMI_TAG=56563,
00158     WIN_INFO_TAG=22134,
00159     REN_INFO_TAG=22135,
00160     BOUNDS_TAG=94135
00161   };
00162 
00164 
00167   virtual void CheckForAbortRender() {}
00168   virtual int CheckForAbortComposite() {return 0;}  
00170 //ETX
00171 
00172 protected:
00173   vtkCompositeManager();
00174   ~vtkCompositeManager();
00175   vtkCompositeManager(const vtkCompositeManager&);
00176   void operator=(const vtkCompositeManager&);
00177   
00178   // A compositing algorithm to be implemented by the subclass.
00179   virtual void CompositeBuffer(int width, int height, int useCharFlag,
00180                                void *pBuf, float *zBuf,
00181                                void *pTmp, float *zTmp) = 0;
00182 
00183   void Composite();
00184   virtual void ComputeVisiblePropBounds(vtkRenderer *ren, float bounds[6]);
00185   void SetRendererSize(int x, int y);
00186   float* MagnifyBuffer(float *localPdata, int windowSize[2]);
00187 
00188   vtkRenderWindow* RenderWindow;
00189   vtkRenderWindowInteractor* RenderWindowInteractor;
00190   vtkMultiProcessController* Controller;
00191 
00192   unsigned long StartInteractorTag;
00193   unsigned long EndInteractorTag;
00194   unsigned long StartTag;
00195   unsigned long EndTag;
00196   unsigned long ResetCameraTag;
00197   unsigned long ResetCameraClippingRangeTag;
00198   int UseChar;
00199   int UseCompositing;
00200   
00201   // Convenience method used internally. It set up the start observer
00202   // and allows the render window's interactor to be set before or after
00203   // the compositer's render window (not exactly true).
00204   void SetRenderWindowInteractor(vtkRenderWindowInteractor *iren);
00205 
00206   // Arrays for compositing.
00207   float *PData;
00208   float *ZData;
00209   int RendererSize[2];
00210 
00211   // Reduction factor (For fast interactive compositing).
00212   int ReductionFactor;
00213   
00214   // This cause me a head ache while trying to debug a lockup.
00215   // I am taking it out in retaliation.  I do not think nested
00216   // RMI's can occur anyway.
00217   // This flag stops nested RMIs from occuring.  Some rmis send and receive information.
00218   // Nesting them can lock up the processes.
00219   int Lock;
00220 
00221   double GetBuffersTime;
00222   double SetBuffersTime;
00223   double CompositeTime;
00224   double MaxRenderTime;
00225 
00226   // Needed to compute the MaxRenderTime.
00227   vtkTimerLog *Timer;
00228 };
00229 
00230 #endif

Generated on Thu Mar 28 14:19:29 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001