update framehistory to use nanosecond timestamps

This commit is contained in:
Konstantin Käfer
2014-04-30 14:25:57 +02:00
parent 4afe20776d
commit 52cd9a6561
4 changed files with 23 additions and 20 deletions

View File

@@ -1,3 +1,4 @@
#ifndef LLMR_MAP_MAP
#define LLMR_MAP_MAP
@@ -89,6 +90,7 @@ public:
inline const Style &getStyle() const { return style; }
inline GlyphAtlas &getGlyphAtlas() { return glyphAtlas; }
inline uv_loop_t *getLoop() { return loop; }
inline time getAnimationTime() const { return animationTime; }
private:
// uv async callbacks

View File

@@ -6,21 +6,22 @@
#include <cmath>
#include <llmr/platform/platform.hpp>
#include <llmr/util/time.hpp>
namespace llmr {
struct FrameSnapshot {
explicit inline FrameSnapshot(float time, float z) : time(time), z(z) {}
float time;
explicit inline FrameSnapshot(time timestamp, float z) : timestamp(timestamp), z(z) {}
float timestamp;
float z;
};
class FrameHistory {
public:
// Record frame history that will be used to calculate fading params
void record(float zoom);
void record(time now, float zoom);
bool needsAnimation(float duration) const;
bool needsAnimation(time duration) const;
public:
std::deque<FrameSnapshot> history;