2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CTIMESCALEFUNCTIONS_HPP__
|
|
|
|
#define __URDE_CTIMESCALEFUNCTIONS_HPP__
|
2016-04-11 03:59:54 +00:00
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
|
|
|
enum class EVaryingAnimationTimeScaleType
|
|
|
|
{
|
|
|
|
Constant,
|
|
|
|
Linear
|
|
|
|
};
|
|
|
|
|
|
|
|
class IVaryingAnimationTimeScale
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~IVaryingAnimationTimeScale() = default;
|
|
|
|
virtual EVaryingAnimationTimeScaleType GetType() const=0;
|
2017-07-02 10:18:38 +00:00
|
|
|
virtual float VTimeScaleIntegral(const float&, const float&) const=0;
|
|
|
|
virtual float VFindUpperLimit(const float&, const float&) const=0;
|
2016-04-11 03:59:54 +00:00
|
|
|
virtual std::shared_ptr<IVaryingAnimationTimeScale> VClone() const=0;
|
|
|
|
virtual std::shared_ptr<IVaryingAnimationTimeScale> VGetFunctionMirrored(const float&) const=0;
|
|
|
|
std::shared_ptr<IVaryingAnimationTimeScale> Clone() const;
|
|
|
|
};
|
|
|
|
|
2017-07-02 10:18:38 +00:00
|
|
|
class CConstantAnimationTimeScale : public IVaryingAnimationTimeScale
|
2016-04-11 03:59:54 +00:00
|
|
|
{
|
2017-07-02 10:18:38 +00:00
|
|
|
private:
|
|
|
|
float x4_;
|
2016-04-11 03:59:54 +00:00
|
|
|
public:
|
2017-07-02 10:18:38 +00:00
|
|
|
CConstantAnimationTimeScale(float f) : x4_(f) {}
|
|
|
|
|
|
|
|
EVaryingAnimationTimeScaleType GetType() const { return EVaryingAnimationTimeScaleType::Constant; }
|
|
|
|
float VTimeScaleIntegral(const float &, const float &) const;
|
|
|
|
float VFindUpperLimit(const float &, const float &) const;
|
2016-04-11 03:59:54 +00:00
|
|
|
std::shared_ptr<IVaryingAnimationTimeScale> VClone() const;
|
2017-07-02 10:18:38 +00:00
|
|
|
std::shared_ptr<IVaryingAnimationTimeScale> VGetFunctionMirrored(const float &) const;
|
2016-04-11 03:59:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CLinearAnimationTimeScale : public IVaryingAnimationTimeScale
|
|
|
|
{
|
|
|
|
float x4_;
|
|
|
|
float x8_;
|
|
|
|
float xc_;
|
|
|
|
float x10_;
|
|
|
|
public:
|
|
|
|
struct CFunctionDescription
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
EVaryingAnimationTimeScaleType GetType() const {return EVaryingAnimationTimeScaleType::Linear;}
|
2017-07-02 10:18:38 +00:00
|
|
|
float VTimeScaleIntegral(const float&, const float&) const;
|
|
|
|
float TimeScaleIntegralWithSortedLimits(const CFunctionDescription& desc, const float&, const float&);
|
|
|
|
float VFindUpperLimit(const float&, const float&) const;
|
|
|
|
float FindUpperLimitFromRoot(const CFunctionDescription& desc, const float&, const float&);
|
2016-04-11 03:59:54 +00:00
|
|
|
std::shared_ptr<IVaryingAnimationTimeScale> VClone() const;
|
|
|
|
std::shared_ptr<IVaryingAnimationTimeScale> VGetFunctionMirrored(const float&) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CTIMESCALEFUNCTIONS_HPP__
|