EditorStatePassSystem.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 <Pass/State/EditorStateBase.h>
  10. #include <AzCore/std/containers/vector.h>
  11. #include <AzCore/std/smart_ptr/unique_ptr.h>
  12. #include <AzCore/std/containers/unordered_map.h>
  13. #include <AzCore/std/containers/unordered_set.h>
  14. #include <AzToolsFramework/Entity/EntityTypes.h>
  15. namespace AZ::Render
  16. {
  17. //! Container for specialized editor state effect parent pass classes.
  18. using EditorStateList = AZStd::vector<AZStd::unique_ptr<EditorStateBase>>;
  19. //! Mapping for mask draw tags to entities rendered to that mask.
  20. using EntityMaskMap = AZStd::unordered_map<Name, AzToolsFramework::EntityIdSet>;
  21. //! System for constructing the passes for the editor state effects.
  22. class EditorStatePassSystem
  23. {
  24. public:
  25. //! Constructs the pass system with the specified editor state effect parent pass instances.
  26. EditorStatePassSystem(EditorStateList&& editorStates);
  27. //! Adds the editor state effect parent passes to the specified render pipeline.
  28. void AddPassesToRenderPipeline(RPI::RenderPipeline* renderPipeline);
  29. //! Returns the map of masks to the entities to be rendered to those masks.
  30. EntityMaskMap GetEntitiesForEditorStates() const;
  31. //! Configures the editor state pass instances for the specified render pipeline.
  32. void ConfigureStatePassesForPipeline(RPI::RenderPipeline* renderPipeline);
  33. //! Removes the editor state pass instances for the specified render pipeline.
  34. void RemoveStatePassesForPipeline(RPI::RenderPipeline* renderPipeline);
  35. //! Returns the set of all masks used by this pass system.
  36. const AZStd::unordered_set<Name>& GetMasks() const
  37. {
  38. return m_masks;
  39. }
  40. //! Performs any updates for the editor state effect parent pass instances for the given simulation tick.
  41. void Update();
  42. //! Returns the pass template name of the main parent pass
  43. const char* GetParentPassTemplateName() const;
  44. private:
  45. //! Parent passes for each editor state (ordering in vector is ordering of rendering).
  46. EditorStateList m_editorStates;
  47. //! Set of all masks used by this pass system.
  48. AZStd::unordered_set<Name> m_masks;
  49. };
  50. } // namespace AZ::Render