3
0

ShapeWeightModifierComponentController.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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/Component.h>
  10. #include <AzCore/Component/TransformBus.h>
  11. #include <AtomLyIntegration/CommonFeatures/PostProcess/ShapeWeightModifier/ShapeWeightModifierComponentConfig.h>
  12. #include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxWeightRequestBus.h>
  13. namespace AZ
  14. {
  15. namespace Render
  16. {
  17. class ShapeWeightModifierComponentController final
  18. : public PostFxWeightRequestBus::Handler
  19. {
  20. public:
  21. friend class EditorShapeWeightModifierComponent;
  22. AZ_TYPE_INFO(AZ::Render::ShapeWeightModifierComponentController, "{5EF82EB8-8A7F-4B6C-BD40-8BABA1ABE0E5}");
  23. static void Reflect(AZ::ReflectContext* context);
  24. ShapeWeightModifierComponentController() = default;
  25. ShapeWeightModifierComponentController(const ShapeWeightModifierComponentConfig& config);
  26. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services);
  27. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services);
  28. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& services);
  29. void Activate(EntityId entityId);
  30. void Deactivate();
  31. void SetConfiguration(const ShapeWeightModifierComponentConfig& config);
  32. const ShapeWeightModifierComponentConfig& GetConfiguration() const { return m_configuration; }
  33. //! PostFxWeightRequestBus::Handler Override
  34. virtual float GetWeightAtPosition(const AZ::Vector3& influencerPosition) const override;
  35. private:
  36. float GetRatio(float maxRange, float minRange, float distance) const;
  37. AZ_DISABLE_COPY(ShapeWeightModifierComponentController);
  38. ShapeWeightModifierComponentConfig m_configuration;
  39. EntityId m_entityId;
  40. };
  41. }
  42. }