Lerp no longer fail when interpolation is not in range [0..1]

Former-commit-id: b9d4179cbd82f709695719dbc47f9d0f9d98841e
This commit is contained in:
Lynix 2013-12-20 19:59:28 +01:00
parent b7a0bf22f6
commit a560a16ef3
1 changed files with 2 additions and 10 deletions

View File

@ -26,12 +26,7 @@ T NzApproach(T value, T objective, T increment)
template<typename T>
T NzClamp(T value, T min, T max)
{
if (value < min)
return min;
else if (value > max)
return max;
else
return value;
return std::max(std::min(value, max), min);
}
template<typename T>
@ -186,10 +181,7 @@ T NzLerp(T from, T to, T2 interpolation)
{
#ifdef NAZARA_DEBUG
if (interpolation < F2(0.0) || interpolation > F2(1.0))
{
NazaraError("Interpolation must be in range [0..1] (Got " + NzString::Number(interpolation) + ')');
return F(0.0);
}
NazaraWarning("Interpolation should be in range [0..1] (Got " + NzString::Number(interpolation) + ')');
#endif
return from + interpolation*(to - from);