DecalExampleComponent.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. * its licensors.
  4. *
  5. * For complete copyright and license terms please see the LICENSE at the root of this
  6. * distribution (the "License"). All use of this software is governed by the License,
  7. * or, if provided, by the license below or the license accompanying this file. Do not
  8. * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. *
  11. */
  12. #pragma once
  13. #include <CommonSampleComponentBase.h>
  14. #include <AzCore/Component/EntityBus.h>
  15. #include <AzCore/Component/TickBus.h>
  16. #include <AzFramework/Input/Events/InputChannelEventListener.h>
  17. #include <Atom/Feature/Decals/DecalFeatureProcessorInterface.h>
  18. #include <Utils/Utils.h>
  19. #include <Utils/ImGuiSidebar.h>
  20. #include "DecalContainer.h"
  21. namespace AtomSampleViewer
  22. {
  23. class DecalContainer;
  24. //! This component creates a simple scene to test Atom's decal system.
  25. class DecalExampleComponent final
  26. : public CommonSampleComponentBase
  27. , public AZ::TickBus::Handler
  28. {
  29. public:
  30. AZ_COMPONENT(DecalExampleComponent, "{91CFCFFC-EDD9-47EB-AE98-4BE9617D6F2F}", CommonSampleComponentBase);
  31. static void Reflect(AZ::ReflectContext* context);
  32. void Activate() override;
  33. void Deactivate() override;
  34. private:
  35. // AZ::TickBus::Handler
  36. void OnTick(float deltaTime, AZ::ScriptTimePoint timePoint) override;
  37. void CreateDecalContainer();
  38. void CreatePlaneObject();
  39. void ScaleObjectToFitDecals();
  40. void EnableArcBallCameraController();
  41. void ConfigureCameraToLookDownAtObject();
  42. void AddImageBasedLight();
  43. void DrawSidebar();
  44. AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
  45. Utils::DefaultIBL m_defaultIbl;
  46. AZStd::unique_ptr<DecalContainer> m_decalContainer;
  47. ImGuiSidebar m_imguiSidebar;
  48. // CommonSampleComponentBase overrides...
  49. void OnAllAssetsReadyActivate() override;
  50. };
  51. } // namespace AtomSampleViewer