UseTextureFunctorSourceData.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 "./UseTextureFunctor.h"
  10. #include <Atom/RPI.Edit/Material/MaterialFunctorSourceData.h>
  11. namespace AZ
  12. {
  13. namespace Render
  14. {
  15. class UseTextureFunctor;
  16. //! Builds a UseTextureFunctor.
  17. //! Materials can use this functor to control whether a specific texture property will be sampled.
  18. //! Sampling will be disabled if no texture is bound or if the useTexture flag is disabled.
  19. class UseTextureFunctorSourceData final
  20. : public RPI::MaterialFunctorSourceData
  21. {
  22. public:
  23. AZ_CLASS_ALLOCATOR(UseTextureFunctorSourceData , AZ::SystemAllocator)
  24. AZ_RTTI(UseTextureFunctorSourceData, "{2CBB80CF-5EEB-4C0F-B628-1FE0729E2D18}", RPI::MaterialFunctorSourceData);
  25. static void Reflect(ReflectContext* context);
  26. FunctorResult CreateFunctor(const RuntimeContext& context) const override;
  27. FunctorResult CreateFunctor(const EditorContext& context) const override;
  28. AZStd::vector<AZ::Name> GetShaderOptionDependencies() const override;
  29. private:
  30. // Material property inputs...
  31. Name m_texturePropertyName; //!< Name of a material property for a texture
  32. Name m_useTexturePropertyName; //!< Name of a material property for a bool that indicates whether to use the texture
  33. //! material properties that relate to the texture, which will be enabled only when the texture map is enabled.
  34. AZStd::vector<Name> m_dependentProperties;
  35. // Shader option output...
  36. Name m_useTextureOptionName; //!< Name of the shader option that controls whether the texture should be sampled
  37. };
  38. } // namespace Render
  39. } // namespace AZ