DiffuseProbeGridDownsamplePass.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 "DiffuseProbeGridDownsamplePass.h"
  9. #include <Render/DiffuseProbeGridFeatureProcessor.h>
  10. #include <Atom/RPI.Public/RenderPipeline.h>
  11. namespace AZ
  12. {
  13. namespace Render
  14. {
  15. RPI::Ptr<DiffuseProbeGridDownsamplePass> DiffuseProbeGridDownsamplePass::Create(const RPI::PassDescriptor& descriptor)
  16. {
  17. RPI::Ptr<DiffuseProbeGridDownsamplePass> pass = aznew DiffuseProbeGridDownsamplePass(descriptor);
  18. return AZStd::move(pass);
  19. }
  20. DiffuseProbeGridDownsamplePass::DiffuseProbeGridDownsamplePass(const RPI::PassDescriptor& descriptor)
  21. : RPI::FullscreenTrianglePass(descriptor)
  22. {
  23. }
  24. bool DiffuseProbeGridDownsamplePass::IsEnabled() const
  25. {
  26. if (!Base::IsEnabled())
  27. {
  28. return false;
  29. }
  30. RPI::Scene* scene = m_pipeline->GetScene();
  31. if (!scene)
  32. {
  33. return false;
  34. }
  35. // only enabled if there are DiffuseProbeGrids present in the scene
  36. DiffuseProbeGridFeatureProcessor* diffuseProbeGridFeatureProcessor = scene->GetFeatureProcessor<DiffuseProbeGridFeatureProcessor>();
  37. return (diffuseProbeGridFeatureProcessor && !diffuseProbeGridFeatureProcessor->GetProbeGrids().empty());
  38. }
  39. } // namespace RPI
  40. } // namespace AZ