/*========================================================================= Program: Visualization Toolkit Module: TestOSPRayOrthographic.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 test verifies that we can switch between scivis and pathtracer modes // // The command line arguments are: // -I => run in interactive mode; unless this is used, the program will // not allow interaction and exit // In interactive mode it responds to the keys listed // vtkOSPRayTestInteractor.h #include "vtkTestUtilities.h" #include "vtkActor.h" #include "vtkCamera.h" #include "vtkOpenGLRenderer.h" #include "vtkOSPRayPass.h" #include "vtkOSPRayRendererNode.h" #include "vtkPolyDataMapper.h" #include "vtkPolyDataNormals.h" #include "vtkPLYReader.h" #include "vtkRenderer.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkSmartPointer.h" #include "vtkOSPRayTestInteractor.h" int TestOSPRayOrthographic(int argc, char* argv[]) { vtkSmartPointer iren = vtkSmartPointer::New(); vtkSmartPointer renWin = vtkSmartPointer::New(); iren->SetRenderWindow(renWin); vtkSmartPointer renderer = vtkSmartPointer::New(); renWin->AddRenderer(renderer); const char* fileName = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/bunny.ply"); vtkSmartPointer polysource = vtkSmartPointer::New(); polysource->SetFileName(fileName); //TODO: ospray acts strangely without these such that Diff and Spec are not 0..255 instead of 0..1 vtkSmartPointer normals = vtkSmartPointer::New(); normals->SetInputConnection(polysource->GetOutputPort()); //normals->ComputePointNormalsOn(); //normals->ComputeCellNormalsOff(); vtkSmartPointer mapper=vtkSmartPointer::New(); mapper->SetInputConnection(normals->GetOutputPort()); vtkSmartPointer actor=vtkSmartPointer::New(); renderer->AddActor(actor); actor->SetMapper(mapper); renderer->SetBackground(0.1,0.1,1.0); renWin->SetSize(400,400); renWin->Render(); vtkSmartPointer ospray=vtkSmartPointer::New(); renderer->SetPass(ospray); vtkCamera *camera = renderer->GetActiveCamera(); camera->SetParallelProjection(1); renWin->Render(); vtkSmartPointer style = vtkSmartPointer::New(); style->SetPipelineControlPoints(renderer, ospray, nullptr); iren->SetInteractorStyle(style); style->SetCurrentRenderer(renderer); iren->Start(); return 0; }