EyeMaterialExampleComponent.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 <AzCore/Component/TickBus.h>
  10. #include <CommonSampleComponentBase.h>
  11. #include <Utils/Utils.h>
  12. #include <Utils/ImGuiSidebar.h>
  13. #include <Atom/Utils/ImGuiMaterialDetails.h>
  14. #include <Atom/Utils/ImGuiMaterialDetails.h>
  15. namespace AtomSampleViewer
  16. {
  17. //! Test sample for the Eye material type
  18. class EyeMaterialExampleComponent final
  19. : public CommonSampleComponentBase
  20. , public AZ::TickBus::Handler
  21. {
  22. public:
  23. AZ_COMPONENT(EyeMaterialExampleComponent, "{591B14E7-72CC-4583-B8D8-5A81EEAE85E7}", CommonSampleComponentBase);
  24. static void Reflect(AZ::ReflectContext* context);
  25. EyeMaterialExampleComponent();
  26. ~EyeMaterialExampleComponent() override = default;
  27. void Activate() override;
  28. void Deactivate() override;
  29. private:
  30. AZ_DISABLE_COPY_MOVE(EyeMaterialExampleComponent);
  31. // AZ::TickBus::Handler overrides...
  32. void OnTick(float deltaTime, AZ::ScriptTimePoint scriptTime) override;
  33. void Prepare();
  34. void LoadMesh(AZ::Transform transform);
  35. void InitializeMaterialProperties();
  36. void DrawSidebar();
  37. void DrawSidebarMaterialProperties();
  38. AZ::Data::Asset<AZ::RPI::ModelAsset> m_modelAsset;
  39. AZ::Data::Asset<AZ::RPI::MaterialAsset> m_materialAsset;
  40. AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
  41. AZ::Data::Instance<AZ::RPI::Material> m_materialInstance;
  42. Utils::DefaultIBL m_defaultIbl;
  43. AZ::Transform m_eyeTransform;
  44. // Property Index
  45. AZ::RPI::MaterialPropertyIndex m_irisColorIndex;
  46. AZ::RPI::MaterialPropertyIndex m_irisColorFactorIndex;
  47. AZ::RPI::MaterialPropertyIndex m_irisRoughnessIndex;
  48. AZ::RPI::MaterialPropertyIndex m_scleraColorIndex;
  49. AZ::RPI::MaterialPropertyIndex m_scleraColorFactorIndex;
  50. AZ::RPI::MaterialPropertyIndex m_scleraRoughnessIndex;
  51. AZ::RPI::MaterialPropertyIndex m_scleraNormalFactorIndex;
  52. AZ::RPI::MaterialPropertyIndex m_irisDepthIndex;
  53. AZ::RPI::MaterialPropertyIndex m_irisRadiusIndex;
  54. AZ::RPI::MaterialPropertyIndex m_innerEyeIORIndex;
  55. AZ::RPI::MaterialPropertyIndex m_limbusSizeIndex;
  56. AZ::RPI::MaterialPropertyIndex m_specularFactorIndex;
  57. AZ::RPI::MaterialPropertyIndex m_SSSEnableIndex;
  58. AZ::RPI::MaterialPropertyIndex m_SSSColorIndex;
  59. AZ::RPI::MaterialPropertyIndex m_SSSFactorIndex;
  60. // GUI
  61. float m_irisColor[3];
  62. float m_irisColorFactor;
  63. float m_irisRoughness;
  64. float m_scleraColor[3];
  65. float m_scleraColorFactor;
  66. float m_scleraRoughness;
  67. float m_scleraNormalFactor;
  68. float m_irisDepth;
  69. float m_irisRadius;
  70. float m_innerEyeIOR;
  71. float m_limbusSize;
  72. float m_specularFactor;
  73. bool m_SSSEnable;
  74. float m_SSSColor[3];
  75. float m_SSSFactor;
  76. float m_rotationEuler[3];
  77. ImGuiSidebar m_imguiSidebar;
  78. AZ::Render::ImGuiMaterialDetails m_imguiMaterialDetails;
  79. };
  80. } // namespace AtomSampleViewer