From 9bb5b5b0ea484f9ced3b44e61e5ef363ae24493c Mon Sep 17 00:00:00 2001 From: Sankhesh Jhaveri <sankhesh.jhaveri@kitware.com> Date: Mon, 5 Jul 2021 09:39:39 -0400 Subject: [PATCH] Add test for FXAA with EDL --- Rendering/OpenGL2/Testing/Cxx/CMakeLists.txt | 5 +- .../Testing/Cxx/TestFXAAWithEDLPass.cxx | 66 +++++++++++++++++++ .../Baseline/TestFXAAWithEDLPass.png.sha512 | 1 + 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 Rendering/OpenGL2/Testing/Cxx/TestFXAAWithEDLPass.cxx create mode 100644 Rendering/OpenGL2/Testing/Data/Baseline/TestFXAAWithEDLPass.png.sha512 diff --git a/Rendering/OpenGL2/Testing/Cxx/CMakeLists.txt b/Rendering/OpenGL2/Testing/Cxx/CMakeLists.txt index 250d0c9d51a..e44b66e603c 100644 --- a/Rendering/OpenGL2/Testing/Cxx/CMakeLists.txt +++ b/Rendering/OpenGL2/Testing/Cxx/CMakeLists.txt @@ -33,12 +33,13 @@ vtk_add_test_cxx(vtkRenderingOpenGL2CxxTests tests TestDepthPeelingPassViewport.cxx TestEDLPass.cxx TestEquirectangularToCubeMap.cxx + TestFXAAFilter.cxx + TestFXAAPass.cxx + TestFXAAWithEDLPass.cxx TestFloor.cxx TestFluidMapper.cxx TestFramebufferHDR.cxx TestFramebufferPass.cxx - TestFXAAFilter.cxx - TestFXAAPass.cxx TestGaussianBlurPass.cxx TestGlyph3DMapperCellPicking.cxx TestGlyph3DMapperCulling.cxx diff --git a/Rendering/OpenGL2/Testing/Cxx/TestFXAAWithEDLPass.cxx b/Rendering/OpenGL2/Testing/Cxx/TestFXAAWithEDLPass.cxx new file mode 100644 index 00000000000..c29c88635af --- /dev/null +++ b/Rendering/OpenGL2/Testing/Cxx/TestFXAAWithEDLPass.cxx @@ -0,0 +1,66 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: TestFXAAWithEDLPass.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. + +=========================================================================*/ + +// Description +// Test FXAA with EDL pass + +#include "vtkActor.h" +#include "vtkCamera.h" +#include "vtkCylinderSource.h" +#include "vtkEDLShading.h" +#include "vtkNew.h" +#include "vtkOpenGLFXAAPass.h" +#include "vtkPolyDataMapper.h" +#include "vtkRenderStepsPass.h" +#include "vtkRenderWindow.h" +#include "vtkRenderWindowInteractor.h" +#include "vtkRenderer.h" +#include "vtkTesting.h" + +int TestFXAAWithEDLPass(int argc, char* argv[]) +{ + cout << "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)" << endl; + + vtkNew<vtkCylinderSource> cylinder; + vtkNew<vtkPolyDataMapper> mapper; + mapper->SetInputConnection(cylinder->GetOutputPort()); + vtkNew<vtkActor> actor; + actor->SetMapper(mapper); + + vtkNew<vtkRenderer> ren; + ren->SetBackground(1.0, 1.0, 1.0); + ren->AddActor(actor); + vtkNew<vtkRenderWindow> renWin; + renWin->SetMultiSamples(0); + renWin->AddRenderer(ren); + vtkNew<vtkRenderWindowInteractor> iren; + iren->SetRenderWindow(renWin); + + vtkNew<vtkRenderStepsPass> basicPasses; + vtkNew<vtkEDLShading> edl; + edl->SetDelegatePass(basicPasses); + vtkNew<vtkOpenGLFXAAPass> fxaa; + fxaa->SetDelegatePass(edl); + ren->SetPass(fxaa); + + ren->ResetCamera(); + auto cam = ren->GetActiveCamera(); + cam->SetViewUp(-0.45365, 0.78693, -0.418262); + cam->SetPosition(-0.388464, 0.574701, 0.0925649); + cam->SetFocalPoint(-0.50418, 0.453051, -0.0108049); + ren->ResetCameraClippingRange(); + + return vtkTesting::InteractorEventLoop(argc, argv, iren, nullptr); +} diff --git a/Rendering/OpenGL2/Testing/Data/Baseline/TestFXAAWithEDLPass.png.sha512 b/Rendering/OpenGL2/Testing/Data/Baseline/TestFXAAWithEDLPass.png.sha512 new file mode 100644 index 00000000000..9d6d503e4de --- /dev/null +++ b/Rendering/OpenGL2/Testing/Data/Baseline/TestFXAAWithEDLPass.png.sha512 @@ -0,0 +1 @@ +cc064ca059d2d81b7e182755d20b6cea6c8a186ab120adb7d218430443990b450faef175f1d008a00cd5cd51a0ea0cc65887a97936202bfc5136620b606f51bd -- GitLab