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:
|
|
|
|
FCycler();
|
|
|
|
void Update(float diff);
|
2016-12-23 14:25:39 +00:00
|
|
|
void SetParams(float start, float end, float 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; }
|
|
|
|
float GetVal() { return m_current; }
|
|
|
|
|
|
|
|
inline operator float () const { return m_current; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
float m_start, m_end, m_current;
|
|
|
|
float m_time, m_cycle;
|
|
|
|
bool m_increment, m_shouldCycle;
|
|
|
|
|
|
|
|
CycleType m_cycleType;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|