JoltViewer.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. #include <Application/Application.h>
  5. #ifdef JPH_DEBUG_RENDERER
  6. #include <Jolt/Renderer/DebugRendererPlayback.h>
  7. #else
  8. // Hack to still compile DebugRenderer inside the test framework when Jolt is compiled without
  9. #define JPH_DEBUG_RENDERER
  10. #include <Jolt/Renderer/DebugRendererPlayback.h>
  11. #undef JPH_DEBUG_RENDERER
  12. #endif
  13. using namespace std;
  14. // Application that views recordings produced by DebugRendererRecorder
  15. class JoltViewer : public Application
  16. {
  17. public:
  18. // Constructor / destructor
  19. JoltViewer();
  20. // Render the frame
  21. virtual bool RenderFrame(float inDeltaTime) override;
  22. private:
  23. enum class EPlaybackMode
  24. {
  25. Rewind,
  26. StepBack,
  27. Stop,
  28. StepForward,
  29. Play
  30. };
  31. DebugRendererPlayback mRendererPlayback { *mDebugRenderer };
  32. EPlaybackMode mPlaybackMode = EPlaybackMode::Play; // Current playback state. Indicates if we're playing or scrubbing back/forward.
  33. uint mCurrentFrame = 0;
  34. };