3
0

StartingPointCameraGem.cpp 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #include "CameraTargetAcquirers/AcquireByEntityId.h"
  9. #include "CameraTargetAcquirers/AcquireByTag.h"
  10. #include "CameraTransformBehaviors/FollowTargetFromDistance.h"
  11. #include "CameraLookAtBehaviors/OffsetPosition.h"
  12. #include "CameraTransformBehaviors/FollowTargetFromAngle.h"
  13. #include "CameraTransformBehaviors/Rotate.h"
  14. #include "CameraTransformBehaviors/OffsetCameraPosition.h"
  15. #include "CameraLookAtBehaviors/SlideAlongAxisBasedOnAngle.h"
  16. #include "CameraLookAtBehaviors/RotateCameraLookAt.h"
  17. #include "CameraTransformBehaviors/FaceTarget.h"
  18. #include <AzCore/Serialization/SerializeContext.h>
  19. #include <AzCore/Module/Module.h>
  20. #include <AzFramework/Metrics/MetricsPlainTextNameRegistration.h>
  21. namespace StartingPointCamera
  22. {
  23. struct StartingPointCameraGemComponent
  24. : public AZ::Component
  25. {
  26. ~StartingPointCameraGemComponent() override = default;
  27. AZ_COMPONENT(StartingPointCameraGemComponent, "{728DF62E-6787-4A16-8F07-8A45BECADAD7}");
  28. static void Reflect(AZ::ReflectContext* reflection)
  29. {
  30. Camera::AcquireByEntityId::Reflect(reflection);
  31. Camera::AcquireByTag::Reflect(reflection);
  32. Camera::FollowTargetFromDistance::Reflect(reflection);
  33. Camera::OffsetPosition::Reflect(reflection);
  34. Camera::FollowTargetFromAngle::Reflect(reflection);
  35. Camera::Rotate::Reflect(reflection);
  36. Camera::OffsetCameraPosition::Reflect(reflection);
  37. Camera::SlideAlongAxisBasedOnAngle::Reflect(reflection);
  38. Camera::RotateCameraLookAt::Reflect(reflection);
  39. Camera::FaceTarget::Reflect(reflection);
  40. if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(reflection))
  41. {
  42. serializeContext->Class<StartingPointCameraGemComponent, AZ::Component>()
  43. ->Version(0)
  44. ;
  45. }
  46. }
  47. void Activate() override {}
  48. void Deactivate() override {}
  49. };
  50. class StartingPointCameraModule
  51. : public AZ::Module
  52. {
  53. public:
  54. AZ_RTTI(StartingPointCameraModule, "{87B6E891-9C64-4C5D-9FA1-4079BF6D902D}", AZ::Module);
  55. StartingPointCameraModule()
  56. : AZ::Module()
  57. {
  58. m_descriptors.insert(m_descriptors.end(), {
  59. StartingPointCameraGemComponent::CreateDescriptor(),
  60. });
  61. // This is an internal Amazon gem, so register it's components for metrics tracking, otherwise the name of the component won't get sent back.
  62. // IF YOU ARE A THIRDPARTY WRITING A GEM, DO NOT REGISTER YOUR COMPONENTS WITH EditorMetricsComponentRegistrationBus
  63. AZStd::vector<AZ::Uuid> typeIds;
  64. typeIds.reserve(m_descriptors.size());
  65. for (AZ::ComponentDescriptor* descriptor : m_descriptors)
  66. {
  67. typeIds.emplace_back(descriptor->GetUuid());
  68. }
  69. AzFramework::MetricsPlainTextNameRegistrationBus::Broadcast(
  70. &AzFramework::MetricsPlainTextNameRegistrationBus::Events::RegisterForNameSending, typeIds);
  71. }
  72. };
  73. }
  74. // DO NOT MODIFY THIS LINE UNLESS YOU RENAME THE GEM
  75. // The first parameter should be GemName_GemIdLower
  76. // The second should be the fully qualified name of the class above
  77. AZ_DECLARE_MODULE_CLASS(Gem_StartingPointCamera, StartingPointCamera::StartingPointCameraModule)