VTK
vtkSynchronizedRenderWindows.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: $RCSfile$
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
26 #ifndef __vtkSynchronizedRenderWindows_h
27 #define __vtkSynchronizedRenderWindows_h
28 
29 #include "vtkObject.h"
30 
31 class vtkRenderWindow;
33 class vtkCommand;
35 
37 {
38 public:
41  void PrintSelf(ostream& os, vtkIndent indent);
42 
44 
47  void SetRenderWindow(vtkRenderWindow*);
48  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
50 
52 
54  void SetParallelController(vtkMultiProcessController*);
55  vtkGetObjectMacro(ParallelController, vtkMultiProcessController);
57 
59 
68  void SetIdentifier(unsigned int id);
69  vtkGetMacro(Identifier, unsigned int);
71 
73 
76  vtkSetMacro(ParallelRendering, bool);
77  vtkGetMacro(ParallelRendering, bool);
78  vtkBooleanMacro(ParallelRendering, bool);
80 
81  // Turns on/off render event propagation. When on (the default) and
82  // ParallelRendering is on, process 0 will send an RMI call to all remote
83  // processes to perform a synchronized render. When off, render must be
84  // manually called on each process.
85  vtkSetMacro(RenderEventPropagation, bool);
86  vtkGetMacro(RenderEventPropagation, bool);
87  vtkBooleanMacro(RenderEventPropagation, bool);
88 
91  virtual void AbortRender();
92 
94 
98  vtkSetMacro(RootProcessId, int);
99  vtkGetMacro(RootProcessId, int);
101 
102 //BTX
103  enum
104  {
105  SYNC_RENDER_TAG = 15001,
106  };
107 protected:
110 
112  {
113  int WindowSize[2];
114  int TileScale[2];
115  double TileViewport[4];
117 
118  // Save/restore the struct to/from a stream.
119  void Save(vtkMultiProcessStream& stream);
120  bool Restore(vtkMultiProcessStream& stream);
121  void CopyFrom(vtkRenderWindow*);
122  void CopyTo(vtkRenderWindow*);
123  };
124 
125  // These methods are called on all processes as a consequence of corresponding
126  // events being called on the render window.
127  virtual void HandleStartRender();
128  virtual void HandleEndRender() {}
129  virtual void HandleAbortRender() {}
130 
131  virtual void MasterStartRender();
132  virtual void SlaveStartRender();
133 
134  unsigned int Identifier;
138 
141 
142 private:
144  void operator=(const vtkSynchronizedRenderWindows&); // Not implemented.
145 
146  class vtkObserver;
147  vtkObserver* Observer;
148  friend class vtkObserver;
149 //ETX
150 };
151 
152 #endif
153 
154