DiffuseProbeGridRenderPass.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #pragma once
  9. #include <Atom/RHI.Reflect/Size.h>
  10. #include <Atom/RPI.Public/Pass/RasterPass.h>
  11. namespace AZ
  12. {
  13. namespace Render
  14. {
  15. class DiffuseProbeGrid;
  16. //! This pass renders the diffuse global illumination in the area covered by
  17. //! each DiffuseProbeGrid.
  18. class DiffuseProbeGridRenderPass final
  19. : public RPI::RasterPass
  20. {
  21. using Base = RPI::RasterPass;
  22. AZ_RPI_PASS(DiffuseProbeGridRenderPass);
  23. public:
  24. AZ_RTTI(DiffuseProbeGridRenderPass, "{33F79A39-2DB3-46FC-8BA1-9E43E222C322}", Base);
  25. AZ_CLASS_ALLOCATOR(DiffuseProbeGridRenderPass, SystemAllocator);
  26. ~DiffuseProbeGridRenderPass() = default;
  27. static RPI::Ptr<DiffuseProbeGridRenderPass> Create(const RPI::PassDescriptor& descriptor);
  28. private:
  29. DiffuseProbeGridRenderPass() = delete;
  30. explicit DiffuseProbeGridRenderPass(const RPI::PassDescriptor& descriptor);
  31. // Pass behavior overrides...
  32. bool IsEnabled() const override;
  33. void FrameBeginInternal(FramePrepareParams params) override;
  34. // Scope producer functions...
  35. void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
  36. void CompileResources(const RHI::FrameGraphCompileContext& context) override;
  37. // helper function to determine if a DiffuseProbeGrid should be rendered based on its state
  38. bool ShouldRender(const AZStd::shared_ptr<DiffuseProbeGrid>& diffuseProbeGrid);
  39. Data::Instance<RPI::Shader> m_shader;
  40. RHI::Ptr<RHI::ShaderResourceGroupLayout> m_srgLayout;
  41. };
  42. } // namespace Render
  43. } // namespace AZ