DiffuseProbeGridVisualizationCompositePass.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Atom/RPI.Public/RenderPipeline.h>
  9. #include <DiffuseProbeGrid_Traits_Platform.h>
  10. #include <Render/DiffuseProbeGridVisualizationCompositePass.h>
  11. #include <Render/DiffuseProbeGridFeatureProcessor.h>
  12. namespace AZ
  13. {
  14. namespace Render
  15. {
  16. RPI::Ptr<DiffuseProbeGridVisualizationCompositePass> DiffuseProbeGridVisualizationCompositePass::Create(const RPI::PassDescriptor& descriptor)
  17. {
  18. RPI::Ptr<DiffuseProbeGridVisualizationCompositePass> pass = aznew DiffuseProbeGridVisualizationCompositePass(descriptor);
  19. return AZStd::move(pass);
  20. }
  21. DiffuseProbeGridVisualizationCompositePass::DiffuseProbeGridVisualizationCompositePass(const RPI::PassDescriptor& descriptor)
  22. : RPI::FullscreenTrianglePass(descriptor)
  23. {
  24. if (!AZ_TRAIT_DIFFUSE_GI_PASSES_SUPPORTED)
  25. {
  26. SetEnabled(false);
  27. }
  28. }
  29. bool DiffuseProbeGridVisualizationCompositePass::IsEnabled() const
  30. {
  31. if (!FullscreenTrianglePass::IsEnabled())
  32. {
  33. return false;
  34. }
  35. RPI::Scene* scene = m_pipeline->GetScene();
  36. if (!scene)
  37. {
  38. return false;
  39. }
  40. DiffuseProbeGridFeatureProcessor* diffuseProbeGridFeatureProcessor = scene->GetFeatureProcessor<DiffuseProbeGridFeatureProcessor>();
  41. if (diffuseProbeGridFeatureProcessor)
  42. {
  43. for (auto& diffuseProbeGrid : diffuseProbeGridFeatureProcessor->GetVisibleProbeGrids())
  44. {
  45. if (diffuseProbeGrid->GetVisualizationEnabled())
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. } // namespace RPI
  54. } // namespace AZ