VTK: Rendering/Parallel/vtkSynchronizedRenderWindows.h Source File

| VTK 9.3.1

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;
23 class vtkMultiProcessController;
24 class vtkCommand;
25 class vtkMultiProcessStream;
26
27 class VTKRENDERINGPARALLEL_EXPORT vtkSynchronizedRenderWindows : public vtkObject
28 {
29 public:
30 static vtkSynchronizedRenderWindows* New();
31 vtkTypeMacro(vtkSynchronizedRenderWindows, vtkObject);
32 void PrintSelf(ostream& os, vtkIndent indent) override;
33
35
40 void SetRenderWindow(vtkRenderWindow*);
41 vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
43
45
49 void SetParallelController(vtkMultiProcessController*);
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:
109 vtkSynchronizedRenderWindows();
110 ~vtkSynchronizedRenderWindows() override;
111
112 struct RenderWindowInfo
113 {
114 int WindowSize[2];
115 int TileScale[2];
116 double TileViewport[4];
117 double DesiredUpdateRate;
118
119 // Save/restore the struct to/from a stream.
120 void Save(vtkMultiProcessStream& stream);
121 bool Restore(vtkMultiProcessStream& stream);
122 void CopyFrom(vtkRenderWindow*);
123 void CopyTo(vtkRenderWindow*);
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;
136 bool ParallelRendering;
137 bool RenderEventPropagation;
138 int RootProcessId;
139
140 vtkRenderWindow* RenderWindow;
141 vtkMultiProcessController* ParallelController;
142
143 private:
144 vtkSynchronizedRenderWindows(const vtkSynchronizedRenderWindows&) = delete;
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
vtkCommand
superclass for callback/observer methods
Definition: vtkCommand.h:384
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:72
vtkMultiProcessStream
stream used to pass data across processes using vtkMultiProcessController.
Definition: vtkMultiProcessStream.h:30
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:95
vtkSynchronizedRenderWindows
synchronizes render windows across processes.
Definition: vtkSynchronizedRenderWindows.h:28
vtkSynchronizedRenderWindows::ParallelController
vtkMultiProcessController * ParallelController
Definition: vtkSynchronizedRenderWindows.h:141
vtkSynchronizedRenderWindows::vtkSynchronizedRenderWindows
vtkSynchronizedRenderWindows()
vtkSynchronizedRenderWindows::AbortRender
virtual void AbortRender()
This method call be called while a render is in progress to abort the rendering.
vtkSynchronizedRenderWindows::New
static vtkSynchronizedRenderWindows * New()
vtkSynchronizedRenderWindows::~vtkSynchronizedRenderWindows
~vtkSynchronizedRenderWindows() override
vtkSynchronizedRenderWindows::RenderWindow
vtkRenderWindow * RenderWindow
Definition: vtkSynchronizedRenderWindows.h:140
vtkSynchronizedRenderWindows::HandleAbortRender
virtual void HandleAbortRender()
Definition: vtkSynchronizedRenderWindows.h:130
vtkSynchronizedRenderWindows::MasterStartRender
virtual void MasterStartRender()
vtkSynchronizedRenderWindows::RenderEventPropagation
bool RenderEventPropagation
Definition: vtkSynchronizedRenderWindows.h:137
vtkSynchronizedRenderWindows::HandleStartRender
virtual void HandleStartRender()
vtkSynchronizedRenderWindows::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSynchronizedRenderWindows::SlaveStartRender
virtual void SlaveStartRender()
vtkSynchronizedRenderWindows::SetParallelController
void SetParallelController(vtkMultiProcessController *)
Set the parallel message communicator.
vtkSynchronizedRenderWindows::RootProcessId
int RootProcessId
Definition: vtkSynchronizedRenderWindows.h:138
vtkSynchronizedRenderWindows::SetIdentifier
void SetIdentifier(unsigned int id)
It's acceptable to have multiple instances on vtkSynchronizedRenderWindows on each processes to synch...
vtkSynchronizedRenderWindows::ParallelRendering
bool ParallelRendering
Definition: vtkSynchronizedRenderWindows.h:136
vtkSynchronizedRenderWindows::HandleEndRender
virtual void HandleEndRender()
Definition: vtkSynchronizedRenderWindows.h:129
vtkSynchronizedRenderWindows::Identifier
unsigned int Identifier
Definition: vtkSynchronizedRenderWindows.h:135
vtkSynchronizedRenderWindows::SetRenderWindow
void SetRenderWindow(vtkRenderWindow *)
Set the render window to be synchronized by this vtkSynchronizedRenderWindows instance.
vtkSynchronizedRenderWindows::RenderWindowInfo
Definition: vtkSynchronizedRenderWindows.h:113
vtkSynchronizedRenderWindows::RenderWindowInfo::DesiredUpdateRate
double DesiredUpdateRate
Definition: vtkSynchronizedRenderWindows.h:117
vtkSynchronizedRenderWindows::RenderWindowInfo::Restore
bool Restore(vtkMultiProcessStream &stream)
vtkSynchronizedRenderWindows::RenderWindowInfo::CopyFrom
void CopyFrom(vtkRenderWindow *)
vtkSynchronizedRenderWindows::RenderWindowInfo::Save
void Save(vtkMultiProcessStream &stream)
vtkSynchronizedRenderWindows::RenderWindowInfo::CopyTo
void CopyTo(vtkRenderWindow *)
vtkObject.h