From 3ad3dbcd9300c7fb18b75833c022b01d1b4bbb25 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 28 Nov 2014 02:24:05 +0100 Subject: [PATCH] Added overview post code sample --- glm/detail/dummy.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/glm/detail/dummy.cpp b/glm/detail/dummy.cpp index 5d0392be..8392ede9 100644 --- a/glm/detail/dummy.cpp +++ b/glm/detail/dummy.cpp @@ -189,7 +189,34 @@ glm::vec3 lighting return Color; } */ + + +template class vecType> +T normalizeDotA(vecType const & x, vecType const & y) +{ + return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); +} + +#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template class + +template +T normalizeDotB(vecType const & x, vecType const & y) +{ + return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); +} + +template +typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b) +{ + return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b)); +} + int main() { + glm::vec4 v(1); + float a = normalizeDotA(v, v); + float b = normalizeDotB(v, v); + float c = normalizeDotC(v, v); + return 0; }