diff --git a/Code/Misc/Utilities.h b/Code/Misc/Utilities.h index 7e76dbba..9c71a515 100644 --- a/Code/Misc/Utilities.h +++ b/Code/Misc/Utilities.h @@ -327,6 +327,10 @@ namespace Utility inline ValueType Min( const ValueType &valueA, const ValueType &valueB ) { return valueA < valueB ? valueA : valueB; } + template + inline ValueType Clamp( const ValueType &value, const ValueType &min, const ValueType &max ) + { return value < min ? Max( value, max ) : min; } + template inline ValueType Average( const ValueType &valueA, const ValueType &valueB ) { return (valueA + valueB) * 0.5f; }