JoltViewer.h 1.1 KB

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