AtomBridgeSystemComponent.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 <AzCore/std/containers/map.h>
  10. #include <AzCore/std/containers/unordered_map.h>
  11. #include <AzCore/std/smart_ptr/shared_ptr.h>
  12. #include <AzCore/Component/Component.h>
  13. #include <AzFramework/Render/RenderSystemBus.h>
  14. #include <AzFramework/Components/DeprecatedComponentsBus.h>
  15. #include <AtomBridge/AtomBridgeBus.h>
  16. #include <Atom/RPI.Public/View.h>
  17. #include <Atom/RPI.Public/Shader/ShaderResourceGroup.h>
  18. #include <Atom/RPI.Public/ViewportContextBus.h>
  19. #include <Atom/Bootstrap/BootstrapNotificationBus.h>
  20. namespace AZ
  21. {
  22. namespace AtomBridge
  23. {
  24. // forward declares
  25. class AtomDebugDisplayViewportInterface;
  26. class PerViewportDynamicDrawManager;
  27. class AtomBridgeSystemComponent
  28. : public Component
  29. , public AzFramework::Render::RenderSystemRequestBus::Handler
  30. , public AzFramework::Components::DeprecatedComponentsRequestBus::Handler
  31. , public Render::Bootstrap::NotificationBus::Handler
  32. , protected AtomBridgeRequestBus::Handler
  33. , public AZ::RPI::ViewportContextManagerNotificationsBus::Handler
  34. {
  35. public:
  36. AZ_COMPONENT(AtomBridgeSystemComponent, "{FFB99CE4-2C9E-476D-8140-50A8A696E242}");
  37. static void Reflect(ReflectContext* context);
  38. AtomBridgeSystemComponent();
  39. ~AtomBridgeSystemComponent() override;
  40. static void GetProvidedServices(ComponentDescriptor::DependencyArrayType& provided);
  41. static void GetIncompatibleServices(ComponentDescriptor::DependencyArrayType& incompatible);
  42. static void GetRequiredServices(ComponentDescriptor::DependencyArrayType& required);
  43. static void GetDependentServices(ComponentDescriptor::DependencyArrayType& dependent);
  44. protected:
  45. // Component overrides ...
  46. void Init() override;
  47. void Activate() override;
  48. void Deactivate() override;
  49. // AzFramework::Render::RenderSystemRequestBus::Handler overrides ...
  50. AZStd::string GetRendererName() const override;
  51. // AzFramework::Components::DeprecatedComponentsRequestBus::Handler overrides ...
  52. void EnumerateDeprecatedComponents(AzFramework::Components::DeprecatedComponentsList& list) const override;
  53. // AtomBridgeRequestBus::Handler overrides ...
  54. // (Empty)
  55. // AZ::Render::Bootstrap::NotificationBus overrides
  56. void OnBootstrapSceneReady(RPI::Scene* bootstrapScene) override;
  57. // ViewportContextManagerNotificationsBus overrides
  58. void OnViewportContextAdded(AZ::RPI::ViewportContextPtr viewportContext) override;
  59. void OnViewportContextRemoved(AzFramework::ViewportId viewportId) override;
  60. AzFramework::EntityContextId m_entityContextId;
  61. RPI::ViewPtr m_view = nullptr;
  62. AZStd::unordered_map<AzFramework::ViewportId, AZStd::shared_ptr<AtomDebugDisplayViewportInterface> > m_activeViewportsList;
  63. AZStd::unique_ptr<PerViewportDynamicDrawManager> m_dynamicDrawManager;
  64. };
  65. }
  66. } // namespace AZ