X-Git-Url: http://git.mutantstargoat.com?p=faros-demo;a=blobdiff_plain;f=src%2Ftrack.h;fp=src%2Ftrack.h;h=b80562ee2df2351680ee1b195f231ffb90fb8166;hp=0000000000000000000000000000000000000000;hb=d60954c471d6f446523bad8c4c4860aa2138da1e;hpb=6917510e2aff5fa6599065c684a344a24e42123d diff --git a/src/track.h b/src/track.h new file mode 100644 index 0000000..b80562e --- /dev/null +++ b/src/track.h @@ -0,0 +1,45 @@ +#ifndef TRACK_H_ +#define TRACK_H_ + +#include + +enum InterpMode { + INTERP_STEP, + INTERP_LINEAR, + INTERP_SIGMOID +}; + +enum ExtrapMode { + EXTRAP_CLAMP, + EXTRAP_REPEAT +}; + +struct TrackKey { + long time; + float value; +}; + +class Track { +private: + std::vector keys; + mutable bool keys_sorted; + + int get_interval(long tm) const; + +public: + InterpMode interp; + ExtrapMode extrap; + float defval; + + Track(); + + void clear(); + + void set_key(long tm, float val); + float get_key(long tm) const; + int find_key(long tm) const; + + float operator ()(long tm) const; +}; + +#endif /* TRACK_H_ */