OcclusionCullingPlaneComponentController.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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/Asset/AssetCommon.h>
  10. #include <AzCore/Component/Component.h>
  11. #include <AzCore/Component/TransformBus.h>
  12. #include <Atom/Feature/OcclusionCullingPlane/OcclusionCullingPlaneFeatureProcessorInterface.h>
  13. #include <Atom/RPI.Public/Model/Model.h>
  14. #include <LmbrCentral/Shape/BoxShapeComponentBus.h>
  15. #include <OcclusionCullingPlane/OcclusionCullingPlaneComponentConstants.h>
  16. namespace AZ
  17. {
  18. namespace Render
  19. {
  20. class OcclusionCullingPlaneComponentConfig final
  21. : public AZ::ComponentConfig
  22. {
  23. public:
  24. AZ_RTTI(AZ::Render::OcclusionCullingPlaneComponentConfig, "{D0E107CA-5AFB-4675-BC97-94BCA5F248DB}", ComponentConfig);
  25. AZ_CLASS_ALLOCATOR(OcclusionCullingPlaneComponentConfig, SystemAllocator);
  26. static void Reflect(AZ::ReflectContext* context);
  27. bool m_showVisualization = true;
  28. bool m_transparentVisualization = false;
  29. OcclusionCullingPlaneComponentConfig() = default;
  30. };
  31. class OcclusionCullingPlaneComponentController final
  32. : public Data::AssetBus::MultiHandler
  33. , private TransformNotificationBus::Handler
  34. {
  35. public:
  36. friend class EditorOcclusionCullingPlaneComponent;
  37. AZ_CLASS_ALLOCATOR(OcclusionCullingPlaneComponentController, AZ::SystemAllocator);
  38. AZ_RTTI(AZ::Render::OcclusionCullingPlaneComponentController, "{8EDA3C7D-5171-4843-9969-4D84DB13F221}");
  39. static void Reflect(AZ::ReflectContext* context);
  40. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  41. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  42. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  43. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  44. OcclusionCullingPlaneComponentController() = default;
  45. OcclusionCullingPlaneComponentController(const OcclusionCullingPlaneComponentConfig& config);
  46. void Activate(AZ::EntityId entityId);
  47. void Deactivate();
  48. void SetConfiguration(const OcclusionCullingPlaneComponentConfig& config);
  49. const OcclusionCullingPlaneComponentConfig& GetConfiguration() const;
  50. private:
  51. AZ_DISABLE_COPY(OcclusionCullingPlaneComponentController);
  52. // TransformNotificationBus overrides
  53. void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
  54. // handle for this occlusion plane in the feature processor
  55. OcclusionCullingPlaneHandle m_handle;
  56. OcclusionCullingPlaneFeatureProcessorInterface* m_featureProcessor = nullptr;
  57. TransformInterface* m_transformInterface = nullptr;
  58. AZ::EntityId m_entityId;
  59. OcclusionCullingPlaneComponentConfig m_configuration;
  60. };
  61. } // namespace Render
  62. } // namespace AZ