DecalExampleComponent.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0 OR MIT
  5. *
  6. */
  7. #pragma once
  8. #include <CommonSampleComponentBase.h>
  9. #include <AzCore/Component/EntityBus.h>
  10. #include <AzCore/Component/TickBus.h>
  11. #include <AzFramework/Input/Events/InputChannelEventListener.h>
  12. #include <Atom/Feature/Decals/DecalFeatureProcessorInterface.h>
  13. #include <Utils/Utils.h>
  14. #include <Utils/ImGuiSidebar.h>
  15. #include "DecalContainer.h"
  16. namespace AtomSampleViewer
  17. {
  18. class DecalContainer;
  19. //! This component creates a simple scene to test Atom's decal system.
  20. class DecalExampleComponent final
  21. : public CommonSampleComponentBase
  22. , public AZ::TickBus::Handler
  23. {
  24. public:
  25. AZ_COMPONENT(DecalExampleComponent, "{91CFCFFC-EDD9-47EB-AE98-4BE9617D6F2F}", CommonSampleComponentBase);
  26. static void Reflect(AZ::ReflectContext* context);
  27. void Activate() override;
  28. void Deactivate() override;
  29. private:
  30. // AZ::TickBus::Handler
  31. void OnTick(float deltaTime, AZ::ScriptTimePoint timePoint) override;
  32. void CreateDecalContainer();
  33. void CreatePlaneObject();
  34. void ScaleObjectToFitDecals();
  35. void EnableArcBallCameraController();
  36. void ConfigureCameraToLookDownAtObject();
  37. void AddImageBasedLight();
  38. void DrawSidebar();
  39. AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
  40. Utils::DefaultIBL m_defaultIbl;
  41. AZStd::unique_ptr<DecalContainer> m_decalContainer;
  42. // Used to test the DecalFeatureProcessor::Clone() function
  43. AZStd::unique_ptr<DecalContainer> m_decalContainerClone;
  44. ImGuiSidebar m_imguiSidebar;
  45. bool m_cloneDecalsEnabled = false;
  46. // CommonSampleComponentBase overrides...
  47. void OnAllAssetsReadyActivate() override;
  48. };
  49. } // namespace AtomSampleViewer