CylinderShapeComponent.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 "Rendering/EntityDebugDisplayComponent.h"
  11. #include "CylinderShape.h"
  12. namespace LmbrCentral
  13. {
  14. /// Provide a Component interface for CylinderShape functionality.
  15. class CylinderShapeComponent
  16. : public AZ::Component
  17. {
  18. public:
  19. AZ_COMPONENT(CylinderShapeComponent, CylinderShapeComponentTypeId);
  20. static void Reflect(AZ::ReflectContext* context);
  21. // AZ::Component
  22. void Activate() override;
  23. void Deactivate() override;
  24. bool ReadInConfig(const AZ::ComponentConfig* baseConfig) override;
  25. bool WriteOutConfig(AZ::ComponentConfig* outBaseConfig) const override;
  26. private:
  27. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  28. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  29. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  30. CylinderShape m_cylinderShape; ///< Stores underlying cylinder type for this component.
  31. };
  32. /// Concrete EntityDebugDisplay implementation for CylinderShape.
  33. class CylinderShapeDebugDisplayComponent
  34. : public EntityDebugDisplayComponent
  35. , public ShapeComponentNotificationsBus::Handler
  36. {
  37. public:
  38. AZ_COMPONENT(CylinderShapeDebugDisplayComponent, "{13F00855-7BB6-447A-9E8D-61F37275BC95}", EntityDebugDisplayComponent)
  39. static void Reflect(AZ::ReflectContext* context);
  40. CylinderShapeDebugDisplayComponent() = default;
  41. // AZ::Component
  42. void Activate() override;
  43. void Deactivate() override;
  44. bool ReadInConfig(const AZ::ComponentConfig* baseConfig) override;
  45. bool WriteOutConfig(AZ::ComponentConfig* outBaseConfig) const override;
  46. // EntityDebugDisplayComponent
  47. void Draw(AzFramework::DebugDisplayRequests& debugDisplay) override;
  48. private:
  49. AZ_DISABLE_COPY_MOVE(CylinderShapeDebugDisplayComponent)
  50. // ShapeComponentNotificationsBus
  51. void OnShapeChanged(ShapeChangeReasons changeReason) override;
  52. CylinderShapeConfig m_cylinderShapeConfig; ///< Stores configuration data for cylinder shape.
  53. };
  54. } // namespace LmbrCentral