From e9febd9ee731b204377d7c5ba8f55ba03acdf9db Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 1 Jan 2016 14:30:14 +0100 Subject: [PATCH] Fixed log from GTX_lob_base build error with tests #470, #471 --- glm/gtx/log_base.hpp | 12 +++++------ test/gtx/gtx_log_base.cpp | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/glm/gtx/log_base.hpp b/glm/gtx/log_base.hpp index 94d03472..e6c89ea2 100644 --- a/glm/gtx/log_base.hpp +++ b/glm/gtx/log_base.hpp @@ -53,15 +53,15 @@ namespace glm /// @addtogroup gtx_log_base /// @{ - //! Logarithm for any base. - //! From GLM_GTX_log_base. + /// Logarithm for any base. + /// From GLM_GTX_log_base. template GLM_FUNC_DECL genType log( - genType x, - genType base); + genType const & x, + genType const & base); - //! Logarithm for any base. - //! From GLM_GTX_log_base. + /// Logarithm for any base. + /// From GLM_GTX_log_base. template class vecType> GLM_FUNC_DECL vecType sign( vecType const & x, diff --git a/test/gtx/gtx_log_base.cpp b/test/gtx/gtx_log_base.cpp index b7cc9ae0..464b6eb1 100644 --- a/test/gtx/gtx_log_base.cpp +++ b/test/gtx/gtx_log_base.cpp @@ -30,10 +30,55 @@ /////////////////////////////////////////////////////////////////////////////////// #include +#include +#include +#include + +namespace test_log +{ + int run() + { + int Error = 0; + + { + float A = glm::log(10.f, 2.0f); + float B = glm::log2(10.f); + Error += glm::epsilonEqual(A, B, 0.00001f) ? 0 : 1; + } + + { + glm::vec1 A = glm::log(glm::vec1(10.f), glm::vec1(2.0f)); + glm::vec1 B = glm::log2(glm::vec1(10.f)); + Error += glm::all(glm::epsilonEqual(A, B, glm::vec1(0.00001f))) ? 0 : 1; + } + + { + glm::vec2 A = glm::log(glm::vec2(10.f), glm::vec2(2.0f)); + glm::vec2 B = glm::log2(glm::vec2(10.f)); + Error += glm::all(glm::epsilonEqual(A, B, glm::vec2(0.00001f))) ? 0 : 1; + } + + { + glm::vec3 A = glm::log(glm::vec3(10.f), glm::vec3(2.0f)); + glm::vec3 B = glm::log2(glm::vec3(10.f)); + Error += glm::all(glm::epsilonEqual(A, B, glm::vec3(0.00001f))) ? 0 : 1; + } + + { + glm::vec4 A = glm::log(glm::vec4(10.f), glm::vec4(2.0f)); + glm::vec4 B = glm::log2(glm::vec4(10.f)); + Error += glm::all(glm::epsilonEqual(A, B, glm::vec4(0.00001f))) ? 0 : 1; + } + + return Error; + } +}//namespace test_log int main() { int Error(0); + Error += test_log::run(); + return Error; }