update framehistory to use nanosecond timestamps
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user