/*========================================================================= Program: Visualization Toolkit Module: TestPBRIrradianceHDR.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. =========================================================================*/ #include "vtkActor.h" #include "vtkCamera.h" #include "vtkHDRReader.h" #include "vtkOpenGLRenderer.h" #include "vtkPBRIrradianceTexture.h" #include "vtkPolyDataMapper.h" #include "vtkProperty.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkSphereSource.h" #include "vtkTestUtilities.h" #include "vtkTexture.h" int TestPBRIrradianceHDR(int argc, char* argv[]) { vtkNew renWin; renWin->SetSize(300, 300); vtkNew iren; iren->SetRenderWindow(renWin); vtkNew renderer; renderer->UseSphericalHarmonicsOn(); renderer->UseImageBasedLightingOn(); renWin->AddRenderer(renderer); vtkNew reader; char* fileName = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/spiaggia_di_mondello_1k.hdr"); reader->SetFileName(fileName); delete[] fileName; vtkNew texture; texture->SetColorModeToDirectScalars(); texture->MipmapOn(); texture->InterpolateOn(); texture->SetInputConnection(reader->GetOutputPort()); renderer->SetEnvironmentTexture(texture); vtkNew sphere; sphere->SetThetaResolution(30); sphere->SetPhiResolution(30); vtkNew mapper; mapper->SetInputConnection(sphere->GetOutputPort()); vtkNew actor; actor->GetProperty()->SetInterpolationToPBR(); actor->GetProperty()->SetRoughness(0.0); actor->GetProperty()->SetColor(0.7, 0.0, 0.2); actor->SetMapper(mapper); renderer->AddActor(actor); renWin->Render(); renderer->GetActiveCamera()->Zoom(1.6); iren->Start(); return 0; }