3
0

PostProcessSettings.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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/Feature/PostProcess/PostProcessSettingsInterface.h>
  10. #include <Atom/Feature/PostProcess/PostFxLayerCategoriesConstants.h>
  11. #include <PostProcess/PostProcessBase.h>
  12. #include <PostProcess/Bloom/BloomSettings.h>
  13. #include <PostProcess/DepthOfField/DepthOfFieldSettings.h>
  14. #include <PostProcess/ExposureControl/ExposureControlSettings.h>
  15. #include <PostProcess/Ssao/SsaoSettings.h>
  16. #include <PostProcess/LookModification/LookModificationSettings.h>
  17. #include <PostProcess/ColorGrading/HDRColorGradingSettings.h>
  18. #include <PostProcess/ChromaticAberration/ChromaticAberrationSettings.h>
  19. #include <PostProcess/PaniniProjection/PaniniProjectionSettings.h>
  20. #include <PostProcess/FilmGrain/FilmGrainSettings.h>
  21. #include <PostProcess/WhiteBalance/WhiteBalanceSettings.h>
  22. #include <PostProcess/Vignette/VignetteSettings.h>
  23. #include <ScreenSpace/DeferredFogSettings.h>
  24. namespace AZ
  25. {
  26. namespace Render
  27. {
  28. //! A collection of post process settings
  29. //! This class is responsible for managing and blending sub-settings classes
  30. //! for post effects like depth of field, anti-aliasing, SSAO, etc.
  31. class PostProcessSettings final
  32. : public PostProcessSettingsInterface
  33. , public PostProcessBase
  34. {
  35. friend class PostProcessFeatureProcessor;
  36. public:
  37. AZ_RTTI(AZ::Render::PostProcessSettings, "{E4BD5945-F4C6-4B68-B1D3-28700BD2BF88}",
  38. AZ::Render::PostProcessSettingsInterface, AZ::Render::PostProcessBase);
  39. AZ_CLASS_ALLOCATOR(PostProcessSettings, SystemAllocator);
  40. PostProcessSettings(PostProcessFeatureProcessor* featureProcessor);
  41. // PostProcessSettingsInterface overrides...
  42. void OnConfigChanged() override;
  43. // Auto-gen function declarations related to sub-settings members
  44. #define POST_PROCESS_MEMBER(ClassName, MemberName) \
  45. ClassName* Get##ClassName() { return MemberName.get(); } \
  46. ClassName##Interface* GetOrCreate##ClassName##Interface() override; \
  47. void Remove##ClassName##Interface() override; \
  48. #include <Atom/Feature/PostProcess/PostProcessSettings.inl>
  49. #undef POST_PROCESS_MEMBER
  50. // Auto-gen getter and setter functions for post process members...
  51. #include <Atom/Feature/ParamMacros/StartParamFunctionsOverrideImpl.inl>
  52. #include <Atom/Feature/PostProcess/PostProcessParams.inl>
  53. #include <Atom/Feature/ParamMacros/EndParams.inl>
  54. // Getter & setter for layer category value
  55. int GetLayerCategoryValue() const { return m_layerCategoryValue; }
  56. void SetLayerCategoryValue(int layerCategoryValue) override { m_layerCategoryValue = layerCategoryValue; }
  57. // camera-to-blendWeight setters and getters
  58. void CopyViewToBlendWeightSettings(const ViewBlendWeightMap& perViewBlendWeights) override;
  59. float GetBlendWeightForView(AZ::RPI::View* view) const;
  60. private:
  61. // Applies owned sub-settings onto target's settings using providing blendFactor,
  62. // this class's overrideFactor and per-param override settings for individual sub-settings
  63. void ApplySettingsTo(PostProcessSettings* targetSettings, float blendFactor = 1.0f) const;
  64. // Called from the PostProcessFeatureProcessor on aggregated PostProcessSettings
  65. // (More detail: The PostProcessFeatureProcessor will blend together PostProcessSettings based on application
  66. // frequency (Level, Volume, Camera) and per-setting override values. Simulate will be called on those combined settings)
  67. void Simulate(float deltaTime);
  68. // Auto-gen post process members...
  69. #include <Atom/Feature/ParamMacros/StartParamMembers.inl>
  70. #include <Atom/Feature/PostProcess/PostProcessParams.inl>
  71. #include <Atom/Feature/ParamMacros/EndParams.inl>
  72. // Auto-gen sub-settings members
  73. #define POST_PROCESS_MEMBER(ClassName, MemberName) \
  74. AZStd::unique_ptr<ClassName> MemberName; \
  75. #include <Atom/Feature/PostProcess/PostProcessSettings.inl>
  76. #undef POST_PROCESS_MEMBER
  77. // This camera-to-blendWeights setting will be used by feature processor to
  78. // blend postfxs per camera
  79. ViewBlendWeightMap m_perViewBlendWeights;
  80. // Integer representation of PostFx layer
  81. int m_layerCategoryValue = PostFx::DefaultLayerCategoryValue;
  82. };
  83. }
  84. }