Eliminate duplicate frames at time transitions when saving screenshot frames during playback

This commit is contained in:
GPayne
2021-07-19 23:33:10 -06:00
parent e866a7da9e
commit 892adf62bf
4 changed files with 52 additions and 7 deletions

View File

@@ -95,6 +95,16 @@ bool compareTimeWithKeyframeTime(double a, const KeyframeBase& b);
*/
bool compareKeyframeTimeWithTime(const KeyframeBase& a, double b);
/**
* Return true if the timestamp of a is smaller than or equal to b.
* This is used only in the mode of saving render frames during session recording
* playback. This was necessary to correct a small timing issue caused by fixing
* the application time according to the playback framerate. In normal operation,
* the application time at the instant the keyframes are evaluated is always a
* little bit newer than the first keyframe in the timeline.
*/
bool compareKeyframeTimeWithTime_playbackWithFrames(const KeyframeBase& a, double b);
} // namespace openspace
#include "timeline.inl"

View File

@@ -121,13 +121,14 @@ public:
private:
void progressTime(double dt);
void applyKeyframeData(const TimeKeyframeData& keyframe);
void applyKeyframeData(const TimeKeyframeData& keyframe, double dt);
TimeKeyframeData interpolate(const Keyframe<TimeKeyframeData>& past,
const Keyframe<TimeKeyframeData>& future, double time);
void addDeltaTimesKeybindings();
void clearDeltaTimesKeybindings();
double currentApplicationTimeForInterpolation() const;
double previousApplicationTimeForInterpolation() const;
Timeline<TimeKeyframeData> _timeline;
SyncData<Time> _currentTime;
@@ -140,6 +141,7 @@ private:
bool _lastTimePaused = false;
double _lastDeltaTime = 0.0;
double _lastTargetDeltaTime = 0.0;
double _previousApplicationTime = 0.0;
bool _deltaTimeStepsChanged = false;
std::vector<double> _deltaTimeSteps;