SkinnedMeshExampleComponent.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 <CommonSampleComponentBase.h>
  10. #include <SkinnedMeshContainer.h>
  11. #include <AzCore/Component/EntityBus.h>
  12. #include <AzCore/Component/TickBus.h>
  13. #include <AzFramework/Input/Events/InputChannelEventListener.h>
  14. #include <AtomCore/Instance/Instance.h>
  15. #include <Utils/Utils.h>
  16. #include <Utils/ImGuiSidebar.h>
  17. namespace AZ::RPI
  18. {
  19. class Model;
  20. class Buffer;
  21. }
  22. namespace AZ::Render
  23. {
  24. class SkinnedMeshInputBuffers;
  25. }
  26. namespace AtomSampleViewer
  27. {
  28. class ProceduralSkinnedMesh;
  29. //! This component creates a simple scene to test Atom's SkinnedMesh system.
  30. class SkinnedMeshExampleComponent final
  31. : public CommonSampleComponentBase
  32. , private AZ::TickBus::Handler
  33. {
  34. public:
  35. AZ_COMPONENT(SkinnedMeshExampleComponent, "{76549B8B-EF34-4B0B-A11C-87A3EB31E4B5}", CommonSampleComponentBase);
  36. static void Reflect(AZ::ReflectContext* context);
  37. void Activate() override;
  38. void Deactivate() override;
  39. private:
  40. // AZ::TickBus::Handler
  41. void OnTick(float deltaTime, AZ::ScriptTimePoint timePoint) override;
  42. void CreateSkinnedMeshContainer();
  43. void CreatePlaneObject();
  44. void ConfigureCamera();
  45. void AddImageBasedLight();
  46. void DrawSidebar();
  47. Utils::DefaultIBL m_defaultIbl;
  48. AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_planeMeshHandle;
  49. ImGuiSidebar m_imguiSidebar;
  50. float m_fixedAnimationTime = 0.0f;
  51. float m_runTime = 0.0f;
  52. bool m_useFixedTime = false;
  53. bool m_useOutOfSyncBoneAnimation = false;
  54. bool m_drawBones = true;
  55. AZStd::unique_ptr<SkinnedMeshContainer> m_skinnedMeshContainer;
  56. };
  57. } // namespace AtomSampleViewer