2
0

StacksShaderInputFunctor.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. * its licensors.
  4. *
  5. * For complete copyright and license terms please see the LICENSE at the root of this
  6. * distribution (the "License"). All use of this software is governed by the License,
  7. * or, if provided, by the license below or the license accompanying this file. Do not
  8. * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. *
  11. */
  12. #pragma once
  13. #include <Atom/RPI.Reflect/Material/MaterialFunctor.h>
  14. #include <Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h>
  15. namespace AtomSampleViewer
  16. {
  17. //! This is an example of a custom hard-coded MaterialFunctor used to perform calculations on material
  18. //! property values to produce shader input values.
  19. //! It is used by comprehensive.materialtype to transform angle values into a light direction vector.
  20. class StacksShaderInputFunctor final
  21. : public AZ::RPI::MaterialFunctor
  22. {
  23. friend class StacksShaderInputFunctorSourceData;
  24. public:
  25. AZ_RTTI(StacksShaderInputFunctor, "{7F607170-1BC2-4510-A252-8A665FC02052}", AZ::RPI::MaterialFunctor);
  26. static void Reflect(AZ::ReflectContext* context);
  27. void Process(RuntimeContext& context) override;
  28. private:
  29. // Indices used to look up material property values at runtime
  30. AZ::RPI::MaterialPropertyIndex m_azimuthDegreesIndex;
  31. AZ::RPI::MaterialPropertyIndex m_elevationDegreesIndex;
  32. // Indices used to look up ShaderResourceGroup inputs at runtime
  33. AZ::RHI::ShaderInputConstantIndex m_lightDirectionIndex;
  34. };
  35. } // namespace AtomSampleViewer