/*========================================================================= Program: Visualization Toolkit Module: TestPLYReaderIntensity.cxx Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME Test of vtkPLYReaderIntensity // .SECTION Description // #include "vtkSmartPointer.h" #include "vtkDebugLeaks.h" #include "vtkPLYReader.h" #include "vtkActor.h" #include "vtkCamera.h" #include "vtkPolyDataMapper.h" #include "vtkRegressionTestImage.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkRenderer.h" #include "vtkTestUtilities.h" #include "vtkWindowToImageFilter.h" int TestPLYReaderIntensity(int argc, char* argv[]) { // Read file name. const char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/Armadillo.ply"); // Test if the reader thinks it can open the file. int canRead = vtkPLYReader::CanReadFile(fname); (void)canRead; // Create the reader. vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName(fname); delete[] fname; // Create a mapper. vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(reader->GetOutputPort()); mapper->ScalarVisibilityOff(); // Create the actor. vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); // Basic visualisation. vtkSmartPointer renWin = vtkSmartPointer::New(); vtkSmartPointer ren = vtkSmartPointer::New(); renWin->AddRenderer(ren); vtkSmartPointer iren = vtkSmartPointer::New(); iren->SetRenderWindow(renWin); ren->AddActor(actor); ren->SetBackground(.2, .3, .5); ren->ResetCamera(); ren->GetActiveCamera()->Azimuth(210); ren->GetActiveCamera()->Elevation(30); renWin->SetSize(300, 300); // interact with data renWin->Render(); int retVal = vtkRegressionTestImage(renWin); if (retVal == vtkRegressionTester::DO_INTERACTOR) { iren->Start(); } return !retVal; }