3
0

EditorModeFeedbackChildPassBase.cpp 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #include <Pass/Child/EditorModeFeedbackChildPassBase.h>
  9. namespace AZ
  10. {
  11. namespace Render
  12. {
  13. RPI::Ptr<EditorModeFeedbackChildPassBase> EditorModeFeedbackChildPassBase::Create(const RPI::PassDescriptor& descriptor)
  14. {
  15. RPI::Ptr<EditorModeFeedbackChildPassBase> pass = aznew EditorModeFeedbackChildPassBase(descriptor);
  16. return AZStd::move(pass);
  17. }
  18. EditorModeFeedbackChildPassBase::EditorModeFeedbackChildPassBase(
  19. const RPI::PassDescriptor& descriptor,
  20. const DepthTransition& depthTransition,
  21. float finalBlendAmount)
  22. : FullscreenTrianglePass(descriptor)
  23. , m_depthransition(depthTransition)
  24. , m_finalBlendAmount(finalBlendAmount)
  25. {
  26. }
  27. void EditorModeFeedbackChildPassBase::InitializeInternal()
  28. {
  29. FullscreenTrianglePass::InitializeInternal();
  30. m_minDepthTransitionValueIndex.Reset();
  31. m_depthTransitionStartIndex.Reset();
  32. m_depthTransitionDurationIndex.Reset();
  33. m_finalBlendAmountIndex.Reset();
  34. }
  35. void EditorModeFeedbackChildPassBase::FrameBeginInternal(FramePrepareParams params)
  36. {
  37. SetSrgConstants();
  38. FullscreenTrianglePass::FrameBeginInternal(params);
  39. }
  40. void EditorModeFeedbackChildPassBase::SetMinDepthTransitionValue(const float minValue)
  41. {
  42. m_depthransition.m_minDepthTransitionValue = minValue;
  43. }
  44. void EditorModeFeedbackChildPassBase::SetDepthTransitionStart(const float start)
  45. {
  46. m_depthransition.m_depthTransitionStart = start;
  47. }
  48. void EditorModeFeedbackChildPassBase::SetDepthTransitionDuration(const float duration)
  49. {
  50. m_depthransition.m_depthTransitionDuration = duration;
  51. }
  52. void EditorModeFeedbackChildPassBase::SetFinalBlendAmount(const float amount)
  53. {
  54. m_finalBlendAmount = amount;
  55. }
  56. void EditorModeFeedbackChildPassBase::SetSrgConstants()
  57. {
  58. m_shaderResourceGroup->SetConstant(m_minDepthTransitionValueIndex, m_depthransition.m_minDepthTransitionValue);
  59. m_shaderResourceGroup->SetConstant(m_depthTransitionStartIndex, m_depthransition.m_depthTransitionStart);
  60. m_shaderResourceGroup->SetConstant(m_depthTransitionDurationIndex, m_depthransition.m_depthTransitionDuration);
  61. m_shaderResourceGroup->SetConstant(m_finalBlendAmountIndex, m_finalBlendAmount);
  62. }
  63. } // namespace Render
  64. } // namespace AZ