TransparencyExampleComponent.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 <AzCore/Component/TickBus.h>
  10. #include <CommonSampleComponentBase.h>
  11. #include <Utils/Utils.h>
  12. namespace AtomSampleViewer
  13. {
  14. //! Depth sort testing for Transparency object
  15. class TransparencyExampleComponent final
  16. : public CommonSampleComponentBase
  17. , public AZ::TickBus::Handler
  18. {
  19. public:
  20. AZ_COMPONENT(TransparencyExampleComponent, "{36988524-5911-45F1-970C-32C889BAB1F1}", CommonSampleComponentBase);
  21. static void Reflect(AZ::ReflectContext* context);
  22. TransparencyExampleComponent();
  23. ~TransparencyExampleComponent() override = default;
  24. void Activate() override;
  25. void Deactivate() override;
  26. private:
  27. AZ_DISABLE_COPY_MOVE(TransparencyExampleComponent);
  28. // AZ::TickBus::Handler overrides...
  29. void OnTick(float deltaTime, AZ::ScriptTimePoint scriptTime) override;
  30. void Prepare();
  31. void LoadMesh(AZ::Transform transform);
  32. AZ::Data::Asset<AZ::RPI::ModelAsset> m_modelAsset;
  33. AZ::Data::Asset<AZ::RPI::MaterialAsset> m_materialAsset;
  34. AZStd::vector<AZ::Render::MeshFeatureProcessorInterface::MeshHandle> m_meshHandles;
  35. AZStd::vector<AZ::Render::MeshFeatureProcessorInterface::ModelChangedEvent::Handler> m_meshLoadEventHandlers;
  36. Utils::DefaultIBL m_defaultIbl;
  37. bool m_waitingForMeshes = false;
  38. uint32_t m_loadedMeshCounter = 0;
  39. float total = 0;
  40. };
  41. } // namespace AtomSampleViewer