/*========================================================================= Program: Visualization Toolkit Module: TestCameraWidget.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. =========================================================================*/ // // This example tests the vtkCameraWidget. // First include the required header files for the VTK classes we are using. #include "vtkSmartPointer.h" #include "vtkCameraWidget.h" #include "vtkCameraRepresentation.h" #include "vtkSphereSource.h" #include "vtkPolyDataMapper.h" #include "vtkActor.h" #include "vtkRenderer.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkCommand.h" #include "vtkTesting.h" int TestCameraWidget(int argc, char *argv[]) { // Create the RenderWindow, Renderer and both Actors // vtkSmartPointer ren1 = vtkSmartPointer::New(); vtkSmartPointer renWin = vtkSmartPointer::New(); renWin->AddRenderer(ren1); vtkSmartPointer iren = vtkSmartPointer::New(); iren->SetRenderWindow(renWin); // Create a test pipeline // vtkSmartPointer ss = vtkSmartPointer::New(); vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(ss->GetOutputPort()); vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); // Create the widget vtkSmartPointer rep = vtkSmartPointer::New(); rep->SetNumberOfFrames(2400); vtkSmartPointer widget = vtkSmartPointer::New(); widget->SetInteractor(iren); widget->SetRepresentation(rep); // Add the actors to the renderer, set the background and size // ren1->AddActor(actor); ren1->SetBackground(0.1, 0.2, 0.4); renWin->SetSize(300, 300); // render the image // iren->Initialize(); renWin->Render(); rep->SetCamera(ren1->GetActiveCamera()); widget->On(); int retVal = vtkTesting::InteractorEventLoop( argc, argv, iren); return retVal; }