made clamp a template function

This commit is contained in:
Jack Andersen 2015-08-28 15:29:17 -10:00
parent 2e3512b800
commit 151b0e6333
1 changed files with 2 additions and 2 deletions

View File

@ -16,8 +16,8 @@
namespace Math
{
inline void clamp(float& val, float min, float max) {val = MAX(min, MIN(max, val));}
inline void clamp(int& val, int min, int max) {val = MAX(min, MIN(max, val));}
template<typename T>
inline T clamp(T min, T val, T max) {return MAX(min, MIN(max, val));}
inline float radToDeg(float rad) {return rad * 180.f / M_PI;}
inline float degToRad(float deg) {return deg * M_PI / 180;}