SubsurfaceTransmissionParameterFunctor.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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/RPI.Reflect/Material/MaterialFunctor.h>
  10. #include <Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h>
  11. #include <Atom/RHI.Reflect/Limits.h>
  12. namespace AZ
  13. {
  14. namespace Render
  15. {
  16. //! This functor is used to pack and precalculate parameters required by subsurface scattering and transmission calculation
  17. class SubsurfaceTransmissionParameterFunctor final
  18. : public RPI::MaterialFunctor
  19. {
  20. friend class SubsurfaceTransmissionParameterFunctorSourceData;
  21. public:
  22. AZ_CLASS_ALLOCATOR(SubsurfaceTransmissionParameterFunctor, SystemAllocator)
  23. AZ_RTTI(SubsurfaceTransmissionParameterFunctor, "{1F95BF80-354E-4A65-9A9E-4C7276F8558F}", RPI::MaterialFunctor);
  24. static void Reflect(ReflectContext* context);
  25. using RPI::MaterialFunctor::Process;
  26. void Process(RPI::MaterialFunctorAPI::RuntimeContext& context) override;
  27. bool UpdateShaderParameterConnections(const RPI::MaterialShaderParameterLayout* layout) override;
  28. private:
  29. // Material property inputs...
  30. RPI::MaterialPropertyIndex m_mode;
  31. RPI::MaterialPropertyIndex m_scale;
  32. RPI::MaterialPropertyIndex m_power;
  33. RPI::MaterialPropertyIndex m_distortion;
  34. RPI::MaterialPropertyIndex m_attenuation;
  35. RPI::MaterialPropertyIndex m_shrinkFactor;
  36. RPI::MaterialPropertyIndex m_transmissionNdLBias;
  37. RPI::MaterialPropertyIndex m_distanceAttenuation;
  38. RPI::MaterialPropertyIndex m_tintColor;
  39. RPI::MaterialPropertyIndex m_thickness;
  40. RPI::MaterialPropertyIndex m_enabled;
  41. RPI::MaterialPropertyIndex m_scatterDistanceColor;
  42. RPI::MaterialPropertyIndex m_scatterDistanceIntensity;
  43. // Shader setting output...
  44. RPI::MaterialShaderParameterNameIndex m_scatterDistance;
  45. RPI::MaterialShaderParameterNameIndex m_transmissionParams;
  46. RPI::MaterialShaderParameterNameIndex m_transmissionTintThickness;
  47. };
  48. } // namespace Render
  49. } // namespace AZ