mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
Revert "- Use std::fma()
in the interpolation code."
This reverts commit ff7e0afa6f
.
On Visual Studio with precise math, which is our main target this generates a very expensive function call instead of optimized assembly which renders the function's purpose ad absurdum.
This commit is contained in:
parent
3444991e4e
commit
2290f05dcb
1 changed files with 6 additions and 18 deletions
|
@ -41,7 +41,7 @@
|
|||
#define VECTORS_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <cmath>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <string.h>
|
||||
#include "xs_Float.h"
|
||||
|
@ -1548,27 +1548,15 @@ inline TVector2<T> clamp(const TVector2<T> &vec, const TVector2<T> &min, const T
|
|||
}
|
||||
|
||||
template<class T>
|
||||
inline T interpolatedvalue(const T oval, const T val, const double interpfrac)
|
||||
inline TAngle<T> interpolatedvalue(const TAngle<T> &oang, const TAngle<T> &ang, const double interpfrac)
|
||||
{
|
||||
return std::fma(interpfrac, val, std::fma(-interpfrac, oval, oval));
|
||||
return oang + (deltaangle(oang, ang) * interpfrac);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline TVector2<T> interpolatedvalue(const TVector2<T>& oval, const TVector2<T>& val, const double interpfrac)
|
||||
template <class T>
|
||||
inline T interpolatedvalue(const T& oval, const T& val, const double interpfrac)
|
||||
{
|
||||
return { interpolatedvalue(oval.X, val.X, interpfrac), interpolatedvalue(oval.Y, val.Y, interpfrac) };
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline TVector3<T> interpolatedvalue(const TVector3<T>& oval, const TVector3<T>& val, const double interpfrac)
|
||||
{
|
||||
return { interpolatedvalue(oval.X, val.X, interpfrac), interpolatedvalue(oval.Y, val.Y, interpfrac), interpolatedvalue(oval.Z, val.Z, interpfrac) };
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline TAngle<T> interpolatedvalue(const TAngle<T> oang, const TAngle<T> ang, const double interpfrac)
|
||||
{
|
||||
return TAngle<T>::fromDeg(interpolatedvalue(oang.Degrees(), (oang + deltaangle(oang, ang)).Degrees(), interpfrac));
|
||||
return T(oval + (val - oval) * interpfrac);
|
||||
}
|
||||
|
||||
// Much of this is copied from TVector3. Is all that functionality really appropriate?
|
||||
|
|
Loading…
Reference in a new issue