2013-06-23 07:49:34 +00:00
|
|
|
#ifndef __GL_CYCLER_H
|
|
|
|
#define __GL_CYCLER_H
|
|
|
|
|
2016-09-23 23:47:44 +00:00
|
|
|
class FSerializer;
|
2013-06-23 07:49:34 +00:00
|
|
|
|
2016-09-23 23:47:44 +00:00
|
|
|
enum CycleType
|
2013-06-23 07:49:34 +00:00
|
|
|
{
|
2016-09-23 23:47:44 +00:00
|
|
|
CYCLE_Linear,
|
|
|
|
CYCLE_Sin,
|
|
|
|
CYCLE_Cos,
|
|
|
|
CYCLE_SawTooth,
|
|
|
|
CYCLE_Square
|
|
|
|
};
|
2013-06-23 07:49:34 +00:00
|
|
|
|
2016-09-23 23:47:44 +00:00
|
|
|
class FCycler;
|
|
|
|
FSerializer &Serialize(FSerializer &arc, const char *key, FCycler &c, FCycler *def);
|
2013-06-23 07:49:34 +00:00
|
|
|
|
|
|
|
class FCycler
|
|
|
|
{
|
2016-09-23 23:47:44 +00:00
|
|
|
friend FSerializer &Serialize(FSerializer &arc, const char *key, FCycler &c, FCycler *def);
|
|
|
|
|
2013-06-23 07:49:34 +00:00
|
|
|
public:
|
2019-09-09 07:52:33 +00:00
|
|
|
FCycler() = default;
|
|
|
|
FCycler(const FCycler &other) = default;
|
|
|
|
FCycler &operator=(const FCycler &other) = default;
|
|
|
|
|
2017-03-12 15:56:00 +00:00
|
|
|
void Update(double diff);
|
|
|
|
void SetParams(double start, double end, double cycle, bool update = false);
|
2013-06-23 07:49:34 +00:00
|
|
|
void ShouldCycle(bool sc) { m_shouldCycle = sc; }
|
|
|
|
void SetCycleType(CycleType ct) { m_cycleType = ct; }
|
2017-03-12 15:56:00 +00:00
|
|
|
double GetVal() { return m_current; }
|
2013-06-23 07:49:34 +00:00
|
|
|
|
2017-03-12 15:56:00 +00:00
|
|
|
inline operator double () const { return m_current; }
|
2019-09-09 07:52:33 +00:00
|
|
|
|
2017-03-12 15:56:00 +00:00
|
|
|
double m_start, m_end, m_current;
|
|
|
|
double m_time, m_cycle;
|
2013-06-23 07:49:34 +00:00
|
|
|
bool m_increment, m_shouldCycle;
|
|
|
|
|
|
|
|
CycleType m_cycleType;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|