VTK  9.3.20240419
vtkSynchronizedRenderWindows.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
15 #ifndef vtkSynchronizedRenderWindows_h
16 #define vtkSynchronizedRenderWindows_h
17 
18 #include "vtkObject.h"
19 #include "vtkRenderingParallelModule.h" // For export macro
20 
21 VTK_ABI_NAMESPACE_BEGIN
22 class vtkRenderWindow;
24 class vtkCommand;
26 
27 class VTKRENDERINGPARALLEL_EXPORT vtkSynchronizedRenderWindows : public vtkObject
28 {
29 public:
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
35 
41  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
43 
45 
50  vtkGetObjectMacro(ParallelController, vtkMultiProcessController);
52 
54 
64  void SetIdentifier(unsigned int id);
65  vtkGetMacro(Identifier, unsigned int);
67 
69 
74  vtkSetMacro(ParallelRendering, bool);
75  vtkGetMacro(ParallelRendering, bool);
76  vtkBooleanMacro(ParallelRendering, bool);
78 
79  // Turns on/off render event propagation. When on (the default) and
80  // ParallelRendering is on, process 0 will send an RMI call to all remote
81  // processes to perform a synchronized render. When off, render must be
82  // manually called on each process.
83  vtkSetMacro(RenderEventPropagation, bool);
84  vtkGetMacro(RenderEventPropagation, bool);
85  vtkBooleanMacro(RenderEventPropagation, bool);
86 
91  virtual void AbortRender();
92 
94 
99  vtkSetMacro(RootProcessId, int);
100  vtkGetMacro(RootProcessId, int);
102 
103  enum
104  {
105  SYNC_RENDER_TAG = 15001,
106  };
107 
108 protected:
111 
113  {
114  int WindowSize[2];
115  int TileScale[2];
116  double TileViewport[4];
118 
119  // Save/restore the struct to/from a stream.
124  };
125 
126  // These methods are called on all processes as a consequence of corresponding
127  // events being called on the render window.
128  virtual void HandleStartRender();
129  virtual void HandleEndRender() {}
130  virtual void HandleAbortRender() {}
131 
132  virtual void MasterStartRender();
133  virtual void SlaveStartRender();
134 
135  unsigned int Identifier;
139 
142 
143 private:
145  void operator=(const vtkSynchronizedRenderWindows&) = delete;
146 
147  class vtkObserver;
148  vtkObserver* Observer;
149  friend class vtkObserver;
150 };
151 
152 VTK_ABI_NAMESPACE_END
153 #endif
superclass for callback/observer methods
Definition: vtkCommand.h:384
a simple class to control print indentation
Definition: vtkIndent.h:108
Multiprocessing communication superclass.
stream used to pass data across processes using vtkMultiProcessController.
abstract base class for most VTK objects
Definition: vtkObject.h:162
create a window for renderers to draw into
synchronizes render windows across processes.
vtkMultiProcessController * ParallelController
virtual void AbortRender()
This method call be called while a render is in progress to abort the rendering.
static vtkSynchronizedRenderWindows * New()
~vtkSynchronizedRenderWindows() override
virtual void MasterStartRender()
virtual void HandleStartRender()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SlaveStartRender()
void SetParallelController(vtkMultiProcessController *)
Set the parallel message communicator.
void SetIdentifier(unsigned int id)
It's acceptable to have multiple instances on vtkSynchronizedRenderWindows on each processes to synch...
void SetRenderWindow(vtkRenderWindow *)
Set the render window to be synchronized by this vtkSynchronizedRenderWindows instance.
bool Restore(vtkMultiProcessStream &stream)
void Save(vtkMultiProcessStream &stream)