// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen // SPDX-License-Identifier: BSD-3-Clause #include "vtkActor.h" #include "vtkCamera.h" #include "vtkCellArray.h" #include "vtkInteractorStyleTrackballCamera.h" #include "vtkNew.h" #include "vtkPolyData.h" #include "vtkPolyDataMapper.h" #include "vtkProperty.h" #include "vtkRegressionTestImage.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkRenderer.h" int TestVertexRendering(int argc, char* argv[]) { vtkNew renWin; renWin->SetWindowName(__func__); renWin->SetMultiSamples(0); vtkNew renderer; renWin->AddRenderer(renderer); // create a sequence of points vtkNew polydata; vtkNew points; points->InsertPoint(0, -1, -1, 0); points->InsertPoint(1, 0, 1.5, 0); points->InsertPoint(2, 1, -1, 0); points->InsertPoint(3, -2, -2, 0); points->InsertPoint(4, 0, 2.5, 0); points->InsertPoint(5, 2, -2, 0); points->InsertPoint(6, -3, -3, 0); points->InsertPoint(7, 0, 3.5, 0); points->InsertPoint(8, 3, -3, 0); points->InsertPoint(9, -4, -4, 0); points->InsertPoint(10, 0, 4.5, 0); points->InsertPoint(11, 4, -4, 0); polydata->SetPoints(points); vtkNew verts; verts->InsertNextCell({ 0 }); verts->InsertNextCell({ 1 }); verts->InsertNextCell({ 2 }); verts->InsertNextCell({ 3, 4, 5 }); verts->InsertNextCell({ 6, 7, 8, 11, 10, 9 }); polydata->SetVerts(verts); vtkNew mapper; mapper->DebugOn(); mapper->SetInputData(polydata); vtkNew actor; actor->GetProperty()->SetPointSize(6); actor->SetMapper(mapper); renderer->AddActor(actor); renderer->ResetCamera(); renderer->SetBackground(0.2, 0.3, 0.4); vtkNew iren; iren->SetRenderWindow(renWin); vtkNew style; iren->SetInteractorStyle(style); style->SetDefaultRenderer(renderer); renWin->Render(); const int retVal = vtkRegressionTestImage(renWin); if (retVal == vtkRegressionTester::DO_INTERACTOR) { iren->Start(); } return !retVal; }