2016-04-11 03:59:54 +00:00
|
|
|
#include "CTimeScaleFunctions.hpp"
|
|
|
|
#include "CCharAnimTime.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
|
|
|
std::shared_ptr<IVaryingAnimationTimeScale> IVaryingAnimationTimeScale::Clone() const
|
|
|
|
{
|
|
|
|
return VClone();
|
|
|
|
}
|
|
|
|
|
2017-07-02 10:18:38 +00:00
|
|
|
float CConstantAnimationTimeScale::VTimeScaleIntegral(const float& a, const float& b) const { return (b - a) * x4_; }
|
|
|
|
float CConstantAnimationTimeScale::VFindUpperLimit(const float& a, const float& b) const { return (b / x4_) + a; }
|
2016-04-11 03:59:54 +00:00
|
|
|
|
|
|
|
std::shared_ptr<IVaryingAnimationTimeScale> CConstantAnimationTimeScale::VClone() const
|
|
|
|
{
|
2017-07-02 10:18:38 +00:00
|
|
|
CConstantAnimationTimeScale* ret = new CConstantAnimationTimeScale(x4_);
|
|
|
|
return std::shared_ptr<IVaryingAnimationTimeScale>(ret);
|
2016-04-11 03:59:54 +00:00
|
|
|
}
|
|
|
|
|
2017-07-02 10:18:38 +00:00
|
|
|
std::shared_ptr<IVaryingAnimationTimeScale> CConstantAnimationTimeScale::VGetFunctionMirrored(const float&) const
|
2016-04-11 03:59:54 +00:00
|
|
|
{
|
2017-07-02 10:18:38 +00:00
|
|
|
return Clone();
|
2016-04-11 03:59:54 +00:00
|
|
|
}
|
2017-07-02 10:18:38 +00:00
|
|
|
float CLinearAnimationTimeScale::VTimeScaleIntegral(const float&, const float&) const
|
2016-04-11 03:59:54 +00:00
|
|
|
{
|
2017-07-02 10:18:38 +00:00
|
|
|
return 0.f;
|
2016-04-11 03:59:54 +00:00
|
|
|
}
|
|
|
|
|
2017-07-02 10:18:38 +00:00
|
|
|
float CLinearAnimationTimeScale::TimeScaleIntegralWithSortedLimits(const CFunctionDescription& desc,
|
2016-04-11 03:59:54 +00:00
|
|
|
const float&, const float&)
|
|
|
|
{
|
2017-07-02 10:18:38 +00:00
|
|
|
return 0.f;
|
2016-04-11 03:59:54 +00:00
|
|
|
}
|
|
|
|
|
2017-07-02 10:18:38 +00:00
|
|
|
float CLinearAnimationTimeScale::VFindUpperLimit(const float&, const float&) const
|
2016-04-11 03:59:54 +00:00
|
|
|
{
|
2017-07-02 10:18:38 +00:00
|
|
|
return 0.f;
|
2016-04-11 03:59:54 +00:00
|
|
|
}
|
|
|
|
|
2017-07-02 10:18:38 +00:00
|
|
|
float CLinearAnimationTimeScale::FindUpperLimitFromRoot(const CFunctionDescription& desc,
|
2016-04-11 03:59:54 +00:00
|
|
|
const float&, const float&)
|
|
|
|
{
|
2017-07-02 10:18:38 +00:00
|
|
|
return 0.f;
|
2016-04-11 03:59:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::shared_ptr<IVaryingAnimationTimeScale> CLinearAnimationTimeScale::VClone() const
|
|
|
|
{
|
|
|
|
CCharAnimTime timeA(x10_);
|
|
|
|
CCharAnimTime timeB(xc_);
|
|
|
|
|
|
|
|
CLinearAnimationTimeScale* ret = new CLinearAnimationTimeScale();
|
|
|
|
float f30 = x4_ * xc_ + x8_;
|
2017-07-10 04:55:51 +00:00
|
|
|
ret->x4_ = (x4_ * x10_ + x8_ - f30) / timeB.GetSeconds();
|
|
|
|
ret->x8_ = -((x4_ * x10_ + x8_ - f30) / (timeA - timeB).GetSeconds() * timeB.GetSeconds() - f30);
|
|
|
|
ret->xc_ = timeB.GetSeconds();
|
|
|
|
ret->x10_ = timeA.GetSeconds();
|
2016-04-11 03:59:54 +00:00
|
|
|
|
|
|
|
return std::shared_ptr<IVaryingAnimationTimeScale>(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::shared_ptr<IVaryingAnimationTimeScale>
|
|
|
|
CLinearAnimationTimeScale::VGetFunctionMirrored(const float& parm) const
|
|
|
|
{
|
|
|
|
float f27 = -(x4_ * parm * 2.f - x8_);
|
|
|
|
float f31 = -x4_ * parm * 2.f - x10_ + f27;
|
|
|
|
CCharAnimTime timeA(2.f * parm - xc_);
|
|
|
|
CCharAnimTime timeB(2.f * parm - x10_);
|
|
|
|
|
|
|
|
CLinearAnimationTimeScale* ret = new CLinearAnimationTimeScale();
|
2017-07-10 04:55:51 +00:00
|
|
|
ret->x4_ = (-x4_ * 2.f * parm - xc_ + f27 - f31) / (timeA - timeB).GetSeconds();
|
|
|
|
ret->x8_ = -(((-x4_ * 2.f * parm - xc_ + f27 - f31) /
|
|
|
|
(timeA - timeB).GetSeconds()) * timeB.GetSeconds() - f31);
|
|
|
|
ret->xc_ = timeB.GetSeconds();
|
|
|
|
ret->x10_ = timeA.GetSeconds();
|
2016-04-11 03:59:54 +00:00
|
|
|
|
|
|
|
return std::shared_ptr<IVaryingAnimationTimeScale>(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|