GradientSignalSystemComponent.cpp 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 "GradientSignalSystemComponent.h"
  9. #include <AzCore/RTTI/BehaviorContext.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. #include <AzCore/Serialization/EditContext.h>
  12. #include <GradientSignal/GradientSampler.h>
  13. #include <GradientSignal/SmoothStep.h>
  14. #include <GradientSignal/Ebuses/GradientRequestBus.h>
  15. namespace GradientSignal
  16. {
  17. void GradientSignalSystemComponent::Reflect(AZ::ReflectContext* context)
  18. {
  19. GradientSampler::Reflect(context);
  20. SmoothStep::Reflect(context);
  21. if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  22. {
  23. serialize->Class<GradientSignalSystemComponent, AZ::Component>()
  24. ->Version(0)
  25. ;
  26. if (AZ::EditContext* ec = serialize->GetEditContext())
  27. {
  28. ec->Class<GradientSignalSystemComponent>("GradientSignal", "Manages registration of gradient image assets and reflection of required types")
  29. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  30. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  31. ;
  32. }
  33. }
  34. if (auto behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
  35. {
  36. behaviorContext->Class<GradientSampleParams>()
  37. ->Constructor()
  38. ->Attribute(AZ::Script::Attributes::Category, "Vegetation")
  39. ->Property("position", BehaviorValueProperty(&GradientSampleParams::m_position))
  40. ;
  41. behaviorContext->EBus<GradientRequestBus>("GradientRequestBus")
  42. ->Event("GetValue", &GradientRequestBus::Events::GetValue)
  43. ;
  44. }
  45. }
  46. void GradientSignalSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  47. {
  48. provided.push_back(AZ_CRC_CE("GradientSignalService"));
  49. }
  50. void GradientSignalSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  51. {
  52. incompatible.push_back(AZ_CRC_CE("GradientSignalService"));
  53. }
  54. void GradientSignalSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
  55. {
  56. (void)required;
  57. }
  58. void GradientSignalSystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
  59. {
  60. (void)dependent;
  61. }
  62. void GradientSignalSystemComponent::Init()
  63. {
  64. }
  65. void GradientSignalSystemComponent::Activate()
  66. {
  67. }
  68. void GradientSignalSystemComponent::Deactivate()
  69. {
  70. }
  71. }