From 78ab122ae050c5664bb791cb40f5a1be5a1a1b4c Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 13 Sep 2011 12:56:11 +0100 Subject: [PATCH] Declare specialized floattoXint functions --- glm/core/func_common.inl | 56 ++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index 8758c70f..d864070e 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -1300,6 +1300,7 @@ namespace glm isnan(x.w)); } + template <> GLM_FUNC_QUALIFIER int floatBitsToInt(float const & value) { union @@ -1312,10 +1313,10 @@ namespace glm return fi.i; } - template + template <> GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToInt ( - detail::tvec2 const & value + detail::tvec2 const & value ) { return detail::tvec2( @@ -1323,28 +1324,32 @@ namespace glm floatBitsToInt(value.y)); } - template + template <> GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToInt ( - detail::tvec3 const & value + detail::tvec3 const & value ) { return detail::tvec3( floatBitsToInt(value.x), - floatBitsToInt(value.y)); + floatBitsToInt(value.y), + floatBitsToInt(value.z)); } - template + template <> GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToInt ( - detail::tvec4 const & value + detail::tvec4 const & value ) { return detail::tvec4( floatBitsToInt(value.x), - floatBitsToInt(value.y)); + floatBitsToInt(value.y), + floatBitsToInt(value.z), + floatBitsToInt(value.w)); } + template<> GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & value) { union @@ -1357,10 +1362,10 @@ namespace glm return fu.u; } - template + template <> GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToUint ( - detail::tvec2 const & value + detail::tvec2 const & value ) { return detail::tvec2( @@ -1368,10 +1373,10 @@ namespace glm floatBitsToUint(value.y)); } - template + template <> GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToUint ( - detail::tvec3 const & value + detail::tvec3 const & value ) { return detail::tvec3( @@ -1380,10 +1385,10 @@ namespace glm floatBitsToUint(value.z)); } - template + template <> GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToUint ( - detail::tvec4 const & value + detail::tvec4 const & value ) { return detail::tvec4( @@ -1405,10 +1410,10 @@ namespace glm return fi.f; } - template + template <> GLM_FUNC_QUALIFIER detail::tvec2 intBitsToFloat ( - detail::tvec2 const & value + detail::tvec2 const & value ) { return detail::tvec2( @@ -1416,10 +1421,10 @@ namespace glm intBitsToFloat(value.y)); } - template + template <> GLM_FUNC_QUALIFIER detail::tvec3 intBitsToFloat ( - detail::tvec3 const & value + detail::tvec3 const & value ) { return detail::tvec3( @@ -1428,7 +1433,7 @@ namespace glm intBitsToFloat(value.z)); } - template + template <> GLM_FUNC_QUALIFIER detail::tvec4 intBitsToFloat ( detail::tvec4 const & value @@ -1441,6 +1446,7 @@ namespace glm intBitsToFloat(value.w)); } + template<> GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & value) { union @@ -1453,10 +1459,10 @@ namespace glm return fu.f; } - template + template <> GLM_FUNC_QUALIFIER detail::tvec2 uintBitsToFloat ( - detail::tvec2 const & value + detail::tvec2 const & value ) { return detail::tvec2( @@ -1464,10 +1470,10 @@ namespace glm uintBitsToFloat(value.y)); } - template + template <> GLM_FUNC_QUALIFIER detail::tvec3 uintBitsToFloat ( - detail::tvec3 const & value + detail::tvec3 const & value ) { return detail::tvec3( @@ -1476,10 +1482,10 @@ namespace glm uintBitsToFloat(value.z)); } - template + template <> GLM_FUNC_QUALIFIER detail::tvec4 uintBitsToFloat ( - detail::tvec4 const & value + detail::tvec4 const & value ) { return detail::tvec4(