WhiteBoxComponent.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 "Rendering/WhiteBoxRenderData.h"
  10. #include "WhiteBox/WhiteBoxComponentBus.h"
  11. #include <AzCore/Component/Component.h>
  12. #include <AzCore/Component/TransformBus.h>
  13. #include <AzCore/Math/Transform.h>
  14. #include <AzFramework/Visibility/VisibleGeometryBus.h>
  15. namespace WhiteBox
  16. {
  17. class RenderMeshInterface;
  18. //! Runtime representation of White Box.
  19. class WhiteBoxComponent
  20. : public AZ::Component
  21. , public WhiteBoxComponentRequestBus::Handler
  22. , private AZ::TransformNotificationBus::Handler
  23. , public AzFramework::VisibleGeometryRequestBus::Handler
  24. {
  25. public:
  26. AZ_COMPONENT(WhiteBoxComponent, "{6CFD4D82-FA68-4C18-BE67-43FC2B755B64}", AZ::Component)
  27. static void Reflect(AZ::ReflectContext* context);
  28. WhiteBoxComponent();
  29. WhiteBoxComponent(const WhiteBoxComponent&) = delete;
  30. WhiteBoxComponent& operator=(const WhiteBoxComponent&) = delete;
  31. WhiteBoxComponent(WhiteBoxComponent&&) = default;
  32. WhiteBoxComponent& operator=(WhiteBoxComponent&&) = default;
  33. ~WhiteBoxComponent();
  34. // WhiteBoxComponentRequestBus ...
  35. bool WhiteBoxIsVisible() const override;
  36. void GenerateWhiteBoxMesh(const WhiteBoxRenderData& whiteBoxRenderData);
  37. private:
  38. // AZ::Component ...
  39. void Activate() override;
  40. void Deactivate() override;
  41. // TransformNotificationBus ...
  42. void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
  43. // AzFramework::VisibleGeometryRequestBus::Handler overrides ...
  44. void BuildVisibleGeometry(const AZ::Aabb& bounds, AzFramework::VisibleGeometryContainer& geometryContainer) const override;
  45. WhiteBoxRenderData m_whiteBoxRenderData; //!< Intermediate format to store White Box render data.
  46. AZStd::unique_ptr<RenderMeshInterface> m_renderMesh; //!< The render mesh to use for White Box rendering.
  47. };
  48. } // namespace WhiteBox