3
0

Transform2DFunctorSourceData.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 "./Transform2DFunctor.h"
  10. #include <Atom/RPI.Edit/Material/MaterialFunctorSourceData.h>
  11. #include <Atom/Utils/MaterialUtils.h>
  12. namespace AZ
  13. {
  14. namespace Render
  15. {
  16. //! Builds a Transform2DFunctor.
  17. //! Materials can use this functor to map 2D scale, translate, and rotate properties into a float3x3 transform matrix.
  18. class Transform2DFunctorSourceData final
  19. : public AZ::RPI::MaterialFunctorSourceData
  20. {
  21. public:
  22. AZ_CLASS_ALLOCATOR(Transform2DFunctorSourceData, AZ::SystemAllocator)
  23. AZ_RTTI(Transform2DFunctorSourceData, "{82E9FE9B-A0C2-42D4-BCE7-A0C10CC0E445}", RPI::MaterialFunctorSourceData);
  24. static void Reflect(AZ::ReflectContext* context);
  25. using AZ::RPI::MaterialFunctorSourceData::CreateFunctor;
  26. FunctorResult CreateFunctor(const RuntimeContext& context) const override;
  27. private:
  28. AZStd::vector<TransformType> m_transformOrder; //!< Controls the order in which Scale, Translate, Rotate are performed
  29. // Material property inputs...
  30. AZStd::string m_center; //!< material property for center of scaling and rotation
  31. AZStd::string m_scale; //!< material property for scaling in both directions
  32. AZStd::string m_scaleX; //!< material property for X scale
  33. AZStd::string m_scaleY; //!< material property for Y scale
  34. AZStd::string m_translateX; //!< material property for X translation
  35. AZStd::string m_translateY; //!< material property for Y translation
  36. AZStd::string m_rotateDegrees; //!< material property for rotating
  37. // Shader setting outputs...
  38. AZStd::string m_transformMatrix; //!< name of a float3x3 shader input
  39. AZStd::string m_transformMatrixInverse; //!< name of the inverse float3x3 shader input
  40. };
  41. } // namespace Render
  42. } // namespace AZ