metaforce/Runtime/Character/CCharAnimTime.hpp

53 lines
1.6 KiB
C++
Raw Normal View History

2016-04-13 06:07:23 +00:00
#ifndef __URDE_CCHARANIMTIME_HPP__
#define __URDE_CCHARANIMTIME_HPP__
2015-08-18 05:54:43 +00:00
2016-04-11 07:10:28 +00:00
#include "IOStreams.hpp"
2016-04-11 03:59:54 +00:00
2016-03-04 23:04:53 +00:00
namespace urde
2015-08-18 05:54:43 +00:00
{
class CCharAnimTime
{
2016-02-27 06:03:39 +00:00
float m_time = 0.f;
2016-04-11 03:59:54 +00:00
enum class Type
{
NonZero,
ZeroIncreasing,
ZeroSteady,
ZeroDecreasing,
Infinity
} m_type = Type::ZeroSteady;
public:
2016-02-27 06:03:39 +00:00
CCharAnimTime() = default;
2016-04-11 07:10:28 +00:00
CCharAnimTime(CInputStream& in)
: m_time(in.readFloatBig()),
m_type(Type(in.readUint32Big())) {}
CCharAnimTime(float time)
: m_time(time),
2016-04-11 03:59:54 +00:00
m_type(m_time != 0.f ? Type::NonZero : Type::ZeroSteady) {}
static CCharAnimTime Infinity();
operator float() const {return m_time;}
bool EqualsZero() const;
2016-08-21 20:39:18 +00:00
bool EpsilonZero() const;
2016-04-11 03:59:54 +00:00
bool GreaterThanZero() const;
bool operator ==(const CCharAnimTime& other) const;
bool operator !=(const CCharAnimTime& other) const;
bool operator>=(const CCharAnimTime& other);
bool operator<=(const CCharAnimTime& other);
bool operator >(const CCharAnimTime& other) const;
bool operator <(const CCharAnimTime& other) const;
CCharAnimTime& operator*=(const CCharAnimTime& other);
CCharAnimTime& operator+=(const CCharAnimTime& other);
CCharAnimTime operator+(const CCharAnimTime& other);
CCharAnimTime& operator-=(const CCharAnimTime& other);
CCharAnimTime operator-(const CCharAnimTime& other);
CCharAnimTime operator*(const CCharAnimTime& other);
CCharAnimTime operator*(const float& other);
float operator/(const CCharAnimTime& other);
};
2015-08-18 05:54:43 +00:00
}
2016-04-13 06:07:23 +00:00
#endif // __URDE_CCHARANIMTIME_HPP__