LyShinePassDataBus.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0 OR MIT
  5. *
  6. */
  7. #pragma once
  8. #include <AzCore/Memory/SystemAllocator.h>
  9. #include <AzCore/std/containers/vector.h>
  10. #include <AtomCore/Instance/Instance.h>
  11. #include <Atom/RPI.Public/Base.h>
  12. namespace AZ
  13. {
  14. namespace RPI
  15. {
  16. class AttachmentImage;
  17. class RasterPass;
  18. }
  19. }
  20. namespace LyShine
  21. {
  22. using AttachmentImages = AZStd::vector<AZ::Data::Instance<AZ::RPI::AttachmentImage>>;
  23. using AttachmentImageAndDependentsPair = AZStd::pair<AZ::Data::Instance<AZ::RPI::AttachmentImage>, AttachmentImages>;
  24. using AttachmentImagesAndDependencies = AZStd::vector<AttachmentImageAndDependentsPair>;
  25. }
  26. class LyShinePassRequests
  27. : public AZ::EBusTraits
  28. {
  29. public:
  30. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  31. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
  32. using BusIdType = AZ::RPI::SceneId;
  33. //! Called when the number of render targets has changed and the LyShine pass needs to rebuild
  34. virtual void RebuildRttChildren() = 0;
  35. //! Returns a render to texture pass based on render target name
  36. virtual AZ::RPI::RasterPass* GetRttPass(const AZStd::string& name) = 0;
  37. //! Returns the final pass that renders the UI canvas contents
  38. virtual AZ::RPI::RasterPass* GetUiCanvasPass() = 0;
  39. };
  40. using LyShinePassRequestBus = AZ::EBus<LyShinePassRequests>;
  41. class LyShinePassDataRequests
  42. : public AZ::EBusTraits
  43. {
  44. public:
  45. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  46. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
  47. using BusIdType = AZ::RPI::SceneId;
  48. //! Get a list of render targets that require a render to texture pass, and any
  49. //! other render targets that are drawn on them
  50. virtual LyShine::AttachmentImagesAndDependencies GetRenderTargets() = 0;
  51. };
  52. using LyShinePassDataRequestBus = AZ::EBus<LyShinePassDataRequests>;