EyeMaterialExampleComponent.h 3.2 KB

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