PreviewRendererCaptureState.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 <Atom/Feature/Utils/FrameCaptureBus.h>
  10. #include <PreviewRenderer/PreviewRendererState.h>
  11. namespace AtomToolsFramework
  12. {
  13. //! PreviewRendererCaptureState renders a preview to an image
  14. class PreviewRendererCaptureState final
  15. : public PreviewRendererState
  16. , public AZ::Render::FrameCaptureNotificationBus::Handler
  17. {
  18. public:
  19. PreviewRendererCaptureState(PreviewRenderer* renderer);
  20. ~PreviewRendererCaptureState();
  21. void Update() override;
  22. private:
  23. //! AZ::Render::FrameCaptureNotificationBus::Handler overrides...
  24. void OnFrameCaptureFinished(AZ::Render::FrameCaptureResult result, const AZStd::string& info) override;
  25. //! Track the amount of time since the capture request was initiated
  26. AZStd::chrono::steady_clock::time_point m_startTime = AZStd::chrono::steady_clock::now();
  27. AZStd::chrono::steady_clock::time_point m_captureTime = AZStd::chrono::steady_clock::now() + AZStd::chrono::milliseconds(5);
  28. AZStd::chrono::steady_clock::time_point m_abortTime = AZStd::chrono::steady_clock::now() + AZStd::chrono::milliseconds(5000);
  29. bool m_captureComplete = false;
  30. };
  31. } // namespace AtomToolsFramework