summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/frame_history.hpp
blob: 8f6c06a697463373f7c00ee8df4815df1fedb0bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef MBGL_RENDERER_FRAME_HISTORY
#define MBGL_RENDERER_FRAME_HISTORY

#include <deque>
#include <cassert>
#include <cmath>

#include <mbgl/platform/platform.hpp>
#include <mbgl/util/chrono.hpp>

namespace mbgl {

struct FrameSnapshot {
    explicit inline FrameSnapshot(TimePoint now_, float z_) : now(now_), z(z_) {}
    const TimePoint now;
    float z;
};

struct FadeProperties {
    float fadedist;
    float minfadezoom;
    float maxfadezoom;
    float bump;
};

class FrameHistory {
public:
    // Record frame history that will be used to calculate fading params
    void record(TimePoint now, float zoom);

    bool needsAnimation(const Duration& duration) const;
    FadeProperties getFadeProperties(TimePoint now, const Duration& duration);

public:
    std::deque<FrameSnapshot> history;
};

} // namespace mbgl

#endif