Added my seq file with an animation for the lighthouse
[faros-demo] / src / track.h
1 #ifndef TRACK_H_
2 #define TRACK_H_
3
4 #include <vector>
5
6 enum InterpMode {
7         INTERP_STEP,
8         INTERP_LINEAR,
9         INTERP_SIGMOID
10 };
11
12 enum ExtrapMode {
13         EXTRAP_CLAMP,
14         EXTRAP_REPEAT
15 };
16
17 struct TrackKey {
18         long time;
19         float value;
20 };
21
22 class Track {
23 private:
24         std::vector<TrackKey> keys;
25         mutable bool keys_sorted;
26
27         int get_interval(long tm) const;
28
29 public:
30         InterpMode interp;
31         ExtrapMode extrap;
32         float defval;
33
34         Track();
35
36         void clear();
37         bool empty() const;
38
39         int get_num_keys() const;
40
41         const TrackKey &operator [](int idx) const;
42         TrackKey &operator [](int idx);
43
44         void set_value(long tm, float val);
45         float get_value(long tm) const;
46         int find_key(long tm) const;
47
48         float operator ()(long tm) const;
49 };
50
51 #endif  /* TRACK_H_ */