diff --git a/Rendering/Core/Testing/Cxx/CMakeLists.txt b/Rendering/Core/Testing/Cxx/CMakeLists.txt index cc567cd65b90b9dc5df26c5d2e670bb7405e2e4a..ca537f63c6e6de70ff6f06e0349220fbfe8a2ada 100644 --- a/Rendering/Core/Testing/Cxx/CMakeLists.txt +++ b/Rendering/Core/Testing/Cxx/CMakeLists.txt @@ -95,6 +95,7 @@ vtk_add_test_cxx(vtkRenderingCoreCxxTests tests TestOffAxisStereo.cxx TestOnAndOffScreenConeCxx.cxx TestOpacity.cxx + TestOpacityMSAA.cxx TestOrderedTriangulator.cxx TestOSConeCxx.cxx TestPickingManager.cxx,NO_VALID diff --git a/Rendering/Core/Testing/Cxx/TestOpacityMSAA.cxx b/Rendering/Core/Testing/Cxx/TestOpacityMSAA.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7c6912cf0a811a86b28c612935d42306cda080c9 --- /dev/null +++ b/Rendering/Core/Testing/Cxx/TestOpacityMSAA.cxx @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen +// SPDX-License-Identifier: BSD-3-Clause + +/**Description + * + */ + +#include "vtkActor.h" +#include "vtkCamera.h" +#include "vtkConeSource.h" +#include "vtkNew.h" +#include "vtkPolyDataMapper.h" +#include "vtkProperty.h" +#include "vtkRegressionTestImage.h" +#include "vtkRenderWindow.h" +#include "vtkRenderWindowInteractor.h" +#include "vtkRenderer.h" +#include "vtkTesting.h" + +int TestOpacityMSAA(int argc, char* argv[]) +{ + cout << "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)" << endl; + + vtkNew<vtkConeSource> c1; + c1->SetResolution(1); + c1->SetCenter(-0.5, 0, 0); + c1->SetRadius(1.3); + vtkNew<vtkPolyDataMapper> m1; + m1->SetInputConnection(c1->GetOutputPort()); + vtkNew<vtkActor> a1; + a1->SetMapper(m1); + + vtkNew<vtkConeSource> c2; + c2->SetResolution(1); + c2->SetCenter(0.5, 0, 0); + c2->SetRadius(1.3); + c2->SetDirection(-1, 0, 0); + vtkNew<vtkPolyDataMapper> m2; + m2->SetInputConnection(c2->GetOutputPort()); + vtkNew<vtkActor> a2; + a2->SetMapper(m2); + a2->GetProperty()->SetOpacity(0.5); + + vtkNew<vtkRenderWindow> renWin; + renWin->SetMultiSamples(8); // enable multisampling + renWin->SetSize(301, 300); // Intentional NPOT size + + vtkNew<vtkRenderer> ren; + ren->AddActor(a1); + ren->AddActor(a2); + renWin->AddRenderer(ren); + ren->ResetCamera(); + ren->GetActiveCamera()->Roll(4); + ren->SetUseOIT(false); // disable OIT pass + + vtkNew<vtkRenderWindowInteractor> iren; + iren->SetRenderWindow(renWin); + + renWin->Render(); + int retVal = vtkRegressionTestImage(renWin); + if (retVal == vtkRegressionTester::DO_INTERACTOR) + { + iren->Start(); + } + + return !retVal; +} diff --git a/Rendering/Core/Testing/Data/Baseline/TestOpacityMSAA.png.sha512 b/Rendering/Core/Testing/Data/Baseline/TestOpacityMSAA.png.sha512 new file mode 100644 index 0000000000000000000000000000000000000000..ee2546e1d19cdb10681c65a9558cc38815a99a08 --- /dev/null +++ b/Rendering/Core/Testing/Data/Baseline/TestOpacityMSAA.png.sha512 @@ -0,0 +1 @@ +b5dce5a56db0d685c638e3383536bcbb1cbf0b71040989c7fad040f221f4527f761d7cd22c7e4dd63aaf368cc236e366d37c4832b07f59f50b6928d223f7da9e