ConvertEmissiveUnitFunctor.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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/Feature/CoreLights/PhotometricValue.h>
  12. namespace AZ
  13. {
  14. namespace Render
  15. {
  16. //! The functor can be used to convert between different emissive light unit
  17. //! Only support Ev100 and Lux
  18. class ConvertEmissiveUnitFunctor final
  19. : public AZ::RPI::MaterialFunctor
  20. {
  21. friend class ConvertEmissiveUnitFunctorSourceData;
  22. public:
  23. AZ_CLASS_ALLOCATOR(ConvertEmissiveUnitFunctor, SystemAllocator)
  24. AZ_RTTI(ConvertEmissiveUnitFunctor, "{F272CFAB-FD71-4E78-AA47-D0D2E88CE30C}", AZ::RPI::MaterialFunctor);
  25. static void Reflect(AZ::ReflectContext* context);
  26. using RPI::MaterialFunctor::Process;
  27. void Process(RPI::MaterialFunctorAPI::RuntimeContext& context) override;
  28. void Process(RPI::MaterialFunctorAPI::EditorContext& context) override;
  29. float GetProcessedValue(float originalEmissiveIntensity, uint32_t lightUnitIndex) const;
  30. private:
  31. AZ::RPI::MaterialPropertyIndex m_intensityPropertyIndex;
  32. AZ::RPI::MaterialPropertyIndex m_lightUnitPropertyIndex;
  33. AZ::RHI::ShaderInputConstantIndex m_shaderInputIndex;
  34. uint32_t m_ev100Index;
  35. uint32_t m_nitIndex;
  36. float m_ev100Min = 0.0f;
  37. float m_ev100Max = 0.0f;
  38. float m_nitMin = 0.0f;
  39. float m_nitMax = 0.0f;
  40. };
  41. }
  42. }