2
0

StacksShaderCollectionFunctor.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 dynamically select shaders/variants/passes.
  18. //! It is used by comprehensive.materialtype to enable/disable variants of the "stacks" shader.
  19. class StacksShaderCollectionFunctor final
  20. : public AZ::RPI::MaterialFunctor
  21. {
  22. friend class StacksShaderCollectionFunctorSourceData;
  23. public:
  24. AZ_RTTI(StacksShaderCollectionFunctor, "{4E51A7D5-7DF1-4402-8975-F6C9DFDEDC1E}", AZ::RPI::MaterialFunctor);
  25. static void Reflect(AZ::ReflectContext* context);
  26. void Process(RuntimeContext& context) override;
  27. private:
  28. // Indexes used to look up material property values at runtime
  29. AZ::RPI::MaterialPropertyIndex m_stackCountProperty;
  30. AZ::RPI::MaterialPropertyIndex m_highlightLastStackProperty;
  31. // Indexes used to access ShaderOption values at runtime
  32. AZ::RPI::ShaderOptionIndex m_highlightLastStackOption;
  33. };
  34. } // namespace AtomSampleViewer