DebugDrawSphereComponent.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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/Script/ScriptTimePoint.h>
  11. #include <DebugDraw/DebugDrawBus.h>
  12. namespace DebugDraw
  13. {
  14. class DebugDrawSphereElement
  15. {
  16. public:
  17. AZ_CLASS_ALLOCATOR(DebugDrawSphereElement, AZ::SystemAllocator);
  18. AZ_TYPE_INFO(DebugDrawSphereElement, "{CB6F2781-DC26-4A10-8C5F-E07032574087}");
  19. static void Reflect(AZ::ReflectContext* context);
  20. float m_duration;
  21. AZ::ScriptTimePoint m_activateTime;
  22. AZ::Color m_color;
  23. AZ::EntityId m_targetEntityId;
  24. AZ::Vector3 m_worldLocation;
  25. float m_radius;
  26. bool m_isRayTracingEnabled = false;
  27. AZ::ComponentId m_owningEditorComponent;
  28. DebugDrawSphereElement()
  29. : m_duration(0.f)
  30. , m_radius(1.0f)
  31. , m_color(1.0f, 1.0f, 1.0f, 1.0f) // AZ::Color::White
  32. , m_worldLocation(AZ::Vector3::CreateZero())
  33. {
  34. }
  35. };
  36. class DebugDrawSphereComponent
  37. : public AZ::Component
  38. {
  39. friend class DebugDrawSystemComponent;
  40. public:
  41. AZ_COMPONENT(DebugDrawSphereComponent, "{823F6C96-627E-4C98-A3B9-0168B5CB3706}");
  42. static void Reflect(AZ::ReflectContext* context);
  43. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  44. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  45. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  46. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  47. DebugDrawSphereComponent() = default;
  48. explicit DebugDrawSphereComponent(const DebugDrawSphereElement& element);
  49. ~DebugDrawSphereComponent() override = default;
  50. ////////////////////////////////////////////////////////////////////////
  51. // AZ::Component interface implementation
  52. void Init() override;
  53. void Activate() override;
  54. void Deactivate() override;
  55. ////////////////////////////////////////////////////////////////////////
  56. protected:
  57. DebugDrawSphereElement m_element;
  58. };
  59. }