From cb9cd7ccb81ac938c25b86023ae071bbbbdaa91b Mon Sep 17 00:00:00 2001 From: Christophe Date: Fri, 12 Jul 2019 22:20:57 +0200 Subject: [PATCH] Fixed GTC_round build --- glm/gtc/round.inl | 55 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/glm/gtc/round.inl b/glm/gtc/round.inl index e43f1a98..48411e41 100644 --- a/glm/gtc/round.inl +++ b/glm/gtc/round.inl @@ -3,8 +3,61 @@ #include "../integer.hpp" #include "../ext/vector_integer.hpp" -namespace glm +namespace glm{ +namespace detail { + template + struct compute_roundMultiple {}; + + template<> + struct compute_roundMultiple + { + template + GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple) + { + if (Source >= genType(0)) + return Source - std::fmod(Source, Multiple); + else + { + genType Tmp = Source + genType(1); + return Tmp - std::fmod(Tmp, Multiple) - Multiple; + } + } + }; + + template<> + struct compute_roundMultiple + { + template + GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple) + { + if (Source >= genType(0)) + return Source - Source % Multiple; + else + { + genType Tmp = Source + genType(1); + return Tmp - Tmp % Multiple - Multiple; + } + } + }; + + template<> + struct compute_roundMultiple + { + template + GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple) + { + if (Source >= genType(0)) + return Source - Source % Multiple; + else + { + genType Tmp = Source + genType(1); + return Tmp - Tmp % Multiple - Multiple; + } + } + }; +}//namespace detail + ////////////////// // ceilPowerOfTwo