This function sets up properties common to both processes and executes the task corresponding to the current process
| 20 | // This function sets up properties common to both processes |
| 21 | // and executes the task corresponding to the current process |
| 22 | void process(vtkMultiProcessController* controller, void* vtkNotUsed(arg)) |
| 23 | { |
| 24 | taskFunction task; |
| 25 | int myId = controller->GetLocalProcessId(); |
| 26 | |
| 27 | // Chose the appropriate task (see task1.cxx and task2.cxx) |
| 28 | if (myId == 0) |
| 29 | { |
| 30 | task = task1; |
| 31 | } |
| 32 | else |
| 33 | { |
| 34 | task = task2; |
| 35 | } |
| 36 | |
| 37 | // Setup camera |
| 38 | vtkCamera* cam = vtkCamera::New(); |
| 39 | cam->SetPosition(-0.6105, 1.467, -6.879); |
| 40 | cam->SetFocalPoint(-0.0617558, 0.127043, 0); |
| 41 | cam->SetViewUp(-0.02, 0.98, 0.193); |
| 42 | cam->SetClippingRange(3.36, 11.67); |
| 43 | cam->Dolly(0.8); |
| 44 | |
| 45 | // Create the render objects |
| 46 | vtkRenderWindow* renWin = vtkRenderWindow::New(); |
| 47 | renWin->SetSize(WINDOW_WIDTH, WINDOW_HEIGHT); |
| 48 | |
| 49 | vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New(); |
| 50 | iren->SetRenderWindow(renWin); |
| 51 | |
| 52 | // This class allows all processes to composite their images. |
| 53 | // The root process then displays it in it's render window. |
| 54 | vtkCompositeRenderManager* tc = vtkCompositeRenderManager::New(); |
| 55 | tc->SetRenderWindow(renWin); |
| 56 | |
| 57 | // Generate the pipeline see task1.cxx and task2.cxx) |
| 58 | vtkPolyDataMapper* mapper = (*task)(renWin, EXTENT, cam); |
| 59 | |
| 60 | // Only the root process will have an active interactor. All |
| 61 | // the other render windows will be slaved to the root. |
| 62 | tc->StartInteractor(); |
| 63 | |
| 64 | // Clean-up |
| 65 | iren->Delete(); |
| 66 | if (mapper) |
| 67 | { |
| 68 | mapper->Delete(); |
| 69 | } |
| 70 | renWin->Delete(); |
| 71 | cam->Delete(); |
| 72 | } |
| 73 | |
| 74 | int main(int argc, char* argv[]) |
| 75 | { |
nothing calls this directly
no test coverage detected