EditorHairComponent.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #if defined (ATOMTRESSFX_EDITOR)
  10. #include <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
  11. #include <AzFramework/Entity/EntityDebugDisplayBus.h>
  12. #include <Components/HairComponent.h>
  13. #include <Components/HairComponentConfig.h>
  14. #include <Components/HairComponentController.h>
  15. namespace AZ
  16. {
  17. namespace Render
  18. {
  19. namespace Hair
  20. {
  21. //! Visual editor representation of the hair that can be created for an entity
  22. //! that have an Actor component.
  23. //! The config data itself is held by the 'HairComponentConfig' that reflects the 'TressFXSettings'
  24. //! and by the 'HairGlobalSettings' that mainly controls the shader options.
  25. //! The hair data is held by the 'HairRenderObject' and the connection between the component
  26. //! and the handling of the data is done by the 'HairComponentController'.
  27. static constexpr const char* const EditorHairComponentTypeId =
  28. "{822A8253-4662-41B1-8623-7B2D047A4D68}";
  29. class EditorHairComponent final
  30. : public AzToolsFramework::Components::EditorComponentAdapter<HairComponentController, HairComponent, HairComponentConfig>
  31. , private AzFramework::EntityDebugDisplayEventBus::Handler
  32. {
  33. public:
  34. using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<HairComponentController, HairComponent, HairComponentConfig>;
  35. AZ_EDITOR_COMPONENT(AZ::Render::Hair::EditorHairComponent, Hair::EditorHairComponentTypeId, BaseClass);
  36. static void Reflect(AZ::ReflectContext* context);
  37. EditorHairComponent() = default;
  38. EditorHairComponent(const HairComponentConfig& config);
  39. void Activate() override;
  40. void Deactivate() override;
  41. // AzFramework::DebugDisplayRequestBus::Handler interface
  42. void DisplayEntityViewport(
  43. const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override;
  44. private:
  45. //! EditorRenderComponentAdapter overrides...
  46. AZ::u32 OnConfigurationChanged() override;
  47. Data::AssetId m_prevHairAssetId; // Previous loaded hair asset id.
  48. };
  49. } // namespace Hair
  50. } // namespace Render
  51. } // namespace AZ
  52. #endif // ATOMTRESSFX_EDITOR