3
0

WhiteBoxComponent.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. namespace WhiteBox
  15. {
  16. class RenderMeshInterface;
  17. //! Runtime representation of White Box.
  18. class WhiteBoxComponent
  19. : public AZ::Component
  20. , public WhiteBoxComponentRequestBus::Handler
  21. , private AZ::TransformNotificationBus::Handler
  22. {
  23. public:
  24. AZ_COMPONENT(WhiteBoxComponent, "{6CFD4D82-FA68-4C18-BE67-43FC2B755B64}", AZ::Component)
  25. static void Reflect(AZ::ReflectContext* context);
  26. WhiteBoxComponent();
  27. WhiteBoxComponent(const WhiteBoxComponent&) = delete;
  28. WhiteBoxComponent& operator=(const WhiteBoxComponent&) = delete;
  29. WhiteBoxComponent(WhiteBoxComponent&&) = default;
  30. WhiteBoxComponent& operator=(WhiteBoxComponent&&) = default;
  31. ~WhiteBoxComponent();
  32. // WhiteBoxComponentRequestBus ...
  33. bool WhiteBoxIsVisible() const override;
  34. void GenerateWhiteBoxMesh(const WhiteBoxRenderData& whiteBoxRenderData);
  35. private:
  36. // AZ::Component ...
  37. void Activate() override;
  38. void Deactivate() override;
  39. // TransformNotificationBus ...
  40. void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
  41. WhiteBoxRenderData m_whiteBoxRenderData; //!< Intermediate format to store White Box render data.
  42. AZStd::unique_ptr<RenderMeshInterface> m_renderMesh; //!< The render mesh to use for White Box rendering.
  43. };
  44. } // namespace WhiteBox