From 34be850afbbacb0e283410b1eb084116dc95dca1 Mon Sep 17 00:00:00 2001 From: GPayne Date: Mon, 28 Jun 2021 21:06:54 -0600 Subject: [PATCH 01/47] Potential fix for pause during playback-with-screenshots --- src/interaction/sessionrecording.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index 052f10c90c..5ae52a2bbb 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -1773,12 +1773,10 @@ void SessionRecording::moveAheadInTime() { global::navigationHandler->orbitalNavigator().anchorNode(); const Renderable* focusRenderable = focusNode->renderable(); if (!focusRenderable || focusRenderable->renderedWithDesiredData()) { - if (!paused) { - _saveRenderingCurrentRecordedTime_interpolation += - _saveRenderingDeltaTime_interpolation_usec; - _saveRenderingCurrentRecordedTime += _saveRenderingDeltaTime; - global::renderEngine->takeScreenshot(); - } + _saveRenderingCurrentRecordedTime_interpolation += + _saveRenderingDeltaTime_interpolation_usec; + saveRenderingCurrentRecordedTime += _saveRenderingDeltaTime; + global::renderEngine->takeScreenshot(); } } } From 24b48734c861997d37343f3a1071173683aadf40 Mon Sep 17 00:00:00 2001 From: GPayne Date: Tue, 29 Jun 2021 08:44:52 -0600 Subject: [PATCH 02/47] Fixed a typo that slipped in --- src/interaction/sessionrecording.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index 5ae52a2bbb..12db50a73f 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -1775,7 +1775,7 @@ void SessionRecording::moveAheadInTime() { if (!focusRenderable || focusRenderable->renderedWithDesiredData()) { _saveRenderingCurrentRecordedTime_interpolation += _saveRenderingDeltaTime_interpolation_usec; - saveRenderingCurrentRecordedTime += _saveRenderingDeltaTime; + _saveRenderingCurrentRecordedTime += _saveRenderingDeltaTime; global::renderEngine->takeScreenshot(); } } From 8226c9d8d005fdfd1ac0c164d52b7f48b30df723 Mon Sep 17 00:00:00 2001 From: GPayne Date: Tue, 6 Jul 2021 19:24:27 -0600 Subject: [PATCH 03/47] Added code from Emma to allow pausing during playback-with-frames --- src/interaction/sessionrecording.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index 5a3ceb57cb..6a0a80064f 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -1771,7 +1771,8 @@ void SessionRecording::moveAheadInTime() { using namespace std::chrono; bool paused = global::timeManager->isPaused(); - if (_state == SessionState::PlaybackPaused) { + bool playbackPaused = (_state == SessionState::PlaybackPaused); + if (playbackPaused) { _playbackPauseOffset += global::windowDelegate->applicationTime() - _previousTime; } @@ -1793,10 +1794,12 @@ void SessionRecording::moveAheadInTime() { global::navigationHandler->orbitalNavigator().anchorNode(); const Renderable* focusRenderable = focusNode->renderable(); if (!focusRenderable || focusRenderable->renderedWithDesiredData()) { - _saveRenderingCurrentRecordedTime_interpolation += - _saveRenderingDeltaTime_interpolation_usec; - _saveRenderingCurrentRecordedTime += _saveRenderingDeltaTime; - global::renderEngine->takeScreenshot(); + if (!playbackPaused) { + _saveRenderingCurrentRecordedTime_interpolation += + _saveRenderingDeltaTime_interpolation_usec; + _saveRenderingCurrentRecordedTime += _saveRenderingDeltaTime; + global::renderEngine->takeScreenshot(); + } } } } From 14af0e5a93ac37d69b7b5be72889fd313aa555a6 Mon Sep 17 00:00:00 2001 From: GPayne Date: Sun, 11 Jul 2021 14:43:54 -0600 Subject: [PATCH 04/47] Time manager uses simulated application time during playback-with-frames --- .../openspace/interaction/sessionrecording.h | 14 +++++++++++ include/openspace/scene/scene.h | 2 +- include/openspace/util/timemanager.h | 1 + src/interaction/sessionrecording.cpp | 9 +++++++ src/scene/scene.cpp | 24 +++++++++---------- src/util/timemanager.cpp | 21 ++++++++++++---- 6 files changed, 53 insertions(+), 18 deletions(-) diff --git a/include/openspace/interaction/sessionrecording.h b/include/openspace/interaction/sessionrecording.h index 6e7167e8b3..bc3adea797 100644 --- a/include/openspace/interaction/sessionrecording.h +++ b/include/openspace/interaction/sessionrecording.h @@ -145,6 +145,19 @@ public: */ std::chrono::steady_clock::time_point currentPlaybackInterpolationTime() const; + /** + * Returns the simulated application time. This simulated application time is only + * used when playback is set to be in the mode where a screenshot is captured with + * every rendered frame (enableTakeScreenShotDuringPlayback() is used to enable this + * mode). At the start of playback, this timer is set to the value of the current + * applicationTime function provided by the window delegate (used during normal + * mode or playback). However, during playback it is incremented by the fixed + * framerate of the playback rather than the actual clock value. + * + * \returns application time in seconds, for use in playback-with-frames mode + */ + double currentApplicationInterpolationTime() const; + /** * Starts a recording session, which will save data to the provided filename * according to the data format specified, and will continue until recording is @@ -719,6 +732,7 @@ protected: double _saveRenderingCurrentRecordedTime; std::chrono::steady_clock::duration _saveRenderingDeltaTime_interpolation_usec; std::chrono::steady_clock::time_point _saveRenderingCurrentRecordedTime_interpolation; + double _saveRenderingCurrentApplicationTime_interpolation; long long _saveRenderingClockInterpolation_countsPerSec; bool _saveRendering_isFirstFrame = true; diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index fc22f6d1e2..f1a03be8e5 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -238,7 +238,7 @@ private: * Update dependencies. */ void updateNodeRegistry(); - + std::chrono::steady_clock::time_point currentTimeForInterpolation(); void sortTopologically(); std::unique_ptr _camera; diff --git a/include/openspace/util/timemanager.h b/include/openspace/util/timemanager.h index d7500939c6..a67bcef09b 100644 --- a/include/openspace/util/timemanager.h +++ b/include/openspace/util/timemanager.h @@ -127,6 +127,7 @@ private: void addDeltaTimesKeybindings(); void clearDeltaTimesKeybindings(); + double currentApplicationTimeForInterpolation() const; Timeline _timeline; SyncData