DebugDrawRayComponent.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 DebugDrawRayElement
  15. {
  16. public:
  17. AZ_CLASS_ALLOCATOR(DebugDrawRayElement, AZ::SystemAllocator);
  18. AZ_TYPE_INFO(DebugDrawRayElement, "{BFA68022-208C-4A25-8A33-CF411164F994}");
  19. static void Reflect(AZ::ReflectContext* context);
  20. AZ::EntityId m_startEntityId;
  21. AZ::EntityId m_endEntityId;
  22. float m_duration;
  23. AZ::ScriptTimePoint m_activateTime;
  24. AZ::Color m_color;
  25. AZ::Vector3 m_worldLocation;
  26. AZ::Vector3 m_worldDirection;
  27. AZ::ComponentId m_owningEditorComponent;
  28. DebugDrawRayElement()
  29. : m_duration(0.f)
  30. , m_color(1.0f, 1.0f, 1.0f, 1.0f) // AZ::Color::White
  31. , m_worldLocation(AZ::Vector3::CreateZero())
  32. , m_worldDirection(AZ::Vector3::CreateZero())
  33. , m_owningEditorComponent(AZ::InvalidComponentId)
  34. {
  35. }
  36. };
  37. class DebugDrawRayComponent
  38. : public AZ::Component
  39. {
  40. friend class DebugDrawSystemComponent;
  41. public:
  42. AZ_COMPONENT(DebugDrawRayComponent, "{7D1C2FE7-541D-4C0A-B10C-D0EA4DE40BA8}");
  43. static void Reflect(AZ::ReflectContext* context);
  44. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  45. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  46. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  47. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  48. DebugDrawRayComponent() = default;
  49. explicit DebugDrawRayComponent(const DebugDrawRayElement& element);
  50. ~DebugDrawRayComponent() override = default;
  51. ////////////////////////////////////////////////////////////////////////
  52. // AZ::Component interface implementation
  53. void Init() override;
  54. void Activate() override;
  55. void Deactivate() override;
  56. ////////////////////////////////////////////////////////////////////////
  57. protected:
  58. DebugDrawRayElement m_element;
  59. };
  60. }