From bbb7daa6c2da2de29034ce3c2ac635a9ffbe9299 Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Mon, 4 Sep 2023 21:44:05 +0800 Subject: [PATCH] added clamp,clamp --- inc/hgl/math/Vector.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/inc/hgl/math/Vector.h b/inc/hgl/math/Vector.h index 4c3db8d..c4d13ed 100644 --- a/inc/hgl/math/Vector.h +++ b/inc/hgl/math/Vector.h @@ -115,6 +115,16 @@ namespace hgl return clamp(in,0.0f,1.0f); } + template<> inline const uint8 clamp(const uint8 in) + { + return clamp(in,0,0xFF); + } + + template<> inline const uint16 clamp(const uint16 in) + { + return clamp(in,0,0xFFFF); + } + template inline T normalized(const T &v) {