Templated the Lerp color operator to allow use with double...

This commit is contained in:
Paolo Cignoni 2014-06-24 08:46:49 +00:00
parent eb642099f1
commit 01ab3c4e68
1 changed files with 69 additions and 68 deletions

View File

@ -104,8 +104,8 @@ public:
return Color4( (*this)[0]+p.V()[0], (*this)[1]+p.V()[1], (*this)[2]+p.V()[2], (*this)[3]+p.V()[3] );
}
inline void lerp(const Color4 &c0, const Color4 &c1, const float x)
template <class ScalarInterpType>
inline void lerp(const Color4 &c0, const Color4 &c1, const ScalarInterpType x)
{
assert(x>=0);
assert(x<=1);
@ -116,7 +116,8 @@ public:
(*this)[3]=(T)(c1.V()[3]*x + c0.V()[3]*(1.0f-x));
}
inline void lerp(const Color4 &c0, const Color4 &c1, const Color4 &c2, const Point3f &ip)
template <class ScalarInterpType>
inline void lerp(const Color4 &c0, const Color4 &c1, const Color4 &c2, const Point3<ScalarInterpType> &ip)
{
assert(fabs(ip[0]+ip[1]+ip[2]-1)<0.00001);